Print this page
4095 minor cleanup up libshare
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/lib/libshare/common/libshare.h
+++ new/usr/src/lib/libshare/common/libshare.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
↓ open down ↓ |
13 lines elided |
↑ open up ↑ |
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21
22 22 /*
23 23 * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
24 + * Copyright (c) 2013 RackTop Systems.
24 25 */
25 26
26 27 /*
27 28 * basic API declarations for share management
28 29 */
29 30
30 31 #ifndef _LIBSHARE_H
31 32 #define _LIBSHARE_H
32 33
33 34 #ifdef __cplusplus
34 35 extern "C" {
35 36 #endif
36 37
37 38 #include <sys/types.h>
38 39 #include <libnvpair.h>
39 40
40 41 /*
↓ open down ↓ |
7 lines elided |
↑ open up ↑ |
41 42 * Basic datatypes for most functions
42 43 */
43 44 typedef void *sa_group_t;
44 45 typedef void *sa_share_t;
45 46 typedef void *sa_property_t;
46 47 typedef void *sa_optionset_t;
47 48 typedef void *sa_security_t;
48 49 typedef void *sa_protocol_properties_t;
49 50 typedef void *sa_resource_t;
50 51
51 -typedef void *sa_handle_t; /* opaque handle to access core functions */
52 +typedef struct sa_handle *sa_handle_t; /* opaque handle to access core functions */
52 53
53 54 /*
54 55 * defined error values
55 56 */
56 57
57 58 #define SA_OK 0
58 59 #define SA_NO_SUCH_PATH 1 /* provided path doesn't exist */
59 60 #define SA_NO_MEMORY 2 /* no memory for data structures */
60 61 #define SA_DUPLICATE_NAME 3 /* object name is already in use */
61 62 #define SA_BAD_PATH 4 /* not a full path */
62 63 #define SA_NO_SUCH_GROUP 5 /* group is not defined */
63 64 #define SA_CONFIG_ERR 6 /* system configuration error */
64 65 #define SA_SYSTEM_ERR 7 /* system error, use errno */
65 66 #define SA_SYNTAX_ERR 8 /* syntax error on command line */
66 67 #define SA_NO_PERMISSION 9 /* no permission for operation */
67 68 #define SA_BUSY 10 /* resource is busy */
68 69 #define SA_NO_SUCH_PROP 11 /* property doesn't exist */
69 70 #define SA_INVALID_NAME 12 /* name of object is invalid */
70 71 #define SA_INVALID_PROTOCOL 13 /* specified protocol not valid */
71 72 #define SA_NOT_ALLOWED 14 /* operation not allowed */
72 73 #define SA_BAD_VALUE 15 /* bad value for property */
73 74 #define SA_INVALID_SECURITY 16 /* invalid security type */
74 75 #define SA_NO_SUCH_SECURITY 17 /* security set not found */
75 76 #define SA_VALUE_CONFLICT 18 /* property value conflict */
76 77 #define SA_NOT_IMPLEMENTED 19 /* plugin interface not implemented */
77 78 #define SA_INVALID_PATH 20 /* path is sub-dir of existing share */
78 79 #define SA_NOT_SUPPORTED 21 /* operation not supported for proto */
79 80 #define SA_PROP_SHARE_ONLY 22 /* property valid on share only */
80 81 #define SA_NOT_SHARED 23 /* path is not shared */
81 82 #define SA_NO_SUCH_RESOURCE 24 /* resource not found */
82 83 #define SA_RESOURCE_REQUIRED 25 /* resource name is required */
83 84 #define SA_MULTIPLE_ERROR 26 /* multiple protocols reported error */
84 85 #define SA_PATH_IS_SUBDIR 27 /* check_path found path is subdir */
85 86 #define SA_PATH_IS_PARENTDIR 28 /* check_path found path is parent */
86 87 #define SA_NO_SECTION 29 /* protocol requires section info */
87 88 #define SA_NO_SUCH_SECTION 30 /* no section found */
88 89 #define SA_NO_PROPERTIES 31 /* no properties found */
89 90 #define SA_PASSWORD_ENC 32 /* passwords must be encrypted */
90 91 #define SA_SHARE_EXISTS 33 /* path or file is already shared */
91 92
92 93 /* API Initialization */
93 94 #define SA_INIT_SHARE_API 0x0001 /* init share specific interface */
94 95 #define SA_INIT_CONTROL_API 0x0002 /* init control specific interface */
95 96
96 97 /* not part of API returns */
97 98 #define SA_LEGACY_ERR 32 /* share/unshare error return */
98 99
99 100 /*
100 101 * other defined values
101 102 */
102 103
103 104 #define SA_MAX_NAME_LEN 100 /* must fit service instance name */
104 105 #define SA_MAX_RESOURCE_NAME 255 /* Maximum length of resource name */
105 106
106 107 /* Used in calls to sa_add_share() and sa_add_resource() */
107 108 #define SA_SHARE_TRANSIENT 0 /* shared but not across reboot */
108 109 #define SA_SHARE_LEGACY 1 /* share is in dfstab only */
109 110 #define SA_SHARE_PERMANENT 2 /* share goes to repository */
110 111
111 112 /* sa_check_path() related */
112 113 #define SA_CHECK_NORMAL 0 /* only check against active shares */
113 114 #define SA_CHECK_STRICT 1 /* check against all shares */
114 115
115 116 /* RBAC related */
116 117 #define SA_RBAC_MANAGE "solaris.smf.manage.shares"
117 118 #define SA_RBAC_VALUE "solaris.smf.value.shares"
118 119
119 120 /*
120 121 * Feature set bit definitions
121 122 */
122 123
123 124 #define SA_FEATURE_NONE 0x0000 /* no feature flags set */
124 125 #define SA_FEATURE_RESOURCE 0x0001 /* resource names are required */
125 126 #define SA_FEATURE_DFSTAB 0x0002 /* need to manage in dfstab */
126 127 #define SA_FEATURE_ALLOWSUBDIRS 0x0004 /* allow subdirs to be shared */
127 128 #define SA_FEATURE_ALLOWPARDIRS 0x0008 /* allow parent dirs to be shared */
128 129 #define SA_FEATURE_HAS_SECTIONS 0x0010 /* protocol supports sections */
129 130 #define SA_FEATURE_ADD_PROPERTIES 0x0020 /* can add properties */
130 131 #define SA_FEATURE_SERVER 0x0040 /* protocol supports server mode */
131 132
132 133 /*
133 134 * legacy files
134 135 */
135 136
136 137 #define SA_LEGACY_DFSTAB "/etc/dfs/dfstab"
137 138 #define SA_LEGACY_SHARETAB "/etc/dfs/sharetab"
138 139
139 140 /*
140 141 * SMF related
141 142 */
142 143
143 144 #define SA_SVC_FMRI_BASE "svc:/network/shares/group"
144 145
145 146 /* initialization */
146 147 extern sa_handle_t sa_init(int);
147 148 extern void sa_fini(sa_handle_t);
148 149 extern int sa_update_config(sa_handle_t);
149 150 extern char *sa_errorstr(int);
150 151
151 152 /* protocol names */
152 153 extern int sa_get_protocols(char ***);
153 154 extern int sa_valid_protocol(char *);
154 155
155 156 /* group control (create, remove, etc) */
156 157 extern sa_group_t sa_create_group(sa_handle_t, char *, int *);
157 158 extern int sa_remove_group(sa_group_t);
158 159 extern sa_group_t sa_get_group(sa_handle_t, char *);
159 160 extern sa_group_t sa_get_next_group(sa_group_t);
160 161 extern char *sa_get_group_attr(sa_group_t, char *);
161 162 extern int sa_set_group_attr(sa_group_t, char *, char *);
162 163 extern sa_group_t sa_get_sub_group(sa_group_t);
163 164 extern int sa_valid_group_name(char *);
164 165
165 166 /* share control */
166 167 extern sa_share_t sa_add_share(sa_group_t, char *, int, int *);
167 168 extern int sa_check_path(sa_group_t, char *, int);
168 169 extern int sa_move_share(sa_group_t, sa_share_t);
169 170 extern int sa_remove_share(sa_share_t);
↓ open down ↓ |
108 lines elided |
↑ open up ↑ |
170 171 extern sa_share_t sa_get_share(sa_group_t, char *);
171 172 extern sa_share_t sa_find_share(sa_handle_t, char *);
172 173 extern sa_share_t sa_get_next_share(sa_share_t);
173 174 extern char *sa_get_share_attr(sa_share_t, char *);
174 175 extern char *sa_get_share_description(sa_share_t);
175 176 extern sa_group_t sa_get_parent_group(sa_share_t);
176 177 extern int sa_set_share_attr(sa_share_t, char *, char *);
177 178 extern int sa_set_share_description(sa_share_t, char *);
178 179 extern int sa_enable_share(sa_group_t, char *);
179 180 extern int sa_disable_share(sa_share_t, char *);
180 -extern int sa_is_share(void *);
181 +extern boolean_t sa_is_share(void *);
181 182
182 183 /* resource name related */
183 184 extern sa_resource_t sa_find_resource(sa_handle_t, char *);
184 185 extern sa_resource_t sa_get_resource(sa_group_t, char *);
185 186 extern sa_resource_t sa_get_next_resource(sa_resource_t);
186 187 extern sa_share_t sa_get_resource_parent(sa_resource_t);
187 188 extern sa_resource_t sa_get_share_resource(sa_share_t, char *);
188 189 extern sa_resource_t sa_add_resource(sa_share_t, char *, int, int *);
189 190 extern int sa_remove_resource(sa_resource_t);
190 191 extern char *sa_get_resource_attr(sa_resource_t, char *);
191 192 extern int sa_set_resource_attr(sa_resource_t, char *, char *);
192 193 extern int sa_set_resource_description(sa_resource_t, char *);
193 194 extern char *sa_get_resource_description(sa_resource_t);
194 195 extern int sa_enable_resource(sa_resource_t, char *);
195 196 extern int sa_disable_resource(sa_resource_t, char *);
196 197 extern int sa_rename_resource(sa_resource_t, char *);
197 198 extern void sa_fix_resource_name(char *);
198 199
199 200 /* data structure free calls */
200 201 extern void sa_free_attr_string(char *);
201 202 extern void sa_free_share_description(char *);
202 203
203 204 /* optionset control */
204 205 extern sa_optionset_t sa_get_optionset(sa_group_t, char *);
205 206 extern sa_optionset_t sa_get_next_optionset(sa_group_t);
206 207 extern char *sa_get_optionset_attr(sa_optionset_t, char *);
207 208 extern void sa_set_optionset_attr(sa_optionset_t, char *, char *);
208 209 extern sa_optionset_t sa_create_optionset(sa_group_t, char *);
209 210 extern int sa_destroy_optionset(sa_optionset_t);
210 211 extern sa_optionset_t sa_get_derived_optionset(void *, char *, int);
211 212 extern void sa_free_derived_optionset(sa_optionset_t);
212 213
213 214 /* property functions */
214 215 extern sa_property_t sa_get_property(sa_optionset_t, char *);
↓ open down ↓ |
24 lines elided |
↑ open up ↑ |
215 216 extern sa_property_t sa_get_next_property(sa_group_t);
216 217 extern char *sa_get_property_attr(sa_property_t, char *);
217 218 extern sa_property_t sa_create_section(char *, char *);
218 219 extern void sa_set_section_attr(sa_property_t, char *, char *);
219 220 extern sa_property_t sa_create_property(char *, char *);
220 221 extern int sa_add_property(void *, sa_property_t);
221 222 extern int sa_update_property(sa_property_t, char *);
222 223 extern int sa_remove_property(sa_property_t);
223 224 extern int sa_commit_properties(sa_optionset_t, int);
224 225 extern int sa_valid_property(sa_handle_t, void *, char *, sa_property_t);
225 -extern int sa_is_persistent(void *);
226 +extern boolean_t sa_is_persistent(void *);
226 227
227 228 /* security control */
228 229 extern sa_security_t sa_get_security(sa_group_t, char *, char *);
229 230 extern sa_security_t sa_get_next_security(sa_security_t);
230 231 extern char *sa_get_security_attr(sa_optionset_t, char *);
231 232 extern sa_security_t sa_create_security(sa_group_t, char *, char *);
232 233 extern int sa_destroy_security(sa_security_t);
233 234 extern void sa_set_security_attr(sa_security_t, char *, char *);
234 235 extern sa_optionset_t sa_get_all_security_types(void *, char *, int);
235 236 extern sa_security_t sa_get_derived_security(void *, char *, char *, int);
236 237 extern void sa_free_derived_security(sa_security_t);
237 238
238 239 /* protocol specific interfaces */
239 240 extern int sa_parse_legacy_options(sa_group_t, char *, char *);
240 241 extern char *sa_proto_legacy_format(char *, sa_group_t, int);
241 -extern int sa_is_security(char *, char *);
242 +extern boolean_t sa_is_security(char *, char *);
242 243 extern sa_protocol_properties_t sa_proto_get_properties(char *);
243 244 extern uint64_t sa_proto_get_featureset(char *);
244 245 extern sa_property_t sa_get_protocol_section(sa_protocol_properties_t, char *);
245 246 extern sa_property_t sa_get_next_protocol_section(sa_property_t, char *);
246 247 extern sa_property_t sa_get_protocol_property(sa_protocol_properties_t, char *);
247 248 extern sa_property_t sa_get_next_protocol_property(sa_property_t, char *);
248 249 extern int sa_set_protocol_property(sa_property_t, char *, char *);
249 250 extern char *sa_get_protocol_status(char *);
250 251 extern void sa_format_free(char *);
251 252 extern sa_protocol_properties_t sa_create_protocol_properties(char *);
252 253 extern int sa_add_protocol_property(sa_protocol_properties_t, sa_property_t);
253 254 extern int sa_proto_valid_prop(sa_handle_t, char *, sa_property_t,
254 255 sa_optionset_t);
255 256 extern int sa_proto_valid_space(char *, char *);
256 257 extern char *sa_proto_space_alias(char *, char *);
257 258 extern int sa_proto_get_transients(sa_handle_t, char *);
258 259 extern int sa_proto_notify_resource(sa_resource_t, char *);
↓ open down ↓ |
7 lines elided |
↑ open up ↑ |
259 260 extern int sa_proto_change_notify(sa_share_t, char *);
260 261 extern int sa_proto_delete_section(char *, char *);
261 262
262 263 /* handle legacy (dfstab/sharetab) files */
263 264 extern int sa_delete_legacy(sa_share_t, char *);
264 265 extern int sa_update_legacy(sa_share_t, char *);
265 266 extern int sa_update_sharetab(sa_share_t, char *);
266 267 extern int sa_delete_sharetab(sa_handle_t, char *, char *);
267 268
268 269 /* ZFS functions */
269 -extern int sa_zfs_is_shared(sa_handle_t, char *);
270 -extern int sa_group_is_zfs(sa_group_t);
271 -extern int sa_path_is_zfs(char *);
270 +extern boolean_t sa_zfs_is_shared(sa_handle_t, char *);
271 +extern boolean_t sa_group_is_zfs(sa_group_t);
272 +extern boolean_t sa_path_is_zfs(char *);
272 273 extern int sa_zfs_setprop(sa_handle_t, char *, nvlist_t *);
273 274
274 275 /* SA Handle specific functions */
275 276 extern sa_handle_t sa_find_group_handle(sa_group_t);
276 277
277 278 #ifdef __cplusplus
278 279 }
279 280 #endif
280 281
281 282 #endif /* _LIBSHARE_H */
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX