include/linux/xattr.h
Source file repositories/reference/linux-study-clean/include/linux/xattr.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/xattr.h- Extension
.h- Size
- 5916 bytes
- Lines
- 173
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/slab.hlinux/types.hlinux/spinlock.hlinux/mm.hlinux/rhashtable-types.hlinux/user_namespace.huapi/linux/xattr.h
Detected Declarations
struct inodestruct dentrystruct xattr_handlerstruct xattrstruct simple_xattr_cachestruct simple_xattrstruct simple_xattr_limitsfunction is_posix_acl_xattrfunction xattr_handler_can_listfunction simple_xattr_limits_init
Annotated Snippet
struct xattr_handler {
const char *name;
const char *prefix;
int flags; /* fs private flags */
bool (*list)(struct dentry *dentry);
int (*get)(const struct xattr_handler *, struct dentry *dentry,
struct inode *inode, const char *name, void *buffer,
size_t size);
int (*set)(const struct xattr_handler *,
struct mnt_idmap *idmap, struct dentry *dentry,
struct inode *inode, const char *name, const void *buffer,
size_t size, int flags);
};
/**
* xattr_handler_can_list - check whether xattr can be listed
* @handler: handler for this type of xattr
* @dentry: dentry whose inode xattr to list
*
* Determine whether the xattr associated with @dentry can be listed given
* @handler.
*
* Return: true if xattr can be listed, false if not.
*/
static inline bool xattr_handler_can_list(const struct xattr_handler *handler,
struct dentry *dentry)
{
return handler && (!handler->list || handler->list(dentry));
}
const char *xattr_full_name(const struct xattr_handler *, const char *);
struct xattr {
const char *name;
void *value;
size_t value_len;
};
ssize_t __vfs_getxattr(struct dentry *, struct inode *, const char *, void *, size_t);
ssize_t vfs_getxattr(struct mnt_idmap *, struct dentry *, const char *,
void *, size_t);
ssize_t vfs_listxattr(struct dentry *d, char *list, size_t size);
int __vfs_setxattr(struct mnt_idmap *, struct dentry *, struct inode *,
const char *, const void *, size_t, int);
int __vfs_setxattr_noperm(struct mnt_idmap *, struct dentry *,
const char *, const void *, size_t, int);
int __vfs_setxattr_locked(struct mnt_idmap *, struct dentry *,
const char *, const void *, size_t, int,
struct delegated_inode *);
int vfs_setxattr(struct mnt_idmap *, struct dentry *, const char *,
const void *, size_t, int);
int __vfs_removexattr(struct mnt_idmap *, struct dentry *, const char *);
int __vfs_removexattr_locked(struct mnt_idmap *, struct dentry *,
const char *, struct delegated_inode *);
int vfs_removexattr(struct mnt_idmap *, struct dentry *, const char *);
ssize_t generic_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size);
int vfs_getxattr_alloc(struct mnt_idmap *idmap,
struct dentry *dentry, const char *name,
char **xattr_value, size_t size, gfp_t flags);
int xattr_supports_user_prefix(struct inode *inode);
static inline const char *xattr_prefix(const struct xattr_handler *handler)
{
return handler->prefix ?: handler->name;
}
struct simple_xattr_cache {
struct rhashtable *ht;
};
struct simple_xattr {
struct rhash_head hash_node;
struct list_head *parent;
struct list_head node;
struct rcu_head rcu;
char *name;
size_t size;
char value[] __counted_by(size);
};
#define SIMPLE_XATTR_MAX_NR 128
#define SIMPLE_XATTR_MAX_SIZE (128 << 10)
struct simple_xattr_limits {
atomic_t nr_xattrs; /* current user.* xattr count */
atomic_t xattr_size; /* current total user.* value bytes */
};
Annotation
- Immediate include surface: `linux/slab.h`, `linux/types.h`, `linux/spinlock.h`, `linux/mm.h`, `linux/rhashtable-types.h`, `linux/user_namespace.h`, `uapi/linux/xattr.h`.
- Detected declarations: `struct inode`, `struct dentry`, `struct xattr_handler`, `struct xattr`, `struct simple_xattr_cache`, `struct simple_xattr`, `struct simple_xattr_limits`, `function is_posix_acl_xattr`, `function xattr_handler_can_list`, `function simple_xattr_limits_init`.
- Atlas domain: Core OS / Core Kernel Interface.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.