]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - include/linux/lockd/bind.h
License cleanup: add SPDX GPL-2.0 license identifier to files with no license
[mirror_ubuntu-bionic-kernel.git] / include / linux / lockd / bind.h
CommitLineData
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 */
21struct svc_rqst;
b1ece737 22struct rpc_task;
1da177e4
LT
23
24/*
25 * This is the set of functions for lockd->nfsd communication
26 */
27struct nlmsvc_binding {
e8c5c045 28 __be32 (*fopen)(struct svc_rqst *,
1da177e4
LT
29 struct nfs_fh *,
30 struct file **);
31 void (*fclose)(struct file *);
32};
33
2a297450 34extern const struct nlmsvc_binding *nlmsvc_ops;
1da177e4 35
883bb163
CL
36/*
37 * Similar to nfs_client_initdata, but without the NFS-specific
38 * rpc_ops field.
39 */
40struct nlmclnt_initdata {
41 const char *hostname;
42 const struct sockaddr *address;
43 size_t addrlen;
44 unsigned short protocol;
45 u32 nfs_version;
0cb2659b 46 int noresvport;
66697bfd 47 struct net *net;
b1ece737 48 const struct nlmclnt_operations *nlmclnt_ops;
883bb163
CL
49};
50
1da177e4
LT
51/*
52 * Functions exported by the lockd module
53 */
883bb163
CL
54
55extern struct nlm_host *nlmclnt_init(const struct nlmclnt_initdata *nlm_init);
52c4044d
CL
56extern void nlmclnt_done(struct nlm_host *host);
57
b1ece737
BC
58/*
59 * NLM client operations provide a means to modify RPC processing of NLM
60 * requests. Callbacks receive a pointer to data passed into the call to
61 * nlmclnt_proc().
62 */
63struct nlmclnt_operations {
64 /* Called on successful allocation of nlm_rqst, use for allocation or
65 * reference counting. */
66 void (*nlmclnt_alloc_call)(void *);
67
68 /* Called in rpc_task_prepare for unlock. A return value of true
69 * indicates the callback has put the task to sleep on a waitqueue
70 * and NLM should not call rpc_call_start(). */
71 bool (*nlmclnt_unlock_prepare)(struct rpc_task*, void *);
72
73 /* Called when the nlm_rqst is freed, callbacks should clean up here */
74 void (*nlmclnt_release_call)(void *);
75};
76
77extern int nlmclnt_proc(struct nlm_host *host, int cmd, struct file_lock *fl, void *data);
e3f70ead
SK
78extern int lockd_up(struct net *net);
79extern void lockd_down(struct net *net);
1da177e4
LT
80
81#endif /* LINUX_LOCKD_BIND_H */