Skip to content

Commit b27e564

Browse files
committed
selinux: fix style issues in security/selinux/ss/context.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 e6162e4 commit b27e564

File tree

1 file changed

+22
-19
lines changed

1 file changed

+22
-19
lines changed

security/selinux/ss/context.h

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
*
1414
* Author : Stephen Smalley, <[email protected]>
1515
*/
16+
1617
#ifndef _SS_CONTEXT_H_
1718
#define _SS_CONTEXT_H_
1819

@@ -28,17 +29,18 @@ struct context {
2829
u32 user;
2930
u32 role;
3031
u32 type;
31-
u32 len; /* length of string in bytes */
32+
u32 len; /* length of string in bytes */
3233
struct mls_range range;
33-
char *str; /* string representation if context cannot be mapped. */
34+
char *str; /* string representation if context cannot be mapped. */
3435
};
3536

3637
static inline void mls_context_init(struct context *c)
3738
{
3839
memset(&c->range, 0, sizeof(c->range));
3940
}
4041

41-
static inline int mls_context_cpy(struct context *dst, const struct context *src)
42+
static inline int mls_context_cpy(struct context *dst,
43+
const struct context *src)
4244
{
4345
int rc;
4446

@@ -58,7 +60,8 @@ static inline int mls_context_cpy(struct context *dst, const struct context *src
5860
/*
5961
* Sets both levels in the MLS range of 'dst' to the low level of 'src'.
6062
*/
61-
static inline int mls_context_cpy_low(struct context *dst, const struct context *src)
63+
static inline int mls_context_cpy_low(struct context *dst,
64+
const struct context *src)
6265
{
6366
int rc;
6467

@@ -78,7 +81,8 @@ static inline int mls_context_cpy_low(struct context *dst, const struct context
7881
/*
7982
* Sets both levels in the MLS range of 'dst' to the high level of 'src'.
8083
*/
81-
static inline int mls_context_cpy_high(struct context *dst, const struct context *src)
84+
static inline int mls_context_cpy_high(struct context *dst,
85+
const struct context *src)
8286
{
8387
int rc;
8488

@@ -95,9 +99,9 @@ static inline int mls_context_cpy_high(struct context *dst, const struct context
9599
return rc;
96100
}
97101

98-
99102
static inline int mls_context_glblub(struct context *dst,
100-
const struct context *c1, const struct context *c2)
103+
const struct context *c1,
104+
const struct context *c2)
101105
{
102106
struct mls_range *dr = &dst->range;
103107
const struct mls_range *r1 = &c1->range, *r2 = &c2->range;
@@ -114,21 +118,22 @@ static inline int mls_context_glblub(struct context *dst,
114118
/* Take the least of the high */
115119
dr->level[1].sens = min(r1->level[1].sens, r2->level[1].sens);
116120

117-
rc = ebitmap_and(&dr->level[0].cat,
118-
&r1->level[0].cat, &r2->level[0].cat);
121+
rc = ebitmap_and(&dr->level[0].cat, &r1->level[0].cat,
122+
&r2->level[0].cat);
119123
if (rc)
120124
goto out;
121125

122-
rc = ebitmap_and(&dr->level[1].cat,
123-
&r1->level[1].cat, &r2->level[1].cat);
126+
rc = ebitmap_and(&dr->level[1].cat, &r1->level[1].cat,
127+
&r2->level[1].cat);
124128
if (rc)
125129
goto out;
126130

127131
out:
128132
return rc;
129133
}
130134

131-
static inline int mls_context_cmp(const struct context *c1, const struct context *c2)
135+
static inline int mls_context_cmp(const struct context *c1,
136+
const struct context *c2)
132137
{
133138
return ((c1->range.level[0].sens == c2->range.level[0].sens) &&
134139
ebitmap_cmp(&c1->range.level[0].cat, &c2->range.level[0].cat) &&
@@ -183,19 +188,17 @@ static inline void context_destroy(struct context *c)
183188
mls_context_destroy(c);
184189
}
185190

186-
static inline int context_cmp(const struct context *c1, const struct context *c2)
191+
static inline int context_cmp(const struct context *c1,
192+
const struct context *c2)
187193
{
188194
if (c1->len && c2->len)
189195
return (c1->len == c2->len && !strcmp(c1->str, c2->str));
190196
if (c1->len || c2->len)
191197
return 0;
192-
return ((c1->user == c2->user) &&
193-
(c1->role == c2->role) &&
194-
(c1->type == c2->type) &&
195-
mls_context_cmp(c1, c2));
198+
return ((c1->user == c2->user) && (c1->role == c2->role) &&
199+
(c1->type == c2->type) && mls_context_cmp(c1, c2));
196200
}
197201

198202
u32 context_compute_hash(const struct context *c);
199203

200-
#endif /* _SS_CONTEXT_H_ */
201-
204+
#endif /* _SS_CONTEXT_H_ */

0 commit comments

Comments
 (0)