提交 e42852bf 编写于 作者: Y Yaowei Bai 提交者: James Morris

security/capability.h: cap_issubset/isclear can be boolean

This patch makes cap_issubset/isclear return bool due to these
functions only using either one or zero as their return
value.

No functional change.
Signed-off-by: NYaowei Bai <baiyaowei@cmss.chinamobile.com>
Acked-by: NSerge Hallyn <serge.hallyn@canonical.com>
Signed-off-by: NJames Morris <james.l.morris@oracle.com>
上级 f70be6da
...@@ -145,24 +145,24 @@ static inline kernel_cap_t cap_invert(const kernel_cap_t c) ...@@ -145,24 +145,24 @@ static inline kernel_cap_t cap_invert(const kernel_cap_t c)
return dest; return dest;
} }
static inline int cap_isclear(const kernel_cap_t a) static inline bool cap_isclear(const kernel_cap_t a)
{ {
unsigned __capi; unsigned __capi;
CAP_FOR_EACH_U32(__capi) { CAP_FOR_EACH_U32(__capi) {
if (a.cap[__capi] != 0) if (a.cap[__capi] != 0)
return 0; return false;
} }
return 1; return true;
} }
/* /*
* Check if "a" is a subset of "set". * Check if "a" is a subset of "set".
* return 1 if ALL of the capabilities in "a" are also in "set" * return true if ALL of the capabilities in "a" are also in "set"
* cap_issubset(0101, 1111) will return 1 * cap_issubset(0101, 1111) will return true
* return 0 if ANY of the capabilities in "a" are not in "set" * return false if ANY of the capabilities in "a" are not in "set"
* cap_issubset(1111, 0101) will return 0 * cap_issubset(1111, 0101) will return false
*/ */
static inline int cap_issubset(const kernel_cap_t a, const kernel_cap_t set) static inline bool cap_issubset(const kernel_cap_t a, const kernel_cap_t set)
{ {
kernel_cap_t dest; kernel_cap_t dest;
dest = cap_drop(a, set); dest = cap_drop(a, set);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册