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