xref: /onnv-gate/usr/src/cmd/dfs.cmds/sharemgr/sharemgr.h (revision 3034:3199b356d00f)
1*3034Sdougm /*
2*3034Sdougm  * CDDL HEADER START
3*3034Sdougm  *
4*3034Sdougm  * The contents of this file are subject to the terms of the
5*3034Sdougm  * Common Development and Distribution License (the "License").
6*3034Sdougm  * You may not use this file except in compliance with the License.
7*3034Sdougm  *
8*3034Sdougm  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*3034Sdougm  * or http://www.opensolaris.org/os/licensing.
10*3034Sdougm  * See the License for the specific language governing permissions
11*3034Sdougm  * and limitations under the License.
12*3034Sdougm  *
13*3034Sdougm  * When distributing Covered Code, include this CDDL HEADER in each
14*3034Sdougm  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*3034Sdougm  * If applicable, add the following below this CDDL HEADER, with the
16*3034Sdougm  * fields enclosed by brackets "[]" replaced with your own identifying
17*3034Sdougm  * information: Portions Copyright [yyyy] [name of copyright owner]
18*3034Sdougm  *
19*3034Sdougm  * CDDL HEADER END
20*3034Sdougm  */
21*3034Sdougm 
22*3034Sdougm /*
23*3034Sdougm  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
24*3034Sdougm  * Use is subject to license terms.
25*3034Sdougm  */
26*3034Sdougm 
27*3034Sdougm #ifndef _SHAREMGR_H
28*3034Sdougm #define	_SHAREMGR_H
29*3034Sdougm 
30*3034Sdougm #pragma ident	"%Z%%M%	%I%	%E% SMI"
31*3034Sdougm 
32*3034Sdougm #ifdef	__cplusplus
33*3034Sdougm extern "C" {
34*3034Sdougm #endif
35*3034Sdougm 
36*3034Sdougm /*
37*3034Sdougm  * shareadm internal interfaces
38*3034Sdougm  */
39*3034Sdougm 
40*3034Sdougm typedef enum {
41*3034Sdougm 	USAGE_ADD_SHARE,
42*3034Sdougm 	USAGE_CREATE,
43*3034Sdougm 	USAGE_DELETE,
44*3034Sdougm 	USAGE_DISABLE,
45*3034Sdougm 	USAGE_ENABLE,
46*3034Sdougm 	USAGE_LIST,
47*3034Sdougm 	USAGE_MOVE_SHARE,
48*3034Sdougm 	USAGE_REMOVE_SHARE,
49*3034Sdougm 	USAGE_SET,
50*3034Sdougm 	USAGE_SET_SECURITY,
51*3034Sdougm 	USAGE_SET_SHARE,
52*3034Sdougm 	USAGE_SHOW,
53*3034Sdougm 	USAGE_SHARE,
54*3034Sdougm 	USAGE_START,
55*3034Sdougm 	USAGE_STOP,
56*3034Sdougm 	USAGE_UNSET,
57*3034Sdougm 	USAGE_UNSET_SECURITY,
58*3034Sdougm 	USAGE_UNSHARE
59*3034Sdougm } sa_usage_t;
60*3034Sdougm 
61*3034Sdougm /* sharectl specific usage message values */
62*3034Sdougm typedef enum {
63*3034Sdougm 	USAGE_CTL_GET,
64*3034Sdougm 	USAGE_CTL_SET,
65*3034Sdougm 	USAGE_CTL_STATUS
66*3034Sdougm } sc_usage_t;
67*3034Sdougm 
68*3034Sdougm typedef struct sa_command {
69*3034Sdougm 	char	*cmdname;
70*3034Sdougm 	int	flags;
71*3034Sdougm 	int	(*cmdfunc)(int, int, char **);
72*3034Sdougm 	int	cmdidx;
73*3034Sdougm 	int	priv;	/* requires RBAC authorizations */
74*3034Sdougm } sa_command_t;
75*3034Sdougm 
76*3034Sdougm #define	CMD_ALIAS	0x0001
77*3034Sdougm #define	CMD_NODISPLAY	0x0002	/* don't display command */
78*3034Sdougm 
79*3034Sdougm #define	SVC_AUTH_VALUE	"value_authorization"
80*3034Sdougm #define	SVC_AUTH_ACTION	"action_authorization"
81*3034Sdougm #define	SVC_SET		0x01 /* need value permissions */
82*3034Sdougm #define	SVC_ACTION	0x02 /* need action permissions */
83*3034Sdougm 
84*3034Sdougm #define	ZFS_SHAREALL	"/usr/sbin/zfs share -a"
85*3034Sdougm 
86*3034Sdougm /*
87*3034Sdougm  * functions/values for manipulating options
88*3034Sdougm  */
89*3034Sdougm #define	OPT_ADD_OK		0
90*3034Sdougm #define	OPT_ADD_SYNTAX		-1
91*3034Sdougm #define	OPT_ADD_SECURITY	-2
92*3034Sdougm #define	OPT_ADD_PROPERTY	-3
93*3034Sdougm #define	OPT_ADD_MEMORY		-4
94*3034Sdougm 
95*3034Sdougm /* option list structure */
96*3034Sdougm struct options {
97*3034Sdougm 	struct options *next;
98*3034Sdougm 	char *optname;
99*3034Sdougm 	char *optvalue;
100*3034Sdougm };
101*3034Sdougm 
102*3034Sdougm /* general list structure */
103*3034Sdougm struct list {
104*3034Sdougm 	struct list *next;
105*3034Sdougm 	void *item;
106*3034Sdougm 	void *itemdata;
107*3034Sdougm };
108*3034Sdougm 
109*3034Sdougm /* shareutil entry points */
110*3034Sdougm     extern int add_opt(struct options **, char *, int);
111*3034Sdougm 
112*3034Sdougm 
113*3034Sdougm #ifdef	__cplusplus
114*3034Sdougm }
115*3034Sdougm #endif
116*3034Sdougm 
117*3034Sdougm #endif /* _SHAREMGR_H */
118