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;
1744 BlockDriverState *bdrv_new_open_driver_opts(BlockDriver *drv,
1762 ret = bdrv_open_driver(bs, drv, node_name, bs->options, flags, errp);
1776 BlockDriverState *bdrv_new_open_driver(BlockDriver *drv, const char *node_name,
1780 return bdrv_new_open_driver_opts(drv, node_name, NULL, flags, errp);
1873 BlockDriver *drv;
1893 drv = bdrv_find_format(driver_name);
1894 assert(drv != NULL);
1923 if (drv->bdrv_needs_filename && (!filename || !filename[0])) {
1925 drv->format_name);
1931 drv->format_name);
1935 if (use_bdrv_whitelist && !bdrv_is_whitelisted(drv, ro)) {
1936 if (!ro && bdrv_is_whitelisted(drv, true)) {
1945 !ro && bdrv_is_whitelisted(drv, true)
1948 drv->format_name);
1994 assert(!drv->protocol_name || file == NULL);
1995 ret = bdrv_open_driver(bs, drv, node_name, options, open_flags, errp);
2075 BlockDriver *drv = NULL;
2089 drv = bdrv_find_format(drvname);
2090 if (!drv) {
2096 protocol = drv->protocol_name;
2126 drv = bdrv_find_protocol(filename, parse_filename, errp);
2127 if (!drv) {
2131 drvname = drv->format_name;
2139 assert(drv || !protocol);
2142 if (drv && drv->bdrv_parse_filename && parse_filename) {
2143 drv->bdrv_parse_filename(filename, *options, &local_err);
2149 if (!drv->bdrv_needs_filename) {
2277 assert(bs->drv && bs->drv->bdrv_child_perm);
2279 bs->drv->bdrv_child_perm(bs, c, role, reopen_queue,
2369 if (bs->drv->bdrv_set_perm) {
2372 bs->drv->bdrv_set_perm(bs, cumulative_perms, cumulative_shared_perms);
2381 if (bs->drv->bdrv_abort_perm_update) {
2382 bs->drv->bdrv_abort_perm_update(bs);
2400 if (!bs->drv) {
2404 if (bs->drv->bdrv_check_perm) {
2405 int ret = bs->drv->bdrv_check_perm(bs, perm, shared_perm, errp);
2512 BlockDriver *drv = bs->drv;
2551 if (!drv) {
2562 if (!drv->bdrv_child_perm) {
3202 assert(parent_bs->drv);
3455 if (bs->drv && bs->drv->is_filter) {
3493 if (!parent_bs->drv) {
3495 * Node without drv is an object without a class :/. TODO: finally fix
3496 * qcow2 driver to never clear bs->drv and implement format corruption
3509 if (is_backing && !parent_bs->drv->is_filter &&
3510 !parent_bs->drv->supports_backing)
3513 "files", parent_bs->drv->format_name, parent_bs->node_name);
3517 if (parent_bs->drv->is_filter) {
3673 if (!bs->drv || !bs->drv->supports_backing) {
3837 assert(!parent->drv->filtered_child_is_backing);
3838 role = parent->drv->is_filter ?
3983 BlockDriver *drv = NULL;
4038 if (parent->drv) {
4039 parent_is_format = parent->drv->is_format;
4042 * parent->drv is not set yet because this node is opened for
4093 drv = bdrv_find_format(drvname);
4094 if (!drv) {
4147 bs->probed = !drv;
4148 if (!drv && file) {
4149 ret = find_image_format(file, filename, &drv, &local_err);
4164 qdict_put_str(bs->options, "driver", drv->format_name);
4165 qdict_put_str(options, "driver", drv->format_name);
4166 } else if (!drv) {
4172 assert(!!(flags & BDRV_O_PROTOCOL) == !!drv->protocol_name);
4213 "'%s'", drv->format_name, entry->key);
4217 drv->format_name, entry->key);
4296 * @bs->drv->mutable_opts are skipped.
4314 !is_str_in_list(e->key, bs->drv->mutable_opts)) {
4512 child->klass, child->role, bs->drv->is_format,
4646 if (bs->drv->bdrv_reopen_commit_post) {
4647 bs->drv->bdrv_reopen_commit_post(&bs_entry->state);
4793 if (bs->drv->is_filter && !old_child_bs) {
4799 "%s child", bs->node_name, bs->drv->format_name, child_name);
4863 BlockDriver *drv;
4871 assert(reopen_state->bs->drv != NULL);
4873 drv = reopen_state->bs->drv;
4929 if (drv->bdrv_reopen_prepare) {
4941 ret = drv->bdrv_reopen_prepare(reopen_state, queue, &local_err);
4956 * handler for each supported drv. */
4959 "does not support reopening files", drv->format_name,
4974 if (drv->supports_backing && reopen_state->backing_missing &&
5066 /* drv->bdrv_reopen_prepare() has succeeded, so we need to
5067 * call drv->bdrv_reopen_abort() before signaling an error
5070 if (drv->bdrv_reopen_abort) {
5071 drv->bdrv_reopen_abort(reopen_state);
5087 BlockDriver *drv;
5093 drv = bs->drv;
5094 assert(drv != NULL);
5098 if (drv->bdrv_reopen_commit) {
5099 drv->bdrv_reopen_commit(reopen_state);
5135 BlockDriver *drv;
5138 drv = reopen_state->bs->drv;
5139 assert(drv != NULL);
5142 if (drv->bdrv_reopen_abort) {
5143 drv->bdrv_reopen_abort(reopen_state);
5160 if (bs->drv) {
5161 if (bs->drv->bdrv_close) {
5163 bs->drv->bdrv_close(bs);
5165 bs->drv = NULL;
5598 BlockDriver *drv;
5606 drv = bdrv_find_format(drvname);
5607 if (!drv) {
5616 new_node_bs = bdrv_new_open_driver_opts(drv, node_name, options, flags,
5665 if (bs->drv == NULL) {
5668 if (bs->drv->bdrv_co_check == NULL) {
5673 return bs->drv->bdrv_co_check(bs, res, fix);
5688 BlockDriver *drv = bs->drv;
5693 if (!drv) {
5706 if (drv->bdrv_co_change_backing_file != NULL) {
5707 ret = drv->bdrv_co_change_backing_file(bs, backing_file, backing_fmt);
5893 if (!top->drv || !base->drv) {
6008 BlockDriver *drv = bs->drv;
6012 if (!drv) {
6015 if (drv->bdrv_co_get_allocated_file_size) {
6016 return drv->bdrv_co_get_allocated_file_size(bs);
6019 if (drv->protocol_name) {
6026 } else if (drv->is_filter) {
6037 * @drv: Format driver
6054 * Note that @in_bs may use a different BlockDriver from @drv.
6058 BlockMeasureInfo *bdrv_measure(BlockDriver *drv, QemuOpts *opts,
6062 if (!drv->bdrv_measure) {
6064 drv->format_name);
6068 return drv->bdrv_measure(opts, in_bs, errp);
6076 BlockDriver *drv = bs->drv;
6080 if (!drv)
6098 BlockDriver *drv = bs->drv;
6101 if (!drv)
6148 if (!bs->drv || !block_driver_can_compress(bs->drv)) {
6167 return bs->drv ? bs->drv->format_name : NULL;
6178 BlockDriver *drv;
6185 QLIST_FOREACH(drv, &bdrv_drivers, list) {
6186 if (drv->format_name) {
6189 if (use_bdrv_whitelist && !bdrv_is_whitelisted(drv, read_only)) {
6195 found = !strcmp(formats[--i], drv->format_name);
6200 formats[count++] = drv->format_name;
6537 if (!bs->drv) {
6546 if (bs->drv->bdrv_has_zero_init) {
6547 return bs->drv->bdrv_has_zero_init(bs);
6579 BlockDriver *drv = bs->drv;
6583 /* if bs->drv == NULL, bs is closed, so there's nothing to do here */
6584 if (!drv) {
6587 if (!drv->bdrv_co_get_info) {
6595 ret = drv->bdrv_co_get_info(bs, bdi);
6617 BlockDriver *drv = bs->drv;
6619 if (drv && drv->bdrv_get_specific_info) {
6620 return drv->bdrv_get_specific_info(bs, errp);
6627 BlockDriver *drv = bs->drv;
6629 if (!drv || !drv->bdrv_get_specific_stats) {
6632 return drv->bdrv_get_specific_stats(bs);
6640 if (!bs || !bs->drv || !bs->drv->bdrv_co_debug_event) {
6644 bs->drv->bdrv_co_debug_event(bs, event);
6651 while (bs && bs->drv && !bs->drv->bdrv_debug_breakpoint) {
6655 if (bs && bs->drv && bs->drv->bdrv_debug_breakpoint) {
6656 assert(bs->drv->bdrv_debug_remove_breakpoint);
6671 return bs->drv->bdrv_debug_breakpoint(bs, event, tag);
6684 return bs->drv->bdrv_debug_remove_breakpoint(bs, tag);
6695 while (bs && (!bs->drv || !bs->drv->bdrv_debug_resume)) {
6699 if (bs && bs->drv && bs->drv->bdrv_debug_resume) {
6700 return bs->drv->bdrv_debug_resume(bs, tag);
6711 while (bs && bs->drv && !bs->drv->bdrv_debug_is_suspended) {
6715 if (bs && bs->drv && bs->drv->bdrv_debug_is_suspended) {
6716 return bs->drv->bdrv_debug_is_suspended(bs, tag);
6741 if (!bs || !bs->drv || !backing_file) {
6865 if (!bs->drv) {
6938 if (bs->drv->bdrv_co_invalidate_cache) {
6939 bs->drv->bdrv_co_invalidate_cache(bs, &local_err);
6997 if (!bs->drv) {
7017 if (bs->drv->bdrv_inactivate) {
7018 ret = bs->drv->bdrv_inactivate(bs);
7120 BlockDriver *drv = bs->drv;
7125 if (!drv) {
7128 if (drv->bdrv_co_is_inserted) {
7129 return drv->bdrv_co_is_inserted(bs);
7144 BlockDriver *drv = bs->drv;
7148 if (drv && drv->bdrv_co_eject) {
7149 drv->bdrv_co_eject(bs, eject_flag);
7159 BlockDriver *drv = bs->drv;
7164 if (drv && drv->bdrv_co_lock_medium) {
7165 drv->bdrv_co_lock_medium(bs, locked);
7298 BlockDriver *drv, *proto_drv;
7305 drv = bdrv_find_format(fmt);
7306 if (!drv) {
7316 if (!drv->create_opts) {
7318 drv->format_name);
7329 create_opts = qemu_opts_append(create_opts, drv->create_opts);
7422 bs->drv->format_name);
7460 ret = bdrv_create(drv, filename, opts, &local_err);
7539 if (bs->drv && bs->drv->bdrv_detach_aio_context) {
7540 bs->drv->bdrv_detach_aio_context(bs);
7554 if (bs->drv && bs->drv->bdrv_attach_aio_context) {
7555 bs->drv->bdrv_attach_aio_context(bs, new_context);
7829 if (!bs->drv) {
7833 if (!bs->drv->bdrv_amend_options) {
7835 bs->drv->format_name);
7838 return bs->drv->bdrv_amend_options(bs, opts, status_cb,
7861 if (!bs || !bs->drv) {
7870 if (bs->drv->bdrv_recurse_can_replace) {
7871 return bs->drv->bdrv_recurse_can_replace(bs, to_replace);
7949 if (curopt == &global_options[ARRAY_SIZE(global_options) - 1] && bs->drv) {
7950 curopt = bs->drv->strong_runtime_opts;
7972 if (!bs->drv) {
8013 qdict_put_str(d, "driver", bs->drv->format_name);
8049 BlockDriver *drv = bs->drv;
8059 if (!drv) {
8099 if (drv->bdrv_gather_child_options) {
8102 drv->bdrv_gather_child_options(bs, opts, backing_overridden);
8125 if (drv->bdrv_refresh_filename) {
8130 drv->bdrv_refresh_filename(bs);
8156 primary_child_bs->drv->protocol_name &&
8157 !drv->is_filter && !generate_json_filename)
8178 BlockDriver *drv = bs->drv;
8183 if (!drv) {
8188 if (drv->bdrv_dirname) {
8189 return drv->bdrv_dirname(bs, errp);
8203 drv->format_name);
8217 if (!parent_bs->drv || !parent_bs->drv->bdrv_add_child) {
8228 if (!parent_bs->drv->supports_zoned_children &&
8237 parent_bs->drv->supports_zoned_children ?
8248 parent_bs->drv->bdrv_add_child(parent_bs, child_bs, errp);
8262 if (!parent_bs->drv || !parent_bs->drv->bdrv_del_child) {
8281 parent_bs->drv->bdrv_del_child(parent_bs, child, errp);
8286 BlockDriver *drv = c->bs->drv;
8292 if (!drv->bdrv_make_empty) {
8294 drv->format_name);
8298 ret = drv->bdrv_make_empty(c->bs);
8316 if (!bs || !bs->drv) {
8320 if (bs->drv->is_filter) {
8341 if (!bs || !bs->drv) {
8345 if (!bs->drv->is_filter) {
8422 assert(!bs->drv || !bs->drv->is_filter);
8428 * Note that this treats nodes with bs->drv == NULL as not being
8429 * filters (bs->drv == NULL should be replaced by something else