xref: /titanic_50/usr/src/cmd/dfs.cmds/sharemgr/sharemgr.h (revision 4bff34e37def8a90f9194d81bc345c52ba20086a)
16185db85Sdougm /*
26185db85Sdougm  * CDDL HEADER START
36185db85Sdougm  *
46185db85Sdougm  * The contents of this file are subject to the terms of the
56185db85Sdougm  * Common Development and Distribution License (the "License").
66185db85Sdougm  * You may not use this file except in compliance with the License.
76185db85Sdougm  *
86185db85Sdougm  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
96185db85Sdougm  * or http://www.opensolaris.org/os/licensing.
106185db85Sdougm  * See the License for the specific language governing permissions
116185db85Sdougm  * and limitations under the License.
126185db85Sdougm  *
136185db85Sdougm  * When distributing Covered Code, include this CDDL HEADER in each
146185db85Sdougm  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
156185db85Sdougm  * If applicable, add the following below this CDDL HEADER, with the
166185db85Sdougm  * fields enclosed by brackets "[]" replaced with your own identifying
176185db85Sdougm  * information: Portions Copyright [yyyy] [name of copyright owner]
186185db85Sdougm  *
196185db85Sdougm  * CDDL HEADER END
206185db85Sdougm  */
216185db85Sdougm 
226185db85Sdougm /*
23*4bff34e3Sthurlow  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
246185db85Sdougm  * Use is subject to license terms.
256185db85Sdougm  */
266185db85Sdougm 
276185db85Sdougm #ifndef _SHAREMGR_H
286185db85Sdougm #define	_SHAREMGR_H
296185db85Sdougm 
306185db85Sdougm #pragma ident	"%Z%%M%	%I%	%E% SMI"
316185db85Sdougm 
326185db85Sdougm #ifdef	__cplusplus
336185db85Sdougm extern "C" {
346185db85Sdougm #endif
35549ec3ffSdougm #include <libshare.h>
366185db85Sdougm 
376185db85Sdougm /*
386185db85Sdougm  * shareadm internal interfaces
396185db85Sdougm  */
406185db85Sdougm 
416185db85Sdougm typedef enum {
426185db85Sdougm 	USAGE_ADD_SHARE,
436185db85Sdougm 	USAGE_CREATE,
446185db85Sdougm 	USAGE_DELETE,
456185db85Sdougm 	USAGE_DISABLE,
466185db85Sdougm 	USAGE_ENABLE,
476185db85Sdougm 	USAGE_LIST,
486185db85Sdougm 	USAGE_MOVE_SHARE,
496185db85Sdougm 	USAGE_REMOVE_SHARE,
506185db85Sdougm 	USAGE_SET,
516185db85Sdougm 	USAGE_SET_SECURITY,
526185db85Sdougm 	USAGE_SET_SHARE,
536185db85Sdougm 	USAGE_SHOW,
546185db85Sdougm 	USAGE_SHARE,
556185db85Sdougm 	USAGE_START,
566185db85Sdougm 	USAGE_STOP,
576185db85Sdougm 	USAGE_UNSET,
586185db85Sdougm 	USAGE_UNSET_SECURITY,
596185db85Sdougm 	USAGE_UNSHARE
606185db85Sdougm } sa_usage_t;
616185db85Sdougm 
626185db85Sdougm /* sharectl specific usage message values */
636185db85Sdougm typedef enum {
646185db85Sdougm 	USAGE_CTL_GET,
656185db85Sdougm 	USAGE_CTL_SET,
66*4bff34e3Sthurlow 	USAGE_CTL_STATUS,
67*4bff34e3Sthurlow 	USAGE_CTL_DELSECT
686185db85Sdougm } sc_usage_t;
696185db85Sdougm 
706185db85Sdougm typedef struct sa_command {
716185db85Sdougm 	char	*cmdname;
726185db85Sdougm 	int	flags;
73549ec3ffSdougm 	int	(*cmdfunc)(sa_handle_t, int, int, char **);
746185db85Sdougm 	int	cmdidx;
756185db85Sdougm 	int	priv;	/* requires RBAC authorizations */
766185db85Sdougm } sa_command_t;
776185db85Sdougm 
786185db85Sdougm #define	CMD_ALIAS	0x0001
796185db85Sdougm #define	CMD_NODISPLAY	0x0002	/* don't display command */
806185db85Sdougm 
816185db85Sdougm #define	SVC_AUTH_VALUE	"value_authorization"
826185db85Sdougm #define	SVC_AUTH_ACTION	"action_authorization"
836185db85Sdougm #define	SVC_SET		0x01 /* need value permissions */
846185db85Sdougm #define	SVC_ACTION	0x02 /* need action permissions */
856185db85Sdougm 
86f3861e1aSahl #define	ZFS_SHAREALL	"/usr/sbin/zfs share -a nfs"
876185db85Sdougm 
886185db85Sdougm /*
896185db85Sdougm  * functions/values for manipulating options
906185db85Sdougm  */
916185db85Sdougm #define	OPT_ADD_OK		0
926185db85Sdougm #define	OPT_ADD_SYNTAX		-1
936185db85Sdougm #define	OPT_ADD_SECURITY	-2
946185db85Sdougm #define	OPT_ADD_PROPERTY	-3
956185db85Sdougm #define	OPT_ADD_MEMORY		-4
966185db85Sdougm 
976185db85Sdougm /* option list structure */
986185db85Sdougm struct options {
996185db85Sdougm 	struct options *next;
1006185db85Sdougm 	char *optname;
1016185db85Sdougm 	char *optvalue;
1026185db85Sdougm };
1036185db85Sdougm 
1046185db85Sdougm /* general list structure */
1056185db85Sdougm struct list {
1066185db85Sdougm 	struct list *next;
1076185db85Sdougm 	void *item;
1086185db85Sdougm 	void *itemdata;
109da6c28aaSamw 	char *proto;
1106185db85Sdougm };
1116185db85Sdougm 
1126185db85Sdougm /* shareutil entry points */
1136185db85Sdougm extern int add_opt(struct options **, char *, int);
1146185db85Sdougm 
1156185db85Sdougm 
1166185db85Sdougm #ifdef	__cplusplus
1176185db85Sdougm }
1186185db85Sdougm #endif
1196185db85Sdougm 
1206185db85Sdougm #endif /* _SHAREMGR_H */
121