1 /* SPDX-License-Identifier: GPL-2.0 */
3 * linux/include/linux/lockd/bind.h
5 * This is the part of lockd visible to nfsd and the nfs client.
7 * Copyright (C) 1996, Olaf Kirch <okir@monad.swb.de>
10 #ifndef LINUX_LOCKD_BIND_H
11 #define LINUX_LOCKD_BIND_H
13 #include <linux/lockd/nlm.h>
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>
20 /* Dummy declarations */
26 * This is the set of functions for lockd->nfsd communication
28 struct nlmsvc_binding
{
29 __be32 (*fopen
)(struct svc_rqst
*,
33 void (*fclose
)(struct file
*);
36 extern const struct nlmsvc_binding
*nlmsvc_ops
;
39 * Similar to nfs_client_initdata, but without the NFS-specific
42 struct nlmclnt_initdata
{
44 const struct sockaddr
*address
;
46 unsigned short protocol
;
50 const struct nlmclnt_operations
*nlmclnt_ops
;
51 const struct cred
*cred
;
55 * Functions exported by the lockd module
58 extern struct nlm_host
*nlmclnt_init(const struct nlmclnt_initdata
*nlm_init
);
59 extern void nlmclnt_done(struct nlm_host
*host
);
60 extern struct rpc_clnt
*nlmclnt_rpc_clnt(struct nlm_host
*host
);
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
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 *);
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 *);
77 /* Called when the nlm_rqst is freed, callbacks should clean up here */
78 void (*nlmclnt_release_call
)(void *);
81 extern int nlmclnt_proc(struct nlm_host
*host
, int cmd
, struct file_lock
*fl
, void *data
);
82 extern int lockd_up(struct net
*net
, const struct cred
*cred
);
83 extern void lockd_down(struct net
*net
);
85 #endif /* LINUX_LOCKD_BIND_H */