xref: /titanic_50/usr/src/cmd/dfs.cmds/sharemgr/sharemgr.h (revision dfb96a4f56fb431b915bc67e5d9d5c8d4f4f6679)
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 2007 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 } sc_usage_t;
68 
69 typedef struct sa_command {
70 	char	*cmdname;
71 	int	flags;
72 	int	(*cmdfunc)(sa_handle_t, int, int, char **);
73 	int	cmdidx;
74 	int	priv;	/* requires RBAC authorizations */
75 } sa_command_t;
76 
77 #define	CMD_ALIAS	0x0001
78 #define	CMD_NODISPLAY	0x0002	/* don't display command */
79 
80 #define	SVC_AUTH_VALUE	"value_authorization"
81 #define	SVC_AUTH_ACTION	"action_authorization"
82 #define	SVC_SET		0x01 /* need value permissions */
83 #define	SVC_ACTION	0x02 /* need action permissions */
84 
85 #define	ZFS_SHAREALL	"/usr/sbin/zfs share -a nfs"
86 
87 /*
88  * functions/values for manipulating options
89  */
90 #define	OPT_ADD_OK		0
91 #define	OPT_ADD_SYNTAX		-1
92 #define	OPT_ADD_SECURITY	-2
93 #define	OPT_ADD_PROPERTY	-3
94 #define	OPT_ADD_MEMORY		-4
95 
96 /* option list structure */
97 struct options {
98 	struct options *next;
99 	char *optname;
100 	char *optvalue;
101 };
102 
103 /* general list structure */
104 struct list {
105 	struct list *next;
106 	void *item;
107 	void *itemdata;
108 };
109 
110 /* shareutil entry points */
111 extern int add_opt(struct options **, char *, int);
112 
113 
114 #ifdef	__cplusplus
115 }
116 #endif
117 
118 #endif /* _SHAREMGR_H */
119