Skip to content

Commit

Permalink
capability: add cap_isidentical
Browse files Browse the repository at this point in the history
Signed-off-by: Mateusz Guzik <mjguzik@gmail.com>
Reviewed-by: Serge Hallyn <serge@hallyn.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Mateusz Guzik authored and Linus Torvalds committed Feb 28, 2023
1 parent 1038306 commit a4eecba
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions include/linux/capability.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,16 @@ static inline bool cap_isclear(const kernel_cap_t a)
return true;
}

static inline bool cap_isidentical(const kernel_cap_t a, const kernel_cap_t b)
{
unsigned __capi;
CAP_FOR_EACH_U32(__capi) {
if (a.cap[__capi] != b.cap[__capi])
return false;
}
return true;
}

/*
* Check if "a" is a subset of "set".
* return true if ALL of the capabilities in "a" are also in "set"
Expand Down

0 comments on commit a4eecba

Please sign in to comment.