fs/fuse/control.c
Source file repositories/reference/linux-study-clean/fs/fuse/control.c
File Facts
- System
- Linux kernel
- Corpus path
fs/fuse/control.c- Extension
.c- Size
- 8211 bytes
- Lines
- 367
- 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
fuse_i.hdev.hlinux/init.hlinux/module.hlinux/fs_context.hlinux/namei.h
Detected Declarations
function fuse_conn_abort_writefunction fuse_conn_waiting_readfunction fuse_conn_limit_readfunction fuse_conn_limit_writefunction fuse_conn_max_background_readfunction fuse_conn_max_background_writefunction fuse_conn_congestion_threshold_readfunction fuse_conn_congestion_threshold_writefunction filesystemfunction remove_onefunction filesystemfunction fuse_ctl_fill_superfunction fuse_ctl_get_treefunction fuse_ctl_init_fs_contextfunction fuse_ctl_kill_sbfunction fuse_ctl_initfunction fuse_ctl_cleanup
Annotated Snippet
static const struct file_operations fuse_ctl_abort_ops = {
.open = nonseekable_open,
.write = fuse_conn_abort_write,
};
static const struct file_operations fuse_ctl_waiting_ops = {
.open = nonseekable_open,
.read = fuse_conn_waiting_read,
};
static const struct file_operations fuse_conn_max_background_ops = {
.open = nonseekable_open,
.read = fuse_conn_max_background_read,
.write = fuse_conn_max_background_write,
};
static const struct file_operations fuse_conn_congestion_threshold_ops = {
.open = nonseekable_open,
.read = fuse_conn_congestion_threshold_read,
.write = fuse_conn_congestion_threshold_write,
};
static struct dentry *fuse_ctl_add_dentry(struct dentry *parent,
struct fuse_conn *fc,
const char *name, int mode,
const struct inode_operations *iop,
const struct file_operations *fop)
{
struct dentry *dentry;
struct inode *inode;
dentry = d_alloc_name(parent, name);
if (!dentry)
return NULL;
inode = new_inode(fuse_control_sb);
if (!inode) {
dput(dentry);
return NULL;
}
inode->i_ino = get_next_ino();
inode->i_mode = mode;
inode->i_uid = fc->user_id;
inode->i_gid = fc->group_id;
simple_inode_init_ts(inode);
/* setting ->i_op to NULL is not allowed */
if (iop)
inode->i_op = iop;
inode->i_fop = fop;
if (S_ISDIR(mode)) {
inc_nlink(d_inode(parent));
inc_nlink(inode);
}
inode->i_private = fc;
d_make_persistent(dentry, inode);
dput(dentry);
/*
* We are returning a borrowed reference here - it's only good while
* fuse_mutex is held. Actually it's d_make_persistent() return
* value...
*/
return dentry;
}
/*
* Add a connection to the control filesystem (if it exists). Caller
* must hold fuse_mutex
*/
int fuse_ctl_add_conn(struct fuse_conn *fc)
{
struct dentry *parent;
char name[32];
if (!fuse_control_sb || fc->no_control)
return 0;
parent = fuse_control_sb->s_root;
sprintf(name, "%u", fc->dev);
parent = fuse_ctl_add_dentry(parent, fc, name, S_IFDIR | 0500,
&simple_dir_inode_operations,
&simple_dir_operations);
if (!parent)
goto err;
if (!fuse_ctl_add_dentry(parent, fc, "waiting", S_IFREG | 0400,
NULL, &fuse_ctl_waiting_ops) ||
!fuse_ctl_add_dentry(parent, fc, "abort", S_IFREG | 0200,
NULL, &fuse_ctl_abort_ops) ||
Annotation
- Immediate include surface: `fuse_i.h`, `dev.h`, `linux/init.h`, `linux/module.h`, `linux/fs_context.h`, `linux/namei.h`.
- Detected declarations: `function fuse_conn_abort_write`, `function fuse_conn_waiting_read`, `function fuse_conn_limit_read`, `function fuse_conn_limit_write`, `function fuse_conn_max_background_read`, `function fuse_conn_max_background_write`, `function fuse_conn_congestion_threshold_read`, `function fuse_conn_congestion_threshold_write`, `function filesystem`, `function remove_one`.
- 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.