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 2006 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 36 /* 37 * shareadm internal interfaces 38 */ 39 40 typedef enum { 41 USAGE_ADD_SHARE, 42 USAGE_CREATE, 43 USAGE_DELETE, 44 USAGE_DISABLE, 45 USAGE_ENABLE, 46 USAGE_LIST, 47 USAGE_MOVE_SHARE, 48 USAGE_REMOVE_SHARE, 49 USAGE_SET, 50 USAGE_SET_SECURITY, 51 USAGE_SET_SHARE, 52 USAGE_SHOW, 53 USAGE_SHARE, 54 USAGE_START, 55 USAGE_STOP, 56 USAGE_UNSET, 57 USAGE_UNSET_SECURITY, 58 USAGE_UNSHARE 59 } sa_usage_t; 60 61 /* sharectl specific usage message values */ 62 typedef enum { 63 USAGE_CTL_GET, 64 USAGE_CTL_SET, 65 USAGE_CTL_STATUS 66 } sc_usage_t; 67 68 typedef struct sa_command { 69 char *cmdname; 70 int flags; 71 int (*cmdfunc)(int, int, char **); 72 int cmdidx; 73 int priv; /* requires RBAC authorizations */ 74 } sa_command_t; 75 76 #define CMD_ALIAS 0x0001 77 #define CMD_NODISPLAY 0x0002 /* don't display command */ 78 79 #define SVC_AUTH_VALUE "value_authorization" 80 #define SVC_AUTH_ACTION "action_authorization" 81 #define SVC_SET 0x01 /* need value permissions */ 82 #define SVC_ACTION 0x02 /* need action permissions */ 83 84 #define ZFS_SHAREALL "/usr/sbin/zfs share -a nfs" 85 86 /* 87 * functions/values for manipulating options 88 */ 89 #define OPT_ADD_OK 0 90 #define OPT_ADD_SYNTAX -1 91 #define OPT_ADD_SECURITY -2 92 #define OPT_ADD_PROPERTY -3 93 #define OPT_ADD_MEMORY -4 94 95 /* option list structure */ 96 struct options { 97 struct options *next; 98 char *optname; 99 char *optvalue; 100 }; 101 102 /* general list structure */ 103 struct list { 104 struct list *next; 105 void *item; 106 void *itemdata; 107 }; 108 109 /* shareutil entry points */ 110 extern int add_opt(struct options **, char *, int); 111 112 113 #ifdef __cplusplus 114 } 115 #endif 116 117 #endif /* _SHAREMGR_H */ 118