qcow2.c (92adf9dbcd3cf9cedddae995b04a99f5c42ae08c) qcow2.c (af91062ee1408f7f5bb58389d355d29a5040c648)
1/*
2 * Block driver for the QCOW version 2 format
3 *
4 * Copyright (c) 2004-2006 Fabrice Bellard
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights

--- 3067 unchanged lines hidden (view full) ---

3076 return ret;
3077}
3078
3079static int coroutine_fn qcow2_co_create_opts(const char *filename, QemuOpts *opts,
3080 Error **errp)
3081{
3082 BlockdevCreateOptions *create_options = NULL;
3083 QDict *qdict;
1/*
2 * Block driver for the QCOW version 2 format
3 *
4 * Copyright (c) 2004-2006 Fabrice Bellard
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights

--- 3067 unchanged lines hidden (view full) ---

3076 return ret;
3077}
3078
3079static int coroutine_fn qcow2_co_create_opts(const char *filename, QemuOpts *opts,
3080 Error **errp)
3081{
3082 BlockdevCreateOptions *create_options = NULL;
3083 QDict *qdict;
3084 QObject *qobj;
3085 Visitor *v;
3086 BlockDriverState *bs = NULL;
3087 Error *local_err = NULL;
3088 const char *val;
3089 int ret;
3090
3091 /* Only the keyval visitor supports the dotted syntax needed for
3092 * encryption, so go through a QDict before getting a QAPI type. Ignore

--- 54 unchanged lines hidden (view full) ---

3147 goto finish;
3148 }
3149
3150 /* Set 'driver' and 'node' options */
3151 qdict_put_str(qdict, "driver", "qcow2");
3152 qdict_put_str(qdict, "file", bs->node_name);
3153
3154 /* Now get the QAPI type BlockdevCreateOptions */
3084 Visitor *v;
3085 BlockDriverState *bs = NULL;
3086 Error *local_err = NULL;
3087 const char *val;
3088 int ret;
3089
3090 /* Only the keyval visitor supports the dotted syntax needed for
3091 * encryption, so go through a QDict before getting a QAPI type. Ignore

--- 54 unchanged lines hidden (view full) ---

3146 goto finish;
3147 }
3148
3149 /* Set 'driver' and 'node' options */
3150 qdict_put_str(qdict, "driver", "qcow2");
3151 qdict_put_str(qdict, "file", bs->node_name);
3152
3153 /* Now get the QAPI type BlockdevCreateOptions */
3155 qobj = qdict_crumple_for_keyval_qiv(qdict, errp);
3156 if (!qobj) {
3154 v = qobject_input_visitor_new_flat_confused(qdict, errp);
3155 if (!v) {
3157 ret = -EINVAL;
3158 goto finish;
3159 }
3160
3156 ret = -EINVAL;
3157 goto finish;
3158 }
3159
3161 v = qobject_input_visitor_new_keyval(qobj);
3162 qobject_unref(qobj);
3163 visit_type_BlockdevCreateOptions(v, NULL, &create_options, &local_err);
3164 visit_free(v);
3165
3166 if (local_err) {
3167 error_propagate(errp, local_err);
3168 ret = -EINVAL;
3169 goto finish;
3170 }

--- 1573 unchanged lines hidden ---
3160 visit_type_BlockdevCreateOptions(v, NULL, &create_options, &local_err);
3161 visit_free(v);
3162
3163 if (local_err) {
3164 error_propagate(errp, local_err);
3165 ret = -EINVAL;
3166 goto finish;
3167 }

--- 1573 unchanged lines hidden ---