Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1626906 > unrolled thread

[PATCH] fs:orangefs:orangefs-debug.h: Use ARRAY_SIZE kernel macro

Started byKarim Eshapa <karim.eshapa@gmail.com>
First post2017-04-20 03:10 +0200
Last post2017-04-20 09:20 +0200
Articles 4 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] fs:orangefs:orangefs-debug.h: Use ARRAY_SIZE kernel macro Karim Eshapa <karim.eshapa@gmail.com> - 2017-04-20 03:10 +0200
    Re: [PATCH] fs:orangefs:orangefs-debug.h: Use ARRAY_SIZE kernel macro kbuild test robot <lkp@intel.com> - 2017-04-20 07:10 +0200
      [PATCH] fs:orangefs:orangefs-debug, orangefs-kernel: Fixing warning issues and use ARRAY_SIZE Karim Eshapa <karim.eshapa@gmail.com> - 2017-04-20 15:10 +0200
    Re: [PATCH] fs:orangefs:orangefs-debug.h: Use ARRAY_SIZE kernel macro kbuild test robot <lkp@intel.com> - 2017-04-20 09:20 +0200

#1626906 — [PATCH] fs:orangefs:orangefs-debug.h: Use ARRAY_SIZE kernel macro

FromKarim Eshapa <karim.eshapa@gmail.com>
Date2017-04-20 03:10 +0200
Subject[PATCH] fs:orangefs:orangefs-debug.h: Use ARRAY_SIZE kernel macro
Message-ID<ty8LD-2hm-1@gated-at.bofh.it>
Let's use the defined kernel macro more safe
and remove unnecessary cast.

Signed-off-by: Karim Eshapa <karim.eshapa@gmail.com>
---
 fs/orangefs/orangefs-debug.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/fs/orangefs/orangefs-debug.h b/fs/orangefs/orangefs-debug.h
index 387db17..becd229 100644
--- a/fs/orangefs/orangefs-debug.h
+++ b/fs/orangefs/orangefs-debug.h
@@ -12,6 +12,7 @@
 #ifndef __ORANGEFS_DEBUG_H
 #define __ORANGEFS_DEBUG_H
 
+#include "orangefs-kernel.h"
 #ifdef __KERNEL__
 #include <linux/types.h>
 #else
@@ -86,7 +87,7 @@ static struct __keyword_mask_s s_kmod_keyword_mask_map[] = {
 	{"all", GOSSIP_MAX_DEBUG}
 };
 
-static const int num_kmod_keyword_mask_map = (int)
-	(sizeof(s_kmod_keyword_mask_map) / sizeof(struct __keyword_mask_s));
+static const int num_kmod_keyword_mask_map = ARRAY_SIZE(
+	s_kmod_keyword_mask_map);
 
 #endif /* __ORANGEFS_DEBUG_H */
-- 
2.7.4

[toc] | [next] | [standalone]


#1626984

Fromkbuild test robot <lkp@intel.com>
Date2017-04-20 07:10 +0200
Message-ID<tycvT-4JA-3@gated-at.bofh.it>
In reply to#1626906

[Multipart message — attachments visible in raw view] — view raw

Hi Karim,

[auto build test ERROR on linus/master]
[also build test ERROR on v4.11-rc7 next-20170419]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Karim-Eshapa/fs-orangefs-orangefs-debug-h-Use-ARRAY_SIZE-kernel-macro/20170420-105518
config: x86_64-randconfig-i0-201716 (attached as .config)
compiler: gcc-4.9 (Debian 4.9.4-2) 4.9.4
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All errors (new ones prefixed by >>):

   In file included from fs/orangefs/orangefs-debug.h:15:0,
                    from fs/orangefs/protocol.h:336,
                    from fs/orangefs/acl.c:7:
   fs/orangefs/orangefs-kernel.h: In function 'is_root_handle':
