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