Skip to content

Commit

Permalink
samples/landlock: Add clang-format exceptions
Browse files Browse the repository at this point in the history
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/[email protected]
Cc: [email protected]
Signed-off-by: Mickaël Salaün <[email protected]>
  • Loading branch information
l0kod committed May 23, 2022
1 parent 371183f commit 9805a72
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions samples/landlock/sandboxer.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,15 @@ static int parse_path(char *env_path, const char ***const path_list)
return num_paths;
}

/* clang-format off */

#define ACCESS_FILE ( \
LANDLOCK_ACCESS_FS_EXECUTE | \
LANDLOCK_ACCESS_FS_WRITE_FILE | \
LANDLOCK_ACCESS_FS_READ_FILE)

/* clang-format on */

static int populate_ruleset(
const char *const env_var, const int ruleset_fd,
const __u64 allowed_access)
Expand Down Expand Up @@ -139,6 +143,8 @@ static int populate_ruleset(
return ret;
}

/* clang-format off */

#define ACCESS_FS_ROUGHLY_READ ( \
LANDLOCK_ACCESS_FS_EXECUTE | \
LANDLOCK_ACCESS_FS_READ_FILE | \
Expand All @@ -156,6 +162,8 @@ static int populate_ruleset(
LANDLOCK_ACCESS_FS_MAKE_BLOCK | \
LANDLOCK_ACCESS_FS_MAKE_SYM)

/* clang-format on */

int main(const int argc, char *const argv[], char *const *const envp)
{
const char *cmd_path;
Expand Down

0 comments on commit 9805a72

Please sign in to comment.