Lines Matching defs:share
253 * set_resource_desc(share, description)
255 * Set the share description value after converting the description
260 set_resource_desc(sa_share_t share, char *description)
266 ret = sa_set_resource_description(share, desc);
273 * set_share_desc(share, description)
280 set_share_desc(sa_share_t share, char *description)
286 ret = sa_set_share_description(share, desc);
448 * notify_or_enable_share(share, protocol)
457 notify_or_enable_share(sa_share_t share, char *protocol)
464 sa_share_t parent = share;
466 /* If really a resource, get parent share */
467 if (!sa_is_share(share)) {
468 parent = sa_get_resource_parent((sa_resource_t)share);
472 * Now that we've got a share in "parent", make sure it has a path.
494 if (sa_is_share(share)) {
495 if ((ret = sa_proto_change_notify(share,
497 ret = sa_enable_share(share, groupproto);
501 " share %s: %s\n"),
507 if ((ret = sa_proto_notify_resource(share,
509 ret = sa_enable_resource(share, groupproto);
536 sa_share_t share;
542 for (share = sa_get_share(group, NULL);
543 share != NULL;
544 share = sa_get_next_share(share)) {
546 (void) sa_update_legacy(share, updateproto);
548 notify_or_enable_share(share, proto);
550 (void) sa_enable_share(share, proto);
624 /* if itemdata != NULL then a single share */
651 * If the share is managed by ZFS, don't
908 * any share doesn't have at least one resource name, it isn't
914 sa_share_t share;
916 for (share = sa_get_share(group, NULL); share != NULL;
917 share = sa_get_next_share(share)) {
918 if (sa_get_share_resource(share, NULL) == NULL) {
930 * to construct an resource name (SMB share name) that is valid.
961 * in and SMB share name. Replace them with '_'.
1025 sa_share_t share;
1029 for (share = sa_get_share(group, NULL); share != NULL;
1030 share = sa_get_next_share(share)) {
1032 if (sa_get_share_resource(share, NULL) == NULL) {
1034 path = sa_get_share_attr(share, "path");
1039 while (sa_add_resource(share, path,
1433 sa_share_t share;
1543 share = sa_get_share(group, NULL);
1544 if (share != NULL)
1546 if (share == NULL || (share != NULL && force == 1)) {
1549 while (share != NULL) {
1551 next_share = sa_get_next_share(share);
1554 * each share, but don't
1558 ret = sa_disable_share(share, NULL);
1559 ret = sa_remove_share(share);
1560 share = next_share;
1618 for (share = sa_get_share(group, NULL);
1619 share != NULL;
1620 share = sa_get_next_share(share)) {
1621 (void) sa_delete_legacy(share, protocol);
1933 * get_resource(share)
1941 get_resource(sa_share_t share)
1947 if ((resource = sa_get_share_resource(share, NULL)) != NULL) {
1978 * has_resource_with_opt(share)
1980 * Check to see if the share has any resource names with optionsets
1985 has_resource_with_opt(sa_share_t share)
1990 for (resource = sa_get_share_resource(share, NULL);
2003 * has_multiple_resource(share)
2005 * Check to see if the share has multiple resource names since
2009 has_multiple_resource(sa_share_t share)
2014 for (num = 0, resource = sa_get_share_resource(share, NULL);
2025 * show_share(share, verbose, properties, proto, iszfs, sharepath)
2027 * print out the share information. With the addition of resource as a
2028 * full object that can have multiple instances below the share, we
2033 show_share(sa_share_t share, int verbose, int properties, char *proto,
2045 rsrcwithopt = has_resource_with_opt(share);
2049 type = sa_get_share_attr(share, "type");
2063 multiple = has_multiple_resource(share);
2066 * if there is a description on the share and there
2070 description = sa_get_share_description(share);
2071 resource = sa_get_share_resource(share, NULL);
2078 rsrcname = get_resource(share);
2092 drive = sa_get_share_attr(share, "drive-letter");
2100 show_properties(share, proto, "\t");
2101 exclude = sa_get_share_attr(share, "exclude");
2109 print_rsrc_desc((sa_resource_t)share, description);
2118 for (resource = sa_get_share_resource(share, NULL);
2154 show_properties(share, proto, "\t");
2169 sa_share_t share;
2193 share = sa_get_share(group, NULL);
2217 for (share = sa_get_share(group, NULL);
2218 share != NULL;
2219 share = sa_get_next_share(share)) {
2220 sharepath = sa_get_share_attr(share, "path");
2222 show_share(share, verbose, properties, proto,
2399 * enable_share(group, share, update_legacy)
2401 * helper function to enable a share if the group is enabled.
2405 enable_share(sa_handle_t handle, sa_group_t group, sa_share_t share,
2418 * need to enable this share if the group is enabled but not
2428 ret = sa_delete_legacy(share, NULL);
2437 * enable the share based on the protocol type. This
2441 isshare = sa_is_share(share);
2449 err = sa_enable_share(share, value);
2451 err = sa_enable_resource(share, value);
2455 share);
2464 "Failed to enable share for "
2471 * share so we can avoid breaking the loop we are in
2476 sa_share_t update = share;
2477 if (!sa_is_share(share)) {
2478 update = sa_get_resource_parent(share);
2525 * implements add-share subcommand.
2536 sa_share_t share;
2568 * Save share path into group. Currently limit
2569 * to one share per command.
2667 share = sa_find_share(handle, sharepath);
2668 if (share != NULL) {
2671 * Can only have a duplicate share if a new
2692 if (share == NULL && ret == SA_OK) {
2697 share = sa_add_share(group, sharepath,
2702 * share into a different group than it already is in.
2704 if (share != NULL) {
2706 parent = sa_get_parent_group(share);
2714 if (!dryrun && share == NULL) {
2716 "Could not add share: %s\n"),
2724 share,
2739 share,
2743 /* now enable the share(s) */
2754 share,
2802 * implements move-share subcommand.
2813 sa_share_t share;
2838 * Remove share path from group. Currently limit
2839 * to one share per command.
2905 share = sa_find_share(handle, sharepath);
2907 * If a share wasn't found, it may have been a symlink
2911 if (share == NULL) {
2919 share = sa_find_share(handle, sharepath);
2921 if (share == NULL) {
2928 parent = sa_get_parent_group(share);
2951 * Note that the share may need to be
2954 * share to update if the new group is
2964 (void) sa_disable_share(share, NULL);
2970 ret = sa_move_share(group, share);
2978 (void) enable_share(handle, group, share, 1);
2982 (void) printf(gettext("Could not move share: %s\n"),
2997 * implements remove-share subcommand.
3010 sa_share_t share = NULL;
3029 * Remove share path from group. Currently limit
3030 * to one share per command.
3042 * Remove share from group if last resource or remove
3043 * resource from share if multiple resources.
3115 "Resource name not found for share: %s\n"),
3129 share = sa_get_share(group, sharepath);
3131 share = sa_find_share(handle, sharepath);
3137 if (share == NULL)
3138 share = rsrcshare;
3139 else if (share != rsrcshare) {
3142 "Bad resource name for share: %s\n"),
3144 share = NULL;
3149 * If we didn't find the share with the provided path,
3155 * on the second attempt. Once a share is found, all
3156 * operations are based off of the share variable.
3158 if (share == NULL) {
3165 share = sa_get_share(group, dir);
3167 share = sa_find_share(handle, dir);
3176 * then disable the share and then remove it from the
3182 if (share == NULL) {
3192 group = sa_get_parent_group(share);
3199 ret = sa_disable_share(share, NULL);
3211 ret = sa_remove_share(share);
3222 * the share as well.
3226 share, NULL);
3229 share);
3236 (void) printf(gettext("Could not remove share:"
3258 * implements set-share subcommand.
3268 sa_share_t share = NULL;
3293 * Update share by resource name
3305 * Save share path into group. Currently limit
3306 * to one share per command.
3415 share = sa_find_share(handle, sharepath);
3419 share = sa_get_resource_parent(resource);
3423 if (share != NULL) {
3424 sharegroup = sa_get_parent_group(share);
3427 "share %s\n"),
3466 * must be on the share.
3475 ret = sa_set_share_description(share,
3615 * zfscheck(group, share)
3617 * For the special case where a share was provided, make sure it is a
3626 * for here is that the group is ZFS and the share is not the defining
3627 * share. All else is SA_OK.
3631 zfscheck(sa_group_t group, sa_share_t share)
3638 * The group is a ZFS group. Does the share represent
3640 * if the attribute "subgroup" exists on the share and
3645 attr = sa_get_share_attr(share, "subgroup");
3668 * an alias for the share.
3682 sa_share_t share = NULL;
3690 share = sa_get_share(group, sharepath);
3691 if (share == NULL) {
3698 ret = zfscheck(group, share);
3701 share = NULL;
3711 * the share if present else it belongs to the
3714 * use share only.
3717 if (share != NULL) {
3718 resource = sa_get_share_resource(share,
3725 share = sa_get_resource_parent(
3735 * "share" so it will all just work.
3739 share = (sa_share_t)resource;
3746 share == NULL ? group : share, NULL);
3748 if (share != NULL)
3749 change |= add_optionset(share, optlist,
3756 share, protocol);
3811 sa_share_t share = NULL;
3813 share = sa_get_share(group, sharepath);
3814 if (share == NULL) {
3821 ret = zfscheck(group, share);
3824 share = NULL;
3834 share == NULL ? group : share, sectype);
3836 if (share != NULL)
3837 change = add_security(share, sectype,
3848 worklist = add_list(worklist, group, share,
4205 sa_share_t share = NULL;
4217 share = sa_get_share(group, sharepath);
4218 if (share == NULL) {
4227 * the share if present else it belongs to the
4230 * use share only.
4233 if (share != NULL) {
4234 resource = sa_get_share_resource(share, rsrcname);
4240 share = sa_get_resource_parent(resource);
4250 * "share" so it will all just work.
4254 share = (sa_share_t)resource;
4260 ret = valid_unset(share != NULL ? share : group,
4263 if (share != NULL) {
4266 change |= remove_options(share, optlist,
4269 * If a share optionset is
4272 optionset = sa_get_optionset((sa_share_t)share,
4285 worklist = add_list(worklist, group, share,
4328 sa_share_t share = NULL;
4336 share = sa_get_share(group, sharepath);
4337 if (share == NULL) {
4344 ret = valid_unset_security(share != NULL ? share : group,
4349 if (share != NULL) {
4352 change = remove_security(share,
4355 /* If a share security is empty, remove it */
4356 optionset = sa_get_security((sa_group_t)share,
4475 * share if resource for this protocol doesn't use
4720 sa_share_t share;
4730 for (share = sa_get_share(group, NULL);
4731 share != NULL && ret == SA_OK;
4732 share = sa_get_next_share(share)) {
4733 ret = sa_disable_share(share, proto);
4737 * re-share it anyway so no error.
5170 * remove_all_options(share, proto)
5172 * Removes all options on a share.
5176 remove_all_options(sa_share_t share, char *proto)
5182 optionset = sa_get_optionset(share, proto);
5185 for (security = sa_get_security(share, NULL, NULL);
5220 * we get if sharemgr is called with the name "share" rather than
5261 * arguments. This implements full legacy share support for those
5287 * Display the share information in the format that the "share"
5294 sa_share_t share;
5299 * The original share command defaulted to displaying NFS
5318 for (share = sa_get_share(group, NULL);
5319 share != NULL;
5320 share = sa_get_next_share(share)) {
5331 sharedstate = sa_get_share_attr(share, "shared");
5332 path = sa_get_share_attr(share, "path");
5333 type = sa_get_share_attr(share, "type");
5334 resource = get_resource(share);
5341 description = sa_get_share_description(share);
5348 soptions = sa_get_share_attr(share, shareopts);
5354 soptions = sa_proto_legacy_format(proto, share, 1);
5391 * "share" command with no arguments.
5447 sa_share_t share;
5464 protocol, "share") == 0 &&
5510 /* display current info in share format */
5522 /* If still using legacy share/unshare, exec it */
5539 share = sa_find_share(handle, sharepath);
5541 share = NULL;
5552 * the zfs share will already be in that group so it
5563 * If the share exists (not NULL), then make sure it
5567 if (share != NULL) {
5568 group = sa_get_parent_group(share);
5591 if (share == NULL) {
5592 share = sa_add_share(group, sharepath,
5594 if (share == NULL &&
5611 share = sa_add_share(
5629 remove_all_options(share, protocol);
5630 type = sa_get_share_attr(share, "type");
5638 (void) sa_set_share_attr(share, "type",
5646 * actually care about it if this is share for
5650 * current share. If it doesn't exist, attempt
5657 if (share != sa_get_resource_parent(rsrc))
5660 rsrc = sa_add_resource(share, resource,
5664 share = rsrc;
5667 /* Have a group to hold this share path */
5670 ret = sa_parse_legacy_options(share,
5681 ret = sa_set_share_description(share,
5686 if (rsrc != share)
5687 ret = sa_enable_share(share, protocol);
5693 (void) sa_update_legacy(share,
5702 (void) fprintf(stderr, gettext("Could not share: %s: %s\n"),
5786 sa_share_t share;
5789 /* if still using legacy share/unshare, exec it */
5799 share = sa_find_share(handle, sharepath);
5800 if (share == NULL) {
5804 share = sa_find_share(handle, dir);
5807 if (share == NULL) {
5812 share = sa_get_resource_parent(resource);
5823 * share, we don't disable the share
5825 * need to remove the share. The
5829 resource = sa_get_share_resource(share, NULL);
5831 share = NULL;
5837 if (share != NULL && resource == NULL) {
5838 ret = sa_disable_share(share, protocol);
5842 * remove-share subcommand which may need the force
5845 * while "remove-share" might require the force option.
5848 ret = sa_remove_share(share);
5852 } else if (ret == SA_OK && share == NULL && resource == NULL) {
5854 * If both share and resource are NULL, then
5855 * share not found. If one or the other was
5883 {"add-share", 0, sa_addshare, USAGE_ADD_SHARE, SVC_SET},
5889 {"move-share", 0, sa_moveshare, USAGE_MOVE_SHARE, SVC_SET},
5890 {"remove-share", 0, sa_removeshare, USAGE_REMOVE_SHARE, SVC_SET},
5892 {"set-share", 0, sa_set_share, USAGE_SET_SHARE, SVC_SET},
5894 {"share", 0, sa_legacy_share, USAGE_SHARE, SVC_SET|SVC_ACTION},
5909 ret = gettext("add-share [-nth] [-r resource-name] "
5930 "move-share [-nvh] -s sharepath destination-group");
5934 "remove-share [-fnvh] {-s sharepath | -r resource} "
5947 ret = gettext("set-share [-nh] [-r resource] "
5954 ret = gettext("share [-F fstype] [-p] [-o optionlist]"