Data Structures

The on-disk representation format for an ACL is similar to the in-memory representation required by the generic POSIX helper functions:

fs/ext3/acl.h typedef struct {

_le16 e_tag;

_le16 e_perm;

} ext3_acl_entry;

The meaning of the struct members is identical to the meaning discussed above for the in-memory variant. To save disk space, a version without the e_id field is also defined. It is used for the first four entries of an ACL list because no specific UID/GID is required for them:

fs/ext3/acl.h typedef struct {

_le16 e_tag;

_le16 e_perm;

} ext3_acl_entry_short;

A list of ACL entries is always led by a header element, which is defined as follows:

fs/ext3/acl.h typedef struct {

_le32 a_version;

} ext3_acl_header;

The a_version field would allow for distinguishing between different versions of the ACL implementation. Fortunately, the current implementation has not yet shown any weaknesses that would require introducing a new version, so revision ext3_acl_version) — 0x0001 — is still perfectly fine. Although the field is not relevant right now, it will become important should an incompatible future version be developed.

The in-memory representation of every Ext3 inode is augmented with two fields that are relevant for the ACL implementation:

struct ext3_inode_info {


struct posix_acl *i_acl;

struct posix_acl *i_default_acl;

While i_acl points to the posix_acl instance for a regular ACL list associated with an inode, i_default_acl points to the default ACL that may be associated with a directory and is inherited by subdirectories. Since all information is stored in extended attributes on disk, no extension of the disk-based struct ext3_inode is necessary.

Note that the kernel does not automatically construct the ACL information for every inode; if the information is not present in memory, the fields are set to ext3_acl_not_cached [defined as (void*)-1].

Continue reading here: Conversion between OnDisk and InMemory Representation

Was this article helpful?

0 0