Lines Matching defs:drv
138 if (!bs || !bs->drv) {
149 if (!bs || !bs->drv) {
516 int bdrv_is_whitelisted(BlockDriver *drv, bool read_only)
519 return bdrv_format_is_whitelisted(drv->format_name, read_only);
528 BlockDriver *drv;
535 int coroutine_fn bdrv_co_create(BlockDriver *drv, const char *filename,
542 if (!drv->bdrv_co_create_opts) {
544 drv->format_name);
548 ret = drv->bdrv_co_create_opts(drv, filename, opts, errp);
632 int coroutine_fn bdrv_co_create_opts_simple(BlockDriver *drv,
665 qdict_put_str(options, "driver", drv->format_name);
674 drv->format_name);
699 BlockDriver *drv;
705 drv = bdrv_find_protocol(filename, true, errp);
706 if (drv == NULL) {
710 if (!drv->create_opts) {
712 drv->format_name);
731 protocol_opts = qemu_opts_from_qdict(drv->create_opts, qdict, errp);
737 ret = bdrv_co_create(drv, filename, protocol_opts, errp);
753 if (!bs->drv) {
758 if (!bs->drv->bdrv_co_delete_file) {
760 bs->drv->format_name);
764 ret = bs->drv->bdrv_co_delete_file(bs, &local_err);
803 BlockDriver *drv = bs->drv;
807 if (drv && drv->bdrv_probe_blocksizes) {
808 return drv->bdrv_probe_blocksizes(bs, bsz);
824 BlockDriver *drv = bs->drv;
830 if (drv && drv->bdrv_probe_geometry) {
831 return drv->bdrv_probe_geometry(bs, geo);
889 BlockDriver *drv = NULL, *d;
897 drv = d;
902 return drv;
997 BlockDriver *drv = NULL, *d;
1005 drv = d;
1010 return drv;
1016 BlockDriver *drv;
1036 drv = bdrv_probe_all(buf, sizeof(buf), filename);
1037 if (!drv) {
1044 *pdrv = drv;
1055 BlockDriver *drv = bs->drv;
1059 if (!drv) {
1063 /* Do not attempt drv->bdrv_co_getlength() on scsi-generic devices */
1068 if (drv->bdrv_co_getlength) {
1069 int64_t length = drv->bdrv_co_getlength(bs);
1093 if (bs->drv && bs->drv->bdrv_join_options) {
1094 bs->drv->bdrv_join_options(options, old_options);
1331 if (base->drv) {
1338 if (backing_mask_protocol && base->drv->protocol_name) {
1341 format_name = base->drv->format_name;
1446 if (bs->drv->is_filter || (child->role & BDRV_CHILD_FILTERED)) {
1462 if (bs->drv->filtered_child_is_backing) {
1471 assert(bs->drv->supports_backing);
1647 bdrv_open_driver(BlockDriverState *bs, BlockDriver *drv, const char *node_name,
1660 bs->drv = drv;
1661 bs->opaque = g_malloc0(drv->instance_size);
1663 assert(!drv->bdrv_needs_filename || bs->filename[0]);
1664 if (drv->bdrv_open) {
1665 ret = drv->bdrv_open(bs, options, open_flags, &local_err);
1715 if (drv->bdrv_drain_begin) {
1716 drv->bdrv_drain_begin(bs);
1722 bs->drv = NULL;
1746 BlockDriverState *bdrv_new_open_driver_opts(BlockDriver *drv,
1764 ret = bdrv_open_driver(bs, drv, node_name, bs->options, flags, errp);
1778 BlockDriverState *bdrv_new_open_driver(BlockDriver *drv, const char *node_name,
1782 return bdrv_new_open_driver_opts(drv, node_name, NULL, flags, errp);
1875 BlockDriver *drv;
1895 drv = bdrv_find_format(driver_name);
1896 assert(drv != NULL);
1925 if (drv->bdrv_needs_filename && (!filename || !filename[0])) {
1927 drv->format_name);
1933 drv->format_name);
1937 if (use_bdrv_whitelist && !bdrv_is_whitelisted(drv, ro)) {
1938 if (!ro && bdrv_is_whitelisted(drv, true)) {
1947 !ro && bdrv_is_whitelisted(drv, true)
1950 drv->format_name);
1996 assert(!drv->protocol_name || file == NULL);
1997 ret = bdrv_open_driver(bs, drv, node_name, options, open_flags, errp);
2077 BlockDriver *drv = NULL;
2091 drv = bdrv_find_format(drvname);
2092 if (!drv) {
2098 protocol = drv->protocol_name;
2128 drv = bdrv_find_protocol(filename, parse_filename, errp);
2129 if (!drv) {
2133 drvname = drv->format_name;
2141 assert(drv || !protocol);
2144 if (drv && drv->bdrv_parse_filename && parse_filename) {
2145 drv->bdrv_parse_filename(filename, *options, &local_err);
2151 if (!drv->bdrv_needs_filename) {
2279 assert(bs->drv && bs->drv->bdrv_child_perm);
2281 bs->drv->bdrv_child_perm(bs, c, role, reopen_queue,
2371 if (bs->drv->bdrv_set_perm) {
2374 bs->drv->bdrv_set_perm(bs, cumulative_perms, cumulative_shared_perms);
2383 if (bs->drv->bdrv_abort_perm_update) {
2384 bs->drv->bdrv_abort_perm_update(bs);
2402 if (!bs->drv) {
2406 if (bs->drv->bdrv_check_perm) {
2407 int ret = bs->drv->bdrv_check_perm(bs, perm, shared_perm, errp);
2514 BlockDriver *drv = bs->drv;
2553 if (!drv) {
2564 if (!drv->bdrv_child_perm) {
3204 assert(parent_bs->drv);
3457 if (bs->drv && bs->drv->is_filter) {
3495 if (!parent_bs->drv) {
3497 * Node without drv is an object without a class :/. TODO: finally fix
3498 * qcow2 driver to never clear bs->drv and implement format corruption
3511 if (is_backing && !parent_bs->drv->is_filter &&
3512 !parent_bs->drv->supports_backing)
3515 "files", parent_bs->drv->format_name, parent_bs->node_name);
3519 if (parent_bs->drv->is_filter) {
3690 if (!bs->drv || !bs->drv->supports_backing) {
3852 assert(!parent->drv->filtered_child_is_backing);
3853 role = parent->drv->is_filter ?
3998 BlockDriver *drv = NULL;
4053 if (parent->drv) {
4054 parent_is_format = parent->drv->is_format;
4057 * parent->drv is not set yet because this node is opened for
4108 drv = bdrv_find_format(drvname);
4109 if (!drv) {
4162 bs->probed = !drv;
4163 if (!drv && file) {
4164 ret = find_image_format(file, filename, &drv, &local_err);
4179 qdict_put_str(bs->options, "driver", drv->format_name);
4180 qdict_put_str(options, "driver", drv->format_name);
4181 } else if (!drv) {
4187 assert(!!(flags & BDRV_O_PROTOCOL) == !!drv->protocol_name);
4228 "'%s'", drv->format_name, entry->key);
4232 drv->format_name, entry->key);
4311 * @bs->drv->mutable_opts are skipped.
4329 !is_str_in_list(e->key, bs->drv->mutable_opts)) {
4527 child->klass, child->role, bs->drv->is_format,
4661 if (bs->drv->bdrv_reopen_commit_post) {
4662 bs->drv->bdrv_reopen_commit_post(&bs_entry->state);
4808 if (bs->drv->is_filter && !old_child_bs) {
4814 "%s child", bs->node_name, bs->drv->format_name, child_name);
4878 BlockDriver *drv;
4886 assert(reopen_state->bs->drv != NULL);
4888 drv = reopen_state->bs->drv;
4944 if (drv->bdrv_reopen_prepare) {
4956 ret = drv->bdrv_reopen_prepare(reopen_state, queue, &local_err);
4971 * handler for each supported drv. */
4974 "does not support reopening files", drv->format_name,
4989 if (drv->supports_backing && reopen_state->backing_missing &&
5081 /* drv->bdrv_reopen_prepare() has succeeded, so we need to
5082 * call drv->bdrv_reopen_abort() before signaling an error
5085 if (drv->bdrv_reopen_abort) {
5086 drv->bdrv_reopen_abort(reopen_state);
5102 BlockDriver *drv;
5108 drv = bs->drv;
5109 assert(drv != NULL);
5113 if (drv->bdrv_reopen_commit) {
5114 drv->bdrv_reopen_commit(reopen_state);
5150 BlockDriver *drv;
5153 drv = reopen_state->bs->drv;
5154 assert(drv != NULL);
5157 if (drv->bdrv_reopen_abort) {
5158 drv->bdrv_reopen_abort(reopen_state);
5175 if (bs->drv) {
5176 if (bs->drv->bdrv_close) {
5178 bs->drv->bdrv_close(bs);
5180 bs->drv = NULL;
5617 BlockDriver *drv;
5625 drv = bdrv_find_format(drvname);
5626 if (!drv) {
5635 new_node_bs = bdrv_new_open_driver_opts(drv, node_name, options, flags,
5684 if (bs->drv == NULL) {
5687 if (bs->drv->bdrv_co_check == NULL) {
5692 return bs->drv->bdrv_co_check(bs, res, fix);
5707 BlockDriver *drv = bs->drv;
5712 if (!drv) {
5725 if (drv->bdrv_co_change_backing_file != NULL) {
5726 ret = drv->bdrv_co_change_backing_file(bs, backing_file, backing_fmt);
5912 if (!top->drv || !base->drv) {
6027 BlockDriver *drv = bs->drv;
6031 if (!drv) {
6034 if (drv->bdrv_co_get_allocated_file_size) {
6035 return drv->bdrv_co_get_allocated_file_size(bs);
6038 if (drv->protocol_name) {
6045 } else if (drv->is_filter) {
6056 * @drv: Format driver
6073 * Note that @in_bs may use a different BlockDriver from @drv.
6077 BlockMeasureInfo *bdrv_measure(BlockDriver *drv, QemuOpts *opts,
6081 if (!drv->bdrv_measure) {
6083 drv->format_name);
6087 return drv->bdrv_measure(opts, in_bs, errp);
6095 BlockDriver *drv = bs->drv;
6099 if (!drv)
6117 BlockDriver *drv = bs->drv;
6120 if (!drv)
6167 if (!bs->drv || !block_driver_can_compress(bs->drv)) {
6186 return bs->drv ? bs->drv->format_name : NULL;
6197 BlockDriver *drv;
6204 QLIST_FOREACH(drv, &bdrv_drivers, list) {
6205 if (drv->format_name) {
6208 if (use_bdrv_whitelist && !bdrv_is_whitelisted(drv, read_only)) {
6214 found = !strcmp(formats[--i], drv->format_name);
6219 formats[count++] = drv->format_name;
6556 if (!bs->drv) {
6565 if (bs->drv->bdrv_has_zero_init) {
6566 return bs->drv->bdrv_has_zero_init(bs);
6598 BlockDriver *drv = bs->drv;
6602 /* if bs->drv == NULL, bs is closed, so there's nothing to do here */
6603 if (!drv) {
6606 if (!drv->bdrv_co_get_info) {
6614 ret = drv->bdrv_co_get_info(bs, bdi);
6636 BlockDriver *drv = bs->drv;
6638 if (drv && drv->bdrv_get_specific_info) {
6639 return drv->bdrv_get_specific_info(bs, errp);
6646 BlockDriver *drv = bs->drv;
6648 if (!drv || !drv->bdrv_get_specific_stats) {
6651 return drv->bdrv_get_specific_stats(bs);
6659 if (!bs || !bs->drv || !bs->drv->bdrv_co_debug_event) {
6663 bs->drv->bdrv_co_debug_event(bs, event);
6670 while (bs && bs->drv && !bs->drv->bdrv_debug_breakpoint) {
6674 if (bs && bs->drv && bs->drv->bdrv_debug_breakpoint) {
6675 assert(bs->drv->bdrv_debug_remove_breakpoint);
6690 return bs->drv->bdrv_debug_breakpoint(bs, event, tag);
6703 return bs->drv->bdrv_debug_remove_breakpoint(bs, tag);
6714 while (bs && (!bs->drv || !bs->drv->bdrv_debug_resume)) {
6718 if (bs && bs->drv && bs->drv->bdrv_debug_resume) {
6719 return bs->drv->bdrv_debug_resume(bs, tag);
6730 while (bs && bs->drv && !bs->drv->bdrv_debug_is_suspended) {
6734 if (bs && bs->drv && bs->drv->bdrv_debug_is_suspended) {
6735 return bs->drv->bdrv_debug_is_suspended(bs, tag);
6760 if (!bs || !bs->drv || !backing_file) {
6884 if (!bs->drv) {
6957 if (bs->drv->bdrv_co_invalidate_cache) {
6958 bs->drv->bdrv_co_invalidate_cache(bs, &local_err);
7016 if (!bs->drv) {
7036 if (bs->drv->bdrv_inactivate) {
7037 ret = bs->drv->bdrv_inactivate(bs);
7145 BlockDriver *drv = bs->drv;
7150 if (!drv) {
7153 if (drv->bdrv_co_is_inserted) {
7154 return drv->bdrv_co_is_inserted(bs);
7169 BlockDriver *drv = bs->drv;
7173 if (drv && drv->bdrv_co_eject) {
7174 drv->bdrv_co_eject(bs, eject_flag);
7184 BlockDriver *drv = bs->drv;
7189 if (drv && drv->bdrv_co_lock_medium) {
7190 drv->bdrv_co_lock_medium(bs, locked);
7323 BlockDriver *drv, *proto_drv;
7330 drv = bdrv_find_format(fmt);
7331 if (!drv) {
7341 if (!drv->create_opts) {
7343 drv->format_name);
7354 create_opts = qemu_opts_append(create_opts, drv->create_opts);
7447 bs->drv->format_name);
7485 ret = bdrv_create(drv, filename, opts, &local_err);
7564 if (bs->drv && bs->drv->bdrv_detach_aio_context) {
7565 bs->drv->bdrv_detach_aio_context(bs);
7579 if (bs->drv && bs->drv->bdrv_attach_aio_context) {
7580 bs->drv->bdrv_attach_aio_context(bs, new_context);
7854 if (!bs->drv) {
7858 if (!bs->drv->bdrv_amend_options) {
7860 bs->drv->format_name);
7863 return bs->drv->bdrv_amend_options(bs, opts, status_cb,
7886 if (!bs || !bs->drv) {
7895 if (bs->drv->bdrv_recurse_can_replace) {
7896 return bs->drv->bdrv_recurse_can_replace(bs, to_replace);
7974 if (curopt == &global_options[ARRAY_SIZE(global_options) - 1] && bs->drv) {
7975 curopt = bs->drv->strong_runtime_opts;
7997 if (!bs->drv) {
8038 qdict_put_str(d, "driver", bs->drv->format_name);
8074 BlockDriver *drv = bs->drv;
8084 if (!drv) {
8124 if (drv->bdrv_gather_child_options) {
8127 drv->bdrv_gather_child_options(bs, opts, backing_overridden);
8150 if (drv->bdrv_refresh_filename) {
8155 drv->bdrv_refresh_filename(bs);
8181 primary_child_bs->drv->protocol_name &&
8182 !drv->is_filter && !generate_json_filename)
8203 BlockDriver *drv = bs->drv;
8208 if (!drv) {
8213 if (drv->bdrv_dirname) {
8214 return drv->bdrv_dirname(bs, errp);
8228 drv->format_name);
8242 if (!parent_bs->drv || !parent_bs->drv->bdrv_add_child) {
8253 if (!parent_bs->drv->supports_zoned_children &&
8262 parent_bs->drv->supports_zoned_children ?
8273 parent_bs->drv->bdrv_add_child(parent_bs, child_bs, errp);
8287 if (!parent_bs->drv || !parent_bs->drv->bdrv_del_child) {
8306 parent_bs->drv->bdrv_del_child(parent_bs, child, errp);
8311 BlockDriver *drv = c->bs->drv;
8317 if (!drv->bdrv_make_empty) {
8319 drv->format_name);
8323 ret = drv->bdrv_make_empty(c->bs);
8341 if (!bs || !bs->drv) {
8345 if (bs->drv->is_filter) {
8366 if (!bs || !bs->drv) {
8370 if (!bs->drv->is_filter) {
8447 assert(!bs->drv || !bs->drv->is_filter);
8453 * Note that this treats nodes with bs->drv == NULL as not being
8454 * filters (bs->drv == NULL should be replaced by something else