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