xref: /onnv-gate/usr/src/cmd/dfs.cmds/sharemgr/sharemgr.h (revision 6007:d57e38e8fdd1)
13034Sdougm /*
23034Sdougm  * CDDL HEADER START
33034Sdougm  *
43034Sdougm  * The contents of this file are subject to the terms of the
53034Sdougm  * Common Development and Distribution License (the "License").
63034Sdougm  * You may not use this file except in compliance with the License.
73034Sdougm  *
83034Sdougm  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
93034Sdougm  * or http://www.opensolaris.org/os/licensing.
103034Sdougm  * See the License for the specific language governing permissions
113034Sdougm  * and limitations under the License.
123034Sdougm  *
133034Sdougm  * When distributing Covered Code, include this CDDL HEADER in each
143034Sdougm  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
153034Sdougm  * If applicable, add the following below this CDDL HEADER, with the
163034Sdougm  * fields enclosed by brackets "[]" replaced with your own identifying
173034Sdougm  * information: Portions Copyright [yyyy] [name of copyright owner]
183034Sdougm  *
193034Sdougm  * CDDL HEADER END
203034Sdougm  */
213034Sdougm 
223034Sdougm /*
23*6007Sthurlow  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
243034Sdougm  * Use is subject to license terms.
253034Sdougm  */
263034Sdougm 
273034Sdougm #ifndef _SHAREMGR_H
283034Sdougm #define	_SHAREMGR_H
293034Sdougm 
303034Sdougm #pragma ident	"%Z%%M%	%I%	%E% SMI"
313034Sdougm 
323034Sdougm #ifdef	__cplusplus
333034Sdougm extern "C" {
343034Sdougm #endif
353910Sdougm #include <libshare.h>
363034Sdougm 
373034Sdougm /*
383034Sdougm  * shareadm internal interfaces
393034Sdougm  */
403034Sdougm 
413034Sdougm typedef enum {
423034Sdougm 	USAGE_ADD_SHARE,
433034Sdougm 	USAGE_CREATE,
443034Sdougm 	USAGE_DELETE,
453034Sdougm 	USAGE_DISABLE,
463034Sdougm 	USAGE_ENABLE,
473034Sdougm 	USAGE_LIST,
483034Sdougm 	USAGE_MOVE_SHARE,
493034Sdougm 	USAGE_REMOVE_SHARE,
503034Sdougm 	USAGE_SET,
513034Sdougm 	USAGE_SET_SECURITY,
523034Sdougm 	USAGE_SET_SHARE,
533034Sdougm 	USAGE_SHOW,
543034Sdougm 	USAGE_SHARE,
553034Sdougm 	USAGE_START,
563034Sdougm 	USAGE_STOP,
573034Sdougm 	USAGE_UNSET,
583034Sdougm 	USAGE_UNSET_SECURITY,
593034Sdougm 	USAGE_UNSHARE
603034Sdougm } sa_usage_t;
613034Sdougm 
623034Sdougm /* sharectl specific usage message values */
633034Sdougm typedef enum {
643034Sdougm 	USAGE_CTL_GET,
653034Sdougm 	USAGE_CTL_SET,
66*6007Sthurlow 	USAGE_CTL_STATUS,
67*6007Sthurlow 	USAGE_CTL_DELSECT
683034Sdougm } sc_usage_t;
693034Sdougm 
703034Sdougm typedef struct sa_command {
713034Sdougm 	char	*cmdname;
723034Sdougm 	int	flags;
733910Sdougm 	int	(*cmdfunc)(sa_handle_t, int, int, char **);
743034Sdougm 	int	cmdidx;
753034Sdougm 	int	priv;	/* requires RBAC authorizations */
763034Sdougm } sa_command_t;
773034Sdougm 
783034Sdougm #define	CMD_ALIAS	0x0001
793034Sdougm #define	CMD_NODISPLAY	0x0002	/* don't display command */
803034Sdougm 
813034Sdougm #define	SVC_AUTH_VALUE	"value_authorization"
823034Sdougm #define	SVC_AUTH_ACTION	"action_authorization"
833034Sdougm #define	SVC_SET		0x01 /* need value permissions */
843034Sdougm #define	SVC_ACTION	0x02 /* need action permissions */
853034Sdougm 
863126Sahl #define	ZFS_SHAREALL	"/usr/sbin/zfs share -a nfs"
873034Sdougm 
883034Sdougm /*
893034Sdougm  * functions/values for manipulating options
903034Sdougm  */
913034Sdougm #define	OPT_ADD_OK		0
923034Sdougm #define	OPT_ADD_SYNTAX		-1
933034Sdougm #define	OPT_ADD_SECURITY	-2
943034Sdougm #define	OPT_ADD_PROPERTY	-3
953034Sdougm #define	OPT_ADD_MEMORY		-4
963034Sdougm 
973034Sdougm /* option list structure */
983034Sdougm struct options {
993034Sdougm 	struct options *next;
1003034Sdougm 	char *optname;
1013034Sdougm 	char *optvalue;
1023034Sdougm };
1033034Sdougm 
1043034Sdougm /* general list structure */
1053034Sdougm struct list {
1063034Sdougm 	struct list *next;
1073034Sdougm 	void *item;
1083034Sdougm 	void *itemdata;
1095331Samw 	char *proto;
1103034Sdougm };
1113034Sdougm 
1123034Sdougm /* shareutil entry points */
1133910Sdougm extern int add_opt(struct options **, char *, int);
1143034Sdougm 
1153034Sdougm 
1163034Sdougm #ifdef	__cplusplus
1173034Sdougm }
1183034Sdougm #endif
1193034Sdougm 
1203034Sdougm #endif /* _SHAREMGR_H */
121