]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/nlm/nlm.h
This commit was generated by cvs2svn to compensate for changes in r179193,
[FreeBSD/FreeBSD.git] / sys / nlm / nlm.h
1 /*-
2  * Copyright (c) 2008 Isilon Inc http://www.isilon.com/
3  * Authors: Doug Rabson <dfr@rabson.org>
4  * Developed with Red Inc: Alfred Perlstein <alfred@freebsd.org>
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in the
13  *    documentation and/or other materials provided with the distribution.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25  * SUCH DAMAGE.
26  *
27  * $FreeBSD$
28  */
29
30 #ifndef _NLM_NLM_H_
31 #define _NLM_NLM_H_
32
33 #ifdef _KERNEL
34
35 #ifdef _SYS_MALLOC_H_
36 MALLOC_DECLARE(M_NLM);
37 #endif
38
39 struct nlm_host;
40
41 /*
42  * Copy a struct netobj.
43  */ 
44 extern void nlm_copy_netobj(struct netobj *dst, struct netobj *src,
45     struct malloc_type *type);
46
47 /*
48  * Search for an existing NLM host that matches the given name
49  * (typically the caller_name element of an nlm4_lock).  If none is
50  * found, create a new host. If 'rqstp' is non-NULL, record the remote
51  * address of the host so that we can call it back for async
52  * responses.
53  */
54 extern struct nlm_host *nlm_find_host_by_name(const char *name,
55     struct svc_req *rqstp);
56
57 /*
58  * Search for an existing NLM host that matches the given remote
59  * address. If none is found, create a new host with the requested
60  * address and remember 'vers' as the NLM protocol version to use for
61  * that host.
62  */
63 extern struct nlm_host *nlm_find_host_by_addr(const struct sockaddr *addr,
64     int vers);
65
66 /*
67  * Return an RPC client handle that can be used to talk to the NLM
68  * running on the given host.
69  */
70 extern CLIENT *nlm_host_get_rpc(struct nlm_host *host);
71
72 /*
73  * Called when a host restarts.
74  */
75 extern void nlm_sm_notify(nlm_sm_status *argp);
76
77 /*
78  * Implementation for lock testing RPCs. Returns the NLM host that
79  * matches the RPC arguments.
80  */
81 extern struct nlm_host *nlm_do_test(nlm4_testargs *argp,
82     nlm4_testres *result, struct svc_req *rqstp);
83
84 /*
85  * Implementation for lock setting RPCs. Returns the NLM host that
86  * matches the RPC arguments. If monitor is TRUE, set up an NSM
87  * monitor for this host.
88  */
89 extern struct nlm_host *nlm_do_lock(nlm4_lockargs *argp,
90     nlm4_res *result, struct svc_req *rqstp, bool_t monitor); 
91
92 /*
93  * Implementation for cancelling a pending lock request. Returns the
94  * NLM host that matches the RPC arguments.
95  */
96 extern struct nlm_host *nlm_do_cancel(nlm4_cancargs *argp,
97     nlm4_res *result, struct svc_req *rqstp);
98
99 /*
100  * Implementation for unlocking RPCs. Returns the NLM host that
101  * matches the RPC arguments.
102  */
103 extern struct nlm_host *nlm_do_unlock(nlm4_unlockargs *argp,
104     nlm4_res *result, struct svc_req *rqstp);
105
106 /*
107  * Free all locks associated with the hostname argp->name.
108  */
109 extern void nlm_do_free_all(nlm4_notify *argp);
110
111 /*
112  * Find an RPC transport that can be used to communicate with the
113  * userland part of lockd.
114  */
115 extern CLIENT *nlm_user_lockd(void);
116
117 #endif
118
119 #endif