--- old/usr/src/lib/libshare/common/libshare.c	2013-09-10 06:31:57.813571487 +0100
+++ new/usr/src/lib/libshare/common/libshare.c	2013-09-10 06:31:57.836669859 +0100
@@ -21,6 +21,7 @@
 
 /*
  * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013 RackTop Systems.
  */
 
 /*
@@ -65,19 +66,19 @@
 
 /* current SMF/SVC repository handle */
 extern void getlegacyconfig(sa_handle_t, char *, xmlNodePtr *);
-extern int gettransients(sa_handle_impl_t, xmlNodePtr *);
+extern int gettransients(sa_handle_t, xmlNodePtr *);
 extern char *sa_fstype(char *);
-extern int sa_is_share(void *);
-extern int sa_is_resource(void *);
+extern boolean_t sa_is_share(void *);
+extern boolean_t sa_is_resource(void *);
 extern ssize_t scf_max_name_len; /* defined in scfutil during initialization */
-extern int sa_group_is_zfs(sa_group_t);
-extern int sa_path_is_zfs(char *);
+extern boolean_t sa_group_is_zfs(sa_group_t);
+extern boolean_t sa_path_is_zfs(char *);
 extern int sa_zfs_set_sharenfs(sa_group_t, char *, int);
 extern int sa_zfs_set_sharesmb(sa_group_t, char *, int);
 extern void update_legacy_config(sa_handle_t);
 extern int issubdir(char *, char *);
-extern int sa_zfs_init(sa_handle_impl_t);
-extern void sa_zfs_fini(sa_handle_impl_t);
+extern int sa_zfs_init(sa_handle_t);
+extern void sa_zfs_fini(sa_handle_t);
 extern void sablocksigs(sigset_t *);
 extern void saunblocksigs(sigset_t *);
 static sa_group_t sa_get_optionset_parent(sa_optionset_t);
@@ -95,7 +96,7 @@
 struct doc2handle {
 	struct doc2handle	*next;
 	xmlNodePtr		root;
-	sa_handle_impl_t	handle;
+	sa_handle_t		handle;
 };
 
 mutex_t sa_dfstab_lock;
@@ -239,7 +240,7 @@
  * item per thread that has called sa_init().
  */
 
-sa_handle_impl_t
+sa_handle_t
 get_handle_for_root(xmlNodePtr root)
 {
 	struct doc2handle *item;
@@ -256,7 +257,7 @@
 }
 
 static int
