xref: /onnv-gate/usr/src/cmd/dfs.cmds/sharemgr/sharemgr.h (revision 5331:3047ad28a67b)
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 /*
233910Sdougm  * Copyright 2007 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,
663034Sdougm 	USAGE_CTL_STATUS
673034Sdougm } sc_usage_t;
683034Sdougm 
693034Sdougm typedef struct sa_command {
703034Sdougm 	char	*cmdname;
713034Sdougm 	int	flags;
723910Sdougm 	int	(*cmdfunc)(sa_handle_t, int, int, char **);
733034Sdougm 	int	cmdidx;
743034Sdougm 	int	priv;	/* requires RBAC authorizations */
753034Sdougm } sa_command_t;
763034Sdougm 
773034Sdougm #define	CMD_ALIAS	0x0001
783034Sdougm #define	CMD_NODISPLAY	0x0002	/* don't display command */
793034Sdougm 
803034Sdougm #define	SVC_AUTH_VALUE	"value_authorization"
813034Sdougm #define	SVC_AUTH_ACTION	"action_authorization"
823034Sdougm #define	SVC_SET		0x01 /* need value permissions */
833034Sdougm #define	SVC_ACTION	0x02 /* need action permissions */
843034Sdougm 
853126Sahl #define	ZFS_SHAREALL	"/usr/sbin/zfs share -a nfs"
863034Sdougm 
873034Sdougm /*
883034Sdougm  * functions/values for manipulating options
893034Sdougm  */
903034Sdougm #define	OPT_ADD_OK		0
913034Sdougm #define	OPT_ADD_SYNTAX		-1
923034Sdougm #define	OPT_ADD_SECURITY	-2
933034Sdougm #define	OPT_ADD_PROPERTY	-3
943034Sdougm #define	OPT_ADD_MEMORY		-4
953034Sdougm 
963034Sdougm /* option list structure */
973034Sdougm struct options {
983034Sdougm 	struct options *next;
993034Sdougm 	char *optname;
1003034Sdougm 	char *optvalue;
1013034Sdougm };
1023034Sdougm 
1033034Sdougm /* general list structure */
1043034Sdougm struct list {
1053034Sdougm 	struct list *next;
1063034Sdougm 	void *item;
1073034Sdougm 	void *itemdata;
108*5331Samw 	char *proto;
1093034Sdougm };
1103034Sdougm 
1113034Sdougm /* shareutil entry points */
1123910Sdougm extern int add_opt(struct options **, char *, int);
1133034Sdougm 
1143034Sdougm 
1153034Sdougm #ifdef	__cplusplus
1163034Sdougm }
1173034Sdougm #endif
1183034Sdougm 
1193034Sdougm #endif /* _SHAREMGR_H */
120