xref: /onnv-gate/usr/src/cmd/dfs.cmds/sharemgr/sharemgr.h (revision 3126:4f4fb617fdd0)
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 /*
233034Sdougm  * Copyright 2006 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
353034Sdougm 
363034Sdougm /*
373034Sdougm  * shareadm internal interfaces
383034Sdougm  */
393034Sdougm 
403034Sdougm typedef enum {
413034Sdougm 	USAGE_ADD_SHARE,
423034Sdougm 	USAGE_CREATE,
433034Sdougm 	USAGE_DELETE,
443034Sdougm 	USAGE_DISABLE,
453034Sdougm 	USAGE_ENABLE,
463034Sdougm 	USAGE_LIST,
473034Sdougm 	USAGE_MOVE_SHARE,
483034Sdougm 	USAGE_REMOVE_SHARE,
493034Sdougm 	USAGE_SET,
503034Sdougm 	USAGE_SET_SECURITY,
513034Sdougm 	USAGE_SET_SHARE,
523034Sdougm 	USAGE_SHOW,
533034Sdougm 	USAGE_SHARE,
543034Sdougm 	USAGE_START,
553034Sdougm 	USAGE_STOP,
563034Sdougm 	USAGE_UNSET,
573034Sdougm 	USAGE_UNSET_SECURITY,
583034Sdougm 	USAGE_UNSHARE
593034Sdougm } sa_usage_t;
603034Sdougm 
613034Sdougm /* sharectl specific usage message values */
623034Sdougm typedef enum {
633034Sdougm 	USAGE_CTL_GET,
643034Sdougm 	USAGE_CTL_SET,
653034Sdougm 	USAGE_CTL_STATUS
663034Sdougm } sc_usage_t;
673034Sdougm 
683034Sdougm typedef struct sa_command {
693034Sdougm 	char	*cmdname;
703034Sdougm 	int	flags;
713034Sdougm 	int	(*cmdfunc)(int, int, char **);
723034Sdougm 	int	cmdidx;
733034Sdougm 	int	priv;	/* requires RBAC authorizations */
743034Sdougm } sa_command_t;
753034Sdougm 
763034Sdougm #define	CMD_ALIAS	0x0001
773034Sdougm #define	CMD_NODISPLAY	0x0002	/* don't display command */
783034Sdougm 
793034Sdougm #define	SVC_AUTH_VALUE	"value_authorization"
803034Sdougm #define	SVC_AUTH_ACTION	"action_authorization"
813034Sdougm #define	SVC_SET		0x01 /* need value permissions */
823034Sdougm #define	SVC_ACTION	0x02 /* need action permissions */
833034Sdougm 
84*3126Sahl #define	ZFS_SHAREALL	"/usr/sbin/zfs share -a nfs"
853034Sdougm 
863034Sdougm /*
873034Sdougm  * functions/values for manipulating options
883034Sdougm  */
893034Sdougm #define	OPT_ADD_OK		0
903034Sdougm #define	OPT_ADD_SYNTAX		-1
913034Sdougm #define	OPT_ADD_SECURITY	-2
923034Sdougm #define	OPT_ADD_PROPERTY	-3
933034Sdougm #define	OPT_ADD_MEMORY		-4
943034Sdougm 
953034Sdougm /* option list structure */
963034Sdougm struct options {
973034Sdougm 	struct options *next;
983034Sdougm 	char *optname;
993034Sdougm 	char *optvalue;
1003034Sdougm };
1013034Sdougm 
1023034Sdougm /* general list structure */
1033034Sdougm struct list {
1043034Sdougm 	struct list *next;
1053034Sdougm 	void *item;
1063034Sdougm 	void *itemdata;
1073034Sdougm };
1083034Sdougm 
1093034Sdougm /* shareutil entry points */
1103034Sdougm     extern int add_opt(struct options **, char *, int);
1113034Sdougm 
1123034Sdougm 
1133034Sdougm #ifdef	__cplusplus
1143034Sdougm }
1153034Sdougm #endif
1163034Sdougm 
1173034Sdougm #endif /* _SHAREMGR_H */
118