Blame view
fs/nfsd/lockd.c
1.7 KB
b24413180 License cleanup: ... |
1 |
// SPDX-License-Identifier: GPL-2.0 |
1da177e4c Linux-2.6.12-rc2 |
2 |
/* |
1da177e4c Linux-2.6.12-rc2 |
3 4 5 6 7 8 |
* This file contains all the stubs needed when communicating with lockd. * This level of indirection is necessary so we can run nfsd+lockd without * requiring the nfs client to be compiled in/loaded, and vice versa. * * Copyright (C) 1996, Olaf Kirch <okir@monad.swb.de> */ |
1da177e4c Linux-2.6.12-rc2 |
9 |
#include <linux/file.h> |
1da177e4c Linux-2.6.12-rc2 |
10 |
#include <linux/lockd/bind.h> |
9a74af213 nfsd: Move privat... |
11 |
#include "nfsd.h" |
0a3adadee nfsd: make fs/nfs... |
12 |
#include "vfs.h" |
1da177e4c Linux-2.6.12-rc2 |
13 14 |
#define NFSDDBG_FACILITY NFSDDBG_LOCKD |
cc77b1521 lockd: dont retur... |
15 16 17 18 19 20 21 |
#ifdef CONFIG_LOCKD_V4 #define nlm_stale_fh nlm4_stale_fh #define nlm_failed nlm4_failed #else #define nlm_stale_fh nlm_lck_denied_nolocks #define nlm_failed nlm_lck_denied_nolocks #endif |
1da177e4c Linux-2.6.12-rc2 |
22 23 24 |
/* * Note: we hold the dentry use count while the file is open. */ |
e8c5c045d [PATCH] lockd end... |
25 |
static __be32 |
1da177e4c Linux-2.6.12-rc2 |
26 27 |
nlm_fopen(struct svc_rqst *rqstp, struct nfs_fh *f, struct file **filp) { |
c7afef1f9 [PATCH] nfsd: mis... |
28 |
__be32 nfserr; |
1da177e4c Linux-2.6.12-rc2 |
29 30 31 32 33 34 35 |
struct svc_fh fh; /* must initialize before using! but maxsize doesn't matter */ fh_init(&fh,0); fh.fh_handle.fh_size = f->size; memcpy((char*)&fh.fh_handle.fh_base, f->data, f->size); fh.fh_export = NULL; |
8837abcab nfsd: rename MAY_... |
36 |
nfserr = nfsd_open(rqstp, &fh, S_IFREG, NFSD_MAY_LOCK, filp); |
1da177e4c Linux-2.6.12-rc2 |
37 |
fh_put(&fh); |
d343fce14 [PATCH] knfsd: Al... |
38 39 |
/* We return nlm error codes as nlm doesn't know * about nfsd, but nfsd does know about nlm.. |
1da177e4c Linux-2.6.12-rc2 |
40 41 42 43 |
*/ switch (nfserr) { case nfs_ok: return 0; |
d343fce14 [PATCH] knfsd: Al... |
44 45 |
case nfserr_dropit: return nlm_drop_reply; |
1da177e4c Linux-2.6.12-rc2 |
46 |
case nfserr_stale: |
cc77b1521 lockd: dont retur... |
47 |
return nlm_stale_fh; |
1da177e4c Linux-2.6.12-rc2 |
48 |
default: |
cc77b1521 lockd: dont retur... |
49 |
return nlm_failed; |
1da177e4c Linux-2.6.12-rc2 |
50 51 52 53 54 55 56 57 |
} } static void nlm_fclose(struct file *filp) { fput(filp); } |
2a297450d lockd: constify n... |
58 |
static const struct nlmsvc_binding nfsd_nlm_ops = { |
1da177e4c Linux-2.6.12-rc2 |
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
.fopen = nlm_fopen, /* open file for locking */ .fclose = nlm_fclose, /* close file */ }; void nfsd_lockd_init(void) { dprintk("nfsd: initializing lockd "); nlmsvc_ops = &nfsd_nlm_ops; } void nfsd_lockd_shutdown(void) { nlmsvc_ops = NULL; } |