Lines Matching refs:zhp
79 match_mountpoint(zfs_handle_t *zhp, void *data) in match_mountpoint() argument
85 if (zfs_get_type(zhp) != ZFS_TYPE_FILESYSTEM) { in match_mountpoint()
86 zfs_close(zhp); in match_mountpoint()
91 if (zfs_prop_get(zhp, ZFS_PROP_MOUNTED, mp, sizeof (mp), NULL, NULL, in match_mountpoint()
93 zfs_close(zhp); in match_mountpoint()
98 if (zfs_prop_get(zhp, ZFS_PROP_MOUNTPOINT, mp, sizeof (mp), NULL, NULL, in match_mountpoint()
100 zfs_close(zhp); in match_mountpoint()
112 nm = zfs_get_name(zhp); in match_mountpoint()
114 zfs_close(zhp); in match_mountpoint()
123 cbp->match_handle = zhp; in match_mountpoint()
132 cbp->match_handle = zhp; in match_mountpoint()
137 res = zfs_iter_filesystems(zhp, match_mountpoint, data); in match_mountpoint()
138 zfs_close(zhp); in match_mountpoint()
227 get_snap_max(zfs_handle_t *zhp, void *data) in get_snap_max() argument
232 if (zfs_get_type(zhp) != ZFS_TYPE_SNAPSHOT) { in get_snap_max()
233 zfs_close(zhp); in get_snap_max()
239 if (strncmp(zfs_get_name(zhp), cbp->match_name, cbp->len) == 0) { in get_snap_max()
244 nump = (char *)(zfs_get_name(zhp) + cbp->len); in get_snap_max()
250 res = zfs_iter_snapshots(zhp, get_snap_max, data); in get_snap_max()
251 zfs_close(zhp); in get_snap_max()
259 take_snapshot(zfs_handle_t *zhp, char *snapshot_name, int snap_size, in take_snapshot() argument
272 zfs_get_name(zhp)) >= sizeof (template)) in take_snapshot()
279 if (zfs_iter_snapshots(zhp, get_snap_max, &cb) != 0) in take_snapshot()
285 zfs_get_name(zhp), cb.max) >= snap_size) in take_snapshot()
365 zfs_handle_t *zhp; in clone_snap() local
369 if ((zhp = zfs_open(g_zfs, snapshot_name, ZFS_TYPE_SNAPSHOT)) == NULL) in clone_snap()
391 err = zfs_clone(zhp, zonepath, props); in clone_snap()
392 zfs_close(zhp); in clone_snap()
456 zfs_handle_t *zhp; in path2name() local
487 if ((zhp = mount2zhandle(dname)) == NULL) { in path2name()
497 res = snprintf(zfs_name, len, "%s/%s", zfs_get_name(zhp), bname); in path2name()
501 zfs_close(zhp); in path2name()
514 has_dependent(zfs_handle_t *zhp, void *data) in has_dependent() argument
516 zfs_close(zhp); in has_dependent()
530 zfs_handle_t *zhp; in snap2path() local
538 zhp = zfs_open(g_zfs, snap_name, ZFS_TYPE_DATASET); in snap2path()
540 if (zhp == NULL) in snap2path()
544 if (zfs_prop_get(zhp, ZFS_PROP_MOUNTPOINT, mp, sizeof (mp), NULL, NULL, in snap2path()
546 zfs_close(zhp); in snap2path()
549 zfs_close(zhp); in snap2path()
563 get_direct_clone(zfs_handle_t *zhp, void *data) in get_direct_clone() argument
569 if (zfs_get_type(zhp) != ZFS_TYPE_FILESYSTEM) { in get_direct_clone()
570 zfs_close(zhp); in get_direct_clone()
574 (void) strlcpy(ds_path, zfs_get_name(zhp), sizeof (ds_path)); in get_direct_clone()
577 if (zfs_prop_get(zhp, ZFS_PROP_ORIGIN, origin, sizeof (origin), NULL, in get_direct_clone()
579 zfs_close(zhp); in get_direct_clone()
586 cd->clone_zhp = zhp; in get_direct_clone()
597 find_clone(zfs_handle_t *zhp, void *data) in find_clone() argument
604 if (zfs_prop_get_int(zhp, ZFS_PROP_NUMCLONES) == 0) { in find_clone()
605 zfs_close(zhp); in find_clone()
609 cd->snapshot = zfs_get_name(zhp); in find_clone()
612 snap_creation = (time_t)zfs_prop_get_int(zhp, ZFS_PROP_CREATION); in find_clone()
624 if ((zret = zfs_iter_dependents(zhp, B_FALSE, get_direct_clone, in find_clone()
626 zfs_close(zhp); in find_clone()
637 zfs_close(zhp); in find_clone()
647 rm_snap(zfs_handle_t *zhp, void *data) in rm_snap() argument
650 if (zfs_prop_get_int(zhp, ZFS_PROP_NUMCLONES) != 0) { in rm_snap()
651 zfs_close(zhp); in rm_snap()
655 if (zfs_unmount(zhp, NULL, 0) == 0) { in rm_snap()
656 (void) zfs_destroy(zhp, B_FALSE); in rm_snap()
659 zfs_close(zhp); in rm_snap()
667 rename_snap(zfs_handle_t *zhp, void *data) in rename_snap() argument
682 zfs_close(zhp); in rename_snap()
686 if (zfs_get_type(zhp) != ZFS_TYPE_SNAPSHOT) { in rename_snap()
687 zfs_close(zhp); in rename_snap()
692 if (strncmp(zfs_get_name(zhp), cbp->match_name, cbp->len) != 0) { in rename_snap()
693 zfs_close(zhp); in rename_snap()
700 res = (zfs_rename(zhp, template, B_FALSE, B_FALSE) != 0); in rename_snap()
703 "to %s: %s\n"), zfs_get_name(zhp), template, in rename_snap()
708 zfs_close(zhp); in rename_snap()
785 promote_all_clones(zfs_handle_t *zhp) in promote_all_clones() argument
794 if (zfs_iter_snapshots(zhp, find_clone, &cd) != 0) { in promote_all_clones()
795 zfs_close(zhp); in promote_all_clones()
804 if (promote_clone(zhp, cd.clone_zhp) != 0) { in promote_all_clones()
806 zfs_close(zhp); in promote_all_clones()
811 (void) strlcpy(nm, zfs_get_name(zhp), sizeof (nm)); in promote_all_clones()
812 zfs_close(zhp); in promote_all_clones()
813 if ((zhp = zfs_open(g_zfs, nm, ZFS_TYPE_FILESYSTEM)) == NULL) in promote_all_clones()
893 zfs_handle_t *zhp; in clone_zfs() local
901 if ((zhp = mount2zhandle(source_zonepath)) == NULL) in clone_zfs()
909 zfs_close(zhp); in clone_zfs()
930 zfs_close(zhp); in clone_zfs()
934 if (take_snapshot(zhp, snap_name, sizeof (snap_name), presnapbuf, in clone_zfs()
936 zfs_close(zhp); in clone_zfs()
939 zfs_close(zhp); in clone_zfs()
943 if ((zhp = zfs_open(g_zfs, snap_name, ZFS_TYPE_SNAPSHOT)) in clone_zfs()
945 if (zfs_unmount(zhp, NULL, 0) == 0) in clone_zfs()
946 (void) zfs_destroy(zhp, B_FALSE); in clone_zfs()
947 zfs_close(zhp); in clone_zfs()
968 zfs_handle_t *zhp; in create_zfs_zonepath() local
976 if ((zhp = zfs_open(g_zfs, zfs_name, ZFS_TYPE_DATASET)) != NULL) { in create_zfs_zonepath()
977 zfs_close(zhp); in create_zfs_zonepath()
998 (zhp = zfs_open(g_zfs, zfs_name, ZFS_TYPE_DATASET)) == NULL) { in create_zfs_zonepath()
1007 if (zfs_mount(zhp, NULL, 0) != 0) { in create_zfs_zonepath()
1010 (void) zfs_destroy(zhp, B_FALSE); in create_zfs_zonepath()
1023 zfs_close(zhp); in create_zfs_zonepath()
1035 zfs_handle_t *zhp; in destroy_zfs() local
1039 if ((zhp = mount2zhandle(zonepath)) == NULL) in destroy_zfs()
1042 if (promote_all_clones(zhp) != 0) in destroy_zfs()
1046 if (zfs_iter_snapshots(zhp, rm_snap, NULL) != 0) { in destroy_zfs()
1047 zfs_close(zhp); in destroy_zfs()
1055 if (zfs_iter_dependents(zhp, B_TRUE, has_dependent, NULL) != 0) { in destroy_zfs()
1057 "dataset still has dependents\n"), zfs_get_name(zhp)); in destroy_zfs()
1058 zfs_close(zhp); in destroy_zfs()
1066 if (zfs_prop_get(zhp, ZFS_PROP_ORIGIN, origin, sizeof (origin), NULL, in destroy_zfs()
1070 if (zfs_unmount(zhp, NULL, 0) != 0) { in destroy_zfs()
1072 zfs_get_name(zhp), libzfs_error_description(g_zfs)); in destroy_zfs()
1073 zfs_close(zhp); in destroy_zfs()
1077 if (zfs_destroy(zhp, B_FALSE) != 0) { in destroy_zfs()
1084 zfs_get_name(zhp), libzfs_error_description(g_zfs)); in destroy_zfs()
1085 (void) zfs_mount(zhp, NULL, 0); in destroy_zfs()
1086 zfs_close(zhp); in destroy_zfs()
1115 zfs_close(zhp); in destroy_zfs()
1163 zfs_handle_t *zhp; in move_zfs() local
1165 if ((zhp = mount2zhandle(zonepath)) == NULL) in move_zfs()
1168 if (zfs_prop_set(zhp, zfs_prop_to_name(ZFS_PROP_MOUNTPOINT), in move_zfs()
1178 zfs_close(zhp); in move_zfs()
1197 zfs_handle_t *zhp; in verify_datasets() local
1214 if ((zhp = zfs_open(g_zfs, dstab.zone_dataset_name, in verify_datasets()
1223 if (zfs_prop_get(zhp, ZFS_PROP_MOUNTPOINT, propbuf, in verify_datasets()
1231 zfs_close(zhp); in verify_datasets()
1235 zfs_close(zhp); in verify_datasets()
1249 zfs_handle_t *zhp; in verify_fs_zfs() local
1252 if ((zhp = zfs_open(g_zfs, fstab->zone_fs_special, in verify_fs_zfs()
1260 if (zfs_get_type(zhp) != ZFS_TYPE_FILESYSTEM) { in verify_fs_zfs()
1264 zfs_close(zhp); in verify_fs_zfs()
1268 if (zfs_prop_get(zhp, ZFS_PROP_MOUNTPOINT, propbuf, sizeof (propbuf), in verify_fs_zfs()
1273 zfs_close(zhp); in verify_fs_zfs()
1277 zfs_close(zhp); in verify_fs_zfs()
1364 zfs_handle_t *zhp; in get_zfs_non_legacy_mountpoint() local
1370 if ((zhp = zfs_open(g_zfs, dataset_name, ZFS_TYPE_DATASET)) == NULL) { in get_zfs_non_legacy_mountpoint()
1374 if (zfs_prop_get(zhp, ZFS_PROP_MOUNTPOINT, propbuf, sizeof (propbuf), in get_zfs_non_legacy_mountpoint()
1376 zfs_close(zhp); in get_zfs_non_legacy_mountpoint()
1380 zfs_close(zhp); in get_zfs_non_legacy_mountpoint()
1542 zfs_handle_t *zhp; in zone_mount_rootfs() local
1544 if ((zhp = zfs_open(g_zfs, mtab->mnt_special, in zone_mount_rootfs()
1550 if (zfs_prop_set(zhp, zfs_prop_to_name(ZFS_PROP_MOUNTPOINT), in zone_mount_rootfs()
1554 zfs_close(zhp); in zone_mount_rootfs()
1557 if (zfs_mount(zhp, mtab->mnt_mntopts, 0) != 0) { in zone_mount_rootfs()
1560 if (zfs_prop_set(zhp, in zone_mount_rootfs()
1565 zfs_close(zhp); in zone_mount_rootfs()
1568 zfs_close(zhp); in zone_mount_rootfs()
1632 zfs_handle_t *zhp; in zone_unmount_rootfs() local
1634 if ((zhp = zfs_open(g_zfs, mtab->mnt_special, in zone_unmount_rootfs()
1640 if (zfs_unmount(zhp, zoneroot, 0) != 0) { in zone_unmount_rootfs()
1641 if (force && zfs_unmount(zhp, zoneroot, MS_FORCE) == in zone_unmount_rootfs()
1643 zfs_close(zhp); in zone_unmount_rootfs()
1648 zfs_close(zhp); in zone_unmount_rootfs()
1651 zfs_close(zhp); in zone_unmount_rootfs()