samples/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-7-mic@digikod.net
Cc: stable@vger.kernel.org
Signed-off-by: Mickaël Salaün <mic@digikod.net>
This commit is contained in:
Mickaël Salaün 2022-05-06 18:05:12 +02:00
parent 371183fa57
commit 9805a722db
No known key found for this signature in database
GPG Key ID: E5E3D0E88C82F6D2

View File

@ -70,11 +70,15 @@ static int parse_path(char *env_path, const char ***const path_list)
return num_paths; return num_paths;
} }
/* clang-format off */
#define ACCESS_FILE ( \ #define ACCESS_FILE ( \
LANDLOCK_ACCESS_FS_EXECUTE | \ LANDLOCK_ACCESS_FS_EXECUTE | \
LANDLOCK_ACCESS_FS_WRITE_FILE | \ LANDLOCK_ACCESS_FS_WRITE_FILE | \
LANDLOCK_ACCESS_FS_READ_FILE) LANDLOCK_ACCESS_FS_READ_FILE)
/* clang-format on */
static int populate_ruleset( static int populate_ruleset(
const char *const env_var, const int ruleset_fd, const char *const env_var, const int ruleset_fd,
const __u64 allowed_access) const __u64 allowed_access)
@ -139,6 +143,8 @@ out_free_name:
return ret; return ret;
} }
/* clang-format off */
#define ACCESS_FS_ROUGHLY_READ ( \ #define ACCESS_FS_ROUGHLY_READ ( \
LANDLOCK_ACCESS_FS_EXECUTE | \ LANDLOCK_ACCESS_FS_EXECUTE | \
LANDLOCK_ACCESS_FS_READ_FILE | \ LANDLOCK_ACCESS_FS_READ_FILE | \
@ -156,6 +162,8 @@ out_free_name:
LANDLOCK_ACCESS_FS_MAKE_BLOCK | \ LANDLOCK_ACCESS_FS_MAKE_BLOCK | \
LANDLOCK_ACCESS_FS_MAKE_SYM) LANDLOCK_ACCESS_FS_MAKE_SYM)
/* clang-format on */
int main(const int argc, char *const argv[], char *const *const envp) int main(const int argc, char *const argv[], char *const *const envp)
{ {
const char *cmd_path; const char *cmd_path;