fs/lockd/svc4proc.c

Source file repositories/reference/linux-study-clean/fs/lockd/svc4proc.c

File Facts

System
Linux kernel
Corpus path
fs/lockd/svc4proc.c
Extension
.c
Size
41063 bytes
Lines
1434
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

struct nlm4_testargs_wrapper {
	struct nlm4_testargs		xdrgen;
	struct lockd_lock		lock;
};

static_assert(offsetof(struct nlm4_testargs_wrapper, xdrgen) == 0);

struct nlm4_lockargs_wrapper {
	struct nlm4_lockargs		xdrgen;
	struct lockd_cookie		cookie;
	struct lockd_lock		lock;
};

static_assert(offsetof(struct nlm4_lockargs_wrapper, xdrgen) == 0);

struct nlm4_cancargs_wrapper {
	struct nlm4_cancargs		xdrgen;
	struct lockd_lock		lock;
};

static_assert(offsetof(struct nlm4_cancargs_wrapper, xdrgen) == 0);

struct nlm4_unlockargs_wrapper {
	struct nlm4_unlockargs		xdrgen;
	struct lockd_lock		lock;
};

static_assert(offsetof(struct nlm4_unlockargs_wrapper, xdrgen) == 0);

struct nlm4_notifyargs_wrapper {
	struct nlm4_notifyargs		xdrgen;
	struct lockd_reboot		reboot;
};

static_assert(offsetof(struct nlm4_notifyargs_wrapper, xdrgen) == 0);

struct nlm4_notify_wrapper {
	struct nlm4_notify		xdrgen;
};

static_assert(offsetof(struct nlm4_notify_wrapper, xdrgen) == 0);

struct nlm4_testres_wrapper {
	struct nlm4_testres		xdrgen;
	struct lockd_lock		lock;
};

struct nlm4_shareargs_wrapper {
	struct nlm4_shareargs		xdrgen;
	struct lockd_lock		lock;
};

static_assert(offsetof(struct nlm4_shareargs_wrapper, xdrgen) == 0);

static_assert(offsetof(struct nlm4_testres_wrapper, xdrgen) == 0);

struct nlm4_res_wrapper {
	struct nlm4_res			xdrgen;
	struct lockd_cookie		cookie;
};

static_assert(offsetof(struct nlm4_res_wrapper, xdrgen) == 0);

struct nlm4_shareres_wrapper {
	struct nlm4_shareres		xdrgen;
};

static_assert(offsetof(struct nlm4_shareres_wrapper, xdrgen) == 0);

static __be32
nlm4_netobj_to_cookie(struct lockd_cookie *cookie, netobj *object)
{
	if (object->len > NLM_MAXCOOKIELEN)
		return nlm_lck_denied_nolocks;
	cookie->len = object->len;
	memcpy(cookie->data, object->data, object->len);
	return nlm_granted;
}

static __be32
nlm4_lock_to_lockd_lock(struct lockd_lock *lock, struct nlm4_lock *alock)
{
	if (alock->fh.len > NFS_MAXFHSIZE)
		return nlm_lck_denied;
	lock->fh.size = alock->fh.len;
	memcpy(lock->fh.data, alock->fh.data, alock->fh.len);
	lock->oh.len = alock->oh.len;
	lock->oh.data = alock->oh.data;
	lock->svid = alock->svid;
	lockd_set_file_lock_range4(&lock->fl, alock->l_offset, alock->l_len);

Annotation

Implementation Notes