Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * linux/include/linux/lockd/bind.h
0004  *
0005  * This is the part of lockd visible to nfsd and the nfs client.
0006  *
0007  * Copyright (C) 1996, Olaf Kirch <okir@monad.swb.de>
0008  */
0009 
0010 #ifndef LINUX_LOCKD_BIND_H
0011 #define LINUX_LOCKD_BIND_H
0012 
0013 #include <linux/lockd/nlm.h>
0014 /* need xdr-encoded error codes too, so... */
0015 #include <linux/lockd/xdr.h>
0016 #ifdef CONFIG_LOCKD_V4
0017 #include <linux/lockd/xdr4.h>
0018 #endif
0019 
0020 /* Dummy declarations */
0021 struct svc_rqst;
0022 struct rpc_task;
0023 
0024 /*
0025  * This is the set of functions for lockd->nfsd communication
0026  */
0027 struct nlmsvc_binding {
0028     __be32          (*fopen)(struct svc_rqst *,
0029                         struct nfs_fh *,
0030                         struct file **,
0031                         int mode);
0032     void            (*fclose)(struct file *);
0033 };
0034 
0035 extern const struct nlmsvc_binding *nlmsvc_ops;
0036 
0037 /*
0038  * Similar to nfs_client_initdata, but without the NFS-specific
0039  * rpc_ops field.
0040  */
0041 struct nlmclnt_initdata {
0042     const char      *hostname;
0043     const struct sockaddr   *address;
0044     size_t          addrlen;
0045     unsigned short      protocol;
0046     u32         nfs_version;
0047     int         noresvport;
0048     struct net      *net;
0049     const struct nlmclnt_operations *nlmclnt_ops;
0050     const struct cred   *cred;
0051 };
0052 
0053 /*
0054  * Functions exported by the lockd module
0055  */
0056 
0057 extern struct nlm_host *nlmclnt_init(const struct nlmclnt_initdata *nlm_init);
0058 extern void nlmclnt_done(struct nlm_host *host);
0059 
0060 /*
0061  * NLM client operations provide a means to modify RPC processing of NLM
0062  * requests.  Callbacks receive a pointer to data passed into the call to
0063  * nlmclnt_proc().
0064  */
0065 struct nlmclnt_operations {
0066     /* Called on successful allocation of nlm_rqst, use for allocation or
0067      * reference counting. */
0068     void (*nlmclnt_alloc_call)(void *);
0069 
0070     /* Called in rpc_task_prepare for unlock.  A return value of true
0071      * indicates the callback has put the task to sleep on a waitqueue
0072      * and NLM should not call rpc_call_start(). */
0073     bool (*nlmclnt_unlock_prepare)(struct rpc_task*, void *);
0074 
0075     /* Called when the nlm_rqst is freed, callbacks should clean up here */
0076     void (*nlmclnt_release_call)(void *);
0077 };
0078 
0079 extern int  nlmclnt_proc(struct nlm_host *host, int cmd, struct file_lock *fl, void *data);
0080 extern int  lockd_up(struct net *net, const struct cred *cred);
0081 extern void lockd_down(struct net *net);
0082 
0083 #endif /* LINUX_LOCKD_BIND_H */