Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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> |
NeilBrown | d343fce | 2006-10-17 00:10:18 -0700 | [diff] [blame] | 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 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19 | |
| 20 | /* Dummy declarations */ |
| 21 | struct svc_rqst; |
Benjamin Coddington | b1ece73 | 2017-04-11 12:50:11 -0400 | [diff] [blame] | 22 | struct rpc_task; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 23 | |
| 24 | /* |
| 25 | * This is the set of functions for lockd->nfsd communication |
| 26 | */ |
| 27 | struct nlmsvc_binding { |
Al Viro | e8c5c04 | 2006-12-13 00:35:03 -0800 | [diff] [blame] | 28 | __be32 (*fopen)(struct svc_rqst *, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 29 | struct nfs_fh *, |
| 30 | struct file **); |
| 31 | void (*fclose)(struct file *); |
| 32 | }; |
| 33 | |
Julia Lawall | 2a29745 | 2015-12-23 22:25:13 +0100 | [diff] [blame] | 34 | extern const struct nlmsvc_binding *nlmsvc_ops; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 35 | |
| 36 | /* |
Chuck Lever | 883bb16 | 2008-01-15 16:04:20 -0500 | [diff] [blame] | 37 | * Similar to nfs_client_initdata, but without the NFS-specific |
| 38 | * rpc_ops field. |
| 39 | */ |
| 40 | struct nlmclnt_initdata { |
| 41 | const char *hostname; |
| 42 | const struct sockaddr *address; |
| 43 | size_t addrlen; |
| 44 | unsigned short protocol; |
| 45 | u32 nfs_version; |
Chuck Lever | 0cb2659 | 2008-12-23 15:21:38 -0500 | [diff] [blame] | 46 | int noresvport; |
Stanislav Kinsbursky | 66697bf | 2012-01-31 15:08:13 +0400 | [diff] [blame] | 47 | struct net *net; |
Benjamin Coddington | b1ece73 | 2017-04-11 12:50:11 -0400 | [diff] [blame] | 48 | const struct nlmclnt_operations *nlmclnt_ops; |
Chuck Lever | 883bb16 | 2008-01-15 16:04:20 -0500 | [diff] [blame] | 49 | }; |
| 50 | |
| 51 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 52 | * Functions exported by the lockd module |
| 53 | */ |
Chuck Lever | 883bb16 | 2008-01-15 16:04:20 -0500 | [diff] [blame] | 54 | |
| 55 | extern struct nlm_host *nlmclnt_init(const struct nlmclnt_initdata *nlm_init); |
Chuck Lever | 52c4044 | 2008-01-11 17:09:44 -0500 | [diff] [blame] | 56 | extern void nlmclnt_done(struct nlm_host *host); |
| 57 | |
Benjamin Coddington | b1ece73 | 2017-04-11 12:50:11 -0400 | [diff] [blame] | 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 | */ |
| 63 | struct 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 | |
| 77 | extern int nlmclnt_proc(struct nlm_host *host, int cmd, struct file_lock *fl, void *data); |
Stanislav Kinsbursky | e3f70ea | 2012-03-29 18:54:33 +0400 | [diff] [blame] | 78 | extern int lockd_up(struct net *net); |
| 79 | extern void lockd_down(struct net *net); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 80 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 81 | #endif /* LINUX_LOCKD_BIND_H */ |