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

landlock: Add clang-format exceptions

In preparation to a following commit, add clang-format on and
clang-format off stanzas around constant definitions. This enables to
keep aligned values, which is much more readable than packed
definitions.

Link: https://lore.kernel.org/r/20220506160513.523257-2-mic@digikod.net
Cc: stable@vger.kernel.org
Signed-off-by: Mickaël Salaün <mic@digikod.net>

+10
+4
include/uapi/linux/landlock.h
··· 33 33 * - %LANDLOCK_CREATE_RULESET_VERSION: Get the highest supported Landlock ABI 34 34 * version. 35 35 */ 36 + /* clang-format off */ 36 37 #define LANDLOCK_CREATE_RULESET_VERSION (1U << 0) 38 + /* clang-format on */ 37 39 38 40 /** 39 41 * enum landlock_rule_type - Landlock rule type ··· 122 120 * :manpage:`access(2)`. 123 121 * Future Landlock evolutions will enable to restrict them. 124 122 */ 123 + /* clang-format off */ 125 124 #define LANDLOCK_ACCESS_FS_EXECUTE (1ULL << 0) 126 125 #define LANDLOCK_ACCESS_FS_WRITE_FILE (1ULL << 1) 127 126 #define LANDLOCK_ACCESS_FS_READ_FILE (1ULL << 2) ··· 136 133 #define LANDLOCK_ACCESS_FS_MAKE_FIFO (1ULL << 10) 137 134 #define LANDLOCK_ACCESS_FS_MAKE_BLOCK (1ULL << 11) 138 135 #define LANDLOCK_ACCESS_FS_MAKE_SYM (1ULL << 12) 136 + /* clang-format on */ 139 137 140 138 #endif /* _UAPI_LINUX_LANDLOCK_H */
+2
security/landlock/fs.c
··· 141 141 } 142 142 143 143 /* All access rights that can be tied to files. */ 144 + /* clang-format off */ 144 145 #define ACCESS_FILE ( \ 145 146 LANDLOCK_ACCESS_FS_EXECUTE | \ 146 147 LANDLOCK_ACCESS_FS_WRITE_FILE | \ 147 148 LANDLOCK_ACCESS_FS_READ_FILE) 149 + /* clang-format on */ 148 150 149 151 /* 150 152 * @path: Should have been checked by get_path_from_fd().
+4
security/landlock/limits.h
··· 12 12 #include <linux/limits.h> 13 13 #include <uapi/linux/landlock.h> 14 14 15 + /* clang-format off */ 16 + 15 17 #define LANDLOCK_MAX_NUM_LAYERS 64 16 18 #define LANDLOCK_MAX_NUM_RULES U32_MAX 17 19 18 20 #define LANDLOCK_LAST_ACCESS_FS LANDLOCK_ACCESS_FS_MAKE_SYM 19 21 #define LANDLOCK_MASK_ACCESS_FS ((LANDLOCK_LAST_ACCESS_FS << 1) - 1) 22 + 23 + /* clang-format on */ 20 24 21 25 #endif /* _SECURITY_LANDLOCK_LIMITS_H */