fs/affs/affs.h
Source file repositories/reference/linux-study-clean/fs/affs/affs.h
File Facts
- System
- Linux kernel
- Corpus path
fs/affs/affs.h- Extension
.h- Size
- 11178 bytes
- Lines
- 325
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/types.hlinux/fs.hlinux/buffer_head.hamigaffs.hlinux/mutex.hlinux/workqueue.h
Detected Declarations
struct affs_ext_keystruct affs_inode_infostruct affs_bm_infostruct affs_sb_infofunction affs_validblockfunction affs_breadfunction affs_getblkfunction affs_getzeroblkfunction affs_getemptyblkfunction affs_brelsefunction affs_adjust_checksumfunction affs_adjust_bitmapchecksumfunction affs_lock_linkfunction affs_unlock_linkfunction affs_lock_dirfunction affs_unlock_dirfunction affs_lock_extfunction affs_unlock_ext
Annotated Snippet
extern const struct file_operations affs_file_operations;
extern const struct file_operations affs_file_operations_ofs;
extern const struct file_operations affs_dir_operations;
extern const struct address_space_operations affs_symlink_aops;
extern const struct address_space_operations affs_aops;
extern const struct address_space_operations affs_aops_ofs;
extern const struct dentry_operations affs_dentry_operations;
extern const struct dentry_operations affs_intl_dentry_operations;
static inline bool affs_validblock(struct super_block *sb, int block)
{
return(block >= AFFS_SB(sb)->s_reserved &&
block < AFFS_SB(sb)->s_partition_size);
}
static inline struct buffer_head *
affs_bread(struct super_block *sb, int block)
{
pr_debug("%s: %d\n", __func__, block);
if (affs_validblock(sb, block))
return sb_bread(sb, block);
return NULL;
}
static inline struct buffer_head *
affs_getblk(struct super_block *sb, int block)
{
pr_debug("%s: %d\n", __func__, block);
if (affs_validblock(sb, block))
return sb_getblk(sb, block);
return NULL;
}
static inline struct buffer_head *
affs_getzeroblk(struct super_block *sb, int block)
{
struct buffer_head *bh;
pr_debug("%s: %d\n", __func__, block);
if (affs_validblock(sb, block)) {
bh = sb_getblk(sb, block);
lock_buffer(bh);
memset(bh->b_data, 0 , sb->s_blocksize);
set_buffer_uptodate(bh);
unlock_buffer(bh);
return bh;
}
return NULL;
}
static inline struct buffer_head *
affs_getemptyblk(struct super_block *sb, int block)
{
struct buffer_head *bh;
pr_debug("%s: %d\n", __func__, block);
if (affs_validblock(sb, block)) {
bh = sb_getblk(sb, block);
wait_on_buffer(bh);
set_buffer_uptodate(bh);
return bh;
}
return NULL;
}
static inline void
affs_brelse(struct buffer_head *bh)
{
if (bh)
pr_debug("%s: %lld\n", __func__, (long long) bh->b_blocknr);
brelse(bh);
}
static inline void
affs_adjust_checksum(struct buffer_head *bh, u32 val)
{
u32 tmp = be32_to_cpu(((__be32 *)bh->b_data)[5]);
((__be32 *)bh->b_data)[5] = cpu_to_be32(tmp - val);
}
static inline void
affs_adjust_bitmapchecksum(struct buffer_head *bh, u32 val)
{
u32 tmp = be32_to_cpu(((__be32 *)bh->b_data)[0]);
((__be32 *)bh->b_data)[0] = cpu_to_be32(tmp - val);
}
static inline void
affs_lock_link(struct inode *inode)
{
mutex_lock(&AFFS_I(inode)->i_link_lock);
}
static inline void
affs_unlock_link(struct inode *inode)
{
mutex_unlock(&AFFS_I(inode)->i_link_lock);
Annotation
- Immediate include surface: `linux/types.h`, `linux/fs.h`, `linux/buffer_head.h`, `amigaffs.h`, `linux/mutex.h`, `linux/workqueue.h`.
- Detected declarations: `struct affs_ext_key`, `struct affs_inode_info`, `struct affs_bm_info`, `struct affs_sb_info`, `function affs_validblock`, `function affs_bread`, `function affs_getblk`, `function affs_getzeroblk`, `function affs_getemptyblk`, `function affs_brelse`.
- 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.