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.

Dependency Surface

Detected Declarations

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

Implementation Notes