-add_handle_for_root(xmlNodePtr root, sa_handle_impl_t handle)
+add_handle_for_root(xmlNodePtr root, sa_handle_t handle)
 {
 	struct doc2handle *item;
 	int ret = SA_NO_MEMORY;
@@ -319,7 +320,7 @@
 	while (node != NULL) {
 		if (strcmp((char *)(node->name), "sharecfg") == 0) {
 			/* have the root so get the handle */
-			handle = (sa_handle_t)get_handle_for_root(node);
+			handle = get_handle_for_root(node);
 			return (handle);
 		}
 		node = node->parent;
@@ -340,7 +341,7 @@
 {
 	xmlNodePtr node;
 	xmlChar *lpath = NULL;
-	sa_handle_impl_t handle;
+	sa_handle_t handle;
 
 	/* Have to have a handle or else we weren't initialized. */
 	handle = get_handle_for_root(root);
@@ -600,23 +601,23 @@
  * works since both thse types are also void *.
  * If the share is a ZFS share, mark it as persistent.
  */
-int
+boolean_t
 sa_is_persistent(void *group)
 {
 	char *type;
-	int persist = 1;
+	boolean_t persist = B_TRUE;
 	sa_group_t grp;
 
 	type = sa_get_group_attr((sa_group_t)group, "type");
 	if (type != NULL) {
 		if (strcmp(type, "transient") == 0)
-			persist = 0;
+			persist = B_FALSE;
 		sa_free_attr_string(type);
 	}
 
 	grp = (sa_is_share(group)) ? sa_get_parent_group(group) : group;
 	if (sa_group_is_zfs(grp))
-		persist = 1;
+		persist = B_TRUE;
 
 	return (persist);
 }
@@ -833,10 +834,10 @@
 	sigset_t old;
 	int updatelegacy = B_FALSE;
 	scf_simple_prop_t *prop;
-	sa_handle_impl_t handle;
+	sa_handle_t handle;
 	int err;
 
-	handle = calloc(sizeof (struct sa_handle_impl), 1);
+	handle = calloc(sizeof (struct sa_handle), 1);
 
 	if (handle != NULL) {
 		/*
@@ -989,7 +990,7 @@
 
 				if (updatelegacy == B_TRUE) {
 					sablocksigs(&old);
-					getlegacyconfig((sa_handle_t)handle,
+					getlegacyconfig(handle,
 					    SA_LEGACY_DFSTAB, &handle->tree);
 					if (stat(SA_LEGACY_DFSTAB, &st) >= 0)
 						set_legacy_timestamp(
@@ -1006,7 +1007,7 @@
 					(void) close(lockfd);
 				}
 				/* Get sharetab timestamp */
-				sa_update_sharetab_ts((sa_handle_t)handle);
+				sa_update_sharetab_ts(handle);
 
 				/* Get lastupdate (transaction) timestamp */
 				prop = scf_simple_prop_get(
@@ -1029,7 +1030,7 @@
 			}
 		}
 	}
-	return ((sa_handle_t)handle);
+	return (handle);
 }
 
 /*
@@ -1041,18 +1042,16 @@
 void
 sa_fini(sa_handle_t handle)
 {
-	sa_handle_impl_t impl_handle = (sa_handle_impl_t)handle;
-
-	if (impl_handle != NULL) {
+	if (handle != NULL) {
 		/*
 		 * Free the config trees and any other data structures
 		 * used in the handle.
 		 */
-		if (impl_handle->doc != NULL)
-			xmlFreeDoc(impl_handle->doc);
+		if (handle->doc != NULL)
+			xmlFreeDoc(handle->doc);
 
 		/* Remove and free the entry in the global list. */
-		remove_handle_for_root(impl_handle->tree);
+		remove_handle_for_root(handle->tree);
 
 		/*
 		 * If this was the last handle to release, unload the
@@ -1064,11 +1063,11 @@
 			(void) proto_plugin_fini();
 		(void) mutex_unlock(&sa_global_lock);
 
-		sa_scf_fini(impl_handle->scfhandle);
-		sa_zfs_fini(impl_handle);
+		sa_scf_fini(handle->scfhandle);
+		sa_zfs_fini(handle);
 
 		/* Make sure we free the handle */
-		free(impl_handle);
+		free(handle);
 
 	}
 }
@@ -1155,9 +1154,8 @@
 	xmlNodePtr node = NULL;
 	char *subgroup = NULL;
 	char *group = NULL;
-	sa_handle_impl_t impl_handle = (sa_handle_impl_t)handle;
 
