Print this page
4095 minor cleanup up libshare


   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 2009 Sun Microsystems, Inc.  All rights reserved.
  24  * Use is subject to license terms.
  25  */
  26 
  27 /*




  28  * basic declarations for implementation of the share management
  29  * libraries.
  30  */
  31 
  32 #ifndef _LIBSHARE_IMPL_H
  33 #define _LIBSHARE_IMPL_H
  34 
  35 #include <libshare.h>
  36 #include <libscf.h>
  37 #include <scfutil.h>
  38 #include <libzfs.h>
  39 #include <sharefs/share.h>
  40 #include <sharefs/sharetab.h>
  41 
  42 #ifdef  __cplusplus
  43 extern "C" {
  44 #endif
  45 
  46 /* directory to find plugin modules in */
  47 #define SA_LIB_DIR      "/usr/lib/fs"


  83         int     (*sa_delete_proto_section)(char *);
  84 };
  85 
  86 struct sa_proto_handle {
  87         int                     sa_num_proto;
  88         char                    **sa_proto;
  89         struct sa_plugin_ops    **sa_ops;
  90 };
  91 
  92 typedef struct propertylist {
  93         struct propertylist     *pl_next;
  94         int                     pl_type;
  95         union propval {
  96             sa_optionset_t      pl_optionset;
  97             sa_security_t       pl_security;
  98             void                *pl_void;
  99         }                       pl_value;
 100 } property_list_t;
 101 
 102 /* internal version of sa_handle_t */
 103 typedef struct sa_handle_impl {
 104         uint64_t        flags;
 105         scfutilhandle_t *scfhandle;
 106         libzfs_handle_t *zfs_libhandle;
 107         zfs_handle_t    **zfs_list;
 108         size_t          zfs_list_count;
 109         xmlNodePtr      tree;
 110         xmlDocPtr       doc;
 111         uint64_t        tssharetab;
 112         uint64_t        tstrans;
 113 } *sa_handle_impl_t;
 114 
 115 extern int sa_proto_share(char *, sa_share_t);
 116 extern int sa_proto_unshare(sa_share_t, char *, char *);
 117 extern int sa_proto_valid_prop(sa_handle_t, char *, sa_property_t,
 118     sa_optionset_t);
 119 extern int sa_proto_security_prop(char *, char *);
 120 extern int sa_proto_legacy_opts(char *, sa_group_t, char *);
 121 extern int sa_proto_share_resource(char *, sa_resource_t);
 122 extern int sa_proto_unshare_resource(char *, sa_resource_t);
 123 
 124 /* internal utility functions */
 125 extern sa_optionset_t sa_get_derived_optionset(sa_group_t, char *, int);
 126 extern void sa_free_derived_optionset(sa_optionset_t);
 127 extern sa_optionset_t sa_get_all_security_types(void *, char *, int);
 128 extern sa_security_t sa_get_derived_security(void *, char *, char *, int);
 129 extern void sa_free_derived_security(sa_security_t);
 130 extern sa_protocol_properties_t sa_create_protocol_properties(char *);
 131 extern int sa_start_transaction(scfutilhandle_t *, char *);
 132 extern int sa_end_transaction(scfutilhandle_t *, sa_handle_impl_t);
 133 extern void sa_abort_transaction(scfutilhandle_t *);
 134 extern int sa_commit_share(scfutilhandle_t *, sa_group_t, sa_share_t);
 135 extern int sa_set_property(scfutilhandle_t *, char *, char *);
 136 extern void sa_free_fstype(char *fstyp);
 137 extern int sa_delete_share(scfutilhandle_t *, sa_group_t, sa_share_t);
 138 extern int sa_delete_instance(scfutilhandle_t *, char *);
 139 extern int sa_create_pgroup(scfutilhandle_t *, char *);
 140 extern int sa_delete_pgroup(scfutilhandle_t *, char *);
 141 extern void sa_fillshare(sa_share_t share, char *proto, struct share *sh);
 142 extern void sa_emptyshare(struct share *sh);
 143 
 144 /* ZFS functions */
 145 extern int sa_get_zfs_shares(sa_handle_t, char *);
 146 extern int sa_zfs_update(sa_share_t);
 147 extern int sa_share_zfs(sa_share_t, sa_resource_t, char *, share_t *,
 148     void *, zfs_share_op_t);
 149 extern int sa_sharetab_fill_zfs(sa_share_t share, struct share *sh,
 150     char *proto);
 151 
 152 /* plugin specific functions */




   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 2009 Sun Microsystems, Inc.  All rights reserved.
  24  * Use is subject to license terms.
  25  */
  26 
  27 /*
  28  * Copyright (c) 2013 RackTop Systems.
  29  */
  30 
  31 /*
  32  * basic declarations for implementation of the share management
  33  * libraries.
  34  */
  35 
  36 #ifndef _LIBSHARE_IMPL_H
  37 #define _LIBSHARE_IMPL_H
  38 
  39 #include <libshare.h>
  40 #include <libscf.h>
  41 #include <scfutil.h>
  42 #include <libzfs.h>
  43 #include <sharefs/share.h>
  44 #include <sharefs/sharetab.h>
  45 
  46 #ifdef  __cplusplus
  47 extern "C" {
  48 #endif
  49 
  50 /* directory to find plugin modules in */
  51 #define SA_LIB_DIR      "/usr/lib/fs"


  87         int     (*sa_delete_proto_section)(char *);
  88 };
  89 
  90 struct sa_proto_handle {
  91         int                     sa_num_proto;
  92         char                    **sa_proto;
  93         struct sa_plugin_ops    **sa_ops;
  94 };
  95 
  96 typedef struct propertylist {
  97         struct propertylist     *pl_next;
  98         int                     pl_type;
  99         union propval {
 100             sa_optionset_t      pl_optionset;
 101             sa_security_t       pl_security;
 102             void                *pl_void;
 103         }                       pl_value;
 104 } property_list_t;
 105 
 106 /* internal version of sa_handle_t */
 107 struct sa_handle {
 108         uint64_t        flags;
 109         scfutilhandle_t *scfhandle;
 110         libzfs_handle_t *zfs_libhandle;
 111         zfs_handle_t    **zfs_list;
 112         size_t          zfs_list_count;
 113         xmlNodePtr      tree;
 114         xmlDocPtr       doc;
 115         uint64_t        tssharetab;
 116         uint64_t        tstrans;
 117 };
 118 
 119 extern int sa_proto_share(char *, sa_share_t);
 120 extern int sa_proto_unshare(sa_share_t, char *, char *);
 121 extern int sa_proto_valid_prop(sa_handle_t, char *, sa_property_t,
 122     sa_optionset_t);
 123 extern int sa_proto_security_prop(char *, char *);
 124 extern int sa_proto_legacy_opts(char *, sa_group_t, char *);
 125 extern int sa_proto_share_resource(char *, sa_resource_t);
 126 extern int sa_proto_unshare_resource(char *, sa_resource_t);
 127 
 128 /* internal utility functions */
 129 extern sa_optionset_t sa_get_derived_optionset(sa_group_t, char *, int);
 130 extern void sa_free_derived_optionset(sa_optionset_t);
 131 extern sa_optionset_t sa_get_all_security_types(void *, char *, int);
 132 extern sa_security_t sa_get_derived_security(void *, char *, char *, int);
 133 extern void sa_free_derived_security(sa_security_t);
 134 extern sa_protocol_properties_t sa_create_protocol_properties(char *);
 135 extern int sa_start_transaction(scfutilhandle_t *, char *);
 136 extern int sa_end_transaction(scfutilhandle_t *, sa_handle_t);
 137 extern void sa_abort_transaction(scfutilhandle_t *);
 138 extern int sa_commit_share(scfutilhandle_t *, sa_group_t, sa_share_t);
 139 extern int sa_set_property(scfutilhandle_t *, char *, char *);
 140 extern void sa_free_fstype(char *fstyp);
 141 extern int sa_delete_share(scfutilhandle_t *, sa_group_t, sa_share_t);
 142 extern int sa_delete_instance(scfutilhandle_t *, char *);
 143 extern int sa_create_pgroup(scfutilhandle_t *, char *);
 144 extern int sa_delete_pgroup(scfutilhandle_t *, char *);
 145 extern void sa_fillshare(sa_share_t share, char *proto, struct share *sh);
 146 extern void sa_emptyshare(struct share *sh);
 147 
 148 /* ZFS functions */
 149 extern int sa_get_zfs_shares(sa_handle_t, char *);
 150 extern int sa_zfs_update(sa_share_t);
 151 extern int sa_share_zfs(sa_share_t, sa_resource_t, char *, share_t *,
 152     void *, zfs_share_op_t);
 153 extern int sa_sharetab_fill_zfs(sa_share_t share, struct share *sh,
 154     char *proto);
 155 
 156 /* plugin specific functions */