Skip to content

Commit 72a1c57

Browse files
committed
selinux: fix style issues in security/selinux/ss/sidtab.h
As part of on ongoing effort to perform more automated testing and provide more tools for individual developers to validate their patches before submitting, we are trying to make our code "clang-format clean". My hope is that once we have fixed all of our style "quirks", developers will be able to run clang-format on their patches to help avoid silly formatting problems and ensure their changes fit in well with the rest of the SELinux kernel code. Signed-off-by: Paul Moore <[email protected]>
1 parent 317e029 commit 72a1c57

File tree

1 file changed

+19
-17
lines changed

1 file changed

+19
-17
lines changed

security/selinux/ss/sidtab.h

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
*
99
* Copyright (C) 2018 Red Hat, Inc.
1010
*/
11+
1112
#ifndef _SS_SIDTAB_H_
1213
#define _SS_SIDTAB_H_
1314

@@ -29,25 +30,26 @@ struct sidtab_entry {
2930

3031
union sidtab_entry_inner {
3132
struct sidtab_node_inner *ptr_inner;
32-
struct sidtab_node_leaf *ptr_leaf;
33+
struct sidtab_node_leaf *ptr_leaf;
3334
};
3435

3536
/* align node size to page boundary */
3637
#define SIDTAB_NODE_ALLOC_SHIFT PAGE_SHIFT
37-
#define SIDTAB_NODE_ALLOC_SIZE PAGE_SIZE
38+
#define SIDTAB_NODE_ALLOC_SIZE PAGE_SIZE
3839

39-
#define size_to_shift(size) ((size) == 1 ? 1 : (const_ilog2((size) - 1) + 1))
40+
#define size_to_shift(size) ((size) == 1 ? 1 : (const_ilog2((size)-1) + 1))
4041

41-
#define SIDTAB_INNER_SHIFT \
42-
(SIDTAB_NODE_ALLOC_SHIFT - size_to_shift(sizeof(union sidtab_entry_inner)))
42+
#define SIDTAB_INNER_SHIFT \
43+
(SIDTAB_NODE_ALLOC_SHIFT - \
44+
size_to_shift(sizeof(union sidtab_entry_inner)))
4345
#define SIDTAB_INNER_ENTRIES ((size_t)1 << SIDTAB_INNER_SHIFT)
4446
#define SIDTAB_LEAF_ENTRIES \
4547
(SIDTAB_NODE_ALLOC_SIZE / sizeof(struct sidtab_entry))
4648

4749
#define SIDTAB_MAX_BITS 32
48-
#define SIDTAB_MAX U32_MAX
50+
#define SIDTAB_MAX U32_MAX
4951
/* ensure enough tree levels for SIDTAB_MAX entries */
50-
#define SIDTAB_MAX_LEVEL \
52+
#define SIDTAB_MAX_LEVEL \
5153
DIV_ROUND_UP(SIDTAB_MAX_BITS - size_to_shift(SIDTAB_LEAF_ENTRIES), \
5254
SIDTAB_INNER_SHIFT)
5355

@@ -69,7 +71,7 @@ struct sidtab_convert_params {
6971
struct sidtab *target;
7072
};
7173

72-
#define SIDTAB_HASH_BITS CONFIG_SECURITY_SELINUX_SIDTAB_HASH_BITS
74+
#define SIDTAB_HASH_BITS CONFIG_SECURITY_SELINUX_SIDTAB_HASH_BITS
7375
#define SIDTAB_HASH_BUCKETS (1 << SIDTAB_HASH_BITS)
7476

7577
struct sidtab {
@@ -125,8 +127,10 @@ int sidtab_convert(struct sidtab *s, struct sidtab_convert_params *params);
125127

126128
void sidtab_cancel_convert(struct sidtab *s);
127129

128-
void sidtab_freeze_begin(struct sidtab *s, unsigned long *flags) __acquires(&s->lock);
129-
void sidtab_freeze_end(struct sidtab *s, unsigned long *flags) __releases(&s->lock);
130+
void sidtab_freeze_begin(struct sidtab *s, unsigned long *flags)
131+
__acquires(&s->lock);
132+
void sidtab_freeze_end(struct sidtab *s, unsigned long *flags)
133+
__releases(&s->lock);
130134

131135
int sidtab_context_to_sid(struct sidtab *s, struct context *context, u32 *sid);
132136

@@ -137,22 +141,20 @@ int sidtab_hash_stats(struct sidtab *sidtab, char *page);
137141
#if CONFIG_SECURITY_SELINUX_SID2STR_CACHE_SIZE > 0
138142
void sidtab_sid2str_put(struct sidtab *s, struct sidtab_entry *entry,
139143
const char *str, u32 str_len);
140-
int sidtab_sid2str_get(struct sidtab *s, struct sidtab_entry *entry,
141-
char **out, u32 *out_len);
144+
int sidtab_sid2str_get(struct sidtab *s, struct sidtab_entry *entry, char **out,
145+
u32 *out_len);
142146
#else
143147
static inline void sidtab_sid2str_put(struct sidtab *s,
144148
struct sidtab_entry *entry,
145149
const char *str, u32 str_len)
146150
{
147151
}
148152
static inline int sidtab_sid2str_get(struct sidtab *s,
149-
struct sidtab_entry *entry,
150-
char **out, u32 *out_len)
153+
struct sidtab_entry *entry, char **out,
154+
u32 *out_len)
151155
{
152156
return -ENOENT;
153157
}
154158
#endif /* CONFIG_SECURITY_SELINUX_SID2STR_CACHE_SIZE > 0 */
155159

156-
#endif /* _SS_SIDTAB_H_ */
157-
158-
160+
#endif /* _SS_SIDTAB_H_ */

0 commit comments

Comments
 (0)