Lines Matching refs:drv

137     if (!bs || !bs->drv) {  in bdrv_opt_mem_align()
148 if (!bs || !bs->drv) { in bdrv_min_mem_align()
515 int bdrv_is_whitelisted(BlockDriver *drv, bool read_only) in bdrv_is_whitelisted() argument
518 return bdrv_format_is_whitelisted(drv->format_name, read_only); in bdrv_is_whitelisted()
527 BlockDriver *drv; member
534 int coroutine_fn bdrv_co_create(BlockDriver *drv, const char *filename, in bdrv_co_create() argument
541 if (!drv->bdrv_co_create_opts) { in bdrv_co_create()
543 drv->format_name); in bdrv_co_create()
547 ret = drv->bdrv_co_create_opts(drv, filename, opts, errp); in bdrv_co_create()
631 int coroutine_fn bdrv_co_create_opts_simple(BlockDriver *drv, in bdrv_co_create_opts_simple() argument
663 qdict_put_str(options, "driver", drv->format_name); in bdrv_co_create_opts_simple()
672 drv->format_name); in bdrv_co_create_opts_simple()
697 BlockDriver *drv; in bdrv_co_create_file() local
703 drv = bdrv_find_protocol(filename, true, errp); in bdrv_co_create_file()
704 if (drv == NULL) { in bdrv_co_create_file()
708 if (!drv->create_opts) { in bdrv_co_create_file()
710 drv->format_name); in bdrv_co_create_file()
729 protocol_opts = qemu_opts_from_qdict(drv->create_opts, qdict, errp); in bdrv_co_create_file()
735 ret = bdrv_co_create(drv, filename, protocol_opts, errp); in bdrv_co_create_file()
751 if (!bs->drv) { in bdrv_co_delete_file()
756 if (!bs->drv->bdrv_co_delete_file) { in bdrv_co_delete_file()
758 bs->drv->format_name); in bdrv_co_delete_file()
762 ret = bs->drv->bdrv_co_delete_file(bs, &local_err); in bdrv_co_delete_file()
801 BlockDriver *drv = bs->drv; in bdrv_probe_blocksizes() local
805 if (drv && drv->bdrv_probe_blocksizes) { in bdrv_probe_blocksizes()
806 return drv->bdrv_probe_blocksizes(bs, bsz); in bdrv_probe_blocksizes()
822 BlockDriver *drv = bs->drv; in bdrv_probe_geometry() local
828 if (drv && drv->bdrv_probe_geometry) { in bdrv_probe_geometry()
829 return drv->bdrv_probe_geometry(bs, geo); in bdrv_probe_geometry()
887 BlockDriver *drv = NULL, *d; in find_hdev_driver() local
895 drv = d; in find_hdev_driver()
900 return drv; in find_hdev_driver()
996 BlockDriver *drv = NULL, *d; in bdrv_probe_all() local
1004 drv = d; in bdrv_probe_all()
1009 return drv; in bdrv_probe_all()
1015 BlockDriver *drv; in find_image_format() local
1035 drv = bdrv_probe_all(buf, sizeof(buf), filename); in find_image_format()
1036 if (!drv) { in find_image_format()
1043 *pdrv = drv; in find_image_format()
1054 BlockDriver *drv = bs->drv; in bdrv_co_refresh_total_sectors() local
1058 if (!drv) { in bdrv_co_refresh_total_sectors()
1067 if (drv->bdrv_co_getlength) { in bdrv_co_refresh_total_sectors()
1068 int64_t length = drv->bdrv_co_getlength(bs); in bdrv_co_refresh_total_sectors()
1092 if (bs->drv && bs->drv->bdrv_join_options) { in bdrv_join_options()
1093 bs->drv->bdrv_join_options(options, old_options); in bdrv_join_options()
1327 base->drv ? base->drv->format_name : "", in bdrv_backing_update_filename()
1427 if (bs->drv->is_filter || (child->role & BDRV_CHILD_FILTERED)) { in bdrv_child_cb_attach()
1443 if (bs->drv->filtered_child_is_backing) { in bdrv_child_cb_attach()
1452 assert(bs->drv->supports_backing); in bdrv_child_cb_attach()
1625 bdrv_open_driver(BlockDriverState *bs, BlockDriver *drv, const char *node_name, in bdrv_open_driver() argument
1639 bs->drv = drv; in bdrv_open_driver()
1640 bs->opaque = g_malloc0(drv->instance_size); in bdrv_open_driver()
1642 if (drv->bdrv_file_open) { in bdrv_open_driver()
1643 assert(!drv->bdrv_needs_filename || bs->filename[0]); in bdrv_open_driver()
1644 ret = drv->bdrv_file_open(bs, options, open_flags, &local_err); in bdrv_open_driver()
1645 } else if (drv->bdrv_open) { in bdrv_open_driver()
1646 ret = drv->bdrv_open(bs, options, open_flags, &local_err); in bdrv_open_driver()
1702 if (drv->bdrv_drain_begin) { in bdrv_open_driver()
1703 drv->bdrv_drain_begin(bs); in bdrv_open_driver()
1709 bs->drv = NULL; in bdrv_open_driver()
1731 BlockDriverState *bdrv_new_open_driver_opts(BlockDriver *drv, in bdrv_new_open_driver_opts() argument
1749 ret = bdrv_open_driver(bs, drv, node_name, bs->options, flags, errp); in bdrv_new_open_driver_opts()
1763 BlockDriverState *bdrv_new_open_driver(BlockDriver *drv, const char *node_name, in bdrv_new_open_driver() argument
1767 return bdrv_new_open_driver_opts(drv, node_name, NULL, flags, errp); in bdrv_new_open_driver()
1855 BlockDriver *drv; in bdrv_open_common() local
1875 drv = bdrv_find_format(driver_name); in bdrv_open_common()
1876 assert(drv != NULL); in bdrv_open_common()
1905 if (drv->bdrv_needs_filename && (!filename || !filename[0])) { in bdrv_open_common()
1907 drv->format_name); in bdrv_open_common()
1913 drv->format_name); in bdrv_open_common()
1917 if (use_bdrv_whitelist && !bdrv_is_whitelisted(drv, ro)) { in bdrv_open_common()
1918 if (!ro && bdrv_is_whitelisted(drv, true)) { in bdrv_open_common()
1927 !ro && bdrv_is_whitelisted(drv, true) in bdrv_open_common()
1930 drv->format_name); in bdrv_open_common()
1976 assert(!drv->bdrv_file_open || file == NULL); in bdrv_open_common()
1977 ret = bdrv_open_driver(bs, drv, node_name, options, open_flags, errp); in bdrv_open_common()
2055 BlockDriver *drv = NULL; in bdrv_fill_options() local
2069 drv = bdrv_find_format(drvname); in bdrv_fill_options()
2070 if (!drv) { in bdrv_fill_options()
2076 protocol = drv->bdrv_file_open; in bdrv_fill_options()
2106 drv = bdrv_find_protocol(filename, parse_filename, errp); in bdrv_fill_options()
2107 if (!drv) { in bdrv_fill_options()
2111 drvname = drv->format_name; in bdrv_fill_options()
2119 assert(drv || !protocol); in bdrv_fill_options()
2122 if (drv && drv->bdrv_parse_filename && parse_filename) { in bdrv_fill_options()
2123 drv->bdrv_parse_filename(filename, *options, &local_err); in bdrv_fill_options()
2129 if (!drv->bdrv_needs_filename) { in bdrv_fill_options()
2257 assert(bs->drv && bs->drv->bdrv_child_perm); in bdrv_child_perm()
2259 bs->drv->bdrv_child_perm(bs, c, role, reopen_queue, in bdrv_child_perm()
2349 if (bs->drv->bdrv_set_perm) { in bdrv_drv_set_perm_commit()
2352 bs->drv->bdrv_set_perm(bs, cumulative_perms, cumulative_shared_perms); in bdrv_drv_set_perm_commit()
2361 if (bs->drv->bdrv_abort_perm_update) { in bdrv_drv_set_perm_abort()
2362 bs->drv->bdrv_abort_perm_update(bs); in bdrv_drv_set_perm_abort()
2380 if (!bs->drv) { in bdrv_drv_set_perm()
2384 if (bs->drv->bdrv_check_perm) { in bdrv_drv_set_perm()
2385 int ret = bs->drv->bdrv_check_perm(bs, perm, shared_perm, errp); in bdrv_drv_set_perm()
2492 BlockDriver *drv = bs->drv; in bdrv_node_refresh_perm() local
2531 if (!drv) { in bdrv_node_refresh_perm()
2542 if (!drv->bdrv_child_perm) { in bdrv_node_refresh_perm()
3181 assert(parent_bs->drv); in bdrv_attach_child_noperm()
3423 if (bs->drv && bs->drv->is_filter) { in bdrv_backing_role()
3459 if (!parent_bs->drv) { in bdrv_set_file_or_backing_noperm()
3475 if (is_backing && !parent_bs->drv->is_filter && in bdrv_set_file_or_backing_noperm()
3476 !parent_bs->drv->supports_backing) in bdrv_set_file_or_backing_noperm()
3479 "files", parent_bs->drv->format_name, parent_bs->node_name); in bdrv_set_file_or_backing_noperm()
3483 if (parent_bs->drv->is_filter) { in bdrv_set_file_or_backing_noperm()
3665 if (!bs->drv || !bs->drv->supports_backing) { in bdrv_open_backing_file()
3818 assert(!parent->drv->filtered_child_is_backing); in bdrv_open_file_child()
3819 role = parent->drv->is_filter ? in bdrv_open_file_child()
3970 BlockDriver *drv = NULL; in bdrv_open_inherit() local
4024 if (parent->drv) { in bdrv_open_inherit()
4025 parent_is_format = parent->drv->is_format; in bdrv_open_inherit()
4078 drv = bdrv_find_format(drvname); in bdrv_open_inherit()
4079 if (!drv) { in bdrv_open_inherit()
4134 bs->probed = !drv; in bdrv_open_inherit()
4135 if (!drv && file) { in bdrv_open_inherit()
4136 ret = find_image_format(file, filename, &drv, &local_err); in bdrv_open_inherit()
4151 qdict_put_str(bs->options, "driver", drv->format_name); in bdrv_open_inherit()
4152 qdict_put_str(options, "driver", drv->format_name); in bdrv_open_inherit()
4153 } else if (!drv) { in bdrv_open_inherit()
4159 assert(!!(flags & BDRV_O_PROTOCOL) == !!drv->bdrv_file_open); in bdrv_open_inherit()
4205 "'%s'", drv->format_name, entry->key); in bdrv_open_inherit()
4209 drv->format_name, entry->key); in bdrv_open_inherit()
4313 !is_str_in_list(e->key, bs->drv->mutable_opts)) { in bdrv_reset_options_allowed()
4518 child->klass, child->role, bs->drv->is_format, in bdrv_reopen_queue_child()
4660 if (bs->drv->bdrv_reopen_commit_post) { in bdrv_reopen_multiple()
4663 bs->drv->bdrv_reopen_commit_post(&bs_entry->state); in bdrv_reopen_multiple()
4825 if (bs->drv->is_filter && !old_child_bs) { in bdrv_reopen_parse_file_or_backing()
4831 "%s child", bs->node_name, bs->drv->format_name, child_name); in bdrv_reopen_parse_file_or_backing()
4907 BlockDriver *drv; in bdrv_reopen_prepare() local
4915 assert(reopen_state->bs->drv != NULL); in bdrv_reopen_prepare()
4917 drv = reopen_state->bs->drv; in bdrv_reopen_prepare()
4973 if (drv->bdrv_reopen_prepare) { in bdrv_reopen_prepare()
4985 ret = drv->bdrv_reopen_prepare(reopen_state, queue, &local_err); in bdrv_reopen_prepare()
5003 "does not support reopening files", drv->format_name, in bdrv_reopen_prepare()
5018 if (drv->supports_backing && reopen_state->backing_missing && in bdrv_reopen_prepare()
5114 if (drv->bdrv_reopen_abort) { in bdrv_reopen_prepare()
5115 drv->bdrv_reopen_abort(reopen_state); in bdrv_reopen_prepare()
5131 BlockDriver *drv; in bdrv_reopen_commit() local
5137 drv = bs->drv; in bdrv_reopen_commit()
5138 assert(drv != NULL); in bdrv_reopen_commit()
5142 if (drv->bdrv_reopen_commit) { in bdrv_reopen_commit()
5143 drv->bdrv_reopen_commit(reopen_state); in bdrv_reopen_commit()
5179 BlockDriver *drv; in bdrv_reopen_abort() local
5182 drv = reopen_state->bs->drv; in bdrv_reopen_abort()
5183 assert(drv != NULL); in bdrv_reopen_abort()
5186 if (drv->bdrv_reopen_abort) { in bdrv_reopen_abort()
5187 drv->bdrv_reopen_abort(reopen_state); in bdrv_reopen_abort()
5204 if (bs->drv) { in bdrv_close()
5205 if (bs->drv->bdrv_close) { in bdrv_close()
5207 bs->drv->bdrv_close(bs); in bdrv_close()
5209 bs->drv = NULL; in bdrv_close()
5682 BlockDriver *drv; in bdrv_insert_node() local
5690 drv = bdrv_find_format(drvname); in bdrv_insert_node()
5691 if (!drv) { in bdrv_insert_node()
5702 new_node_bs = bdrv_new_open_driver_opts(drv, node_name, options, flags, in bdrv_insert_node()
5753 if (bs->drv == NULL) { in bdrv_co_check()
5756 if (bs->drv->bdrv_co_check == NULL) { in bdrv_co_check()
5761 return bs->drv->bdrv_co_check(bs, res, fix); in bdrv_co_check()
5776 BlockDriver *drv = bs->drv; in bdrv_co_change_backing_file() local
5781 if (!drv) { in bdrv_co_change_backing_file()
5794 if (drv->bdrv_co_change_backing_file != NULL) { in bdrv_co_change_backing_file()
5795 ret = drv->bdrv_co_change_backing_file(bs, backing_file, backing_fmt); in bdrv_co_change_backing_file()
5980 if (!top->drv || !base->drv) { in bdrv_drop_intermediate()
6094 BlockDriver *drv = bs->drv; in bdrv_co_get_allocated_file_size() local
6098 if (!drv) { in bdrv_co_get_allocated_file_size()
6101 if (drv->bdrv_co_get_allocated_file_size) { in bdrv_co_get_allocated_file_size()
6102 return drv->bdrv_co_get_allocated_file_size(bs); in bdrv_co_get_allocated_file_size()
6105 if (drv->bdrv_file_open) { in bdrv_co_get_allocated_file_size()
6112 } else if (drv->is_filter) { in bdrv_co_get_allocated_file_size()
6144 BlockMeasureInfo *bdrv_measure(BlockDriver *drv, QemuOpts *opts, in bdrv_measure() argument
6148 if (!drv->bdrv_measure) { in bdrv_measure()
6150 drv->format_name); in bdrv_measure()
6154 return drv->bdrv_measure(opts, in_bs, errp); in bdrv_measure()
6162 BlockDriver *drv = bs->drv; in bdrv_co_nb_sectors() local
6166 if (!drv) in bdrv_co_nb_sectors()
6184 BlockDriver *drv = bs->drv; in bdrv_nb_sectors() local
6187 if (!drv) in bdrv_nb_sectors()
6234 if (!bs->drv || !block_driver_can_compress(bs->drv)) { in bdrv_supports_compressed_writes()
6253 return bs->drv ? bs->drv->format_name : NULL; in bdrv_get_format_name()
6264 BlockDriver *drv; in bdrv_iterate_format() local
6271 QLIST_FOREACH(drv, &bdrv_drivers, list) { in bdrv_iterate_format()
6272 if (drv->format_name) { in bdrv_iterate_format()
6275 if (use_bdrv_whitelist && !bdrv_is_whitelisted(drv, read_only)) { in bdrv_iterate_format()
6281 found = !strcmp(formats[--i], drv->format_name); in bdrv_iterate_format()
6286 formats[count++] = drv->format_name; in bdrv_iterate_format()
6623 if (!bs->drv) { in bdrv_has_zero_init()
6632 if (bs->drv->bdrv_has_zero_init) { in bdrv_has_zero_init()
6633 return bs->drv->bdrv_has_zero_init(bs); in bdrv_has_zero_init()
6665 BlockDriver *drv = bs->drv; in bdrv_co_get_info() local
6670 if (!drv) { in bdrv_co_get_info()
6673 if (!drv->bdrv_co_get_info) { in bdrv_co_get_info()
6681 ret = drv->bdrv_co_get_info(bs, bdi); in bdrv_co_get_info()
6703 BlockDriver *drv = bs->drv; in bdrv_get_specific_info() local
6705 if (drv && drv->bdrv_get_specific_info) { in bdrv_get_specific_info()
6706 return drv->bdrv_get_specific_info(bs, errp); in bdrv_get_specific_info()
6713 BlockDriver *drv = bs->drv; in bdrv_get_specific_stats() local
6715 if (!drv || !drv->bdrv_get_specific_stats) { in bdrv_get_specific_stats()
6718 return drv->bdrv_get_specific_stats(bs); in bdrv_get_specific_stats()
6726 if (!bs || !bs->drv || !bs->drv->bdrv_co_debug_event) { in bdrv_co_debug_event()
6730 bs->drv->bdrv_co_debug_event(bs, event); in bdrv_co_debug_event()
6737 while (bs && bs->drv && !bs->drv->bdrv_debug_breakpoint) { in bdrv_find_debug_node()
6741 if (bs && bs->drv && bs->drv->bdrv_debug_breakpoint) { in bdrv_find_debug_node()
6742 assert(bs->drv->bdrv_debug_remove_breakpoint); in bdrv_find_debug_node()
6757 return bs->drv->bdrv_debug_breakpoint(bs, event, tag); in bdrv_debug_breakpoint()
6770 return bs->drv->bdrv_debug_remove_breakpoint(bs, tag); in bdrv_debug_remove_breakpoint()
6781 while (bs && (!bs->drv || !bs->drv->bdrv_debug_resume)) { in bdrv_debug_resume()
6785 if (bs && bs->drv && bs->drv->bdrv_debug_resume) { in bdrv_debug_resume()
6786 return bs->drv->bdrv_debug_resume(bs, tag); in bdrv_debug_resume()
6797 while (bs && bs->drv && !bs->drv->bdrv_debug_is_suspended) { in bdrv_debug_is_suspended()
6801 if (bs && bs->drv && bs->drv->bdrv_debug_is_suspended) { in bdrv_debug_is_suspended()
6802 return bs->drv->bdrv_debug_is_suspended(bs, tag); in bdrv_debug_is_suspended()
6827 if (!bs || !bs->drv || !backing_file) { in bdrv_find_backing_image()
6947 if (!bs->drv) { in bdrv_activate()
7020 if (bs->drv->bdrv_co_invalidate_cache) { in bdrv_co_invalidate_cache()
7021 bs->drv->bdrv_co_invalidate_cache(bs, &local_err); in bdrv_co_invalidate_cache()
7079 if (!bs->drv) { in bdrv_inactivate_recurse()
7092 if (bs->drv->bdrv_inactivate) { in bdrv_inactivate_recurse()
7093 ret = bs->drv->bdrv_inactivate(bs); in bdrv_inactivate_recurse()
7186 BlockDriver *drv = bs->drv; in bdrv_co_is_inserted() local
7191 if (!drv) { in bdrv_co_is_inserted()
7194 if (drv->bdrv_co_is_inserted) { in bdrv_co_is_inserted()
7195 return drv->bdrv_co_is_inserted(bs); in bdrv_co_is_inserted()
7210 BlockDriver *drv = bs->drv; in bdrv_co_eject() local
7214 if (drv && drv->bdrv_co_eject) { in bdrv_co_eject()
7215 drv->bdrv_co_eject(bs, eject_flag); in bdrv_co_eject()
7225 BlockDriver *drv = bs->drv; in bdrv_co_lock_medium() local
7230 if (drv && drv->bdrv_co_lock_medium) { in bdrv_co_lock_medium()
7231 drv->bdrv_co_lock_medium(bs, locked); in bdrv_co_lock_medium()
7371 BlockDriver *drv, *proto_drv; in bdrv_img_create() local
7378 drv = bdrv_find_format(fmt); in bdrv_img_create()
7379 if (!drv) { in bdrv_img_create()
7389 if (!drv->create_opts) { in bdrv_img_create()
7391 drv->format_name); in bdrv_img_create()
7404 create_opts = qemu_opts_append(create_opts, drv->create_opts); in bdrv_img_create()
7497 bs->drv->format_name); in bdrv_img_create()
7532 ret = bdrv_create(drv, filename, opts, &local_err); in bdrv_img_create()
7639 if (bs->drv && bs->drv->bdrv_detach_aio_context) { in bdrv_detach_aio_context()
7640 bs->drv->bdrv_detach_aio_context(bs); in bdrv_detach_aio_context()
7654 if (bs->drv && bs->drv->bdrv_attach_aio_context) { in bdrv_attach_aio_context()
7655 bs->drv->bdrv_attach_aio_context(bs, new_context); in bdrv_attach_aio_context()
7939 if (!bs->drv) { in bdrv_amend_options()
7943 if (!bs->drv->bdrv_amend_options) { in bdrv_amend_options()
7945 bs->drv->format_name); in bdrv_amend_options()
7948 return bs->drv->bdrv_amend_options(bs, opts, status_cb, in bdrv_amend_options()
7971 if (!bs || !bs->drv) { in bdrv_recurse_can_replace()
7980 if (bs->drv->bdrv_recurse_can_replace) { in bdrv_recurse_can_replace()
7981 return bs->drv->bdrv_recurse_can_replace(bs, to_replace); in bdrv_recurse_can_replace()
8067 if (curopt == &global_options[ARRAY_SIZE(global_options) - 1] && bs->drv) { in strong_options()
8068 curopt = bs->drv->strong_runtime_opts; in strong_options()
8090 if (!bs->drv) { in append_strong_runtime_options()
8131 qdict_put_str(d, "driver", bs->drv->format_name); in append_strong_runtime_options()
8167 BlockDriver *drv = bs->drv; in bdrv_refresh_filename() local
8177 if (!drv) { in bdrv_refresh_filename()
8217 if (drv->bdrv_gather_child_options) { in bdrv_refresh_filename()
8220 drv->bdrv_gather_child_options(bs, opts, backing_overridden); in bdrv_refresh_filename()
8243 if (drv->bdrv_refresh_filename) { in bdrv_refresh_filename()
8248 drv->bdrv_refresh_filename(bs); in bdrv_refresh_filename()
8274 primary_child_bs->drv->bdrv_file_open && in bdrv_refresh_filename()
8275 !drv->is_filter && !generate_json_filename) in bdrv_refresh_filename()
8296 BlockDriver *drv = bs->drv; in bdrv_dirname() local
8301 if (!drv) { in bdrv_dirname()
8306 if (drv->bdrv_dirname) { in bdrv_dirname()
8307 return drv->bdrv_dirname(bs, errp); in bdrv_dirname()
8321 drv->format_name); in bdrv_dirname()
8333 if (!parent_bs->drv || !parent_bs->drv->bdrv_add_child) { in bdrv_add_child()
8344 if (!parent_bs->drv->supports_zoned_children && in bdrv_add_child()
8353 parent_bs->drv->supports_zoned_children ? in bdrv_add_child()
8364 parent_bs->drv->bdrv_add_child(parent_bs, child_bs, errp); in bdrv_add_child()
8372 if (!parent_bs->drv || !parent_bs->drv->bdrv_del_child) { in bdrv_del_child()
8391 parent_bs->drv->bdrv_del_child(parent_bs, child, errp); in bdrv_del_child()
8396 BlockDriver *drv = c->bs->drv; in bdrv_make_empty() local
8402 if (!drv->bdrv_make_empty) { in bdrv_make_empty()
8404 drv->format_name); in bdrv_make_empty()
8408 ret = drv->bdrv_make_empty(c->bs); in bdrv_make_empty()
8426 if (!bs || !bs->drv) { in bdrv_cow_child()
8430 if (bs->drv->is_filter) { in bdrv_cow_child()
8451 if (!bs || !bs->drv) { in bdrv_filter_child()
8455 if (!bs->drv->is_filter) { in bdrv_filter_child()
8532 assert(!bs->drv || !bs->drv->is_filter); in bdrv_do_skip_filters()