Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

kernel.h: move VERIFY_OCTAL_PERMISSIONS() to sysfs.h

The macro is related to sysfs, but is defined in kernel.h. Move it to the
proper header, and unload the generic kernel.h.

Now that the macro is removed from kernel.h, linux/moduleparam.h is
decoupled, and kernel.h inclusion can be removed.

Link: https://lkml.kernel.org/r/20260116042510.241009-4-ynorov@nvidia.com
Signed-off-by: Yury Norov <ynorov@nvidia.com>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Tested-by: Randy Dunlap <rdunlap@infradead.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Petr Pavlu <petr.pavlu@suse.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Joel Fernandes <joelagnelf@nvidia.com>
Cc: Aaron Tomlin <atomlin@atomlin.com>
Cc: Andi Shyti <andi.shyti@linux.intel.com>
Cc: Christophe Leroy (CS GROUP) <chleroy@kernel.org>
Cc: Jani Nikula <jani.nikula@intel.com>
Cc: Steven Rostedt (Google) <rostedt@goodmis.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Yury Norov and committed by
Andrew Morton
90ddd39b 25b66674

+15 -14
+1 -1
Documentation/filesystems/sysfs.rst
··· 120 120 .store = store_foo, 121 121 }; 122 122 123 - Note as stated in include/linux/kernel.h "OTHER_WRITABLE? Generally 123 + Note as stated in include/linux/sysfs.h "OTHER_WRITABLE? Generally 124 124 considered a bad idea." so trying to set a sysfs file writable for 125 125 everyone will fail reverting to RO mode for "Others". 126 126
-12
include/linux/kernel.h
··· 388 388 # define REBUILD_DUE_TO_DYNAMIC_FTRACE 389 389 #endif 390 390 391 - /* Permissions on a sysfs file: you didn't miss the 0 prefix did you? */ 392 - #define VERIFY_OCTAL_PERMISSIONS(perms) \ 393 - (BUILD_BUG_ON_ZERO((perms) < 0) + \ 394 - BUILD_BUG_ON_ZERO((perms) > 0777) + \ 395 - /* USER_READABLE >= GROUP_READABLE >= OTHER_READABLE */ \ 396 - BUILD_BUG_ON_ZERO((((perms) >> 6) & 4) < (((perms) >> 3) & 4)) + \ 397 - BUILD_BUG_ON_ZERO((((perms) >> 3) & 4) < ((perms) & 4)) + \ 398 - /* USER_WRITABLE >= GROUP_WRITABLE */ \ 399 - BUILD_BUG_ON_ZERO((((perms) >> 6) & 2) < (((perms) >> 3) & 2)) + \ 400 - /* OTHER_WRITABLE? Generally considered a bad idea. */ \ 401 - BUILD_BUG_ON_ZERO((perms) & 2) + \ 402 - (perms)) 403 391 #endif
+1 -1
include/linux/moduleparam.h
··· 8 8 #include <linux/compiler.h> 9 9 #include <linux/init.h> 10 10 #include <linux/stringify.h> 11 - #include <linux/kernel.h> 11 + #include <linux/sysfs.h> 12 12 #include <linux/types.h> 13 13 14 14 /*
+13
include/linux/sysfs.h
··· 808 808 kernfs_put(kn); 809 809 } 810 810 811 + /* Permissions on a sysfs file: you didn't miss the 0 prefix did you? */ 812 + #define VERIFY_OCTAL_PERMISSIONS(perms) \ 813 + (BUILD_BUG_ON_ZERO((perms) < 0) + \ 814 + BUILD_BUG_ON_ZERO((perms) > 0777) + \ 815 + /* USER_READABLE >= GROUP_READABLE >= OTHER_READABLE */ \ 816 + BUILD_BUG_ON_ZERO((((perms) >> 6) & 4) < (((perms) >> 3) & 4)) + \ 817 + BUILD_BUG_ON_ZERO((((perms) >> 3) & 4) < ((perms) & 4)) + \ 818 + /* USER_WRITABLE >= GROUP_WRITABLE */ \ 819 + BUILD_BUG_ON_ZERO((((perms) >> 6) & 2) < (((perms) >> 3) & 2)) + \ 820 + /* OTHER_WRITABLE? Generally considered a bad idea. */ \ 821 + BUILD_BUG_ON_ZERO((perms) & 2) + \ 822 + (perms)) 823 + 811 824 #endif /* _SYSFS_H_ */