[PATCH 4.9 14/32] libceph: use kbasename() and kill ceph_file_part()

From: Greg Kroah-Hartman
Date: Fri Aug 09 2019 - 09:48:18 EST


From: Ilya Dryomov <idryomov@xxxxxxxxx>

commit 6f4dbd149d2a151b89d1a5bbf7530ee5546c7908 upstream.

Signed-off-by: Ilya Dryomov <idryomov@xxxxxxxxx>
Reviewed-by: Alex Elder <elder@xxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>

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

--- 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 { \
--- 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) {