Lines Matching refs:bt
104 be_transaction_data_t bt = { 0 }; in be_init() local
122 if (nvlist_lookup_string(be_attrs, BE_ATTR_NEW_BE_NAME, &bt.nbe_name) in be_init()
130 if (!be_valid_be_name(bt.nbe_name)) { in be_init()
132 bt.nbe_name); in be_init()
137 if (nvlist_lookup_string(be_attrs, BE_ATTR_NEW_BE_POOL, &bt.nbe_zpool) in be_init()
177 if ((zlp = zpool_open(g_zfs, bt.nbe_zpool)) == NULL) { in be_init()
179 "find existing zpool (%s): %s\n"), bt.nbe_zpool, in be_init()
189 if (!be_create_container_ds(bt.nbe_zpool)) in be_init()
195 if ((zret = zpool_iter(g_zfs, be_exists_callback, bt.nbe_name)) > 0) { in be_init()
197 bt.nbe_name); in be_init()
206 be_make_root_ds(bt.nbe_zpool, bt.nbe_name, nbe_root_ds, in be_init()
231 if (nvlist_dup(zfs_props, &bt.nbe_zfs_props, 0) != 0) { in be_init()
238 if (nvlist_alloc(&bt.nbe_zfs_props, NV_UNIQUE_NAME, 0) != 0) { in be_init()
246 if (nvlist_add_string(bt.nbe_zfs_props, in be_init()
255 if (nvlist_add_string(bt.nbe_zfs_props, in be_init()
265 bt.nbe_zfs_props) != 0) { in be_init()
283 (void) nvlist_remove(bt.nbe_zfs_props, in be_init()
301 bt.nbe_zfs_props) != 0) { in be_init()
323 bt.nbe_zpool, shared_fs_names[i]); in be_init()
355 if (bt.nbe_zfs_props != NULL) in be_init()
356 nvlist_free(bt.nbe_zfs_props); in be_init()
383 be_transaction_data_t bt = { 0 }; in be_destroy() local
398 if (nvlist_lookup_string(be_attrs, BE_ATTR_ORIG_BE_NAME, &bt.obe_name) in be_destroy()
410 if (!be_valid_be_name(bt.obe_name)) { in be_destroy()
412 bt.obe_name); in be_destroy()
414 } else if (bt.obe_name != NULL) { in be_destroy()
418 if (strcmp(cur_bt.obe_name, bt.obe_name) == 0) { in be_destroy()
436 if ((zret = zpool_iter(g_zfs, be_find_zpool_callback, &bt)) == 0) { in be_destroy()
438 "for BE (%s)\n"), bt.obe_name); in be_destroy()
447 be_make_root_ds(bt.obe_zpool, bt.obe_name, obe_root_ds, in be_destroy()
449 bt.obe_root_ds = obe_root_ds; in be_destroy()
452 if (!be_zone_compare_uuids(bt.obe_root_ds)) { in be_destroy()
453 if (be_is_active_on_boot(bt.obe_name)) { in be_destroy()
466 if (be_is_active_on_boot(bt.obe_name)) { in be_destroy()
475 if ((zhp = zfs_open(g_zfs, bt.obe_root_ds, ZFS_TYPE_FILESYSTEM)) == in be_destroy()
478 "open BE root dataset (%s): %s\n"), bt.obe_root_ds, in be_destroy()
510 bt.obe_name, mp != NULL ? mp : "<unknown>"); in be_destroy()
524 if ((ret = be_destroy_zones(bt.obe_name, bt.obe_root_ds, &dd)) in be_destroy()
528 bt.obe_name); in be_destroy()
535 if ((ret = _be_unmount(bt.obe_name, BE_UNMOUNT_FLAG_FORCE)) in be_destroy()
538 "failed to unmount %s\n"), bt.obe_name); in be_destroy()
546 if ((ret = _be_destroy((const char *)bt.obe_root_ds, &dd)) in be_destroy()
553 if ((ret = be_remove_menu(bt.obe_name, bt.obe_zpool, NULL)) in be_destroy()
557 bt.obe_root_ds); in be_destroy()
604 be_transaction_data_t bt = { 0 }; in be_copy() local
635 if ((ret = be_find_current_be(&bt)) != BE_SUCCESS) { in be_copy()
643 bt.obe_name = obe_name; in be_copy()
645 if (!be_valid_be_name(bt.obe_name)) { in be_copy()
647 "invalid BE name %s\n"), bt.obe_name); in be_copy()
653 if ((zphp = zpool_open(g_zfs, bt.obe_zpool)) == NULL) { in be_copy()
655 "open rpool (%s): %s\n"), bt.obe_zpool, in be_copy()
659 if (be_find_zpool_callback(zphp, &bt) == 0) { in be_copy()
664 if ((zret = zpool_iter(g_zfs, be_find_zpool_callback, &bt)) == in be_copy()
667 "find zpool for BE (%s)\n"), bt.obe_name); in be_copy()
679 BE_ATTR_SNAP_NAME, DATA_TYPE_STRING, &bt.obe_snap_name, NULL) in be_copy()
688 BE_ATTR_NEW_BE_NAME, DATA_TYPE_STRING, &bt.nbe_name, NULL) in be_copy()
697 BE_ATTR_NEW_BE_POOL, DATA_TYPE_STRING, &bt.nbe_zpool, NULL) != 0) { in be_copy()
705 BE_ATTR_NEW_BE_DESC, DATA_TYPE_STRING, &bt.nbe_desc, NULL) != 0) { in be_copy()
713 BE_ATTR_POLICY, DATA_TYPE_STRING, &bt.policy, NULL) != 0) { in be_copy()
741 if (nvlist_dup(zfs_props, &bt.nbe_zfs_props, 0) != 0) { in be_copy()
748 if (nvlist_alloc(&bt.nbe_zfs_props, NV_UNIQUE_NAME, 0) != 0) { in be_copy()
759 if (bt.nbe_name) { in be_copy()
761 if (!be_valid_be_name(bt.nbe_name)) { in be_copy()
763 "invalid BE name %s\n"), bt.nbe_name); in be_copy()
771 bt.nbe_name)) > 0) { in be_copy()
773 "exists\n"), bt.nbe_name); in be_copy()
784 be_make_root_ds(bt.nbe_zpool, bt.nbe_name, nbe_root_ds, in be_copy()
789 "exists\n"), bt.nbe_name); in be_copy()
799 if (bt.nbe_zpool != NULL) { in be_copy()
809 if ((bt.nbe_name = be_auto_be_name(bt.obe_name)) in be_copy()
824 if (bt.nbe_zpool == NULL) { in be_copy()
825 bt.nbe_zpool = bt.obe_zpool; in be_copy()
829 be_make_root_ds(bt.obe_zpool, bt.obe_name, obe_root_ds, in be_copy()
831 be_make_root_ds(bt.nbe_zpool, bt.nbe_name, nbe_root_ds, in be_copy()
834 bt.obe_root_ds = obe_root_ds; in be_copy()
835 bt.nbe_root_ds = nbe_root_ds; in be_copy()
841 if (bt.obe_snap_name != NULL) { in be_copy()
844 (void) snprintf(ss, sizeof (ss), "%s@%s", bt.obe_root_ds, in be_copy()
845 bt.obe_snap_name); in be_copy()
860 if ((ret = _be_create_snapshot(bt.obe_name, in be_copy()
861 &bt.obe_snap_name, bt.policy)) != BE_SUCCESS) { in be_copy()
868 bt.obe_snap_name) != 0) { in be_copy()
877 if ((zhp = zfs_open(g_zfs, bt.obe_root_ds, ZFS_TYPE_FILESYSTEM)) in be_copy()
880 "open BE root dataset (%s): %s\n"), bt.obe_root_ds, in be_copy()
887 if (zfs_is_mounted(zhp, &bt.obe_altroot) && bt.obe_altroot == NULL) { in be_copy()
890 bt.obe_name, libzfs_error_description(g_zfs)); in be_copy()
895 if (strcmp(bt.obe_zpool, bt.nbe_zpool) == 0) { in be_copy()
904 if ((ret = be_clone_fs_callback(zhp, &bt)) != 0) { in be_copy()
911 bt.nbe_name, bt.obe_name); in be_copy()
928 free(bt.nbe_name); in be_copy()
929 if ((bt.nbe_name = be_auto_be_name(bt.obe_name)) in be_copy()
942 be_make_root_ds(bt.nbe_zpool, bt.nbe_name, in be_copy()
944 bt.nbe_root_ds = nbe_root_ds; in be_copy()
949 if ((zhp = zfs_open(g_zfs, bt.obe_root_ds, in be_copy()
953 "(%s): %s\n"), bt.obe_root_ds, in be_copy()
965 ret = be_clone_fs_callback(zhp, &bt); in be_copy()
973 bt.nbe_name, bt.obe_name); in be_copy()
987 free(bt.nbe_name); in be_copy()
988 bt.nbe_name = NULL; in be_copy()
1003 if (!be_create_container_ds(bt.nbe_zpool)) { in be_copy()
1013 if ((ret = be_send_fs_callback(zhp, &bt)) != 0) { in be_copy()
1015 "send BE (%s) to pool (%s)\n"), bt.obe_name, in be_copy()
1016 bt.nbe_zpool); in be_copy()
1036 if ((ret = _be_mount(bt.nbe_name, &new_mp, BE_MOUNT_FLAG_NO_ZONES)) in be_copy()
1040 (void) _be_unmount(bt.nbe_name, 0); in be_copy()
1046 if (be_set_uuid(bt.nbe_root_ds) != BE_SUCCESS) { in be_copy()
1051 if ((ret = be_zone_get_parent_uuid(bt.obe_root_ds, in be_copy()
1057 } else if ((ret = be_zone_set_parent_uuid(bt.nbe_root_ds, in be_copy()
1072 be_get_uuid(bt.obe_root_ds, &uu) == BE_SUCCESS) { in be_copy()
1073 if ((ret = be_copy_zones(bt.obe_name, bt.obe_root_ds, in be_copy()
1074 bt.nbe_root_ds)) != BE_SUCCESS) { in be_copy()
1086 if ((ret = be_get_legacy_fs(bt.obe_name, bt.obe_root_ds, NULL, NULL, in be_copy()
1090 bt.obe_name); in be_copy()
1097 if ((ret = be_update_vfstab(bt.nbe_name, bt.obe_zpool, bt.nbe_zpool, in be_copy()
1100 "update new BE's vfstab (%s)\n"), bt.nbe_name); in be_copy()
1105 if ((ret = _be_unmount(bt.nbe_name, 0)) != BE_SUCCESS) { in be_copy()
1115 (ret = be_append_menu(bt.nbe_name, bt.nbe_zpool, in be_copy()
1116 NULL, bt.obe_root_ds, bt.nbe_desc)) != BE_SUCCESS) { in be_copy()
1118 "add BE (%s) to boot menu\n"), bt.nbe_name); in be_copy()
1129 if ((zhp = zfs_open(g_zfs, bt.nbe_root_ds, in be_copy()
1132 "open BE root dataset (%s): %s\n"), bt.nbe_root_ds, in be_copy()
1141 if (bt.policy == NULL) { in be_copy()
1143 bt.policy = be_default_policy(); in be_copy()
1146 if (zfs_prop_set(zhp, BE_POLICY_PROPERTY, bt.policy) != 0) { in be_copy()
1148 "set BE policy for %s: %s\n"), bt.nbe_name, in be_copy()
1157 if (bt.nbe_name) { in be_copy()
1159 bt.nbe_name) != 0) { in be_copy()
1170 if (bt.nbe_zfs_props != NULL) in be_copy()
1171 nvlist_free(bt.nbe_zfs_props); in be_copy()
1173 free(bt.obe_altroot); in be_copy()
1188 if (getzoneid() == GLOBAL_ZONEID && be_get_uuid(bt.nbe_root_ds, in be_copy()
1190 (void) be_destroy_zones(bt.nbe_name, bt.nbe_root_ds, in be_copy()
1193 (void) _be_destroy(bt.nbe_root_ds, &cdd); in be_copy()
1226 be_transaction_data_t *bt = data; in be_find_zpool_callback() local
1233 be_make_root_ds(zpool, bt->obe_name, be_root_ds, sizeof (be_root_ds)); in be_find_zpool_callback()
1240 bt->obe_zpool = strdup(zpool); in be_find_zpool_callback()
1906 be_transaction_data_t bt = { 0 }; in be_copy_zones() local
2068 bt.obe_name = zone_be_name; in be_copy_zones()
2069 bt.obe_root_ds = zoneroot_ds; in be_copy_zones()
2070 bt.obe_snap_name = snap_name; in be_copy_zones()
2071 bt.obe_altroot = temp_mntpt; in be_copy_zones()
2072 bt.nbe_name = new_zone_be_name; in be_copy_zones()
2073 bt.nbe_root_ds = new_zoneroot_ds; in be_copy_zones()
2075 if (nvlist_alloc(&bt.nbe_zfs_props, NV_UNIQUE_NAME, 0) != 0) { in be_copy_zones()
2086 if ((iret = be_clone_fs_callback(z_zhp, &bt)) != 0) { in be_copy_zones()
2093 if (bt.nbe_zfs_props != NULL) in be_copy_zones()
2094 nvlist_free(bt.nbe_zfs_props); in be_copy_zones()
2119 if (bt.nbe_zfs_props != NULL) in be_copy_zones()
2120 nvlist_free(bt.nbe_zfs_props); in be_copy_zones()
2128 bt.nbe_name = new_zone_be_name; in be_copy_zones()
2129 bt.nbe_root_ds = new_zoneroot_ds; in be_copy_zones()
2143 if (bt.nbe_zfs_props != NULL) in be_copy_zones()
2144 nvlist_free(bt.nbe_zfs_props); in be_copy_zones()
2154 iret = be_clone_fs_callback(z_zhp, &bt); in be_copy_zones()
2164 if (bt.nbe_zfs_props != NULL) in be_copy_zones()
2165 nvlist_free(bt.nbe_zfs_props); in be_copy_zones()
2177 free(bt.nbe_name); in be_copy_zones()
2178 bt.nbe_name = NULL; in be_copy_zones()
2180 if (bt.nbe_zfs_props != NULL) in be_copy_zones()
2181 nvlist_free(bt.nbe_zfs_props); in be_copy_zones()
2186 if (bt.nbe_zfs_props != NULL) in be_copy_zones()
2187 nvlist_free(bt.nbe_zfs_props); in be_copy_zones()
2236 if ((ret = be_update_zone_vfstab(z_zhp, bt.nbe_name, in be_copy_zones()
2240 bt.nbe_name); in be_copy_zones()
2281 be_transaction_data_t *bt = data; in be_clone_fs_callback() local
2317 if ((ret = be_prep_clone_send_fs(zhp, bt, clone_ds, in be_clone_fs_callback()
2327 bt->obe_snap_name); in be_clone_fs_callback()
2344 if (zfs_clone(zhp_ss, clone_ds, bt->nbe_zfs_props) != 0) { in be_clone_fs_callback()
2362 if ((ret = zfs_iter_filesystems(zhp, be_clone_fs_callback, bt)) != 0) { in be_clone_fs_callback()
2402 be_transaction_data_t *bt = data; in be_send_fs_callback() local
2419 if ((ret = be_prep_clone_send_fs(zhp, bt, clone_ds, in be_send_fs_callback()
2428 if (zfs_create(g_zfs, clone_ds, ZFS_TYPE_FILESYSTEM, bt->nbe_zfs_props) in be_send_fs_callback()
2469 if (zfs_send(zhp, NULL, bt->obe_snap_name, &send_flags, in be_send_fs_callback()
2507 if ((ret = zfs_iter_filesystems(zhp, be_send_fs_callback, bt)) != 0) { in be_send_fs_callback()
2941 be_prep_clone_send_fs(zfs_handle_t *zhp, be_transaction_data_t *bt, in be_prep_clone_send_fs() argument
2960 if (strncmp(zhp_name, bt->obe_root_ds, strlen(bt->obe_root_ds)) in be_prep_clone_send_fs()
2962 child_fs = zhp_name + strlen(bt->obe_root_ds); in be_prep_clone_send_fs()
2977 (void) snprintf(clone_ds, clone_ds_len, "%s%s", bt->nbe_root_ds, in be_prep_clone_send_fs()
3013 bt->obe_altroot != NULL && strcmp(bt->obe_altroot, in be_prep_clone_send_fs()
3016 int altroot_len = strlen(bt->obe_altroot); in be_prep_clone_send_fs()
3018 if (strncmp(bt->obe_altroot, mountpoint, altroot_len) in be_prep_clone_send_fs()
3029 if (nvlist_add_string(bt->nbe_zfs_props, in be_prep_clone_send_fs()
3037 err = nvlist_remove_all(bt->nbe_zfs_props, in be_prep_clone_send_fs()
3050 if (nvlist_add_string(bt->nbe_zfs_props, in be_prep_clone_send_fs()