xref: /titanic_51/usr/src/cmd/ndmpd/include/ndmpd_door.h (revision 53a7b6b6763f5865522a76e5e887390a8f4777d7)
1 /*
2  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
3  * Use is subject to license terms.
4  */
5 
6 /*
7  * BSD 3 Clause License
8  *
9  * Copyright (c) 2007, The Storage Networking Industry Association.
10  *
11  * Redistribution and use in source and binary forms, with or without
12  * modification, are permitted provided that the following conditions
13  * are met:
14  * 	- Redistributions of source code must retain the above copyright
15  *	  notice, this list of conditions and the following disclaimer.
16  *
17  * 	- Redistributions in binary form must reproduce the above copyright
18  *	  notice, this list of conditions and the following disclaimer in
19  *	  the documentation and/or other materials provided with the
20  *	  distribution.
21  *
22  *	- Neither the name of The Storage Networking Industry Association (SNIA)
23  *	  nor the names of its contributors may be used to endorse or promote
24  *	  products derived from this software without specific prior written
25  *	  permission.
26  *
27  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
28  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
29  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
30  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
31  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
32  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
33  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
34  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
35  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
36  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
37  * POSSIBILITY OF SUCH DAMAGE.
38  */
39 #ifndef	_NDMPD_DOOR_H
40 #define	_NDMPD_DOOR_H
41 
42 #include <rpc/types.h>
43 #include <libndmp.h>
44 #include <atomic.h>
45 
46 #define	NDMP_DOOR_SVC		"/var/run/ndmp_door_svc"
47 #define	NDMP_DOOR_SIZE		(8 * 1024)
48 #define	NDMP_DOOR_SRV_SUCCESS	0
49 #define	NDMP_DOOR_SRV_ERROR	-1
50 
51 #define	NDMP_SESSION_DATA	1
52 #define	NDMP_SESSION_NODATA	0
53 
54 /* DOOR REQUESTS */
55 /* door status message */
56 #define	NDMP_GET_DOOR_STATUS		0
57 
58 /* set subcommand messages */
59 #define	NDMP_SET_DEBUG_LEVEL		1
60 #define	NDMP_SET_DEBUG_PATH		2
61 #define	NDMP_SET_DUMP_PATHNODE		3
62 #define	NDMP_SET_TAR_PATHNODE		4
63 #define	NDMP_SET_IGNOR_CTIME		5
64 #define	NDMP_SET_MAXSEQ			6
65 #define	NDMP_SET_VERSION		7
66 #define	NDMP_SET_DAR			8
67 #define	NDMP_SET_BACKUP_QTN		9
68 #define	NDMP_SET_RESTORE_QTN		10
69 #define	NDMP_SET_OVERWRITE_QTN		11
70 
71 /* get subcommand messages */
72 #define	NDMP_GET_DEBUG_LEVEL		20
73 #define	NDMP_GET_DEBUG_PATH		21
74 #define	NDMP_GET_DUMP_PATHNODE		22
75 #define	NDMP_GET_TAR_PATHNODE		23
76 #define	NDMP_GET_IGNOR_CTIME		24
77 #define	NDMP_GET_MAXSEQ			25
78 #define	NDMP_GET_VERSION		26
79 #define	NDMP_GET_DAR			27
80 #define	NDMP_GET_BACKUP_QTN		28
81 #define	NDMP_GET_RESTORE_QTN		29
82 #define	NDMP_GET_OVERWRITE_QTN		30
83 #define	NDMP_GET_ALL			31
84 #define	NDMP_GET_DEV_CNT		32
85 
86 /* ndmpstat messages */
87 #define	NDMP_GET_STAT			33
88 
89 /* device subcommand message */
90 #define	NDMP_DEVICES_GET_INFO		40
91 
92 /* show subcommand messages */
93 #define	NDMP_SHOW			60
94 
95 /* terminate subcommand messages */
96 #define	NDMP_TERMINATE_SESSION_ID	80
97 #define	NDMP_TERMINATE_SESSION_ALL	81
98 
99 /*
100  * NDMP statistics
101  */
102 extern ndmp_stat_t	ndstat;
103 #define	NS_INC(s)	(atomic_inc_32((volatile uint32_t *)&ndstat.ns_##s))
104 #define	NS_DEC(s)	(atomic_dec_32((volatile uint32_t *)&ndstat.ns_##s))
105 #define	NS_ADD(s, d)	(atomic_add_64((volatile uint64_t *)&ndstat.ns_##s, \
106 	(uint64_t)d))
107 #define	NS_UPD(s, t)	{ \
108 	atomic_inc_32((volatile uint32_t *)&ndstat.ns_##s); \
109 	atomic_dec_32((volatile uint32_t *)&ndstat.ns_##t); \
110 	}
111 #endif /* _NDMPD_DOOR_H */
112