>> fs/orangefs/orangefs-kernel.h:365:2: error: implicit declaration of function 'gossip_debug' [-Werror=implicit-function-declaration]
     gossip_debug(GOSSIP_DCACHE_DEBUG,
     ^
>> fs/orangefs/orangefs-kernel.h:365:15: error: 'GOSSIP_DCACHE_DEBUG' undeclared (first use in this function)
     gossip_debug(GOSSIP_DCACHE_DEBUG,
                  ^
   fs/orangefs/orangefs-kernel.h:365:15: note: each undeclared identifier is reported only once for each function it appears in
   fs/orangefs/orangefs-kernel.h: In function 'match_handle':
   fs/orangefs/orangefs-kernel.h:381:15: error: 'GOSSIP_DCACHE_DEBUG' undeclared (first use in this function)
     gossip_debug(GOSSIP_DCACHE_DEBUG,
                  ^
   cc1: some warnings being treated as errors

vim +/gossip_debug +365 fs/orangefs/orangefs-kernel.h

f7ab093f fs/orangefs/pvfs2-kernel.h Mike Marshall 2015-07-17  359  {
f7ab093f fs/orangefs/pvfs2-kernel.h Mike Marshall 2015-07-17  360  	return get_ino_from_khandle(dentry->d_parent->d_inode);
f7ab093f fs/orangefs/pvfs2-kernel.h Mike Marshall 2015-07-17  361  }
f7ab093f fs/orangefs/pvfs2-kernel.h Mike Marshall 2015-07-17  362  
f7ab093f fs/orangefs/pvfs2-kernel.h Mike Marshall 2015-07-17  363  static inline int is_root_handle(struct inode *inode)
f7ab093f fs/orangefs/pvfs2-kernel.h Mike Marshall 2015-07-17  364  {
f7ab093f fs/orangefs/pvfs2-kernel.h Mike Marshall 2015-07-17 @365  	gossip_debug(GOSSIP_DCACHE_DEBUG,
f7ab093f fs/orangefs/pvfs2-kernel.h Mike Marshall 2015-07-17  366  		     "%s: root handle: %pU, this handle: %pU:\n",
f7ab093f fs/orangefs/pvfs2-kernel.h Mike Marshall 2015-07-17  367  		     __func__,
8bb8aefd fs/orangefs/pvfs2-kernel.h Yi Liu        2015-11-24  368  		     &ORANGEFS_SB(inode->i_sb)->root_khandle,

:::::: The code at line 365 was first introduced by commit
:::::: f7ab093f74bf638ed98fd1115f3efa17e308bb7f Orangefs: kernel client part 1

:::::: TO: Mike Marshall <hubcap@omnibond.com>
:::::: CC: Mike Marshall <hubcap@omnibond.com>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[toc] | [prev] | [next] | [standalone]


#1627424 — [PATCH] fs:orangefs:orangefs-debug, orangefs-kernel: Fixing warning issues and use ARRAY_SIZE

FromKarim Eshapa <karim.eshapa@gmail.com>
Date2017-04-20 15:10 +0200
Subject[PATCH] fs:orangefs:orangefs-debug, orangefs-kernel: Fixing warning issues and use ARRAY_SIZE
Message-ID<tyk0p-Ud-9@gated-at.bofh.it>
In reply to#1626984
Fix warning issues produced by kbuild test and use a ARRAY_SIZE
kernel defined macro more safe and remove unnecessary cast
when __KERNEL__ is defined.

Signed-off-by: Karim Eshapa <karim.eshapa@gmail.com>
---
 fs/orangefs/orangefs-debug.h  | 6 ++++++
 fs/orangefs/orangefs-kernel.h | 2 ++
 2 files changed, 8 insertions(+)

diff --git a/fs/orangefs/orangefs-debug.h b/fs/orangefs/orangefs-debug.h
index 387db17..ff1f592 100644
--- a/fs/orangefs/orangefs-debug.h
+++ b/fs/orangefs/orangefs-debug.h
@@ -14,6 +14,7 @@
 
 #ifdef __KERNEL__
 #include <linux/types.h>
+#include <orangefs-kernel.h>
 #else
 #include <stdint.h>
 #endif
@@ -86,7 +87,12 @@ static struct __keyword_mask_s s_kmod_keyword_mask_map[] = {
 	{"all", GOSSIP_MAX_DEBUG}
 };
 
+#ifdef __KERNEL__
+static const int num_kmod_keyword_mask_map = ARRAY_SIZE(
+	s_kmod_keyword_mask_map);
+#else
 static const int num_kmod_keyword_mask_map = (int)
 	(sizeof(s_kmod_keyword_mask_map) / sizeof(struct __keyword_mask_s));
+#endif
 
 #endif /* __ORANGEFS_DEBUG_H */
diff --git a/fs/orangefs/orangefs-kernel.h b/fs/orangefs/orangefs-kernel.h
index 8afac46..e9330c1 100644
--- a/fs/orangefs/orangefs-kernel.h
+++ b/fs/orangefs/orangefs-kernel.h
@@ -54,6 +54,8 @@
 #include <asm/unaligned.h>
 
 #include "orangefs-dev-proto.h"
+#include "protocol.h"
+#include "orangefs-debug.h"
 
 #ifdef ORANGEFS_KERNEL_DEBUG
 #define ORANGEFS_DEFAULT_OP_TIMEOUT_SECS       10
-- 
2.7.4

[toc] | [prev] | [next] | [standalone]


#1627158

Fromkbuild test robot <lkp@intel.com>
Date2017-04-20 09:20 +0200
Message-ID<tyexI-5X9-11@gated-at.bofh.it>
In reply to#1626906
Hi Karim,

[auto build test WARNING on linus/master]
[also build test WARNING on v4.11-rc7 next-20170419]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Karim-Eshapa/fs-orangefs-orangefs-debug-h-Use-ARRAY_SIZE-kernel-macro/20170420-105518
reproduce:
        # apt-get install sparse
        make ARCH=x86_64 allmodconfig
        make C=1 CF=-D__CHECK_ENDIAN__


sparse warnings: (new ones prefixed by >>)

   include/linux/compiler.h:264:8: sparse: attribute 'no_sanitize_address': unknown attribute
   fs/orangefs/orangefs-kernel.h:365:9: sparse: undefined identifier 'gossip_debug'
>> fs/orangefs/orangefs-kernel.h:365:21: sparse: not a function <noident>
   fs/orangefs/orangefs-kernel.h:365:22: sparse: undefined identifier 'GOSSIP_DCACHE_DEBUG'
>> fs/orangefs/orangefs-kernel.h:365:21: sparse: not a function <noident>
   In file included from fs/orangefs/orangefs-debug.h:15:0,
                    from fs/orangefs/protocol.h:336,
                    from fs/orangefs/orangefs-utils.c:6:
   fs/orangefs/orangefs-kernel.h: In function 'is_root_handle':
   fs/orangefs/orangefs-kernel.h:365:2: error: implicit declaration of function 'gossip_debug' [-Werror=implicit-function-declaration]
     gossip_debug(GOSSIP_DCACHE_DEBUG,
     ^~~~~~~~~~~~
   fs/orangefs/orangefs-kernel.h:365:15: error: 'GOSSIP_DCACHE_DEBUG' undeclared (first use in this function)
     gossip_debug(GOSSIP_DCACHE_DEBUG,
                  ^~~~~~~~~~~~~~~~~~~
   fs/orangefs/orangefs-kernel.h:365:15: note: each undeclared identifier is reported only once for each function it appears in
   fs/orangefs/orangefs-kernel.h: In function 'match_handle':
   fs/orangefs/orangefs-kernel.h:381:15: error: 'GOSSIP_DCACHE_DEBUG' undeclared (first use in this function)
     gossip_debug(GOSSIP_DCACHE_DEBUG,
                  ^~~~~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors

vim +365 fs/orangefs/orangefs-kernel.h

f7ab093f fs/orangefs/pvfs2-kernel.h Mike Marshall 2015-07-17  349  {
8bb8aefd fs/orangefs/pvfs2-kernel.h Yi Liu        2015-11-24  350  	struct orangefs_khandle *khandle;
f7ab093f fs/orangefs/pvfs2-kernel.h Mike Marshall 2015-07-17  351  	ino_t ino;
f7ab093f fs/orangefs/pvfs2-kernel.h Mike Marshall 2015-07-17  352  
f7ab093f fs/orangefs/pvfs2-kernel.h Mike Marshall 2015-07-17  353  	khandle = get_khandle_from_ino(inode);
8bb8aefd fs/orangefs/pvfs2-kernel.h Yi Liu        2015-11-24  354  	ino = orangefs_khandle_to_ino(khandle);
f7ab093f fs/orangefs/pvfs2-kernel.h Mike Marshall 2015-07-17  355  	return ino;
f7ab093f fs/orangefs/pvfs2-kernel.h Mike Marshall 2015-07-17  356  }
f7ab093f fs/orangefs/pvfs2-kernel.h Mike Marshall 2015-07-17  357  
f7ab093f fs/orangefs/pvfs2-kernel.h Mike Marshall 2015-07-17  358  static inline ino_t get_parent_ino_from_dentry(struct dentry *dentry)
f7ab093f fs/orangefs/pvfs2-kernel.h Mike Marshall 2015-07-17  359  {
f7ab093f fs/orangefs/pvfs2-kernel.h Mike Marshall 2015-07-17  360  	return get_ino_from_khandle(dentry->d_parent->d_inode);
f7ab093f fs/orangefs/pvfs2-kernel.h Mike Marshall 2015-07-17  361  }
f7ab093f fs/orangefs/pvfs2-kernel.h Mike Marshall 2015-07-17  362  
f7ab093f fs/orangefs/pvfs2-kernel.h Mike Marshall 2015-07-17  363  static inline int is_root_handle(struct inode *inode)
f7ab093f fs/orangefs/pvfs2-kernel.h Mike Marshall 2015-07-17  364  {
f7ab093f fs/orangefs/pvfs2-kernel.h Mike Marshall 2015-07-17 @365  	gossip_debug(GOSSIP_DCACHE_DEBUG,
f7ab093f fs/orangefs/pvfs2-kernel.h Mike Marshall 2015-07-17  366  		     "%s: root handle: %pU, this handle: %pU:\n",
f7ab093f fs/orangefs/pvfs2-kernel.h Mike Marshall 2015-07-17  367  		     __func__,
8bb8aefd fs/orangefs/pvfs2-kernel.h Yi Liu        2015-11-24  368  		     &ORANGEFS_SB(inode->i_sb)->root_khandle,
f7ab093f fs/orangefs/pvfs2-kernel.h Mike Marshall 2015-07-17  369  		     get_khandle_from_ino(inode));
f7ab093f fs/orangefs/pvfs2-kernel.h Mike Marshall 2015-07-17  370  
8bb8aefd fs/orangefs/pvfs2-kernel.h Yi Liu        2015-11-24  371  	if (ORANGEFS_khandle_cmp(&(ORANGEFS_SB(inode->i_sb)->root_khandle),
f7ab093f fs/orangefs/pvfs2-kernel.h Mike Marshall 2015-07-17  372  			     get_khandle_from_ino(inode)))
f7ab093f fs/orangefs/pvfs2-kernel.h Mike Marshall 2015-07-17  373  		return 0;

:::::: The code at line 365 was first introduced by commit
:::::: f7ab093f74bf638ed98fd1115f3efa17e308bb7f Orangefs: kernel client part 1

:::::: TO: Mike Marshall <hubcap@omnibond.com>
:::::: CC: Mike Marshall <hubcap@omnibond.com>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web