fs/befs/linuxvfs.c
Source file repositories/reference/linux-study-clean/fs/befs/linuxvfs.c
File Facts
- System
- Linux kernel
- Corpus path
fs/befs/linuxvfs.c- Extension
.c- Size
- 26323 bytes
- Lines
- 1031
- 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.
- 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
linux/module.hlinux/slab.hlinux/fs.hlinux/fs_context.hlinux/fs_parser.hlinux/errno.hlinux/filelock.hlinux/stat.hlinux/nls.hlinux/buffer_head.hlinux/vfs.hlinux/namei.hlinux/sched.hlinux/cred.hlinux/exportfs.hlinux/seq_file.hlinux/blkdev.hbefs.hbtree.hinode.hdatastream.hsuper.hio.h
Detected Declarations
function generic_file_readfunction befs_bmapfunction positionfunction befs_lookupfunction befs_readdirfunction befs_alloc_inodefunction befs_free_inodefunction init_oncefunction befs_init_inodecachefunction befs_destroy_inodecachefunction befs_symlink_read_foliofunction uni2charfunction kfreefunction befs_parse_paramfunction befs_show_optionsfunction befs_put_superfunction befs_set_optionsfunction befs_fill_superfunction befs_reconfigurefunction befs_statfsfunction befs_get_treefunction befs_init_fs_contextfunction befs_free_fcfunction init_befs_fsfunction exit_befs_fsmodule init init_befs_fs
Annotated Snippet
static const struct file_operations befs_dir_operations = {
.read = generic_read_dir,
.iterate_shared = befs_readdir,
.llseek = generic_file_llseek,
.setlease = generic_setlease,
};
static const struct inode_operations befs_dir_inode_operations = {
.lookup = befs_lookup,
};
static const struct address_space_operations befs_aops = {
.read_folio = befs_read_folio,
.bmap = befs_bmap,
};
static const struct address_space_operations befs_symlink_aops = {
.read_folio = befs_symlink_read_folio,
};
static const struct export_operations befs_export_operations = {
.encode_fh = generic_encode_ino32_fh,
.fh_to_dentry = befs_fh_to_dentry,
.fh_to_parent = befs_fh_to_parent,
.get_parent = befs_get_parent,
};
/*
* Called by generic_file_read() to read a folio of data
*
* In turn, simply calls a generic block read function and
* passes it the address of befs_get_block, for mapping file
* positions to disk blocks.
*/
static int befs_read_folio(struct file *file, struct folio *folio)
{
return block_read_full_folio(folio, befs_get_block);
}
static sector_t
befs_bmap(struct address_space *mapping, sector_t block)
{
return generic_block_bmap(mapping, block, befs_get_block);
}
/*
* Generic function to map a file position (block) to a
* disk offset (passed back in bh_result).
*
* Used by many higher level functions.
*
* Calls befs_fblock2brun() in datastream.c to do the real work.
*/
static int
befs_get_block(struct inode *inode, sector_t block,
struct buffer_head *bh_result, int create)
{
struct super_block *sb = inode->i_sb;
befs_data_stream *ds = &BEFS_I(inode)->i_data.ds;
befs_block_run run = BAD_IADDR;
int res;
ulong disk_off;
befs_debug(sb, "---> befs_get_block() for inode %llu, block %ld",
inode->i_ino, (long)block);
if (create) {
befs_error(sb, "befs_get_block() was asked to write to "
"block %ld in inode %llu", (long)block,
inode->i_ino);
return -EPERM;
}
res = befs_fblock2brun(sb, ds, block, &run);
if (res != BEFS_OK) {
befs_error(sb,
"<--- %s for inode %llu, block %ld ERROR",
__func__, inode->i_ino,
(long)block);
return -EFBIG;
}
disk_off = (ulong) iaddr2blockno(sb, &run);
map_bh(bh_result, inode->i_sb, disk_off);
befs_debug(sb, "<--- %s for inode %llu, block %ld, disk address %lu",
__func__, inode->i_ino, (long)block,
(unsigned long)disk_off);
Annotation
- Immediate include surface: `linux/module.h`, `linux/slab.h`, `linux/fs.h`, `linux/fs_context.h`, `linux/fs_parser.h`, `linux/errno.h`, `linux/filelock.h`, `linux/stat.h`.
- Detected declarations: `function generic_file_read`, `function befs_bmap`, `function position`, `function befs_lookup`, `function befs_readdir`, `function befs_alloc_inode`, `function befs_free_inode`, `function init_once`, `function befs_init_inodecache`, `function befs_destroy_inodecache`.
- Atlas domain: Core OS / VFS And Filesystem Core.
- Implementation status: pattern 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.