MCPcopy Create free account
hub / github.com/F-Stack/f-stack / vacl_set_acl

Function vacl_set_acl

freebsd/kern/vfs_acl.c:227–260  ·  view source on GitHub ↗

* Given a vnode, set its ACL. */

Source from the content-addressed store, hash-verified

225 * Given a vnode, set its ACL.
226 */
227static int
228vacl_set_acl(struct thread *td, struct vnode *vp, acl_type_t type,
229 const struct acl *aclp)
230{
231 struct acl *inkernelacl;
232 struct mount *mp;
233 int error;
234
235 AUDIT_ARG_VALUE(type);
236 inkernelacl = acl_alloc(M_WAITOK);
237 error = acl_copyin(aclp, inkernelacl, type);
238 if (error != 0)
239 goto out;
240 error = vn_start_write(vp, &mp, V_WAIT | PCATCH);
241 if (error != 0)
242 goto out;
243 vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
244 AUDIT_ARG_VNODE1(vp);
245#ifdef MAC
246 error = mac_vnode_check_setacl(td->td_ucred, vp, type, inkernelacl);
247 if (error != 0)
248 goto out_unlock;
249#endif
250 error = VOP_SETACL(vp, acl_type_unold(type), inkernelacl,
251 td->td_ucred, td);
252#ifdef MAC
253out_unlock:
254#endif
255 VOP_UNLOCK(vp);
256 vn_finished_write(mp);
257out:
258 acl_free(inkernelacl);
259 return (error);
260}
261
262/*
263 * Given a vnode, get its ACL.

Callers 2

kern___acl_set_pathFunction · 0.85
sys___acl_set_fdFunction · 0.85

Calls 8

acl_copyinFunction · 0.85
vn_start_writeFunction · 0.85
vn_lockFunction · 0.85
mac_vnode_check_setaclFunction · 0.85
acl_type_unoldFunction · 0.85
vn_finished_writeFunction · 0.85
acl_allocFunction · 0.70
acl_freeFunction · 0.70

Tested by

no test coverage detected