Lines Matching refs:group

92  * with a group or share and find the library handle needed for
142 ret = dgettext(TEXT_DOMAIN, "no such group");
193 ret = dgettext(TEXT_DOMAIN, "property not valid for group");
309 * sa_find_group_handle(sa_group_t group)
312 * group.
315 sa_find_group_handle(sa_group_t group)
317 xmlNodePtr node = (xmlNodePtr)group;
447 * checksubdirgroup(group, newpath, strictness)
450 * group. This is a helper function for checksubdir to make it easier
458 checksubdirgroup(sa_group_t group, char *newpath, int strictness)
469 for (share = sa_get_share(group, NULL); share != NULL;
486 * group inappropriately. It should be
526 sa_group_t group;
530 for (group = sa_get_group(handle, NULL);
531 group != NULL && issub == SA_OK;
532 group = sa_get_next_group(group)) {
533 if (sa_group_is_zfs(group)) {
535 for (subgroup = sa_get_sub_group(group);
541 issub = checksubdirgroup(group, newpath, strictness);
598 * check to see if group/share is persistent.
600 * "group" can be either an sa_group_t or an sa_share_t. (void *)
605 sa_is_persistent(void *group)
611 type = sa_get_group_attr((sa_group_t)group, "type");
618 grp = (sa_is_share(group)) ? sa_get_parent_group(group) : group;
644 if (len < (scf_max_name_len - sizeof ("group:"))) {
660 * is_zfs_group(group)
661 * Determine if the specified group is a ZFS sharenfs group
664 is_zfs_group(sa_group_t group)
670 if (strcmp((char *)((xmlNodePtr)group)->name, "share") == 0)
671 parent = (xmlNodePtr)sa_get_parent_group(group);
673 parent = (xmlNodePtr)group;
696 if (xmlStrcmp(node->name, (xmlChar *)"group") == 0)
796 * Make sure a "default" group exists and has default protocols enabled.
808 * NFS is the default for default group
1116 * find_group_by_name(node, group)
1118 * search the XML document subtree specified by node to find the group
1119 * specified by group. Searching subtree allows subgroups to be
1124 find_group_by_name(xmlNodePtr node, xmlChar *group)
1130 if (xmlStrcmp(node->name, (xmlChar *)"group") == 0) {
1132 if (group == NULL)
1135 if (name != NULL && xmlStrcmp(name, group) == 0)
1150 * Return the "group" specified. If groupname is NULL,
1151 * return the first group of the list of groups.
1158 char *group = NULL;
1163 group = strdup(groupname);
1164 if (group != NULL) {
1165 subgroup = strchr(group, '/');
1171 * We want to find the, possibly, named group. If
1172 * group is not NULL, then lookup the name. If it is
1174 * NULL. This allows lookup of the "first" group in
1177 if (group != NULL || groupname == NULL)
1179 (xmlChar *)group);
1185 if (node != NULL && (char *)group != NULL)
1186 (void) sa_get_instance(impl_handle->scfhandle, (char *)group);
1187 if (group != NULL)
1188 free(group);
1193 * sa_get_next_group(group)
1194 * Return the "next" group after the specified group from
1195 * the internal group list. NULL if there are no more.
1198 sa_get_next_group(sa_group_t group)
1201 if (group != NULL) {
1202 for (ngroup = ((xmlNodePtr)group)->next; ngroup != NULL;
1204 if (xmlStrcmp(ngroup->name, (xmlChar *)"group") == 0)
1212 * sa_get_share(group, sharepath)
1214 * must be in the specified group. Return NULL if not found.
1217 sa_get_share(sa_group_t group, char *sharepath)
1227 if (group != NULL) {
1228 for (node = ((xmlNodePtr)group)->children; node != NULL;
1256 * group.
1293 * find_share(group, path)
1295 * Search all the shares in the specified group for one that has the
1300 find_share(sa_group_t group, char *sharepath)
1305 for (share = sa_get_share(group, NULL); share != NULL;
1319 * sa_get_sub_group(group)
1321 * Get the first sub-group of group. The sa_get_next_group() function
1327 sa_get_sub_group(sa_group_t group)
1329 return ((sa_group_t)_sa_get_child_node((xmlNodePtr)group,
1330 (xmlChar *)"group"));
1335 * Finds a share regardless of group. In the future, this
1344 sa_group_t group;
1349 for (group = sa_get_group(handle, NULL); group != NULL && !done;
1350 group = sa_get_next_group(group)) {
1351 if (is_zfs_group(group)) {
1353 (sa_group_t)_sa_get_child_node((xmlNodePtr)group,
1354 (xmlChar *)"group");
1362 share = find_share(group, sharepath);
1371 * sa_check_path(group, path, strictness)
1373 * Check that path is a valid path relative to the group. Currently,
1374 * we are ignoring the group and checking only the NFS rules. Later,
1375 * we may want to use the group to then check against the protocols
1376 * enabled on the group. The strictness values mean:
1383 sa_check_path(sa_group_t group, char *path, int strictness)
1387 handle = sa_find_group_handle(group);
1395 * mark_excluded_protos(group, share, flags)
1397 * Walk through all the protocols enabled for the group and check to
1403 mark_excluded_protos(sa_group_t group, xmlNodePtr share, uint64_t flags)
1410 for (optionset = sa_get_optionset(group, NULL);
1434 * get_all_features(group)
1436 * Walk through all the protocols on the group and collect all
1440 get_all_features(sa_group_t group)
1445 for (optionset = sa_get_optionset(group, NULL);
1460 * _sa_add_share(group, sharepath, persist, *error, flags)
1471 _sa_add_share(sa_group_t group, char *sharepath, int persist, int *error,
1479 node = xmlNewChild((xmlNodePtr)group, NULL, (xmlChar *)"share", NULL);
1490 mark_excluded_protos(group, node, flags);
1494 * ZFS. Sort this one out based on target group and
1499 if (sa_group_is_zfs(group) &&
1501 if (sa_get_optionset(group, "nfs") != NULL)
1502 err = sa_zfs_set_sharenfs(group, sharepath, 1);
1503 else if (sa_get_optionset(group, "smb") != NULL)
1504 err = sa_zfs_set_sharesmb(group, sharepath, 1);
1508 (sa_handle_impl_t)sa_find_group_handle(group);
1511 group, (sa_share_t)node);
1538 * sa_add_share(group, sharepath, persist, *error)
1540 * Add a new share object to the specified group. The share will
1547 sa_add_share(sa_group_t group, char *sharepath, int persist, int *error)
1568 handle = sa_find_group_handle(group);
1579 *error = sa_check_path(group, sharepath, strictness);
1580 features = get_all_features(group);
1592 node = _sa_add_share(group, sharepath, persist,
1632 sa_group_t group;
1635 group = sa_get_parent_group(share);
1637 for (optionset = sa_get_optionset(group, NULL);
1681 sa_group_t group;
1684 group = sa_get_parent_group(share);
1687 for (optionset = sa_get_optionset(group, NULL);
1711 * remove the specified share from its containing group.
1718 sa_group_t group;
1726 group = sa_get_parent_group(share);
1727 zfs = sa_get_group_attr(group, "zfs");
1728 groupname = sa_get_group_attr(group, "name");
1734 /* remove the node from its group then free the memory */
1744 if (!sa_group_is_zfs(group)) {
1747 sa_find_group_handle(group);
1750 impl_handle->scfhandle, group,
1759 ret = sa_zfs_set_sharenfs(group,
1777 * sa_move_share(group, share)
1779 * move the specified share to the specified group. Update SMF
1784 sa_move_share(sa_group_t group, sa_share_t share)
1789 /* remove the node from its group then free the memory */
1792 if (oldgroup != group) {
1796 * now that the share isn't in its old group, add to
1799 (void) xmlAddChild((xmlNodePtr)group, (xmlNodePtr)share);
1801 impl_handle = (sa_handle_impl_t)sa_find_group_handle(group);
1804 * need to remove from old group first and then add to
1805 * new group. Ideally, we would do the other order but
1813 group, share);
1824 * Return the containing group for the share. If a group was actually
1835 * make sure parent is a group and not sharecfg since
1836 * we may be cheating and passing in a group.
1849 * Create a group in the document. The caller will need to deal with
1859 node = xmlNewChild(impl_handle->tree, NULL, (xmlChar *)"group",
1872 * _sa_create_zfs_group(group, groupname)
1874 * Create a ZFS subgroup under the specified group. This may
1879 _sa_create_zfs_group(sa_group_t group, char *groupname)
1883 node = xmlNewChild((xmlNodePtr)group, NULL, (xmlChar *)"group", NULL);
1897 * Create a new group with groupname. Need to validate that it is a
1899 * svc:/network/shares/group to implement the group. All necessary
1900 * operational properties must be added to the group at this point
1907 sa_group_t group;
1919 group = sa_get_group(handle, groupname);
1920 if (group != NULL) {
1925 (xmlChar *)"group", NULL);
1929 /* default to the group being enabled */
1986 * Couldn't commit the group
2008 * sa_remove_group(group)
2010 * Remove the specified group. This deletes from the SMF repository.
2015 sa_remove_group(sa_group_t group)
2021 impl_handle = (sa_handle_impl_t)sa_find_group_handle(group);
2023 name = sa_get_group_attr(group, "name");
2028 xmlUnlinkNode((xmlNodePtr)group); /* make sure unlinked */
2029 xmlFreeNode((xmlNodePtr)group); /* now it is gone */
2096 * sa_get_group_attr(group, tag)
2098 * Get the specied attribute, if defined, for the group.
2102 sa_get_group_attr(sa_group_t group, char *tag)
2104 return (get_node_attr((void *)group, tag));
2108 * sa_set_group_attr(group, tag, value)
2110 * set the specified tag/attribute on the group using value as its
2118 sa_set_group_attr(sa_group_t group, char *tag, char *value)
2125 * ZFS group/subgroup doesn't need the handle so shortcut.
2127 if (sa_group_is_zfs(group)) {
2128 set_node_attr((void *)group, tag, value);
2132 impl_handle = (sa_handle_impl_t)sa_find_group_handle(group);
2134 groupname = sa_get_group_attr(group, "name");
2137 set_node_attr((void *)group, tag, value);
2197 * the case of "resource", enforce a no duplicates in a group rule. If
2205 sa_group_t group;
2209 group = sa_get_parent_group(share);
2215 * of a resource name may exist within a group.
2219 resource = sa_get_resource(group, value);
2225 if (group != NULL) {
2233 group);
2236 impl_handle->scfhandle, group,
2303 * sa_get_optionset(group, proto)
2310 sa_get_optionset(void *group, char *proto)
2315 for (node = ((xmlNodePtr)group)->children; node != NULL;
2341 * Return the next optionset in the group. NULL if this was the last.
2359 * sa_get_security(group, sectype, proto)
2364 * as a group of properties (like NFS security options).
2368 sa_get_security(sa_group_t group, char *sectype, char *proto)
2373 for (node = ((xmlNodePtr)group)->children; node != NULL;
2507 sa_group_t group;
2528 group = sa_get_parent_group(share);
2529 if (group != NULL &&
2530 sa_is_persistent(share) && (!sa_group_is_zfs(group))) {
2532 impl_handle = (sa_handle_impl_t)sa_find_group_handle(group);
2534 ret = sa_commit_share(impl_handle->scfhandle, group,
2600 * sa_create_optionset(group, proto)
2603 * group. This is manifested as a property group within SMF.
2607 sa_create_optionset(sa_group_t group, char *proto)
2610 sa_group_t parent = group;
2615 optionset = sa_get_optionset(group, proto);
2624 if (sa_is_share(group)) {
2629 id = sa_get_share_attr((sa_share_t)group, "id");
2630 } else if (sa_is_resource(group)) {
2632 (sa_resource_t)group);
2635 /* id can be NULL if the group is transient (ZFS) */
2636 if (id == NULL && sa_is_persistent(group))
2649 optionset = (sa_optionset_t)xmlNewChild((xmlNodePtr)group,
2652 * only put to repository if on a group and we were
2660 * Need to get parent group in all cases, but also get
2663 if (sa_is_share(group)) {
2664 parent = sa_get_parent_group((sa_share_t)group);
2665 } else if (sa_is_resource(group)) {
2667 (sa_resource_t)group);
2676 if (groupname != NULL && sa_is_persistent(group)) {
2680 group);
2719 * Return the parent of the specified optionset. This could be a group
2780 sa_group_t group;
2787 group = sa_get_optionset_parent(optionset);
2788 if (group != NULL && (sa_is_share(group) || is_zfs_group(group))) {
2790 parent = sa_get_parent_group(group);
2793 needsupdate = zfs_needs_update(group);
2799 ret = sa_zfs_update((sa_share_t)group);
2801 impl_handle = (sa_handle_impl_t)sa_find_group_handle(group);
2820 * Remove the optionset from its group. Update the repository to
2831 sa_group_t group;
2834 /* now delete the prop group */
2835 group = sa_get_optionset_parent(optionset);
2836 if (group != NULL) {
2837 if (sa_is_resource(group)) {
2838 sa_resource_t resource = group;
2840 group = sa_get_parent_group(share);
2842 } else if (sa_is_share(group)) {
2843 id = sa_get_share_attr((sa_share_t)group, "id");
2845 ispersist = sa_is_persistent(group);
2850 impl_handle = (sa_handle_impl_t)sa_find_group_handle(group);
2879 * sa_create_security(group, sectype, proto)
2886 sa_create_security(sa_group_t group, char *sectype, char *proto)
2893 if (group != NULL && sa_is_share(group)) {
2894 id = sa_get_share_attr((sa_share_t)group, "id");
2895 parent = sa_get_parent_group(group);
2898 } else if (group != NULL) {
2899 groupname = sa_get_group_attr(group, "name");
2902 security = sa_get_security(group, sectype, proto);
2907 security = (sa_security_t)xmlNewChild((xmlNodePtr)group,
2916 if (groupname != NULL && sa_is_persistent(group)) {
2920 group);
2951 sa_group_t group;
2955 group = sa_get_optionset_parent(security);
2957 if (group != NULL)
2958 iszfs = sa_group_is_zfs(group);
2960 if (group != NULL && !iszfs) {
2961 if (sa_is_share(group))
2962 ispersist = sa_is_persistent(group);
2963 id = sa_get_share_attr((sa_share_t)group, "id");
2970 (sa_handle_impl_t)sa_find_group_handle(group);
2982 ret = sa_zfs_update(group);
3059 * sa_set_prop_by_prop(optionset, group, prop, type)
3062 * share. If a share, sort out which property group based on GUID. In
3068 sa_set_prop_by_prop(sa_optionset_t optionset, sa_group_t group,
3084 if (!sa_is_persistent(group)) {
3086 * if the group/share is not persistent we don't need
3091 impl_handle = (sa_handle_impl_t)sa_find_group_handle(group);
3105 if (sa_is_share(group)) {
3106 parent = sa_get_parent_group(group);
3107 share = (sa_share_t)group;
3110 } else if (sa_is_resource(group)) {
3111 share = sa_get_parent_group(group);
3115 iszfs = is_zfs_group(group);
3129 groupname = sa_get_group_attr(group,
3168 zfs_set_update((sa_share_t)group);
3245 sa_group_t group;
3274 * levels to find the group but the parent needs to be
3278 group = sa_get_parent_group(parent);
3280 group = sa_get_parent_group(parent);
3282 group = parent;
3290 if (!is_zfs_group(group)) {
3296 group);
3378 sa_group_t group;
3381 group = sa_get_optionset_parent(optionset);
3382 if (group != NULL) {
3383 ret = sa_set_prop_by_prop(optionset, group,
3410 sa_group_t group;
3414 group = sa_get_optionset_parent(optionset);
3415 if (group != NULL) {
3416 ret = sa_set_prop_by_prop(optionset, group,
3430 * the protocol and not specific to a group or share.
3525 * the protocol and not specific to a group or share.
3710 * group.
3769 sa_group_t group;
3774 group = sa_get_parent_group(share);
3775 handle = sa_find_group_handle(group);
3798 if (!sa_group_is_zfs(group)) {
3804 group);
3807 ihandle->scfhandle, group,
3812 err = sa_zfs_update((sa_share_t)group);
3833 sa_group_t group;
3841 group = sa_get_parent_group(share);
3867 if (!sa_group_is_zfs(group)) {
3869 ihandle = (sa_handle_impl_t)sa_find_group_handle(group);
3871 ret = sa_commit_share(ihandle->scfhandle, group, share);
3875 ret = sa_zfs_update((sa_share_t)group);
3882 * proto_rename_resource(handle, group, resource, newname)
3888 proto_rename_resource(sa_handle_t handle, sa_group_t group,
3895 for (optionset = sa_get_optionset(group, NULL);
3921 sa_group_t group = NULL;
3930 group = sa_get_parent_group(share);
3931 if (group == NULL)
3934 handle = (sa_handle_impl_t)sa_find_group_handle(group);
3947 ret = proto_rename_resource(handle, group, resource, newname);
3953 if (!sa_group_is_zfs(group)) {
3955 ret = sa_commit_share(ihandle->scfhandle, group,
3958 ret = sa_zfs_update((sa_share_t)group);
4009 * find_resource(group, name)
4011 * Find the resource within the group.
4015 find_resource(sa_group_t group, char *resname)
4021 /* Iterate over all the shares and resources in the group. */
4022 for (share = sa_get_share(group, NULL);
4051 sa_group_t group;
4059 for (group = sa_get_group(handle, NULL); group != NULL;
4060 group = sa_get_next_group(group)) {
4062 if (is_zfs_group(group)) {
4064 (sa_group_t)_sa_get_child_node((xmlNodePtr)group,
4065 (xmlChar *)"group");
4071 resource = find_resource(group, name);
4080 * sa_get_resource(group, resource)
4082 * Search all the shares in the specified group for a share with a
4085 * In the future, it may be advantageous to allow group to be NULL and
4090 sa_get_resource(sa_group_t group, char *resource)
4096 for (share = sa_get_share(group, NULL);
4164 * The function finds the parent group and extracts the protocol
4175 sa_group_t group = NULL;
4192 group = sa_get_parent_group(share);
4195 group = sa_get_parent_group(share);
4197 group = (sa_group_t)group;
4203 if (ret == SA_OK && group != NULL)
4204 ret = get_protocol_list(options, group);
4339 sa_group_t group;
4365 group = sa_get_parent_group(share);
4366 if (group != NULL &&
4367 sa_is_persistent(share) && (!sa_group_is_zfs(group))) {
4369 impl_handle = (sa_handle_impl_t)sa_find_group_handle(group);
4372 group, share);