Retrieving ACLs

Given an instance of struct inode, ext3_get_acl can be used to retrieve an in-memory representation of the ACL. Note that another parameter (type) specifies if the default or the access inode is supposed to be retrieved. The cases are distinguished with acl_type_access and acl_type_default. The code flow diagram for the function is shown in Figure 11-10.

Figure 11-10: Code flow diagram for ext3_get_acl.

At first, the kernel uses the helper function ext3_iget_acl to check if the in-memory representation of the ACL is already cached in ext3_inode_info->i_acl (or, respectively, i_default_acl if the default ACL is requested). Should this be the case, the function creates a copy of the representation that can be returned as the result of ext3_get_acl.

If the ACL is not yet cached, then first ext3_xattr_get is called to retrieve the raw data from the extended attribute subsystem4; the conversion from the on-disk to the in-memory representation is performed with the aid of ext3_acl_from_disk. Before a pointer to this representation can be returned, the cache field in question of ext3_inode_info is updated so that subsequent requests can directly get the in-memory representation.

Continue reading here: Modifying ACLs

Was this article helpful?

0 0