-	if (impl_handle != NULL && impl_handle->tree != NULL) {
+	if (handle != NULL && handle->tree != NULL) {
 		if (groupname != NULL) {
 			group = strdup(groupname);
 			if (group != NULL) {
@@ -1174,7 +1172,7 @@
 		 * the internal list.
 		 */
 		if (group != NULL || groupname == NULL)
-			node = find_group_by_name(impl_handle->tree,
+			node = find_group_by_name(handle->tree,
 			    (xmlChar *)group);
 
 		/* if a subgroup, find it before returning */
@@ -1182,7 +1180,7 @@
 			node = find_group_by_name(node, (xmlChar *)subgroup);
 	}
 	if (node != NULL && (char *)group != NULL)
-		(void) sa_get_instance(impl_handle->scfhandle, (char *)group);
+		(void) sa_get_instance(handle->scfhandle, (char *)group);
 	if (group != NULL)
 		free(group);
 	return ((sa_group_t)(node));
@@ -1502,11 +1500,9 @@
 			else if (sa_get_optionset(group, "smb") != NULL)
 				err = sa_zfs_set_sharesmb(group, sharepath, 1);
 		} else {
-			sa_handle_impl_t impl_handle;
-			impl_handle =
-			    (sa_handle_impl_t)sa_find_group_handle(group);
-			if (impl_handle != NULL) {
-				err = sa_commit_share(impl_handle->scfhandle,
+			sa_handle_t handle = sa_find_group_handle(group);
+			if (handle != NULL) {
+				err = sa_commit_share(handle->scfhandle,
 				    group, (sa_share_t)node);
 			} else {
 				err = SA_SYSTEM_ERR;
@@ -1741,12 +1737,11 @@
 		ret = sa_delete_legacy(share, NULL);
 		if (ret == SA_OK) {
 			if (!sa_group_is_zfs(group)) {
-				sa_handle_impl_t impl_handle;
-				impl_handle = (sa_handle_impl_t)
+				sa_handle_t handle =
 				    sa_find_group_handle(group);
-				if (impl_handle != NULL) {
+				if (handle != NULL) {
 					ret = sa_delete_share(
-					    impl_handle->scfhandle, group,
+					    handle->scfhandle, group,
 					    share);
 				} else {
 					ret = SA_SYSTEM_ERR;
@@ -1789,7 +1784,7 @@
 
 	oldgroup = sa_get_parent_group(share);
 	if (oldgroup != group) {
-		sa_handle_impl_t impl_handle;
+		sa_handle_t handle;
 		xmlUnlinkNode((xmlNodePtr)share);
 		/*
 		 * now that the share isn't in its old group, add to
@@ -1797,18 +1792,18 @@
 		 */
 		(void) xmlAddChild((xmlNodePtr)group, (xmlNodePtr)share);
 		/* need to deal with SMF */
-		impl_handle = (sa_handle_impl_t)sa_find_group_handle(group);
-		if (impl_handle != NULL) {
+		handle = sa_find_group_handle(group);
+		if (handle != NULL) {
 			/*
 			 * need to remove from old group first and then add to
 			 * new group. Ideally, we would do the other order but
 			 * need to avoid having the share in two groups at the
 			 * same time.
 			 */
-			ret = sa_delete_share(impl_handle->scfhandle, oldgroup,
+			ret = sa_delete_share(handle->scfhandle, oldgroup,
 			    share);
 			if (ret == SA_OK)
-				ret = sa_commit_share(impl_handle->scfhandle,
+				ret = sa_commit_share(handle->scfhandle,
 				    group, share);
 		} else {
 			ret = SA_SYSTEM_ERR;
@@ -1843,19 +1838,19 @@
 }
 
 /*
- * _sa_create_group(impl_handle, groupname)
+ * _sa_create_group(handle, groupname)
  *
  * Create a group in the document. The caller will need to deal with
  * configuration store and activation.
  */
 
 sa_group_t
-_sa_create_group(sa_handle_impl_t impl_handle, char *groupname)
+_sa_create_group(sa_handle_t handle, char *groupname)
 {
 	xmlNodePtr node = NULL;
 
 	if (sa_valid_group_name(groupname)) {
-		node = xmlNewChild(impl_handle->tree, NULL, (xmlChar *)"group",
+		node = xmlNewChild(handle->tree, NULL, (xmlChar *)"group",
 		    NULL);
 		if (node != NULL) {
 			(void) xmlSetProp(node, (xmlChar *)"name",
@@ -1906,11 +1901,10 @@
 	sa_group_t group;
 	int ret;
 	char rbacstr[SA_STRSIZE];
-	sa_handle_impl_t impl_handle = (sa_handle_impl_t)handle;
 
 	ret = SA_OK;
 
-	if (impl_handle == NULL || impl_handle->scfhandle == NULL) {
+	if (handle == NULL || handle->scfhandle == NULL) {
 		ret = SA_SYSTEM_ERR;
 		goto err;
 	}
@@ -1920,7 +1914,7 @@
 		ret = SA_DUPLICATE_NAME;
 	} else {
 		if (sa_valid_group_name(groupname)) {
-			node = xmlNewChild(impl_handle->tree, NULL,
+			node = xmlNewChild(handle->tree, NULL,
 			    (xmlChar *)"group", NULL);
 			if (node != NULL) {
 				(void) xmlSetProp(node, (xmlChar *)"name",
@@ -1928,37 +1922,37 @@
 				/* default to the group being enabled */
 				(void) xmlSetProp(node, (xmlChar *)"state",
 				    (xmlChar *)"enabled");
-				ret = sa_create_instance(impl_handle->scfhandle,
+				ret = sa_create_instance(handle->scfhandle,
 				    groupname);
 				if (ret == SA_OK) {
 					ret = sa_start_transaction(
-					    impl_handle->scfhandle,
+					    handle->scfhandle,
 					    "operation");
 				}
 				if (ret == SA_OK) {
 					ret = sa_set_property(
-					    impl_handle->scfhandle,
+					    handle->scfhandle,
 					    "state", "enabled");
 					if (ret == SA_OK) {
 						ret = sa_end_transaction(
-						    impl_handle->scfhandle,
-						    impl_handle);
+						    handle->scfhandle,
+						    handle);
 					} else {
 						sa_abort_transaction(
-						    impl_handle->scfhandle);
+						    handle->scfhandle);
 					}
 				}
 				if (ret == SA_OK) {
 					/* initialize the RBAC strings */
 					ret = sa_start_transaction(
-					    impl_handle->scfhandle,
+					    handle->scfhandle,
 					    "general");
 					if (ret == SA_OK) {
 						(void) snprintf(rbacstr,
 						    sizeof (rbacstr), "%s.%s",
 						    SA_RBAC_MANAGE, groupname);
 						ret = sa_set_property(
-						    impl_handle->scfhandle,
+						    handle->scfhandle,
 						    "action_authorization",
 						    rbacstr);
 					}
@@ -1967,17 +1961,17 @@
 						    sizeof (rbacstr), "%s.%s",
 						    SA_RBAC_VALUE, groupname);
 						ret = sa_set_property(
-						    impl_handle->scfhandle,
+						    handle->scfhandle,
 						    "value_authorization",
 						    rbacstr);
 					}
 					if (ret == SA_OK) {
 						ret = sa_end_transaction(
-						    impl_handle->scfhandle,
-						    impl_handle);
+						    handle->scfhandle,
+						    handle);
 					} else {
 						sa_abort_transaction(
-						    impl_handle->scfhandle);
+						    handle->scfhandle);
 					}
 				}
 				if (ret != SA_OK) {
@@ -2015,13 +2009,13 @@
 {
 	char *name;
 	int ret = SA_OK;
-	sa_handle_impl_t impl_handle;
+	sa_handle_t handle;
 
-	impl_handle = (sa_handle_impl_t)sa_find_group_handle(group);
-	if (impl_handle != NULL) {
+	handle = sa_find_group_handle(group);
+	if (handle != NULL) {
 		name = sa_get_group_attr(group, "name");
 		if (name != NULL) {
-			ret = sa_delete_instance(impl_handle->scfhandle, name);
+			ret = sa_delete_instance(handle->scfhandle, name);
 			sa_free_attr_string(name);
 		}
 		xmlUnlinkNode((xmlNodePtr)group); /* make sure unlinked */
@@ -2118,7 +2112,7 @@
 {
 	int ret;
 	char *groupname;
-	sa_handle_impl_t impl_handle;
+	sa_handle_t handle;
 
 	/*
 	 * ZFS group/subgroup doesn't need the handle so shortcut.
@@ -2128,24 +2122,24 @@
 		return (SA_OK);
 	}
 
-	impl_handle = (sa_handle_impl_t)sa_find_group_handle(group);
-	if (impl_handle != NULL) {
+	handle = sa_find_group_handle(group);
+	if (handle != NULL) {
 		groupname = sa_get_group_attr(group, "name");
-		ret = sa_get_instance(impl_handle->scfhandle, groupname);
+		ret = sa_get_instance(handle->scfhandle, groupname);
 		if (ret == SA_OK) {
 			set_node_attr((void *)group, tag, value);
-			ret = sa_start_transaction(impl_handle->scfhandle,
+			ret = sa_start_transaction(handle->scfhandle,
 			    "operation");
 			if (ret == SA_OK) {
-				ret = sa_set_property(impl_handle->scfhandle,
+				ret = sa_set_property(handle->scfhandle,
 				    tag, value);
 				if (ret == SA_OK)
 					ret = sa_end_transaction(
-					    impl_handle->scfhandle,
-					    impl_handle);
+					    handle->scfhandle,
+					    handle);
 				else
 					sa_abort_transaction(
-					    impl_handle->scfhandle);
+					    handle->scfhandle);
 			}
 			if (ret == SA_SYSTEM_ERR)
 				ret = SA_NO_PERMISSION;
@@ -2226,13 +2220,11 @@
 			/* we can probably optimize this some */
 			type = sa_get_share_attr(share, "type");
 			if (type == NULL || strcmp(type, "transient") != 0) {
-				sa_handle_impl_t impl_handle;
-				impl_handle =
-				    (sa_handle_impl_t)sa_find_group_handle(
+				sa_handle_t handle = sa_find_group_handle(
 				    group);
-				if (impl_handle != NULL) {
+				if (handle != NULL) {
 					ret = sa_commit_share(
-					    impl_handle->scfhandle, group,
+					    handle->scfhandle, group,
 					    share);
 				} else {
 					ret = SA_SYSTEM_ERR;
@@ -2527,10 +2519,9 @@
 	group = sa_get_parent_group(share);
 	if (group != NULL &&
 	    sa_is_persistent(share) && (!sa_group_is_zfs(group))) {
-		sa_handle_impl_t impl_handle;
-		impl_handle = (sa_handle_impl_t)sa_find_group_handle(group);
-		if (impl_handle != NULL) {
-			ret = sa_commit_share(impl_handle->scfhandle, group,
+		sa_handle_t handle = sa_find_group_handle(group);
+		if (handle != NULL) {
+			ret = sa_commit_share(handle->scfhandle, group,
 			    share);
 		} else {
 			ret = SA_SYSTEM_ERR;
@@ -2673,16 +2664,14 @@
 			    sizeof (oname), id);
 			groupname = sa_get_group_attr(parent, "name");
 			if (groupname != NULL && sa_is_persistent(group)) {
-				sa_handle_impl_t impl_handle;
-				impl_handle =
-				    (sa_handle_impl_t)sa_find_group_handle(
+				sa_handle_t handle = sa_find_group_handle(
 				    group);
-				assert(impl_handle != NULL);
-				if (impl_handle != NULL) {
+				assert(handle != NULL);
+				if (handle != NULL) {
 					(void) sa_get_instance(
-					    impl_handle->scfhandle, groupname);
+					    handle->scfhandle, groupname);
 					(void) sa_create_pgroup(
-					    impl_handle->scfhandle, oname);
+					    handle->scfhandle, oname);
 				}
 			}
 			if (groupname != NULL)
@@ -2781,7 +2770,7 @@
 	int zfs = 0;
 	int needsupdate = 0;
 	int ret = SA_OK;
-	sa_handle_impl_t impl_handle;
+	sa_handle_t handle;
 
 	group = sa_get_optionset_parent(optionset);
 	if (group != NULL && (sa_is_share(group) || is_zfs_group(group))) {
@@ -2797,14 +2786,14 @@
 		if (!clear && needsupdate)
 			ret = sa_zfs_update((sa_share_t)group);
 	} else {
-		impl_handle = (sa_handle_impl_t)sa_find_group_handle(group);
-		if (impl_handle != NULL) {
+		handle = sa_find_group_handle(group);
+		if (handle != NULL) {
 			if (clear) {
 				(void) sa_abort_transaction(
-				    impl_handle->scfhandle);
+				    handle->scfhandle);
 			} else {
 				ret = sa_end_transaction(
-				    impl_handle->scfhandle, impl_handle);
+				    handle->scfhandle, handle);
 			}
 		} else {
 			ret = SA_SYSTEM_ERR;
@@ -2844,12 +2833,11 @@
 		ispersist = sa_is_persistent(group);
 	}
 	if (ispersist) {
-		sa_handle_impl_t impl_handle;
+		sa_handle_t handle = sa_find_group_handle(group);
 		len = sa_optionset_name(optionset, name, sizeof (name), id);
-		impl_handle = (sa_handle_impl_t)sa_find_group_handle(group);
-		if (impl_handle != NULL) {
+		if (handle != NULL) {
 			if (len > 0) {
-				ret = sa_delete_pgroup(impl_handle->scfhandle,
+				ret = sa_delete_pgroup(handle->scfhandle,
 				    name);
 			}
 		} else {
@@ -2913,15 +2901,13 @@
 			(void) sa_security_name(security, oname,
 			    sizeof (oname), id);
 			if (groupname != NULL && sa_is_persistent(group)) {
-				sa_handle_impl_t impl_handle;
-				impl_handle =
-				    (sa_handle_impl_t)sa_find_group_handle(
+				sa_handle_t handle = sa_find_group_handle(
 				    group);
-				if (impl_handle != NULL) {
+				if (handle != NULL) {
 					(void) sa_get_instance(
-					    impl_handle->scfhandle, groupname);
+					    handle->scfhandle, groupname);
 					(void) sa_create_pgroup(
-					    impl_handle->scfhandle, oname);
+					    handle->scfhandle, oname);
 				}
 			}
 		}
@@ -2964,11 +2950,9 @@
 	if (ispersist) {
 		len = sa_security_name(security, name, sizeof (name), id);
 		if (!iszfs && len > 0) {
-			sa_handle_impl_t impl_handle;
-			impl_handle =
-			    (sa_handle_impl_t)sa_find_group_handle(group);
-			if (impl_handle != NULL) {
-				ret = sa_delete_pgroup(impl_handle->scfhandle,
+			sa_handle_t handle = sa_find_group_handle(group);
+			if (handle != NULL) {
+				ret = sa_delete_pgroup(handle->scfhandle,
 				    name);
 			} else {
 				ret = SA_SYSTEM_ERR;
@@ -3077,7 +3061,7 @@
 	int iszfs = 0;
 	sa_group_t parent = NULL;
 	sa_share_t share = NULL;
-	sa_handle_impl_t impl_handle;
+	sa_handle_t handle;
 	scfutilhandle_t  *scf_handle;
 
 	if (!sa_is_persistent(group)) {
@@ -3087,10 +3071,10 @@
 		 */
 		return (SA_OK);
 	}
-	impl_handle = (sa_handle_impl_t)sa_find_group_handle(group);
-	if (impl_handle == NULL || impl_handle->scfhandle == NULL)
+	handle = sa_find_group_handle(group);
+	if (handle == NULL || handle->scfhandle == NULL)
 		return (SA_SYSTEM_ERR);
-	scf_handle = impl_handle->scfhandle;
+	scf_handle = handle->scfhandle;
 	name = sa_get_property_attr(prop, "type");
 	valstr = sa_get_property_attr(prop, "value");
 	entry = scf_entry_create(scf_handle->handle);
@@ -3288,16 +3272,15 @@
 
 		if (!is_zfs_group(group)) {
 			char *id = NULL;
-			sa_handle_impl_t impl_handle;
+			sa_handle_t handle;
 			scfutilhandle_t  *scf_handle;
 
-			impl_handle = (sa_handle_impl_t)sa_find_group_handle(
-			    group);
-			if (impl_handle == NULL ||
-			    impl_handle->scfhandle == NULL)
+			handle = sa_find_group_handle(group);
+			if (handle == NULL ||
+			    handle->scfhandle == NULL)
 				ret = SA_SYSTEM_ERR;
 			if (ret == SA_OK) {
-				scf_handle = impl_handle->scfhandle;
+				scf_handle = handle->scfhandle;
 				if (sa_is_share((sa_group_t)parent)) {
 					id = sa_get_share_attr(
 					    (sa_share_t)parent, "id");
@@ -3796,14 +3779,13 @@
 
 				if (!sa_group_is_zfs(group)) {
 					/* ZFS doesn't use resource names */
-					sa_handle_impl_t ihandle;
+					sa_handle_t handle;
 
-					ihandle = (sa_handle_impl_t)
-					    sa_find_group_handle(
+					handle = sa_find_group_handle(
 					    group);
-					if (ihandle != NULL)
+					if (handle != NULL)
 						err = sa_commit_share(
-						    ihandle->scfhandle, group,
+						    handle->scfhandle, group,
 						    share);
 					else
 						err = SA_SYSTEM_ERR;
@@ -3864,10 +3846,9 @@
 		return (ret);
 
 	if (!sa_group_is_zfs(group)) {
-		sa_handle_impl_t ihandle;
-		ihandle = (sa_handle_impl_t)sa_find_group_handle(group);
-		if (ihandle != NULL)
-			ret = sa_commit_share(ihandle->scfhandle, group, share);
+		sa_handle_t handle = sa_find_group_handle(group);
+		if (handle != NULL)
+			ret = sa_commit_share(handle->scfhandle, group, share);
 		else
 			ret = SA_SYSTEM_ERR;
 	} else {
@@ -3930,7 +3911,7 @@
 	if (group == NULL)
 		return (ret);
 
-	handle = (sa_handle_impl_t)sa_find_group_handle(group);
+	handle = sa_find_group_handle(group);
 	if (handle == NULL)
 		return (ret);
 
@@ -3950,8 +3931,7 @@
 			return (ret);
 
 		if (!sa_group_is_zfs(group)) {
-			sa_handle_impl_t ihandle = (sa_handle_impl_t)handle;
-			ret = sa_commit_share(ihandle->scfhandle, group,
+			ret = sa_commit_share(handle->scfhandle, group,
 			    share);
 		} else {
 			ret = sa_zfs_update((sa_share_t)group);
@@ -4364,10 +4344,9 @@
 	group = sa_get_parent_group(share);
 	if (group != NULL &&
 	    sa_is_persistent(share) && (!sa_group_is_zfs(group))) {
-		sa_handle_impl_t impl_handle;
-		impl_handle = (sa_handle_impl_t)sa_find_group_handle(group);
-		if (impl_handle != NULL)
-			ret = sa_commit_share(impl_handle->scfhandle,
+		sa_handle_t handle = sa_find_group_handle(group);
+		if (handle != NULL)
+			ret = sa_commit_share(handle->scfhandle,
 			    group, share);
 		else
 			ret = SA_SYSTEM_ERR;
