Skip to content

Commit 152f273

Browse files
l0kodsmb49
authored andcommitted
samples/landlock: Add clang-format exceptions
BugLink: https://bugs.launchpad.net/bugs/1981864 commit 9805a722db071e1772b80e6e0ff33f35355639ac upstream. 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]> Signed-off-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Kamal Mostafa <[email protected]> Signed-off-by: Stefan Bader <[email protected]>
1 parent b5eb919 commit 152f273

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

samples/landlock/sandboxer.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,15 @@ static int parse_path(char *env_path, const char ***const path_list)
7070
return num_paths;
7171
}
7272

73+
/* clang-format off */
74+
7375
#define ACCESS_FILE ( \
7476
LANDLOCK_ACCESS_FS_EXECUTE | \
7577
LANDLOCK_ACCESS_FS_WRITE_FILE | \
7678
LANDLOCK_ACCESS_FS_READ_FILE)
7779

80+
/* clang-format on */
81+
7882
static int populate_ruleset(
7983
const char *const env_var, const int ruleset_fd,
8084
const __u64 allowed_access)
@@ -139,6 +143,8 @@ static int populate_ruleset(
139143
return ret;
140144
}
141145

146+
/* clang-format off */
147+
142148
#define ACCESS_FS_ROUGHLY_READ ( \
143149
LANDLOCK_ACCESS_FS_EXECUTE | \
144150
LANDLOCK_ACCESS_FS_READ_FILE | \
@@ -156,6 +162,8 @@ static int populate_ruleset(
156162
LANDLOCK_ACCESS_FS_MAKE_BLOCK | \
157163
LANDLOCK_ACCESS_FS_MAKE_SYM)
158164

165+
/* clang-format on */
166+
159167
int main(const int argc, char *const argv[], char *const *const envp)
160168
{
161169
const char *cmd_path;

0 commit comments

Comments
 (0)