fs/smb/client/ioctl.c
Source file repositories/reference/linux-study-clean/fs/smb/client/ioctl.c
File Facts
- System
- Linux kernel
- Corpus path
fs/smb/client/ioctl.c- Extension
.c- Size
- 18646 bytes
- Lines
- 724
- 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.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- 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
linux/fs.hlinux/file.hlinux/mount.hlinux/mm.hlinux/pagemap.hcifsglob.hcifsproto.hcifs_debug.hcifsfs.hcifs_ioctl.hsmb2proto.hsmb2glob.hlinux/btrfs.h
Detected Declarations
function Copyrightfunction cifs_set_compression_by_pathfunction cifs_ioctl_set_compressionfunction cifs_ioctl_copychunkfunction smb_mnt_get_tcon_infofunction smb_mnt_get_fsinfofunction cifs_shutdownfunction cifs_dump_full_keyfunction list_for_each_entryfunction cifs_ioctl
Annotated Snippet
if (!utf16_path) {
rc = -ENOMEM;
goto ici_exit;
}
}
if (tcon->ses->server->ops->ioctl_query_info)
rc = tcon->ses->server->ops->ioctl_query_info(
xid, tcon, cifs_sb, utf16_path,
filep->private_data ? 0 : 1, p);
else
rc = -EOPNOTSUPP;
ici_exit:
if (utf16_path != &root_path)
kfree(utf16_path);
free_dentry_path(page);
return rc;
}
static int cifs_set_compression_by_path(unsigned int xid, struct file *filep,
struct cifs_tcon *tcon,
__u16 compression_state)
{
struct inode *inode = file_inode(filep);
struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
struct TCP_Server_Info *server = tcon->ses->server;
struct cifs_open_parms oparms;
struct cifs_open_info_data data = {};
struct cifsFileInfo *tmp_cfile = NULL;
struct cifs_fid fid = {};
const char *full_path;
__u32 oplock = 0;
u64 uniqueid;
void *page;
int rc;
if (!server->ops->open || !server->ops->close ||
!server->ops->query_file_info)
return -EOPNOTSUPP;
if (!(cifs_sb_flags(cifs_sb) & CIFS_MOUNT_SERVER_INUM) ||
cifs_sb->mnt_cifs_serverino_autodisabled)
return -EOPNOTSUPP;
if (d_unhashed(filep->f_path.dentry))
return -ESTALE;
page = alloc_dentry_path();
full_path = build_path_from_dentry(filep->f_path.dentry, page);
if (IS_ERR(full_path)) {
free_dentry_path(page);
return PTR_ERR(full_path);
}
oparms = CIFS_OPARMS(cifs_sb, tcon, full_path, FILE_WRITE_DATA |
FILE_READ_ATTRIBUTES,
FILE_OPEN, 0, ACL_NO_MODE);
oparms.fid = &fid;
rc = server->ops->open(xid, &oparms, &oplock, NULL);
if (rc)
goto out;
tmp_cfile = kzalloc_obj(*tmp_cfile);
if (!tmp_cfile) {
rc = -ENOMEM;
goto close;
}
tmp_cfile->fid = fid;
rc = server->ops->query_file_info(xid, tcon, tmp_cfile, &data);
if (rc)
goto close;
uniqueid = le64_to_cpu(data.fi.IndexNumber);
if (uniqueid != CIFS_I(inode)->uniqueid) {
rc = -ESTALE;
goto close;
}
rc = server->ops->set_compression(xid, tcon, tmp_cfile,
compression_state);
close:
server->ops->close(xid, tcon, &fid);
if (tmp_cfile)
kfree(tmp_cfile);
cifs_free_open_info(&data);
out:
Annotation
- Immediate include surface: `linux/fs.h`, `linux/file.h`, `linux/mount.h`, `linux/mm.h`, `linux/pagemap.h`, `cifsglob.h`, `cifsproto.h`, `cifs_debug.h`.
- Detected declarations: `function Copyright`, `function cifs_set_compression_by_path`, `function cifs_ioctl_set_compression`, `function cifs_ioctl_copychunk`, `function smb_mnt_get_tcon_info`, `function smb_mnt_get_fsinfo`, `function cifs_shutdown`, `function cifs_dump_full_key`, `function list_for_each_entry`, `function cifs_ioctl`.
- Atlas domain: Core OS / VFS And Filesystem Core.
- Implementation status: source implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
- 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.