diff mbox

[1/5] libceph: use kbasename() and kill ceph_file_part()

Message ID 1495557238-1077-2-git-send-email-idryomov@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ilya Dryomov May 23, 2017, 4:33 p.m. UTC
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
---
 include/linux/ceph/ceph_debug.h |  6 +++---
 net/ceph/ceph_common.c          | 13 -------------
 2 files changed, 3 insertions(+), 16 deletions(-)

Comments

Alex Elder May 23, 2017, 5:39 p.m. UTC | #1
On 05/23/2017 11:33 AM, Ilya Dryomov wrote:
> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>

Looks good.

Reviewed-by: Alex Elder <elder@linaro.org>

> ---
>  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 aa2e19182d99..51c5bd64bd00 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 4fd02831beed..47e94b560ba0 100644
> --- a/net/ceph/ceph_common.c
> +++ b/net/ceph/ceph_common.c
> @@ -56,19 +56,6 @@ static const struct kernel_param_ops param_ops_supported_features = {
>  module_param_cb(supported_features, &param_ops_supported_features, NULL,
>  		S_IRUGO);
>  
> -/*
> - * 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) {
> 

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/include/linux/ceph/ceph_debug.h b/include/linux/ceph/ceph_debug.h
index aa2e19182d99..51c5bd64bd00 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 4fd02831beed..47e94b560ba0 100644
--- a/net/ceph/ceph_common.c
+++ b/net/ceph/ceph_common.c
@@ -56,19 +56,6 @@  static const struct kernel_param_ops param_ops_supported_features = {
 module_param_cb(supported_features, &param_ops_supported_features, NULL,
 		S_IRUGO);
 
-/*
- * 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) {