1/* SPDX-License-Identifier: GPL-2.0 */
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>
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
19
20/* Dummy declarations */
21struct svc_rqst;
22struct rpc_task;
23struct rpc_clnt;
24
25/*
26 * This is the set of functions for lockd->nfsd communication
27 */
28struct nlmsvc_binding {
29 __be32 (*fopen)(struct svc_rqst *,
30 struct nfs_fh *,
31 struct file **,
32 int mode);
33 void (*fclose)(struct file *);
34};
35
36extern const struct nlmsvc_binding *nlmsvc_ops;
37
38/*
39 * Similar to nfs_client_initdata, but without the NFS-specific
40 * rpc_ops field.
41 */
42struct nlmclnt_initdata {
43 const char *hostname;
44 const struct sockaddr *address;
45 size_t addrlen;
46 unsigned short protocol;
47 u32 nfs_version;
48 int noresvport;
49 struct net *net;
50 const struct nlmclnt_operations *nlmclnt_ops;
51 const struct cred *cred;
52};
53
54/*
55 * Functions exported by the lockd module
56 */
57
58extern struct nlm_host *nlmclnt_init(const struct nlmclnt_initdata *nlm_init);
59extern void nlmclnt_done(struct nlm_host *host);
60extern struct rpc_clnt *nlmclnt_rpc_clnt(struct nlm_host *host);
61
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 */
67struct 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
81extern int nlmclnt_proc(struct nlm_host *host, int cmd, struct file_lock *fl, void *data);
82extern int lockd_up(struct net *net, const struct cred *cred);
83extern void lockd_down(struct net *net);
84
85#endif /* LINUX_LOCKD_BIND_H */
86

source code of linux/include/linux/lockd/bind.h