libceph: use kbasename() and kill ceph_file_part() [Linux 4.9.189]

This Linux kernel change "libceph: use kbasename() and kill ceph_file_part()" is included in the Linux 4.9.189 release. This change is authored by Ilya Dryomov <idryomov [at] gmail.com> on Fri May 19 11:33:16 2017 +0200. The commit for this change in Linux stable tree is 22395a3 (patch) which is from upstream commit 6f4dbd1. The same Linux upstream change may have been applied to various maintained Linux releases and you can find all Linux releases containing changes from upstream 6f4dbd1.

libceph: use kbasename() and kill ceph_file_part()

commit 6f4dbd149d2a151b89d1a5bbf7530ee5546c7908 upstream.

Signed-off-by: Ilya Dryomov <[email protected]>
Reviewed-by: Alex Elder <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

There are 19 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 include/linux/ceph/ceph_debug.h |  6 +++---
 net/ceph/ceph_common.c          | 13 -------------
 2 files changed, 3 insertions(+), 16 deletions(-)

diff --git a/include/linux/ceph/ceph_debug.h b/include/linux/ceph/ceph_debug.h
index aa2e191..51c5bd6 100644
--- a/include/linux/ceph/ceph_debug.h
+++ b/include/linux/ceph/ceph_debug.h
@@ -3,6 +3,8 @@

 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

+#include <linux/string.h>
+
 #ifdef CONFIG_CEPH_LIB_PRETTYDEBUG

 /*
@@ -12,12 +14,10 @@
  */

 # if defined(DEBUG) || defined(CONFIG_DYNAMIC_DEBUG)
-extern const char *ceph_file_part(const char *s, int len);
 #  define dout(fmt, ...)                       \
    pr_debug("%.*s %12.12s:%-4d : " fmt,                \
         8 - (int)sizeof(KBUILD_MODNAME), "    ",       \
-        ceph_file_part(__FILE__, sizeof(__FILE__)),        \
-        __LINE__, ##__VA_ARGS__)
+        kbasename(__FILE__), __LINE__, ##__VA_ARGS__)
 # else
 /* faux printk call just to see any compiler warnings. */
 #  define dout(fmt, ...)   do {                \
diff --git a/net/ceph/ceph_common.c b/net/ceph/ceph_common.c
index bf0294c..18c4b34 100644
--- a/net/ceph/ceph_common.c
+++ b/net/ceph/ceph_common.c
@@ -45,19 +45,6 @@ bool libceph_compatible(void *data)
 }
 EXPORT_SYMBOL(libceph_compatible);

-/*
- * find filename portion of a path (/foo/bar/baz -> baz)
- */
-const char *ceph_file_part(const char *s, int len)
-{
-   const char *e = s + len;
-
-   while (e != s && *(e-1) != '/')
-       e--;
-   return e;
-}
-EXPORT_SYMBOL(ceph_file_part);
-
 const char *ceph_msg_type_name(int type)
 {
    switch (type) {

Leave a Reply

Your email address will not be published. Required fields are marked *