Print this page
4095 minor cleanup up libshare
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/lib/libshare/common/libshare_impl.h
+++ new/usr/src/lib/libshare/common/libshare_impl.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
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]
↓ open down ↓ |
17 lines elided |
↑ open up ↑ |
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21
22 22 /*
23 23 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
24 24 * Use is subject to license terms.
25 25 */
26 26
27 27 /*
28 + * Copyright (c) 2013 RackTop Systems.
29 + */
30 +
31 +/*
28 32 * basic declarations for implementation of the share management
29 33 * libraries.
30 34 */
31 35
32 36 #ifndef _LIBSHARE_IMPL_H
33 37 #define _LIBSHARE_IMPL_H
34 38
35 39 #include <libshare.h>
36 40 #include <libscf.h>
37 41 #include <scfutil.h>
38 42 #include <libzfs.h>
39 43 #include <sharefs/share.h>
40 44 #include <sharefs/sharetab.h>
41 45
42 46 #ifdef __cplusplus
43 47 extern "C" {
44 48 #endif
45 49
46 50 /* directory to find plugin modules in */
47 51 #define SA_LIB_DIR "/usr/lib/fs"
48 52
49 53 /* default group name for dfstab file */
50 54 #define SA_DEFAULT_FILE_GRP "sys"
51 55
52 56 typedef void *sa_phandle_t;
53 57
54 58 #define SA_PLUGIN_VERSION 1
55 59 struct sa_plugin_ops {
56 60 int sa_version; /* version number */
57 61 char *sa_protocol; /* protocol name */
58 62 int (*sa_init)();
59 63 void (*sa_fini)();
60 64 int (*sa_share)(sa_share_t); /* start sharing */
61 65 int (*sa_unshare)(sa_share_t, char *); /* stop sharing */
62 66 int (*sa_valid_prop)(sa_handle_t, sa_property_t,
63 67 sa_optionset_t); /* validate */
64 68 int (*sa_valid_space)(char *); /* is name valid optionspace? */
65 69 int (*sa_security_prop)(char *); /* property is security */
66 70 int (*sa_legacy_opts)(sa_group_t, char *); /* parse legacy opts */
67 71 char *(*sa_legacy_format)(sa_group_t, int);
68 72 int (*sa_set_proto_prop)(sa_property_t); /* set a property */
69 73 sa_protocol_properties_t (*sa_get_proto_set)(); /* get properties */
70 74 char *(*sa_get_proto_status)();
71 75 char *(*sa_space_alias)(char *);
72 76 int (*sa_update_legacy)(sa_share_t);
73 77 int (*sa_delete_legacy)(sa_share_t);
74 78 int (*sa_change_notify)(sa_share_t);
75 79 int (*sa_enable_resource)(sa_resource_t);
76 80 int (*sa_disable_resource)(sa_resource_t);
77 81 uint64_t (*sa_features)(void);
78 82 int (*sa_get_transient_shares)(sa_handle_t); /* add transients */
79 83 int (*sa_notify_resource)(sa_resource_t);
80 84 int (*sa_rename_resource)(sa_handle_t, sa_resource_t, char *);
81 85 int (*sa_run_command)(int, int, char **); /* proto specific */
82 86 int (*sa_command_help)();
83 87 int (*sa_delete_proto_section)(char *);
84 88 };
85 89
86 90 struct sa_proto_handle {
87 91 int sa_num_proto;
88 92 char **sa_proto;
89 93 struct sa_plugin_ops **sa_ops;
90 94 };
91 95
92 96 typedef struct propertylist {
↓ open down ↓ |
55 lines elided |
↑ open up ↑ |
93 97 struct propertylist *pl_next;
94 98 int pl_type;
95 99 union propval {
96 100 sa_optionset_t pl_optionset;
97 101 sa_security_t pl_security;
98 102 void *pl_void;
99 103 } pl_value;
100 104 } property_list_t;
101 105
102 106 /* internal version of sa_handle_t */
103 -typedef struct sa_handle_impl {
107 +struct sa_handle {
104 108 uint64_t flags;
105 109 scfutilhandle_t *scfhandle;
106 110 libzfs_handle_t *zfs_libhandle;
107 111 zfs_handle_t **zfs_list;
108 112 size_t zfs_list_count;
109 113 xmlNodePtr tree;
110 114 xmlDocPtr doc;
111 115 uint64_t tssharetab;
112 116 uint64_t tstrans;
113 -} *sa_handle_impl_t;
117 +};
114 118
115 119 extern int sa_proto_share(char *, sa_share_t);
116 120 extern int sa_proto_unshare(sa_share_t, char *, char *);
117 121 extern int sa_proto_valid_prop(sa_handle_t, char *, sa_property_t,
118 122 sa_optionset_t);
119 123 extern int sa_proto_security_prop(char *, char *);
120 124 extern int sa_proto_legacy_opts(char *, sa_group_t, char *);
121 125 extern int sa_proto_share_resource(char *, sa_resource_t);
122 126 extern int sa_proto_unshare_resource(char *, sa_resource_t);
123 127
124 128 /* internal utility functions */
125 129 extern sa_optionset_t sa_get_derived_optionset(sa_group_t, char *, int);
126 130 extern void sa_free_derived_optionset(sa_optionset_t);
127 131 extern sa_optionset_t sa_get_all_security_types(void *, char *, int);
128 132 extern sa_security_t sa_get_derived_security(void *, char *, char *, int);
129 133 extern void sa_free_derived_security(sa_security_t);
130 134 extern sa_protocol_properties_t sa_create_protocol_properties(char *);
131 135 extern int sa_start_transaction(scfutilhandle_t *, char *);
132 -extern int sa_end_transaction(scfutilhandle_t *, sa_handle_impl_t);
136 +extern int sa_end_transaction(scfutilhandle_t *, sa_handle_t);
133 137 extern void sa_abort_transaction(scfutilhandle_t *);
134 138 extern int sa_commit_share(scfutilhandle_t *, sa_group_t, sa_share_t);
135 139 extern int sa_set_property(scfutilhandle_t *, char *, char *);
136 140 extern void sa_free_fstype(char *fstyp);
137 141 extern int sa_delete_share(scfutilhandle_t *, sa_group_t, sa_share_t);
138 142 extern int sa_delete_instance(scfutilhandle_t *, char *);
139 143 extern int sa_create_pgroup(scfutilhandle_t *, char *);
140 144 extern int sa_delete_pgroup(scfutilhandle_t *, char *);
141 145 extern void sa_fillshare(sa_share_t share, char *proto, struct share *sh);
142 146 extern void sa_emptyshare(struct share *sh);
143 147
144 148 /* ZFS functions */
145 149 extern int sa_get_zfs_shares(sa_handle_t, char *);
146 150 extern int sa_zfs_update(sa_share_t);
147 151 extern int sa_share_zfs(sa_share_t, sa_resource_t, char *, share_t *,
148 152 void *, zfs_share_op_t);
149 153 extern int sa_sharetab_fill_zfs(sa_share_t share, struct share *sh,
150 154 char *proto);
151 155
152 156 /* plugin specific functions */
153 157 extern int proto_plugin_init();
154 158 extern void proto_plugin_fini();
155 159 extern int sa_proto_set_property(char *, sa_property_t);
156 160 extern int sa_proto_delete_legacy(char *, sa_share_t);
157 161 extern int sa_proto_update_legacy(char *, sa_share_t);
158 162 extern int sa_proto_rename_resource(sa_handle_t, char *,
159 163 sa_resource_t, char *);
160 164
161 165 #define PL_TYPE_PROPERTY 0
162 166 #define PL_TYPE_SECURITY 1
163 167
164 168 /* values only used by the internal dfstab/sharetab parser */
165 169 #define SA_SHARE_PARSER 0x1000
166 170
167 171 /* plugin handler only */
168 172 struct sa_proto_plugin {
169 173 struct sa_proto_plugin *plugin_next;
170 174 struct sa_plugin_ops *plugin_ops;
171 175 void *plugin_handle;
172 176 };
173 177
174 178 #define TSTAMP(tm) (uint64_t)(((uint64_t)tm.tv_sec << 32) | \
175 179 (tm.tv_nsec & 0xffffffff))
176 180
177 181
178 182 #ifdef __cplusplus
179 183 }
180 184 #endif
181 185
182 186 #endif /* _LIBSHARE_IMPL_H */
↓ open down ↓ |
40 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX