diff mbox series

memfd: fuse_mnt: remove unused macro

Message ID 20240903044455.11268-1-bajing@cmss.chinamobile.com (mailing list archive)
State New
Headers show
Series memfd: fuse_mnt: remove unused macro | expand

Commit Message

Ba Jing Sept. 3, 2024, 4:44 a.m. UTC
The macro FUSE_USE_VERSION is never referenced in the code,
just remove it.

Signed-off-by: Ba Jing <bajing@cmss.chinamobile.com>
---
 tools/testing/selftests/memfd/fuse_mnt.c | 2 --
 1 file changed, 2 deletions(-)

Comments

kernel test robot Sept. 24, 2024, 9:11 a.m. UTC | #1
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/202409241613.KyXs9fiF-lkp@intel.com/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 <lkp@intel.com>
| Closes: https://lore.kernel.org/r/202409241613.KyXs9fiF-lkp@intel.com/

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[],
         |     ^~~~~~~~~~~~~~~~~
Shuah Khan Sept. 25, 2024, 3:29 p.m. UTC | #2
On 9/2/24 22:44, Ba Jing wrote:
> 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.

> Signed-off-by: Ba Jing <bajing@cmss.chinamobile.com>
> ---
>   tools/testing/selftests/memfd/fuse_mnt.c | 2 --
>   1 file changed, 2 deletions(-)
> 
> diff --git a/tools/testing/selftests/memfd/fuse_mnt.c b/tools/testing/selftests/memfd/fuse_mnt.c
> index 6936f2a001f3..f9f06fd43c5f 100644
> --- a/tools/testing/selftests/memfd/fuse_mnt.c
> +++ b/tools/testing/selftests/memfd/fuse_mnt.c
> @@ -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/202409241613.KyXs9fiF-lkp@intel.com/
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
diff mbox series

Patch

diff --git a/tools/testing/selftests/memfd/fuse_mnt.c b/tools/testing/selftests/memfd/fuse_mnt.c
index 6936f2a001f3..f9f06fd43c5f 100644
--- a/tools/testing/selftests/memfd/fuse_mnt.c
+++ b/tools/testing/selftests/memfd/fuse_mnt.c
@@ -12,8 +12,6 @@ 
  * file-system.
  */
 
-#define FUSE_USE_VERSION 26
-
 #include <fuse.h>
 #include <stdio.h>
 #include <string.h>