crypto.c (235e59cf03ed75d0ce96c97343194ed11c146231) crypto.c (af175e85f92c870386ad74f466e29537b79611d3)
1/*
2 * QEMU block full disk encryption
3 *
4 * Copyright (c) 2015-2016 Red Hat, Inc.
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either

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

255 QemuOptsList *opts_spec,
256 BlockDriverState *bs,
257 QDict *options,
258 int flags,
259 Error **errp)
260{
261 BlockCrypto *crypto = bs->opaque;
262 QemuOpts *opts = NULL;
1/*
2 * QEMU block full disk encryption
3 *
4 * Copyright (c) 2015-2016 Red Hat, Inc.
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either

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

255 QemuOptsList *opts_spec,
256 BlockDriverState *bs,
257 QDict *options,
258 int flags,
259 Error **errp)
260{
261 BlockCrypto *crypto = bs->opaque;
262 QemuOpts *opts = NULL;
263 Error *local_err = NULL;
264 int ret = -EINVAL;
265 QCryptoBlockOpenOptions *open_opts = NULL;
266 unsigned int cflags = 0;
267 QDict *cryptoopts = NULL;
268
269 bs->file = bdrv_open_child(NULL, options, "file", bs, &child_of_bds,
270 BDRV_CHILD_IMAGE, false, errp);
271 if (!bs->file) {
272 return -EINVAL;
273 }
274
275 bs->supported_write_flags = BDRV_REQ_FUA &
276 bs->file->bs->supported_write_flags;
277
278 opts = qemu_opts_create(opts_spec, NULL, 0, &error_abort);
263 int ret = -EINVAL;
264 QCryptoBlockOpenOptions *open_opts = NULL;
265 unsigned int cflags = 0;
266 QDict *cryptoopts = NULL;
267
268 bs->file = bdrv_open_child(NULL, options, "file", bs, &child_of_bds,
269 BDRV_CHILD_IMAGE, false, errp);
270 if (!bs->file) {
271 return -EINVAL;
272 }
273
274 bs->supported_write_flags = BDRV_REQ_FUA &
275 bs->file->bs->supported_write_flags;
276
277 opts = qemu_opts_create(opts_spec, NULL, 0, &error_abort);
279 if (!qemu_opts_absorb_qdict(opts, options, &local_err)) {
280 error_propagate(errp, local_err);
278 if (!qemu_opts_absorb_qdict(opts, options, errp)) {
281 goto cleanup;
282 }
283
284 cryptoopts = qemu_opts_to_qdict(opts, NULL);
285 qdict_put_str(cryptoopts, "format", QCryptoBlockFormat_str(format));
286
287 open_opts = block_crypto_open_opts_init(cryptoopts, errp);
288 if (!open_opts) {

--- 668 unchanged lines hidden ---
279 goto cleanup;
280 }
281
282 cryptoopts = qemu_opts_to_qdict(opts, NULL);
283 qdict_put_str(cryptoopts, "format", QCryptoBlockFormat_str(format));
284
285 open_opts = block_crypto_open_opts_init(cryptoopts, errp);
286 if (!open_opts) {

--- 668 unchanged lines hidden ---