fs/hfsplus/attributes.c
Source file repositories/reference/linux-study-clean/fs/hfsplus/attributes.c
File Facts
- System
- Linux kernel
- Corpus path
fs/hfsplus/attributes.c- Extension
.c- Size
- 11460 bytes
- Lines
- 500
- 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
hfsplus_fs.hhfsplus_raw.h
Detected Declarations
function hfsplus_create_attr_tree_cachefunction hfsplus_destroy_attr_tree_cachefunction hfsplus_attr_bin_cmp_keyfunction hfsplus_attr_build_keyfunction hfsplus_destroy_attr_entryfunction hfsplus_attr_build_recordfunction hfsplus_find_attrfunction hfsplus_attr_existsfunction hfsplus_create_attr_nolockfunction hfsplus_create_attrfunction __hfsplus_delete_attrfunction hfsplus_delete_attr_nolockfunction hfsplus_delete_attrfunction hfsplus_delete_all_attrsfunction hfsplus_replace_attr
Annotated Snippet
if (err == -ENOENT) {
/* file exists but xattr is absent */
err = -ENODATA;
goto failed_find_attr;
} else if (err)
goto failed_find_attr;
} else {
err = hfsplus_attr_build_key(sb, fd->search_key, cnid, NULL);
if (err)
goto failed_find_attr;
err = hfs_brec_find(fd, hfs_find_1st_rec_by_cnid);
if (err == -ENOENT) {
/* file exists but xattr is absent */
err = -ENODATA;
goto failed_find_attr;
} else if (err)
goto failed_find_attr;
}
failed_find_attr:
return err;
}
int hfsplus_attr_exists(struct inode *inode, const char *name)
{
int err = 0;
struct super_block *sb = inode->i_sb;
struct hfs_find_data fd;
hfs_dbg("name %s, ino %llu\n",
name ? name : NULL, inode->i_ino);
if (!HFSPLUS_SB(sb)->attr_tree)
return 0;
err = hfs_find_init(HFSPLUS_SB(sb)->attr_tree, &fd);
if (err)
return 0;
err = hfsplus_find_attr(sb, inode->i_ino, name, &fd);
if (err)
goto attr_not_found;
hfs_find_exit(&fd);
return 1;
attr_not_found:
hfs_find_exit(&fd);
return 0;
}
static
int hfsplus_create_attr_nolock(struct inode *inode, const char *name,
const void *value, size_t size,
struct hfs_find_data *fd,
hfsplus_attr_entry *entry_ptr)
{
struct super_block *sb = inode->i_sb;
int entry_size;
int err;
hfs_dbg("name %s, ino %llu\n",
name ? name : NULL, inode->i_ino);
if (name) {
err = hfsplus_attr_build_key(sb, fd->search_key,
inode->i_ino, name);
if (err)
return err;
} else
return -EINVAL;
/* Mac OS X supports only inline data attributes. */
entry_size = hfsplus_attr_build_record(entry_ptr,
HFSPLUS_ATTR_INLINE_DATA,
inode->i_ino,
value, size);
if (entry_size == HFSPLUS_INVALID_ATTR_RECORD) {
if (size > HFSPLUS_MAX_INLINE_DATA_SIZE)
err = -E2BIG;
else
err = -EINVAL;
hfs_dbg("unable to store value: err %d\n", err);
return err;
}
err = hfs_brec_find(fd, hfs_find_rec_by_key);
if (err != -ENOENT) {
if (!err)
err = -EEXIST;
Annotation
- Immediate include surface: `hfsplus_fs.h`, `hfsplus_raw.h`.
- Detected declarations: `function hfsplus_create_attr_tree_cache`, `function hfsplus_destroy_attr_tree_cache`, `function hfsplus_attr_bin_cmp_key`, `function hfsplus_attr_build_key`, `function hfsplus_destroy_attr_entry`, `function hfsplus_attr_build_record`, `function hfsplus_find_attr`, `function hfsplus_attr_exists`, `function hfsplus_create_attr_nolock`, `function hfsplus_create_attr`.
- 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.