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