summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMateusz Guzik <mjguzik@gmail.com>2023-01-25 16:55:56 +0100
committerLinus Torvalds <torvalds@linux-foundation.org>2023-02-27 16:39:19 -0800
commita4eecbae092759537748360299de03e434c9a956 (patch)
tree2408d38947372eb9635d22523ab6f5991335c40a /include
parent103830683cfc8f43b15158b0a48014b6d6e83633 (diff)
downloadlinux-rpi-a4eecbae092759537748360299de03e434c9a956.tar.gz
linux-rpi-a4eecbae092759537748360299de03e434c9a956.tar.bz2
linux-rpi-a4eecbae092759537748360299de03e434c9a956.zip
capability: add cap_isidentical
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>
Diffstat (limited to 'include')
-rw-r--r--include/linux/capability.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/linux/capability.h b/include/linux/capability.h
index 03c2a613ad40..d3c6c2d1ff45 100644
--- a/include/linux/capability.h
+++ b/include/linux/capability.h
@@ -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"