Lines Matching +full:new +full:- +full:cap
1 // SPDX-License-Identifier: GPL-2.0-or-later
26 static void do_cap_drop(uint32_t *set, uint32_t mask, const struct tst_cap *cap) in do_cap_drop() argument
29 tst_res(TINFO, "Dropping %s(%d)", cap->name, cap->id); in do_cap_drop()
35 const struct tst_cap *cap) in do_cap_req() argument
38 tst_brk(TCONF, "Need %s(%d)", cap->name, cap->id); in do_cap_req()
41 tst_res(TINFO, "Permitting %s(%d)", cap->name, cap->id); in do_cap_req()
46 void tst_cap_action(struct tst_cap *cap) in tst_cap_action() argument
53 struct tst_cap_user_data new[2] = { {0} }; in tst_cap_action() local
54 uint32_t act = cap->action; in tst_cap_action()
55 uint32_t *pE = &new[CAP_TO_INDEX(cap->id)].effective; in tst_cap_action()
56 uint32_t *pP = &new[CAP_TO_INDEX(cap->id)].permitted; in tst_cap_action()
57 uint32_t mask = CAP_TO_MASK(cap->id); in tst_cap_action()
62 memcpy(new, cur, sizeof(new)); in tst_cap_action()
66 do_cap_drop(pE, mask, cap); in tst_cap_action()
69 do_cap_req(pP, pE, mask, cap); in tst_cap_action()
72 tst_brk(TBROK, "Unrecognised action %d", cap->action); in tst_cap_action()
75 if (!memcmp(cur, new, sizeof(new))) in tst_cap_action()
78 if (tst_capset(&hdr, new)) in tst_cap_action()
79 tst_brk(TBROK | TERRNO, "tst_capset(%s)", cap->name); in tst_cap_action()
84 struct tst_cap *cap; in tst_cap_setup() local
86 for (cap = caps; cap->action; cap++) { in tst_cap_setup()
87 if (cap->action & action_mask) in tst_cap_setup()
88 tst_cap_action(cap); in tst_cap_setup()