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