fs/nfs/nfs3acl.c
Source file repositories/reference/linux-study-clean/fs/nfs/nfs3acl.c
File Facts
- System
- Linux kernel
- Corpus path
fs/nfs/nfs3acl.c- Extension
.c- Size
- 8228 bytes
- Lines
- 344
- Domain
- Core OS
- Bucket
- VFS And Filesystem Core
- Inferred role
- Core OS: implementation source
- Status
- source implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/fs.hlinux/gfp.hlinux/nfs.hlinux/nfs3.hlinux/nfs_fs.hlinux/posix_acl_xattr.hlinux/nfsacl.hinternal.hnfs3_fs.h
Detected Declarations
function nfs3_prepare_get_aclfunction nfs3_complete_get_aclfunction nfs3_abort_get_aclfunction __nfs3_proc_setaclsfunction nfs3_proc_setaclsfunction nfs3_set_aclfunction nfs3_list_one_aclfunction nfs3_listxattr
Annotated Snippet
switch(type) {
case ACL_TYPE_ACCESS:
alloc = get_inode_acl(inode, ACL_TYPE_DEFAULT);
if (IS_ERR(alloc))
goto fail;
dfacl = alloc;
break;
case ACL_TYPE_DEFAULT:
alloc = get_inode_acl(inode, ACL_TYPE_ACCESS);
if (IS_ERR(alloc))
goto fail;
dfacl = acl;
acl = alloc;
break;
}
}
if (acl == NULL) {
alloc = posix_acl_from_mode(inode->i_mode, GFP_KERNEL);
if (IS_ERR(alloc))
goto fail;
acl = alloc;
}
status = __nfs3_proc_setacls(inode, acl, dfacl);
out:
if (acl != orig)
posix_acl_release(acl);
if (dfacl != orig)
posix_acl_release(dfacl);
return status;
fail:
status = PTR_ERR(alloc);
goto out;
}
static int
nfs3_list_one_acl(struct inode *inode, int type, const char *name, void *data,
size_t size, ssize_t *result)
{
struct posix_acl *acl;
char *p = data + *result;
acl = get_inode_acl(inode, type);
if (IS_ERR_OR_NULL(acl))
return 0;
posix_acl_release(acl);
*result += strlen(name);
*result += 1;
if (!size)
return 0;
if (*result > size)
return -ERANGE;
strcpy(p, name);
return 0;
}
ssize_t
nfs3_listxattr(struct dentry *dentry, char *data, size_t size)
{
struct inode *inode = d_inode(dentry);
ssize_t result = 0;
int error;
error = nfs3_list_one_acl(inode, ACL_TYPE_ACCESS,
XATTR_NAME_POSIX_ACL_ACCESS, data, size, &result);
if (error)
return error;
error = nfs3_list_one_acl(inode, ACL_TYPE_DEFAULT,
XATTR_NAME_POSIX_ACL_DEFAULT, data, size, &result);
if (error)
return error;
return result;
}
Annotation
- Immediate include surface: `linux/fs.h`, `linux/gfp.h`, `linux/nfs.h`, `linux/nfs3.h`, `linux/nfs_fs.h`, `linux/posix_acl_xattr.h`, `linux/nfsacl.h`, `internal.h`.
- Detected declarations: `function nfs3_prepare_get_acl`, `function nfs3_complete_get_acl`, `function nfs3_abort_get_acl`, `function __nfs3_proc_setacls`, `function nfs3_proc_setacls`, `function nfs3_set_acl`, `function nfs3_list_one_acl`, `function nfs3_listxattr`.
- Atlas domain: Core OS / VFS And Filesystem Core.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.