fs/smb/client/cifsproto.h

Source file repositories/reference/linux-study-clean/fs/smb/client/cifsproto.h

File Facts

System
Linux kernel
Corpus path
fs/smb/client/cifsproto.h
Extension
.h
Size
23201 bytes
Lines
616
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 (*s1 == '/' || *s1 == '\\') {
			if (*s2 != '/' && *s2 != '\\')
				return false;
		} else if (tolower(*s1) != tolower(*s2))
			return false;
	}
	return true;
}

static inline void smb_get_mid(struct mid_q_entry *mid)
{
	refcount_inc(&mid->refcount);
}

static inline void release_mid(struct TCP_Server_Info *server, struct mid_q_entry *mid)
{
	if (refcount_dec_and_test(&mid->refcount))
		__release_mid(server, mid);
}

static inline void cifs_free_open_info(struct cifs_open_info_data *data)
{
	kfree(data->symlink_target);
	free_rsp_buf(data->reparse.io.buftype, data->reparse.io.iov.iov_base);
	memset(data, 0, sizeof(*data));
}

static inline int smb_EIO(enum smb_eio_trace trace)
{
	trace_smb3_eio(trace, 0, 0);
	return -EIO;
}

static inline int smb_EIO1(enum smb_eio_trace trace, unsigned long info)
{
	trace_smb3_eio(trace, info, 0);
	return -EIO;
}

static inline int smb_EIO2(enum smb_eio_trace trace, unsigned long info, unsigned long info2)
{
	trace_smb3_eio(trace, info, info2);
	return -EIO;
}

static inline int cifs_get_num_sgs(const struct smb_rqst *rqst,
				   int num_rqst,
				   const u8 *sig)
{
	unsigned int len, skip;
	unsigned int nents = 0;
	unsigned long addr;
	size_t data_size;
	int i, j;

	/*
	 * The first rqst has a transform header where the first 20 bytes are
	 * not part of the encrypted blob.
	 */
	skip = 20;

	/* Assumes the first rqst has a transform header as the first iov.
	 * I.e.
	 * rqst[0].rq_iov[0]  is transform header
	 * rqst[0].rq_iov[1+] data to be encrypted/decrypted
	 * rqst[1+].rq_iov[0+] data to be encrypted/decrypted
	 */
	for (i = 0; i < num_rqst; i++) {
		data_size = iov_iter_count(&rqst[i].rq_iter);

		/* We really don't want a mixture of pinned and unpinned pages
		 * in the sglist.  It's hard to keep track of which is what.
		 * Instead, we convert to a BVEC-type iterator higher up.
		 */
		if (data_size &&
		    WARN_ON_ONCE(user_backed_iter(&rqst[i].rq_iter)))
			return smb_EIO(smb_eio_trace_user_iter);

		/* We also don't want to have any extra refs or pins to clean
		 * up in the sglist.
		 */
		if (data_size &&
		    WARN_ON_ONCE(iov_iter_extract_will_pin(&rqst[i].rq_iter)))
			return smb_EIO(smb_eio_trace_extract_will_pin);

		for (j = 0; j < rqst[i].rq_nvec; j++) {
			struct kvec *iov = &rqst[i].rq_iov[j];

			addr = (unsigned long)iov->iov_base + skip;
			if (is_vmalloc_or_module_addr((void *)addr)) {

Annotation

Implementation Notes