Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
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
13struct file_lock;
14struct nfs_fh;
15struct svc_rqst;
16struct rpc_task;
17struct rpc_clnt;
18struct super_block;
19
20/*
21 * This is the set of functions for lockd->nfsd communication
22 */
23struct nlmsvc_binding {
24 int (*fopen)(struct svc_rqst *rqstp, struct nfs_fh *f,
25 struct file **filp, int flags);
26 void (*fclose)(struct file *filp);
27};
28
29extern const struct nlmsvc_binding *nlmsvc_ops;
30
31/*
32 * Similar to nfs_client_initdata, but without the NFS-specific
33 * rpc_ops field.
34 */
35struct nlmclnt_initdata {
36 const char *hostname;
37 const struct sockaddr *address;
38 size_t addrlen;
39 unsigned short protocol;
40 u32 nfs_version;
41 int noresvport;
42 struct net *net;
43 const struct nlmclnt_operations *nlmclnt_ops;
44 const struct cred *cred;
45};
46
47/*
48 * Functions exported by the lockd module
49 */
50
51extern struct nlm_host *nlmclnt_init(const struct nlmclnt_initdata *nlm_init);
52extern void nlmclnt_done(struct nlm_host *host);
53extern struct rpc_clnt *nlmclnt_rpc_clnt(struct nlm_host *host);
54extern void nlmclnt_shutdown_rpc_clnt(struct nlm_host *host);
55
56/*
57 * NLM client operations provide a means to modify RPC processing of NLM
58 * requests. Callbacks receive a pointer to data passed into the call to
59 * nlmclnt_proc().
60 */
61struct nlmclnt_operations {
62 /* Called on successful allocation of nlm_rqst, use for allocation or
63 * reference counting. */
64 void (*nlmclnt_alloc_call)(void *);
65
66 /* Called in rpc_task_prepare for unlock. A return value of true
67 * indicates the callback has put the task to sleep on a waitqueue
68 * and NLM should not call rpc_call_start(). */
69 bool (*nlmclnt_unlock_prepare)(struct rpc_task*, void *);
70
71 /* Called when the nlm_rqst is freed, callbacks should clean up here */
72 void (*nlmclnt_release_call)(void *);
73};
74
75extern int nlmclnt_proc(struct nlm_host *host, int cmd, struct file_lock *fl, void *data);
76extern int lockd_up(struct net *net, const struct cred *cred);
77extern void lockd_down(struct net *net);
78
79/*
80 * Cluster failover support
81 */
82int nlmsvc_unlock_all_by_sb(struct super_block *sb);
83int nlmsvc_unlock_all_by_ip(struct sockaddr *server_addr);
84
85#endif /* LINUX_LOCKD_BIND_H */