fs/ubifs/ubifs.h
Source file repositories/reference/linux-study-clean/fs/ubifs/ubifs.h
File Facts
- System
- Linux kernel
- Corpus path
fs/ubifs/ubifs.h- Extension
.h- Size
- 73885 bytes
- Lines
- 2160
- Domain
- Core OS
- Bucket
- VFS And Filesystem Core
- Inferred role
- Core OS: operation-table or driver-model contract
- Status
- pattern 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 an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
asm/div64.hlinux/statfs.hlinux/fs.hlinux/err.hlinux/sched.hlinux/slab.hlinux/vmalloc.hlinux/spinlock.hlinux/mutex.hlinux/rwsem.hlinux/mtd/ubi.hlinux/pagemap.hlinux/backing-dev.hlinux/security.hlinux/xattr.hlinux/random.hlinux/sysfs.hlinux/completion.hcrypto/hash_info.hcrypto/hash.hcrypto/utils.hlinux/fscrypt.hubifs-media.hdebug.hmisc.hkey.h
Detected Declarations
struct foliostruct ubifs_old_idxstruct ubifs_scan_nodestruct ubifs_scan_lebstruct ubifs_gced_idx_lebstruct ubifs_inodestruct ubifs_unclean_lebstruct ubifs_lpropsstruct ubifs_lpt_lpropsstruct ubifs_lp_statsstruct ubifs_nnodestruct ubifs_cnodestruct ubifs_pnodestruct ubifs_nbranchstruct ubifs_nnodestruct ubifs_lpt_heapstruct ubifs_infostruct ubifs_wbufstruct ubifs_budstruct ubifs_jheadstruct ubifs_zbranchstruct ubifs_znodestruct bu_infostruct ubifs_node_rangestruct ubifs_compressorstruct ubifs_budget_reqstruct ubifs_orphanstruct ubifs_mount_optsstruct ubifs_budg_infostruct ubifs_stats_infostruct ubifs_debug_infostruct ubifs_infofunction ubifs_authenticatedfunction ubifs_shash_initfunction ubifs_shash_updatefunction ubifs_shash_finalfunction ubifs_node_calc_hashfunction ubifs_check_hashfunction ubifs_check_hmacfunction ubifs_bad_hashfunction ubifs_node_check_hashfunction ubifs_exit_authenticationfunction ubifs_copy_hashfunction ubifs_node_insert_hmacfunction ubifs_node_verify_hmacfunction ubifs_auth_node_szfunction ubifs_shash_copy_statefunction ubifs_purge_xattrs
Annotated Snippet
extern const struct file_operations ubifs_file_operations;
extern const struct inode_operations ubifs_file_inode_operations;
extern const struct file_operations ubifs_dir_operations;
extern const struct inode_operations ubifs_dir_inode_operations;
extern const struct inode_operations ubifs_symlink_inode_operations;
extern struct ubifs_compressor *ubifs_compressors[UBIFS_COMPR_TYPES_CNT];
extern int ubifs_default_version;
/* auth.c */
static inline int ubifs_authenticated(const struct ubifs_info *c)
{
return (IS_ENABLED(CONFIG_UBIFS_FS_AUTHENTICATION)) && c->authenticated;
}
struct shash_desc *__ubifs_hash_get_desc(const struct ubifs_info *c);
static inline struct shash_desc *ubifs_hash_get_desc(const struct ubifs_info *c)
{
return ubifs_authenticated(c) ? __ubifs_hash_get_desc(c) : NULL;
}
static inline int ubifs_shash_init(const struct ubifs_info *c,
struct shash_desc *desc)
{
if (ubifs_authenticated(c))
return crypto_shash_init(desc);
else
return 0;
}
static inline int ubifs_shash_update(const struct ubifs_info *c,
struct shash_desc *desc, const void *buf,
unsigned int len)
{
int err = 0;
if (ubifs_authenticated(c)) {
err = crypto_shash_update(desc, buf, len);
if (err < 0)
return err;
}
return 0;
}
static inline int ubifs_shash_final(const struct ubifs_info *c,
struct shash_desc *desc, u8 *out)
{
return ubifs_authenticated(c) ? crypto_shash_final(desc, out) : 0;
}
int __ubifs_node_calc_hash(const struct ubifs_info *c, const void *buf,
u8 *hash);
static inline int ubifs_node_calc_hash(const struct ubifs_info *c,
const void *buf, u8 *hash)
{
if (ubifs_authenticated(c))
return __ubifs_node_calc_hash(c, buf, hash);
else
return 0;
}
int ubifs_prepare_auth_node(struct ubifs_info *c, void *node,
struct shash_desc *inhash);
/**
* ubifs_check_hash - compare two hashes
* @c: UBIFS file-system description object
* @expected: first hash
* @got: second hash
*
* Compare two hashes @expected and @got. Returns 0 when they are equal, a
* negative error code otherwise.
*/
static inline int ubifs_check_hash(const struct ubifs_info *c,
const u8 *expected, const u8 *got)
{
return crypto_memneq(expected, got, c->hash_len);
}
/**
* ubifs_check_hmac - compare two HMACs
* @c: UBIFS file-system description object
* @expected: first HMAC
* @got: second HMAC
*
* Compare two hashes @expected and @got. Returns 0 when they are equal, a
* negative error code otherwise.
*/
static inline int ubifs_check_hmac(const struct ubifs_info *c,
const u8 *expected, const u8 *got)
Annotation
- Immediate include surface: `asm/div64.h`, `linux/statfs.h`, `linux/fs.h`, `linux/err.h`, `linux/sched.h`, `linux/slab.h`, `linux/vmalloc.h`, `linux/spinlock.h`.
- Detected declarations: `struct folio`, `struct ubifs_old_idx`, `struct ubifs_scan_node`, `struct ubifs_scan_leb`, `struct ubifs_gced_idx_leb`, `struct ubifs_inode`, `struct ubifs_unclean_leb`, `struct ubifs_lprops`, `struct ubifs_lpt_lprops`, `struct ubifs_lp_stats`.
- Atlas domain: Core OS / VFS And Filesystem Core.
- Implementation status: pattern 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.