Skip to content

Commit a4eecba

Browse files
mjguziktorvalds
authored andcommitted
capability: add cap_isidentical
Signed-off-by: Mateusz Guzik <[email protected]> Reviewed-by: Serge Hallyn <[email protected]> Cc: Al Viro <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 1038306 commit a4eecba

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

include/linux/capability.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,16 @@ static inline bool cap_isclear(const kernel_cap_t a)
157157
return true;
158158
}
159159

160+
static inline bool cap_isidentical(const kernel_cap_t a, const kernel_cap_t b)
161+
{
162+
unsigned __capi;
163+
CAP_FOR_EACH_U32(__capi) {
164+
if (a.cap[__capi] != b.cap[__capi])
165+
return false;
166+
}
167+
return true;
168+
}
169+
160170
/*
161171
* Check if "a" is a subset of "set".
162172
* return true if ALL of the capabilities in "a" are also in "set"

0 commit comments

Comments
 (0)