blkdebug.c (62a35aaa310807fa161ca041ddb0f308faeb582b) blkdebug.c (af175e85f92c870386ad74f466e29537b79611d3)
1/*
2 * Block protocol for I/O error injection
3 *
4 * Copyright (C) 2016-2017 Red Hat, Inc.
5 * Copyright (c) 2010 Kevin Wolf <kwolf@redhat.com>
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a copy
8 * of this software and associated documentation files (the "Software"), to deal

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

354static int blkdebug_parse_perm_list(uint64_t *dest, QDict *options,
355 const char *prefix, Error **errp)
356{
357 int ret = 0;
358 QDict *subqdict = NULL;
359 QObject *crumpled_subqdict = NULL;
360 Visitor *v = NULL;
361 BlockPermissionList *perm_list = NULL, *element;
1/*
2 * Block protocol for I/O error injection
3 *
4 * Copyright (C) 2016-2017 Red Hat, Inc.
5 * Copyright (c) 2010 Kevin Wolf <kwolf@redhat.com>
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a copy
8 * of this software and associated documentation files (the "Software"), to deal

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

354static int blkdebug_parse_perm_list(uint64_t *dest, QDict *options,
355 const char *prefix, Error **errp)
356{
357 int ret = 0;
358 QDict *subqdict = NULL;
359 QObject *crumpled_subqdict = NULL;
360 Visitor *v = NULL;
361 BlockPermissionList *perm_list = NULL, *element;
362 Error *local_err = NULL;
363
364 *dest = 0;
365
366 qdict_extract_subqdict(options, &subqdict, prefix);
367 if (!qdict_size(subqdict)) {
368 goto out;
369 }
370
371 crumpled_subqdict = qdict_crumple(subqdict, errp);
372 if (!crumpled_subqdict) {
373 ret = -EINVAL;
374 goto out;
375 }
376
377 v = qobject_input_visitor_new(crumpled_subqdict);
362
363 *dest = 0;
364
365 qdict_extract_subqdict(options, &subqdict, prefix);
366 if (!qdict_size(subqdict)) {
367 goto out;
368 }
369
370 crumpled_subqdict = qdict_crumple(subqdict, errp);
371 if (!crumpled_subqdict) {
372 ret = -EINVAL;
373 goto out;
374 }
375
376 v = qobject_input_visitor_new(crumpled_subqdict);
378 if (!visit_type_BlockPermissionList(v, NULL, &perm_list, &local_err)) {
379 error_propagate(errp, local_err);
377 if (!visit_type_BlockPermissionList(v, NULL, &perm_list, errp)) {
380 ret = -EINVAL;
381 goto out;
382 }
383
384 for (element = perm_list; element; element = element->next) {
385 *dest |= bdrv_qapi_perm_to_blk_perm(element->value);
386 }
387

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

466{
467 BDRVBlkdebugState *s = bs->opaque;
468 QemuOpts *opts;
469 Error *local_err = NULL;
470 int ret;
471 uint64_t align;
472
473 opts = qemu_opts_create(&runtime_opts, NULL, 0, &error_abort);
378 ret = -EINVAL;
379 goto out;
380 }
381
382 for (element = perm_list; element; element = element->next) {
383 *dest |= bdrv_qapi_perm_to_blk_perm(element->value);
384 }
385

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

464{
465 BDRVBlkdebugState *s = bs->opaque;
466 QemuOpts *opts;
467 Error *local_err = NULL;
468 int ret;
469 uint64_t align;
470
471 opts = qemu_opts_create(&runtime_opts, NULL, 0, &error_abort);
474 if (!qemu_opts_absorb_qdict(opts, options, &local_err)) {
475 error_propagate(errp, local_err);
472 if (!qemu_opts_absorb_qdict(opts, options, errp)) {
476 ret = -EINVAL;
477 goto out;
478 }
479
480 /* Read rules from config file or command line options */
481 s->config_file = g_strdup(qemu_opt_get(opts, "config"));
482 ret = read_config(s, s->config_file, options, errp);
483 if (ret) {

--- 579 unchanged lines hidden ---
473 ret = -EINVAL;
474 goto out;
475 }
476
477 /* Read rules from config file or command line options */
478 s->config_file = g_strdup(qemu_opt_get(opts, "config"));
479 ret = read_config(s, s->config_file, options, errp);
480 if (ret) {

--- 579 unchanged lines hidden ---