Skip to contentSkip to conversation

memfd: fuse_mnt: remove unused macro

PATCH In review Ba Jing 3 participants 3 messages Sep 23, 2024 – Sep 25, 2024 Kselftest

lore
Share & tools
lore

Ba Jing

author
#0 lore raw

PATCH 1/1 memfd: fuse_mnt: remove unused macro

The macro FUSE_USE_VERSION is never referenced in the code, just remove it.

---
 tools/testing/selftests/memfd/fuse_mnt.c | 2 --
 1 file changed, 2 deletions(-)
tools/testing/selftests/memfd/fuse_mnt.c +0 -2
index 6936f2a001f3..f9f06fd43c5f 100644
@@ -12,8 +12,6 @@
  * file-system.
  */
 
-#define FUSE_USE_VERSION 26
-
 #include <fuse.h>
 #include <stdio.h>
 #include <string.h>
Signature · 1 line
2.33.0
#1 lore raw
kernel test robot noticed the following build warnings:

Hi Ba,

kernel test robot noticed the following build warnings:

[auto build test WARNING on shuah-kselftest/next]
[also build test WARNING on shuah-kselftest/fixes linus/master v6.11 next-20240924] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Ba-Jing/memfd-fuse_mnt-remove-unused-macro/20240923-161950
base:   https://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest.git next
patch link:    https://lore.kernel.org/r/20240903044455.11268-1-bajing%40cmss.chinamobile.com
patch subject: [PATCH] memfd: fuse_mnt: remove unused macro

:::::: branch date: 24 hours ago
:::::: commit date: 24 hours ago
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240924/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/r/[email protected]/

All warnings (new ones prefixed by >>):

fuse_mnt.c:101:10: error: 'struct fuse_operations_compat2' has no member named 'readdir'
101 | .readdir = memfd_readdir,
| ^~~~~~~

>> fuse_mnt.c:101:27: warning: initialization of 'int (*)(const char *, char *, size_t)' {aka 'int (*)(const char *, char *, long unsigned int)'} from incompatible pointer type 'int (*)(const char *, void *, int (*)(void *, const char *, const struct stat *, off_t), off_t,  struct fuse_file_info *)' {aka 'int (*)(const char *, void *, int (*)(void *, const char *, const struct stat *, long int), long int,  struct fuse_file_info *)'} [-Wincompatible-pointer-types]
     101 |         .readdir        = memfd_readdir,
         |                           ^~~~~~~~~~~~~
   fuse_mnt.c:101:27: note: (near initialization for 'memfd_ops.readlink')
>> fuse_mnt.c:102:27: warning: initialization of 'int (*)(const char *, int)' from incompatible pointer type 'int (*)(const char *, struct fuse_file_info *)' [-Wincompatible-pointer-types]
     102 |         .open           = memfd_open,
         |                           ^~~~~~~~~~
   fuse_mnt.c:102:27: note: (near initialization for 'memfd_ops.open')
>> fuse_mnt.c:103:27: warning: initialization of 'int (*)(const char *, char *, size_t,  off_t)' {aka 'int (*)(const char *, char *, long unsigned int,  long int)'} from incompatible pointer type 'int (*)(const char *, char *, size_t,  off_t,  struct fuse_file_info *)' {aka 'int (*)(const char *, char *, long unsigned int,  long int,  struct fuse_file_info *)'} [-Wincompatible-pointer-types]
     103 |         .read           = memfd_read,
         |                           ^~~~~~~~~~
   fuse_mnt.c:103:27: note: (near initialization for 'memfd_ops.read')
   In file included from /usr/include/fuse.h:9,
                    from fuse_mnt.c:15:
   fuse_mnt.c: In function 'main':
   fuse_mnt.c:108:16: error: too many arguments to function 'fuse_main_compat2'
     108 |         return fuse_main(argc, argv, &memfd_ops, NULL);
         |                ^~~~~~~~~
   In file included from /usr/include/fuse/fuse.h:1012:
   /usr/include/fuse/fuse_compat.h:151:5: note: declared here
     151 | int fuse_main_compat2(int argc, char *argv[],
         |     ^~~~~~~~~~~~~~~~~
Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
maintainer
#2 lore raw
In reply to Ba Jing
Quoted 3 lines · Ba Jing

The macro FUSE_USE_VERSION is never referenced in the code, just remove it.

How did you find this problem and how did you test this change? This patch is incorrect - please see below.

When you find unused defines, do check first if they are indeed unused checking tree wide to see what happens if you remove it.

Quoted 10 lines
---
  tools/testing/selftests/memfd/fuse_mnt.c | 2 --
  1 file changed, 2 deletions(-)
tools/testing/selftests/memfd/fuse_mnt.c +0 -0
index 6936f2a001f3..f9f06fd43c5f 100644

tools/testing/selftests/memfd/fuse_mnt.c line 17

Quoted 8 lines
tools/testing/selftests/memfd/fuse_mnt.c +0 -2
@@ -12,8 +12,6 @@
   * file-system.
   */
 
-#define FUSE_USE_VERSION 26
-
  #include <fuse.h>
  #include <stdio.h>
  #include <string.h>

You probably noticed https://lore.kernel.org/all/[email protected]/
found build problems with this change.

Also you have to define this to pick up the new API from fuse.h Removing #define FUSE_USE_VERSION 26 from this source file causes the version 21 API to be used, hence the build errors.

/usr/include/fuse/fuse.h

/** @file
*
* This file defines the library interface of FUSE
*
* IMPORTANT: you should define FUSE_USE_VERSION before including this
* header. To use the newest API define it to 26 (recommended for any
* new application), to use the old API define it to 21 (default) 22
* or 25, to use the even older 1.X API define it to 11.
*/

#ifndef FUSE_USE_VERSION
#define FUSE_USE_VERSION 21
#endif

thanks,
-- Shuah