Lines Matching refs:zhp

255 	zfs_handle_t	*zhp;  in _be_mount()  local
290 if ((zhp = zfs_open(g_zfs, bt.obe_root_ds, ZFS_TYPE_FILESYSTEM)) == in _be_mount()
299 if (zfs_is_mounted(zhp, &mp)) { in _be_mount()
300 ZFS_CLOSE(zhp); in _be_mount()
311 if ((ret = fix_mountpoint(zhp)) != BE_SUCCESS) { in _be_mount()
314 ZFS_CLOSE(zhp); in _be_mount()
327 ZFS_CLOSE(zhp); in _be_mount()
341 if ((ret = be_mount_root(zhp, tmp_altroot)) != BE_SUCCESS) { in _be_mount()
346 ZFS_CLOSE(zhp); in _be_mount()
351 if ((ret = be_mount_zone_root(zhp, &md)) != BE_SUCCESS) { in _be_mount()
355 ZFS_CLOSE(zhp); in _be_mount()
361 if ((err = zfs_iter_filesystems(zhp, be_mount_callback, in _be_mount()
367 ZFS_CLOSE(zhp); in _be_mount()
390 if (be_mount_zones(zhp, &md) != BE_SUCCESS) { in _be_mount()
395 ZFS_CLOSE(zhp); in _be_mount()
428 zfs_handle_t *zhp; in _be_unmount() local
465 if ((zhp = zfs_open(g_zfs, bt.obe_root_ds, ZFS_TYPE_FILESYSTEM)) == in _be_unmount()
475 if (!zfs_is_mounted(zhp, &mp)) { in _be_unmount()
484 if ((ret = fix_mountpoint(zhp)) != BE_SUCCESS) { in _be_unmount()
487 ZFS_CLOSE(zhp); in _be_unmount()
491 ZFS_CLOSE(zhp); in _be_unmount()
500 if (zfs_prop_get(zhp, ZFS_PROP_MOUNTPOINT, mountpoint, in _be_unmount()
504 ZFS_CLOSE(zhp); in _be_unmount()
516 ZFS_CLOSE(zhp); in _be_unmount()
527 ZFS_CLOSE(zhp); in _be_unmount()
538 ZFS_CLOSE(zhp); in _be_unmount()
543 if ((zret = zfs_iter_filesystems(zhp, be_unmount_callback, in _be_unmount()
547 ZFS_CLOSE(zhp); in _be_unmount()
553 if ((ret = be_unmount_root(zhp, &ud)) != BE_SUCCESS) { in _be_unmount()
554 ZFS_CLOSE(zhp); in _be_unmount()
558 if ((ret = be_unmount_zone_root(zhp, &ud)) != BE_SUCCESS) { in _be_unmount()
559 ZFS_CLOSE(zhp); in _be_unmount()
564 ZFS_CLOSE(zhp); in _be_unmount()
582 be_mount_zone_root(zfs_handle_t *zhp, be_mount_data_t *md) in be_mount_zone_root() argument
589 if (zfs_prop_get(zhp, ZFS_PROP_MOUNTPOINT, mountpoint, in be_mount_zone_root()
592 "get mountpoint property for %s: %s\n"), zfs_get_name(zhp), in be_mount_zone_root()
631 if (mount(zfs_get_name(zhp), md->altroot, MS_OVERLAY, MNTTYPE_ZFS, in be_mount_zone_root()
636 zfs_get_name(zhp), md->altroot); in be_mount_zone_root()
656 be_unmount_zone_root(zfs_handle_t *zhp, be_unmount_data_t *ud) in be_unmount_zone_root() argument
661 if (zfs_unmount(zhp, NULL, ud->force ? MS_FORCE : 0) != 0) { in be_unmount_zone_root()
663 "unmount zone root dataset %s: %s\n"), zfs_get_name(zhp), in be_unmount_zone_root()
669 if (zfs_prop_get(zhp, ZFS_PROP_MOUNTPOINT, mountpoint, in be_unmount_zone_root()
673 zfs_get_name(zhp), libzfs_error_description(g_zfs)); in be_unmount_zone_root()
679 if (zfs_prop_set(zhp, zfs_prop_to_name(ZFS_PROP_MOUNTPOINT), in be_unmount_zone_root()
683 "%s to 'legacy': %s\n"), zfs_get_name(zhp), in be_unmount_zone_root()
721 zfs_handle_t *zhp = NULL; in be_get_legacy_fs() local
731 if ((zhp = zfs_open(g_zfs, be_root_ds, ZFS_TYPE_FILESYSTEM)) in be_get_legacy_fs()
741 if (!zfs_is_mounted(zhp, &fld->altroot)) { in be_get_legacy_fs()
768 ZFS_CLOSE(zhp); in be_get_legacy_fs()
771 if ((zhp = zfs_open(g_zfs, zoneroot_ds, in be_get_legacy_fs()
781 if (!zfs_is_mounted(zhp, &zone_md.altroot)) { in be_get_legacy_fs()
794 if ((ret = be_mount_zone_root(zhp, &zone_md)) in be_get_legacy_fs()
814 if (get_mountpoint_from_vfstab(fld->altroot, zfs_get_name(zhp), in be_get_legacy_fs()
817 if (add_to_fs_list(fld, zfs_get_name(zhp)) in be_get_legacy_fs()
821 zfs_get_name(zhp)); in be_get_legacy_fs()
829 if ((ret = zfs_iter_filesystems(zhp, be_get_legacy_fs_callback, in be_get_legacy_fs()
833 zfs_get_name(zhp)); in be_get_legacy_fs()
843 if ((err = be_unmount_zone_root(zhp, &zone_ud)) != BE_SUCCESS) { in be_get_legacy_fs()
862 ZFS_CLOSE(zhp); in be_get_legacy_fs()
1003 zfs_handle_t *zhp, in be_mount_pool() argument
1016 if (!zfs_is_mounted(zhp, NULL)) { in be_mount_pool()
1017 if (zfs_mount(zhp, NULL, 0) != 0) { in be_mount_pool()
1018 if (zfs_prop_get(zhp, ZFS_PROP_MOUNTPOINT, mountpoint, in be_mount_pool()
1022 zfs_get_name(zhp), in be_mount_pool()
1043 if (zfs_prop_set(zhp, in be_mount_pool()
1048 "%s: %s\n"), zfs_get_name(zhp), in be_mount_pool()
1058 if (zfs_mount(zhp, NULL, 0) != 0) { in be_mount_pool()
1061 zfs_get_name(zhp), *tmp_mntpnt, in be_mount_pool()
1064 if (zfs_prop_set(zhp, in be_mount_pool()
1070 zfs_get_name(zhp), *tmp_mntpnt, in be_mount_pool()
1107 zfs_handle_t *zhp, in be_unmount_pool() argument
1111 if (zfs_unmount(zhp, NULL, 0) != 0) { in be_unmount_pool()
1113 "unmount pool (%s): %s\n"), zfs_get_name(zhp), in be_unmount_pool()
1122 if (zfs_prop_set(zhp, in be_unmount_pool()
1127 "%s: %s\n"), zfs_get_name(zhp), orig_mntpnt, in be_unmount_pool()
1155 be_mount_callback(zfs_handle_t *zhp, void *data) in be_mount_callback() argument
1158 const char *fs_name = zfs_get_name(zhp); in be_mount_callback()
1166 if (zfs_prop_get(zhp, ZFS_PROP_MOUNTPOINT, zhp_mountpoint, in be_mount_callback()
1172 ZFS_CLOSE(zhp); in be_mount_callback()
1180 if (zfs_prop_set(zhp, zfs_prop_to_name(ZFS_PROP_CANMOUNT), "noauto")) { in be_mount_callback()
1183 ZFS_CLOSE(zhp); in be_mount_callback()
1236 if (mount_zfs(zhp, altroot) != 0) { in be_mount_callback()
1240 ZFS_CLOSE(zhp); in be_mount_callback()
1246 if ((ret = zfs_iter_filesystems(zhp, be_mount_callback, in be_mount_callback()
1248 ZFS_CLOSE(zhp); in be_mount_callback()
1253 ZFS_CLOSE(zhp); in be_mount_callback()
1272 be_unmount_callback(zfs_handle_t *zhp, void *data) in be_unmount_callback() argument
1276 const char *fs_name = zfs_get_name(zhp); in be_unmount_callback()
1283 if (zfs_iter_filesystems(zhp, be_unmount_callback, ud)) { in be_unmount_callback()
1289 if (!zfs_is_mounted(zhp, NULL)) in be_unmount_callback()
1293 if (zfs_unmount(zhp, NULL, ud->force ? MS_FORCE : 0) != 0) { in be_unmount_callback()
1302 if (zfs_prop_get(zhp, ZFS_PROP_MOUNTPOINT, mountpoint, in be_unmount_callback()
1346 if (zfs_prop_set(zhp, in be_unmount_callback()
1374 if (zfs_prop_set(zhp, zfs_prop_to_name(ZFS_PROP_CANMOUNT), "noauto")) { in be_unmount_callback()
1381 ZFS_CLOSE(zhp); in be_unmount_callback()
1402 be_get_legacy_fs_callback(zfs_handle_t *zhp, void *data) in be_get_legacy_fs_callback() argument
1405 const char *fs_name = zfs_get_name(zhp); in be_get_legacy_fs_callback()
1411 if (zfs_prop_get(zhp, ZFS_PROP_MOUNTPOINT, zhp_mountpoint, in be_get_legacy_fs_callback()
1417 ZFS_CLOSE(zhp); in be_get_legacy_fs_callback()
1437 if (add_to_fs_list(fld, zfs_get_name(zhp)) != BE_SUCCESS) { in be_get_legacy_fs_callback()
1440 ZFS_CLOSE(zhp); in be_get_legacy_fs_callback()
1447 if ((ret = zfs_iter_filesystems(zhp, be_get_legacy_fs_callback, in be_get_legacy_fs_callback()
1449 ZFS_CLOSE(zhp); in be_get_legacy_fs_callback()
1452 ZFS_CLOSE(zhp); in be_get_legacy_fs_callback()
1512 zfs_handle_t *zhp = NULL; in zpool_shared_fs_callback() local
1519 if ((zhp = zfs_open(g_zfs, zpool, ZFS_TYPE_FILESYSTEM)) == NULL) { in zpool_shared_fs_callback()
1529 (void) loopback_mount_shared_fs(zhp, md); in zpool_shared_fs_callback()
1532 (void) zfs_iter_filesystems(zhp, iter_shared_fs_callback, md); in zpool_shared_fs_callback()
1534 ZFS_CLOSE(zhp); in zpool_shared_fs_callback()
1564 iter_shared_fs_callback(zfs_handle_t *zhp, void *data) in iter_shared_fs_callback() argument
1567 const char *name = zfs_get_name(zhp); in iter_shared_fs_callback()
1584 ZFS_CLOSE(zhp); in iter_shared_fs_callback()
1591 ZFS_CLOSE(zhp); in iter_shared_fs_callback()
1596 (void) loopback_mount_shared_fs(zhp, md); in iter_shared_fs_callback()
1599 (void) zfs_iter_filesystems(zhp, iter_shared_fs_callback, md); in iter_shared_fs_callback()
1600 ZFS_CLOSE(zhp); in iter_shared_fs_callback()
1624 loopback_mount_shared_fs(zfs_handle_t *zhp, be_mount_data_t *md) in loopback_mount_shared_fs() argument
1637 if (zfs_is_mounted(zhp, &mp) && (getzoneid() != GLOBAL_ZONEID || in loopback_mount_shared_fs()
1638 !zfs_prop_get_int(zhp, ZFS_PROP_ZONED))) { in loopback_mount_shared_fs()
1644 if (zfs_prop_get(zhp, ZFS_PROP_MOUNTPOINT, in loopback_mount_shared_fs()
2007 fix_mountpoint_callback(zfs_handle_t *zhp, void *data) in fix_mountpoint_callback() argument
2017 if (zfs_prop_get(zhp, ZFS_PROP_MOUNTPOINT, mountpoint, in fix_mountpoint_callback()
2022 zfs_get_name(zhp)); in fix_mountpoint_callback()
2023 ZFS_CLOSE(zhp); in fix_mountpoint_callback()
2049 if (zfs_prop_set(zhp, in fix_mountpoint_callback()
2054 "%s: %s\n"), zfs_get_name(zhp), in fix_mountpoint_callback()
2058 ZFS_CLOSE(zhp); in fix_mountpoint_callback()
2065 if ((ret = zfs_iter_filesystems(zhp, fix_mountpoint_callback, in fix_mountpoint_callback()
2067 ZFS_CLOSE(zhp); in fix_mountpoint_callback()
2072 ZFS_CLOSE(zhp); in fix_mountpoint_callback()
2091 be_mount_root(zfs_handle_t *zhp, char *altroot) in be_mount_root() argument
2096 if (zfs_prop_get(zhp, ZFS_PROP_MOUNTPOINT, mountpoint, in be_mount_root()
2099 "get mountpoint property for %s: %s\n"), zfs_get_name(zhp), in be_mount_root()
2108 if (zfs_prop_set(zhp, zfs_prop_to_name(ZFS_PROP_CANMOUNT), "noauto") in be_mount_root()
2112 zfs_get_name(zhp), libzfs_error_description(g_zfs)); in be_mount_root()
2117 if (mount_zfs(zhp, altroot) != 0) { in be_mount_root()
2119 "mount dataset %s at %s: %s\n"), zfs_get_name(zhp), in be_mount_root()
2148 be_unmount_root(zfs_handle_t *zhp, be_unmount_data_t *ud) in be_unmount_root() argument
2154 if (get_mountpoint_from_vfstab(ud->altroot, zfs_get_name(zhp), in be_unmount_root()
2161 if (zfs_unmount(zhp, NULL, ud->force ? MS_FORCE : 0) != 0) { in be_unmount_root()
2163 "unmount BE root dataset %s: %s\n"), zfs_get_name(zhp), in be_unmount_root()
2169 if (zfs_prop_set(zhp, zfs_prop_to_name(ZFS_PROP_CANMOUNT), "noauto") in be_unmount_root()
2173 zfs_get_name(zhp), libzfs_error_description(g_zfs)); in be_unmount_root()
2181 if (zfs_prop_set(zhp, zfs_prop_to_name(ZFS_PROP_MOUNTPOINT), in be_unmount_root()
2184 "set mountpoint of %s to %s\n"), zfs_get_name(zhp), in be_unmount_root()
2210 fix_mountpoint(zfs_handle_t *zhp) in fix_mountpoint() argument
2221 if (zfs_prop_get(zhp, ZFS_PROP_MOUNTPOINT, mountpoint, in fix_mountpoint()
2224 "mountpoint property of (%s): %s\n"), zfs_get_name(zhp), in fix_mountpoint()
2241 if (zfs_iter_filesystems(zhp, fix_mountpoint_callback, mountpoint) in fix_mountpoint()
2261 if ((ret = be_mount_root(zhp, altroot)) != BE_SUCCESS) { in fix_mountpoint()
2267 if ((ret = be_unmount_root(zhp, &ud)) != BE_SUCCESS) { in fix_mountpoint()
2656 be_get_ds_from_dir_callback(zfs_handle_t *zhp, void *data) in be_get_ds_from_dir_callback() argument
2662 if (zfs_get_type(zhp) != ZFS_TYPE_FILESYSTEM) { in be_get_ds_from_dir_callback()
2663 ZFS_CLOSE(zhp); in be_get_ds_from_dir_callback()
2667 if (zfs_is_mounted(zhp, &mp) && mp != NULL && in be_get_ds_from_dir_callback()
2669 if ((dd->ds = strdup(zfs_get_name(zhp))) == NULL) { in be_get_ds_from_dir_callback()
2672 ZFS_CLOSE(zhp); in be_get_ds_from_dir_callback()
2675 ZFS_CLOSE(zhp); in be_get_ds_from_dir_callback()
2679 zret = zfs_iter_filesystems(zhp, be_get_ds_from_dir_callback, dd); in be_get_ds_from_dir_callback()
2681 ZFS_CLOSE(zhp); in be_get_ds_from_dir_callback()
2701 mount_zfs(zfs_handle_t *zhp, char *altroot) in mount_zfs() argument
2714 if (zfs_prop_get(zhp, ZFS_PROP_MOUNTPOINT, mountpoint, in mount_zfs()
2719 zfs_get_name(zhp)); in mount_zfs()
2720 ZFS_CLOSE(zhp); in mount_zfs()
2736 if (zpool_get_prop_int(zfs_get_pool_handle(zhp), ZPOOL_PROP_READONLY, in mount_zfs()
2745 zfs_get_name(zhp)); in mount_zfs()
2746 ZFS_CLOSE(zhp); in mount_zfs()
2751 if (mount(zfs_get_name(zhp), real_mountpoint, MS_OPTIONSTR | flags, in mount_zfs()
2754 "mount dataset %s at %s\n"), zfs_get_name(zhp), in mount_zfs()