Commit | Line | Data |
---|---|---|
b2441318 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
1da177e4 LT |
2 | /* |
3 | * linux/include/linux/lockd/bind.h | |
4 | * | |
5 | * This is the part of lockd visible to nfsd and the nfs client. | |
6 | * | |
7 | * Copyright (C) 1996, Olaf Kirch <okir@monad.swb.de> | |
8 | */ | |
9 | ||
10 | #ifndef LINUX_LOCKD_BIND_H | |
11 | #define LINUX_LOCKD_BIND_H | |
12 | ||
13 | #include <linux/lockd/nlm.h> | |
d343fce1 N |
14 | /* need xdr-encoded error codes too, so... */ |
15 | #include <linux/lockd/xdr.h> | |
16 | #ifdef CONFIG_LOCKD_V4 | |
17 | #include <linux/lockd/xdr4.h> | |
18 | #endif | |
1da177e4 LT |
19 | |
20 | /* Dummy declarations */ | |
21 | struct svc_rqst; | |
b1ece737 | 22 | struct rpc_task; |
d97c0589 | 23 | struct rpc_clnt; |
1da177e4 LT |
24 | |
25 | /* | |
26 | * This is the set of functions for lockd->nfsd communication | |
27 | */ | |
28 | struct nlmsvc_binding { | |
e8c5c045 | 29 | __be32 (*fopen)(struct svc_rqst *, |
1da177e4 | 30 | struct nfs_fh *, |
7f024fcd BF |
31 | struct file **, |
32 | int mode); | |
1da177e4 LT |
33 | void (*fclose)(struct file *); |
34 | }; | |
35 | ||
2a297450 | 36 | extern const struct nlmsvc_binding *nlmsvc_ops; |
1da177e4 | 37 | |
883bb163 CL |
38 | /* |
39 | * Similar to nfs_client_initdata, but without the NFS-specific | |
40 | * rpc_ops field. | |
41 | */ | |
42 | struct nlmclnt_initdata { | |
43 | const char *hostname; | |
44 | const struct sockaddr *address; | |
45 | size_t addrlen; | |
46 | unsigned short protocol; | |
47 | u32 nfs_version; | |
0cb2659b | 48 | int noresvport; |
66697bfd | 49 | struct net *net; |
b1ece737 | 50 | const struct nlmclnt_operations *nlmclnt_ops; |
40373b12 | 51 | const struct cred *cred; |
883bb163 CL |
52 | }; |
53 | ||
1da177e4 LT |
54 | /* |
55 | * Functions exported by the lockd module | |
56 | */ | |
883bb163 CL |
57 | |
58 | extern struct nlm_host *nlmclnt_init(const struct nlmclnt_initdata *nlm_init); | |
52c4044d | 59 | extern void nlmclnt_done(struct nlm_host *host); |
d97c0589 | 60 | extern struct rpc_clnt *nlmclnt_rpc_clnt(struct nlm_host *host); |
52c4044d | 61 | |
b1ece737 BC |
62 | /* |
63 | * NLM client operations provide a means to modify RPC processing of NLM | |
64 | * requests. Callbacks receive a pointer to data passed into the call to | |
65 | * nlmclnt_proc(). | |
66 | */ | |
67 | struct nlmclnt_operations { | |
68 | /* Called on successful allocation of nlm_rqst, use for allocation or | |
69 | * reference counting. */ | |
70 | void (*nlmclnt_alloc_call)(void *); | |
71 | ||
72 | /* Called in rpc_task_prepare for unlock. A return value of true | |
73 | * indicates the callback has put the task to sleep on a waitqueue | |
74 | * and NLM should not call rpc_call_start(). */ | |
75 | bool (*nlmclnt_unlock_prepare)(struct rpc_task*, void *); | |
76 | ||
77 | /* Called when the nlm_rqst is freed, callbacks should clean up here */ | |
78 | void (*nlmclnt_release_call)(void *); | |
79 | }; | |
80 | ||
81 | extern int nlmclnt_proc(struct nlm_host *host, int cmd, struct file_lock *fl, void *data); | |
40373b12 | 82 | extern int lockd_up(struct net *net, const struct cred *cred); |
e3f70ead | 83 | extern void lockd_down(struct net *net); |
1da177e4 LT |
84 | |
85 | #endif /* LINUX_LOCKD_BIND_H */ |