Lines Matching defs:zhp
220 zfs_is_mounted(zfs_handle_t *zhp, char **where)
222 return (is_mounted(zhp->zfs_hdl, zfs_get_name(zhp), where));
230 zfs_is_mountable(zfs_handle_t *zhp, char *buf, size_t buflen,
236 if (!zfs_prop_valid_for_type(ZFS_PROP_MOUNTPOINT, zhp->zfs_type))
239 verify(zfs_prop_get(zhp, ZFS_PROP_MOUNTPOINT, buf, buflen,
246 if (zfs_prop_get_int(zhp, ZFS_PROP_CANMOUNT) == ZFS_CANMOUNT_OFF)
249 if (zfs_prop_get_int(zhp, ZFS_PROP_ZONED) &&
263 zfs_mount(zfs_handle_t *zhp, const char *options, int flags)
268 libzfs_handle_t *hdl = zhp->zfs_hdl;
278 if (zpool_get_prop_int(zhp->zpool_hdl, ZPOOL_PROP_READONLY, NULL))
281 if (!zfs_is_mountable(zhp, mountpoint, sizeof (mountpoint), NULL))
311 if (mount(zfs_get_name(zhp), mountpoint, MS_OPTIONSTR | flags,
328 VERIFY(zfs_spa_version(zhp, &spa_version) == 0);
333 (u_longlong_t)zfs_prop_get_int(zhp,
341 zhp->zfs_name));
345 libzfs_mnttab_add(hdl, zfs_get_name(zhp), mountpoint,
370 zfs_unmount(zfs_handle_t *zhp, const char *mountpoint, int flags)
372 libzfs_handle_t *hdl = zhp->zfs_hdl;
377 if (mountpoint != NULL || ((zfs_get_type(zhp) == ZFS_TYPE_FILESYSTEM) &&
378 libzfs_mnttab_find(hdl, zhp->zfs_name, &entry) == 0)) {
393 if (zfs_unshare_proto(zhp, mntpt, share_all_proto) != 0)
398 (void) zfs_shareall(zhp);
401 libzfs_mnttab_remove(hdl, zhp->zfs_name);
414 zfs_unmountall(zfs_handle_t *zhp, int flags)
419 clp = changelist_gather(zhp, ZFS_PROP_MOUNTPOINT, 0, flags);
430 zfs_is_shared(zfs_handle_t *zhp)
435 if (ZFS_IS_VOLUME(zhp))
440 rc |= zfs_is_shared_proto(zhp, NULL, *curr_proto);
446 zfs_share(zfs_handle_t *zhp)
448 assert(!ZFS_IS_VOLUME(zhp));
449 return (zfs_share_proto(zhp, share_all_proto));
453 zfs_unshare(zfs_handle_t *zhp)
455 assert(!ZFS_IS_VOLUME(zhp));
456 return (zfs_unshareall(zhp));
463 zfs_is_shared_proto(zfs_handle_t *zhp, char **where, zfs_share_proto_t proto)
468 if (!zfs_is_mounted(zhp, &mountpoint))
471 if (rc = is_shared(zhp->zfs_hdl, mountpoint, proto)) {
484 zfs_is_shared_nfs(zfs_handle_t *zhp, char **where)
486 return (zfs_is_shared_proto(zhp, where,
491 zfs_is_shared_smb(zfs_handle_t *zhp, char **where)
493 return (zfs_is_shared_proto(zhp, where,
706 zfs_share_proto(zfs_handle_t *zhp, zfs_share_proto_t *proto)
711 libzfs_handle_t *hdl = zhp->zfs_hdl;
717 if (!zfs_is_mountable(zhp, mountpoint, sizeof (mountpoint), NULL))
724 if (zfs_prop_get(zhp, proto_table[*curr_proto].p_prop,
734 zfs_get_name(zhp), _sa_errorstr != NULL ?
745 if (zfs_prop_get_int(zhp, ZFS_PROP_ZONED))
762 shareopts, sourcestr, zhp->zfs_name) != SA_OK) {
766 zfs_get_name(zhp));
781 zfs_get_name(zhp));
788 zfs_get_name(zhp));
798 zfs_share_nfs(zfs_handle_t *zhp)
800 return (zfs_share_proto(zhp, nfs_only));
804 zfs_share_smb(zfs_handle_t *zhp)
806 return (zfs_share_proto(zhp, smb_only));
810 zfs_shareall(zfs_handle_t *zhp)
812 return (zfs_share_proto(zhp, share_all_proto));
862 zfs_unshare_proto(zfs_handle_t *zhp, const char *mountpoint,
865 libzfs_handle_t *hdl = zhp->zfs_hdl;
870 rewind(zhp->zfs_hdl->libzfs_mnttab);
874 if (mountpoint != NULL || ((zfs_get_type(zhp) == ZFS_TYPE_FILESYSTEM) &&
875 libzfs_mnttab_find(hdl, zfs_get_name(zhp), &entry) == 0)) {
879 mntpt = zfs_strdup(zhp->zfs_hdl, entry.mnt_mountp);
885 unshare_one(hdl, zhp->zfs_name,
900 zfs_unshare_nfs(zfs_handle_t *zhp, const char *mountpoint)
902 return (zfs_unshare_proto(zhp, mountpoint, nfs_only));
906 zfs_unshare_smb(zfs_handle_t *zhp, const char *mountpoint)
908 return (zfs_unshare_proto(zhp, mountpoint, smb_only));
915 zfs_unshareall_proto(zfs_handle_t *zhp, zfs_share_proto_t *proto)
920 clp = changelist_gather(zhp, ZFS_PROP_SHARENFS, 0, 0);
931 zfs_unshareall_nfs(zfs_handle_t *zhp)
933 return (zfs_unshareall_proto(zhp, nfs_only));
937 zfs_unshareall_smb(zfs_handle_t *zhp)
939 return (zfs_unshareall_proto(zhp, smb_only));
943 zfs_unshareall(zfs_handle_t *zhp)
945 return (zfs_unshareall_proto(zhp, share_all_proto));
949 zfs_unshareall_bypath(zfs_handle_t *zhp, const char *mountpoint)
951 return (zfs_unshare_proto(zhp, mountpoint, share_all_proto));
966 remove_mountpoint(zfs_handle_t *zhp)
971 if (!zfs_is_mountable(zhp, mountpoint, sizeof (mountpoint),
988 libzfs_add_handle(get_all_cb_t *cbp, zfs_handle_t *zhp)
995 ptr = zfs_realloc(zhp->zfs_hdl,
1001 cbp->cb_handles[cbp->cb_used++] = zhp;
1005 mount_cb(zfs_handle_t *zhp, void *data)
1009 if (!(zfs_get_type(zhp) & ZFS_TYPE_FILESYSTEM)) {
1010 zfs_close(zhp);
1014 if (zfs_prop_get_int(zhp, ZFS_PROP_CANMOUNT) == ZFS_CANMOUNT_NOAUTO) {
1015 zfs_close(zhp);
1023 if (zfs_prop_get_int(zhp, ZFS_PROP_INCONSISTENT) &&
1024 zfs_prop_get(zhp, ZFS_PROP_RECEIVE_RESUME_TOKEN,
1026 zfs_close(zhp);
1030 libzfs_add_handle(cbp, zhp);
1031 if (zfs_iter_filesystems(zhp, mount_cb, cbp) != 0) {
1032 zfs_close(zhp);
1075 zpool_enable_datasets(zpool_handle_t *zhp, const char *mntopts, int flags)
1078 libzfs_handle_t *hdl = zhp->zpool_hdl;
1086 if ((zfsp = zfs_open(hdl, zhp->zpool_name, ZFS_TYPE_DATASET)) == NULL)
1102 if ((good = zfs_alloc(zhp->zpool_hdl,
1154 zpool_disable_datasets(zpool_handle_t *zhp, boolean_t force)
1161 libzfs_handle_t *hdl = zhp->zpool_hdl;
1166 namelen = strlen(zhp->zpool_name);
1182 strncmp(entry.mnt_special, zhp->zpool_name, namelen) != 0 ||