Monitor patches
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABAgAGBQJViExCAAoJEDhwtADrkYZTx5IP/1xjBC15T5SDUXEcuWIDg4VY 92Qipe5dcQfZo+EYbKUbQx3Pj+27KhKQjIXthmh+RGvI0fPi/Y2iikcHTzCWqrL8 SNxLLWQXGJSG8yur30OziR/6aRq65jnLCkCR5cNbtQt8Zvzm8jk67lNVL5212NGJ 3jhpoD8eXzrkeDOxlXP2zshOGyGr+05tKXfPYu6npKPiJ8HyUSUwA4CD46ZQLZz8 HtJOkSbhwi8GyWoACF3QEEnYVwYV2cFpGpAB4prWxba5EBihGruC3I7wrVOxs5H8 v2ZVjePdvxwQ/YHPmdpd8DhLpe2BCDgHjEbya9Qg8FStUKALE79AUfc+VkSUKf1/ pPyJmC30coM7yEFWMlJM+RqOel013/TOMuSqBdTnV8C0d8AaEx8Ako6NDiwRm7mt NeNixsEITAhvi9qUUCywxNO6kVIfbKdqk/cTF3eWj2O3FsMeR2ICd2/ucux5X+Xu axvrC1xt4s2j4IK7awSFz8kq2w0+eV9OR9+cV9Lpa5cVjHkes8M+b7zExs9+wjBZ nZcvOBAJo5Xe9FIi4lj2TuEZvZQLgocUkVZIZQRfMTE1VXykcitqp5skLRms63e0 n+W4CSKD0scMxCpTVZfdnVjJpSIOm58R429aOLsDrz+Np8QieNzLsujCsP7V7A+1 EvCwddtvLsKjRvX9ZbE1 =v038 -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/armbru/tags/pull-monitor-2015-06-22' into staging Monitor patches # gpg: Signature made Mon Jun 22 18:56:18 2015 BST using RSA key ID EB918653 # gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" # gpg: aka "Markus Armbruster <armbru@pond.sub.org>" * remotes/armbru/tags/pull-monitor-2015-06-22: (24 commits) Include monitor/monitor.h exactly where needed Include qapi/qmp/qerror.h exactly where needed qerror: Move #include out of qerror.h qerror: Finally unused, clean up qmp: Wean off qerror_report() tpm: Avoid qerror_report() outside QMP command handlers qerror: Clean up QERR_ macros to expand into a single string qerror: Eliminate QERR_DEVICE_NOT_FOUND vl: Use error_report() for --display errors vl: Avoid qerror_report() outside QMP command handlers QemuOpts: Wean off qerror_report_err() qdev-monitor: Propagate errors through qdev_device_add() qdev-monitor: Propagate errors through set_property() qdev-monitor: Convert qbus_find() to Error qdev-monitor: Fix check for full bus qdev-monitor: Stop error avalanche in qbus_find_recursive() disas: Remove uses of CPU env monitor: Split mon_get_cpu fn to remove ENV_GET_CPU monitor: Fix failure path for "S" argument monitor: Point to "help" command on syntax error ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
a3206972a9
@ -18,6 +18,7 @@
|
||||
*/
|
||||
|
||||
#include "hw/hw.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "qemu/timer.h"
|
||||
#include "ui/qemu-spice.h"
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include "hw/hw.h"
|
||||
#include "monitor/monitor.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "audio.h"
|
||||
|
||||
typedef struct {
|
||||
|
@ -13,7 +13,6 @@
|
||||
#include "qapi/visitor.h"
|
||||
#include "qapi-types.h"
|
||||
#include "qapi-visit.h"
|
||||
#include "qapi/qmp/qerror.h"
|
||||
#include "qemu/config-file.h"
|
||||
#include "qom/object_interfaces.h"
|
||||
|
||||
|
@ -140,19 +140,20 @@ static void rng_egd_opened(RngBackend *b, Error **errp)
|
||||
RngEgd *s = RNG_EGD(b);
|
||||
|
||||
if (s->chr_name == NULL) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER_VALUE,
|
||||
"chardev", "a valid character device");
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_VALUE,
|
||||
"chardev", "a valid character device");
|
||||
return;
|
||||
}
|
||||
|
||||
s->chr = qemu_chr_find(s->chr_name);
|
||||
if (s->chr == NULL) {
|
||||
error_set(errp, QERR_DEVICE_NOT_FOUND, s->chr_name);
|
||||
error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND,
|
||||
"Device '%s' not found", s->chr_name);
|
||||
return;
|
||||
}
|
||||
|
||||
if (qemu_chr_fe_claim(s->chr) != 0) {
|
||||
error_set(errp, QERR_DEVICE_IN_USE, s->chr_name);
|
||||
error_setg(errp, QERR_DEVICE_IN_USE, s->chr_name);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -167,7 +168,7 @@ static void rng_egd_set_chardev(Object *obj, const char *value, Error **errp)
|
||||
RngEgd *s = RNG_EGD(b);
|
||||
|
||||
if (b->opened) {
|
||||
error_set(errp, QERR_PERMISSION_DENIED);
|
||||
error_setg(errp, QERR_PERMISSION_DENIED);
|
||||
} else {
|
||||
g_free(s->chr_name);
|
||||
s->chr_name = g_strdup(value);
|
||||
|
@ -74,8 +74,8 @@ static void rng_random_opened(RngBackend *b, Error **errp)
|
||||
RndRandom *s = RNG_RANDOM(b);
|
||||
|
||||
if (s->filename == NULL) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER_VALUE,
|
||||
"filename", "a valid filename");
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_VALUE,
|
||||
"filename", "a valid filename");
|
||||
} else {
|
||||
s->fd = qemu_open(s->filename, O_RDONLY | O_NONBLOCK);
|
||||
if (s->fd == -1) {
|
||||
@ -98,7 +98,7 @@ static void rng_random_set_filename(Object *obj, const char *filename,
|
||||
RndRandom *s = RNG_RANDOM(obj);
|
||||
|
||||
if (b->opened) {
|
||||
error_set(errp, QERR_PERMISSION_DENIED);
|
||||
error_setg(errp, QERR_PERMISSION_DENIED);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -57,7 +57,7 @@ static void rng_backend_prop_set_opened(Object *obj, bool value, Error **errp)
|
||||
}
|
||||
|
||||
if (!value && s->opened) {
|
||||
error_set(errp, QERR_PERMISSION_DENIED);
|
||||
error_setg(errp, QERR_PERMISSION_DENIED);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -133,7 +133,7 @@ static void tpm_backend_prop_set_opened(Object *obj, bool value, Error **errp)
|
||||
}
|
||||
|
||||
if (!value && s->opened) {
|
||||
error_set(errp, QERR_PERMISSION_DENIED);
|
||||
error_setg(errp, QERR_PERMISSION_DENIED);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -24,12 +24,13 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "monitor/monitor.h"
|
||||
#include "qemu-common.h"
|
||||
#include "exec/cpu-common.h"
|
||||
#include "sysemu/kvm.h"
|
||||
#include "sysemu/balloon.h"
|
||||
#include "trace.h"
|
||||
#include "qmp-commands.h"
|
||||
#include "qapi/qmp/qerror.h"
|
||||
#include "qapi/qmp/qjson.h"
|
||||
|
||||
static QEMUBalloonEvent *balloon_event_fn;
|
||||
@ -96,7 +97,7 @@ void qmp_balloon(int64_t target, Error **errp)
|
||||
}
|
||||
|
||||
if (target <= 0) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER_VALUE, "target", "a size");
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "target", "a size");
|
||||
return;
|
||||
}
|
||||
|
||||
|
4
block.c
4
block.c
@ -26,7 +26,9 @@
|
||||
#include "trace.h"
|
||||
#include "block/block_int.h"
|
||||
#include "block/blockjob.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "qemu/module.h"
|
||||
#include "qapi/qmp/qerror.h"
|
||||
#include "qapi/qmp/qjson.h"
|
||||
#include "sysemu/block-backend.h"
|
||||
#include "sysemu/sysemu.h"
|
||||
@ -2698,7 +2700,7 @@ void bdrv_add_key(BlockDriverState *bs, const char *key, Error **errp)
|
||||
error_setg(errp, "Node '%s' is not encrypted",
|
||||
bdrv_get_device_or_node_name(bs));
|
||||
} else if (bdrv_set_key(bs, key) < 0) {
|
||||
error_set(errp, QERR_INVALID_PASSWORD);
|
||||
error_setg(errp, QERR_INVALID_PASSWORD);
|
||||
}
|
||||
} else {
|
||||
if (bdrv_key_required(bs)) {
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "block/block.h"
|
||||
#include "block/block_int.h"
|
||||
#include "block/blockjob.h"
|
||||
#include "qapi/qmp/qerror.h"
|
||||
#include "qemu/ratelimit.h"
|
||||
|
||||
#define BACKUP_CLUSTER_BITS 16
|
||||
@ -197,7 +198,7 @@ static void backup_set_speed(BlockJob *job, int64_t speed, Error **errp)
|
||||
BackupBlockJob *s = container_of(job, BackupBlockJob, common);
|
||||
|
||||
if (speed < 0) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER, "speed");
|
||||
error_setg(errp, QERR_INVALID_PARAMETER, "speed");
|
||||
return;
|
||||
}
|
||||
ratelimit_set_speed(&s->limit, speed / BDRV_SECTOR_SIZE, SLICE_TIME);
|
||||
@ -472,7 +473,7 @@ void backup_start(BlockDriverState *bs, BlockDriverState *target,
|
||||
if ((on_source_error == BLOCKDEV_ON_ERROR_STOP ||
|
||||
on_source_error == BLOCKDEV_ON_ERROR_ENOSPC) &&
|
||||
!bdrv_iostatus_is_enabled(bs)) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER, "on-source-error");
|
||||
error_setg(errp, QERR_INVALID_PARAMETER, "on-source-error");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "trace.h"
|
||||
#include "block/block_int.h"
|
||||
#include "block/blockjob.h"
|
||||
#include "qapi/qmp/qerror.h"
|
||||
#include "qemu/ratelimit.h"
|
||||
|
||||
enum {
|
||||
@ -186,7 +187,7 @@ static void commit_set_speed(BlockJob *job, int64_t speed, Error **errp)
|
||||
CommitBlockJob *s = container_of(job, CommitBlockJob, common);
|
||||
|
||||
if (speed < 0) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER, "speed");
|
||||
error_setg(errp, QERR_INVALID_PARAMETER, "speed");
|
||||
return;
|
||||
}
|
||||
ratelimit_set_speed(&s->limit, speed / BDRV_SECTOR_SIZE, SLICE_TIME);
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "qemu-common.h"
|
||||
#include "block/block_int.h"
|
||||
#include "qapi/qmp/qbool.h"
|
||||
#include "qapi/qmp/qstring.h"
|
||||
#include <curl/curl.h>
|
||||
|
||||
// #define DEBUG_CURL
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "qemu-common.h"
|
||||
#include "block/block_int.h"
|
||||
#include "qemu/bswap.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "qemu/module.h"
|
||||
#include <zlib.h>
|
||||
#ifdef CONFIG_BZIP2
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "block/blockjob.h"
|
||||
#include "block/block_int.h"
|
||||
#include "block/throttle-groups.h"
|
||||
#include "qemu/error-report.h"
|
||||
|
||||
#define NOT_DONE 0x7fffffff /* used while emulated sync operation in progress */
|
||||
|
||||
|
@ -38,6 +38,7 @@
|
||||
#include "qemu/iov.h"
|
||||
#include "sysemu/sysemu.h"
|
||||
#include "qmp-commands.h"
|
||||
#include "qapi/qmp/qstring.h"
|
||||
|
||||
#include <iscsi/iscsi.h>
|
||||
#include <iscsi/scsi-lowlevel.h>
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "trace.h"
|
||||
#include "block/blockjob.h"
|
||||
#include "block/block_int.h"
|
||||
#include "qapi/qmp/qerror.h"
|
||||
#include "qemu/ratelimit.h"
|
||||
#include "qemu/bitmap.h"
|
||||
|
||||
@ -573,7 +574,7 @@ static void mirror_set_speed(BlockJob *job, int64_t speed, Error **errp)
|
||||
MirrorBlockJob *s = container_of(job, MirrorBlockJob, common);
|
||||
|
||||
if (speed < 0) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER, "speed");
|
||||
error_setg(errp, QERR_INVALID_PARAMETER, "speed");
|
||||
return;
|
||||
}
|
||||
ratelimit_set_speed(&s->limit, speed / BDRV_SECTOR_SIZE, SLICE_TIME);
|
||||
@ -598,8 +599,8 @@ static void mirror_complete(BlockJob *job, Error **errp)
|
||||
return;
|
||||
}
|
||||
if (!s->synced) {
|
||||
error_set(errp, QERR_BLOCK_JOB_NOT_READY,
|
||||
bdrv_get_device_name(job->bs));
|
||||
error_setg(errp, QERR_BLOCK_JOB_NOT_READY,
|
||||
bdrv_get_device_name(job->bs));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -667,7 +668,7 @@ static void mirror_start_job(BlockDriverState *bs, BlockDriverState *target,
|
||||
if ((on_source_error == BLOCKDEV_ON_ERROR_STOP ||
|
||||
on_source_error == BLOCKDEV_ON_ERROR_ENOSPC) &&
|
||||
!bdrv_iostatus_is_enabled(bs)) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER, "on-source-error");
|
||||
error_setg(errp, QERR_INVALID_PARAMETER, "on-source-error");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -520,13 +520,7 @@ static void dump_qobject(fprintf_function func_fprintf, void *f,
|
||||
}
|
||||
case QTYPE_QBOOL: {
|
||||
QBool *value = qobject_to_qbool(obj);
|
||||
func_fprintf(f, "%s", qbool_get_int(value) ? "true" : "false");
|
||||
break;
|
||||
}
|
||||
case QTYPE_QERROR: {
|
||||
QString *value = qerror_human((QError *)obj);
|
||||
func_fprintf(f, "%s", qstring_get_str(value));
|
||||
QDECREF(value);
|
||||
func_fprintf(f, "%s", qbool_get_bool(value) ? "true" : "false");
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "block/block_int.h"
|
||||
#include "qemu/module.h"
|
||||
#include <zlib.h>
|
||||
#include "qapi/qmp/qerror.h"
|
||||
#include "qemu/aes.h"
|
||||
#include "migration/migration.h"
|
||||
|
||||
@ -123,8 +124,8 @@ static int qcow_open(BlockDriverState *bs, QDict *options, int flags,
|
||||
char version[64];
|
||||
snprintf(version, sizeof(version), "QCOW version %" PRIu32,
|
||||
header.version);
|
||||
error_set(errp, QERR_UNKNOWN_BLOCK_FORMAT_FEATURE,
|
||||
bdrv_get_device_or_node_name(bs), "qcow", version);
|
||||
error_setg(errp, QERR_UNKNOWN_BLOCK_FORMAT_FEATURE,
|
||||
bdrv_get_device_or_node_name(bs), "qcow", version);
|
||||
ret = -ENOTSUP;
|
||||
goto fail;
|
||||
}
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "qemu-common.h"
|
||||
#include "block/block_int.h"
|
||||
#include "block/qcow2.h"
|
||||
#include "qemu/error-report.h"
|
||||
|
||||
void qcow2_free_snapshots(BlockDriverState *bs)
|
||||
{
|
||||
|
@ -207,8 +207,8 @@ static void GCC_FMT_ATTR(3, 4) report_unsupported(BlockDriverState *bs,
|
||||
vsnprintf(msg, sizeof(msg), fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
error_set(errp, QERR_UNKNOWN_BLOCK_FORMAT_FEATURE,
|
||||
bdrv_get_device_or_node_name(bs), "qcow2", msg);
|
||||
error_setg(errp, QERR_UNKNOWN_BLOCK_FORMAT_FEATURE,
|
||||
bdrv_get_device_or_node_name(bs), "qcow2", msg);
|
||||
}
|
||||
|
||||
static void report_unsupported_feature(BlockDriverState *bs,
|
||||
|
@ -407,8 +407,8 @@ static int bdrv_qed_open(BlockDriverState *bs, QDict *options, int flags,
|
||||
char buf[64];
|
||||
snprintf(buf, sizeof(buf), "%" PRIx64,
|
||||
s->header.features & ~QED_FEATURE_MASK);
|
||||
error_set(errp, QERR_UNKNOWN_BLOCK_FORMAT_FEATURE,
|
||||
bdrv_get_device_or_node_name(bs), "QED", buf);
|
||||
error_setg(errp, QERR_UNKNOWN_BLOCK_FORMAT_FEATURE,
|
||||
bdrv_get_device_or_node_name(bs), "QED", buf);
|
||||
return -ENOTSUP;
|
||||
}
|
||||
if (!qed_is_cluster_size_valid(s->header.cluster_size)) {
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "block/block_int.h"
|
||||
#include "qapi/qmp/qbool.h"
|
||||
#include "qapi/qmp/qdict.h"
|
||||
#include "qapi/qmp/qerror.h"
|
||||
#include "qapi/qmp/qint.h"
|
||||
#include "qapi/qmp/qjson.h"
|
||||
#include "qapi/qmp/qlist.h"
|
||||
@ -800,8 +801,8 @@ static int quorum_valid_threshold(int threshold, int num_children, Error **errp)
|
||||
{
|
||||
|
||||
if (threshold < 1) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER_VALUE,
|
||||
"vote-threshold", "value >= 1");
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_VALUE,
|
||||
"vote-threshold", "value >= 1");
|
||||
return -ERANGE;
|
||||
}
|
||||
|
||||
@ -1024,9 +1025,9 @@ static void quorum_refresh_filename(BlockDriverState *bs)
|
||||
qdict_put_obj(opts, QUORUM_OPT_VOTE_THRESHOLD,
|
||||
QOBJECT(qint_from_int(s->threshold)));
|
||||
qdict_put_obj(opts, QUORUM_OPT_BLKVERIFY,
|
||||
QOBJECT(qbool_from_int(s->is_blkverify)));
|
||||
QOBJECT(qbool_from_bool(s->is_blkverify)));
|
||||
qdict_put_obj(opts, QUORUM_OPT_REWRITE,
|
||||
QOBJECT(qbool_from_int(s->rewrite_corrupted)));
|
||||
QOBJECT(qbool_from_bool(s->rewrite_corrupted)));
|
||||
qdict_put_obj(opts, "children", QOBJECT(children));
|
||||
|
||||
bs->full_open_options = opts;
|
||||
|
@ -22,6 +22,7 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
#include "qemu-common.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "qemu/timer.h"
|
||||
#include "qemu/log.h"
|
||||
#include "block/block_int.h"
|
||||
@ -31,6 +32,7 @@
|
||||
#include "qemu/iov.h"
|
||||
#include "raw-aio.h"
|
||||
#include "qapi/util.h"
|
||||
#include "qapi/qmp/qstring.h"
|
||||
|
||||
#if defined(__APPLE__) && (__MACH__)
|
||||
#include <paths.h>
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include "trace.h"
|
||||
#include "block/thread-pool.h"
|
||||
#include "qemu/iov.h"
|
||||
#include "qapi/qmp/qstring.h"
|
||||
#include <windows.h>
|
||||
#include <winioctl.h>
|
||||
|
||||
|
@ -24,6 +24,7 @@
|
||||
|
||||
#include "block/snapshot.h"
|
||||
#include "block/block_int.h"
|
||||
#include "qapi/qmp/qerror.h"
|
||||
|
||||
QemuOptsList internal_snapshot_opts = {
|
||||
.name = "snapshot",
|
||||
@ -229,7 +230,7 @@ int bdrv_snapshot_delete(BlockDriverState *bs,
|
||||
{
|
||||
BlockDriver *drv = bs->drv;
|
||||
if (!drv) {
|
||||
error_set(errp, QERR_DEVICE_HAS_NO_MEDIUM, bdrv_get_device_name(bs));
|
||||
error_setg(errp, QERR_DEVICE_HAS_NO_MEDIUM, bdrv_get_device_name(bs));
|
||||
return -ENOMEDIUM;
|
||||
}
|
||||
if (!snapshot_id && !name) {
|
||||
@ -315,7 +316,7 @@ int bdrv_snapshot_load_tmp(BlockDriverState *bs,
|
||||
BlockDriver *drv = bs->drv;
|
||||
|
||||
if (!drv) {
|
||||
error_set(errp, QERR_DEVICE_HAS_NO_MEDIUM, bdrv_get_device_name(bs));
|
||||
error_setg(errp, QERR_DEVICE_HAS_NO_MEDIUM, bdrv_get_device_name(bs));
|
||||
return -ENOMEDIUM;
|
||||
}
|
||||
if (!snapshot_id && !name) {
|
||||
|
@ -30,9 +30,11 @@
|
||||
#include <libssh2_sftp.h>
|
||||
|
||||
#include "block/block_int.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "qemu/sockets.h"
|
||||
#include "qemu/uri.h"
|
||||
#include "qapi/qmp/qint.h"
|
||||
#include "qapi/qmp/qstring.h"
|
||||
|
||||
/* DEBUG_SSH=1 enables the DPRINTF (debugging printf) statements in
|
||||
* this block driver code.
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "trace.h"
|
||||
#include "block/block_int.h"
|
||||
#include "block/blockjob.h"
|
||||
#include "qapi/qmp/qerror.h"
|
||||
#include "qemu/ratelimit.h"
|
||||
|
||||
enum {
|
||||
@ -227,7 +228,7 @@ static void stream_set_speed(BlockJob *job, int64_t speed, Error **errp)
|
||||
StreamBlockJob *s = container_of(job, StreamBlockJob, common);
|
||||
|
||||
if (speed < 0) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER, "speed");
|
||||
error_setg(errp, QERR_INVALID_PARAMETER, "speed");
|
||||
return;
|
||||
}
|
||||
ratelimit_set_speed(&s->limit, speed / BDRV_SECTOR_SIZE, SLICE_TIME);
|
||||
@ -250,7 +251,7 @@ void stream_start(BlockDriverState *bs, BlockDriverState *base,
|
||||
if ((on_error == BLOCKDEV_ON_ERROR_STOP ||
|
||||
on_error == BLOCKDEV_ON_ERROR_ENOSPC) &&
|
||||
!bdrv_iostatus_is_enabled(bs)) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER, "on-error");
|
||||
error_setg(errp, QERR_INVALID_PARAMETER, "on-error");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -19,6 +19,7 @@
|
||||
*/
|
||||
#include "qemu-common.h"
|
||||
#include "block/block_int.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "qemu/module.h"
|
||||
#include "block/vhdx.h"
|
||||
|
||||
|
14
block/vmdk.c
14
block/vmdk.c
@ -25,6 +25,8 @@
|
||||
|
||||
#include "qemu-common.h"
|
||||
#include "block/block_int.h"
|
||||
#include "qapi/qmp/qerror.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "qemu/module.h"
|
||||
#include "migration/migration.h"
|
||||
#include <zlib.h>
|
||||
@ -645,8 +647,8 @@ static int vmdk_open_vmdk4(BlockDriverState *bs,
|
||||
char buf[64];
|
||||
snprintf(buf, sizeof(buf), "VMDK version %" PRId32,
|
||||
le32_to_cpu(header.version));
|
||||
error_set(errp, QERR_UNKNOWN_BLOCK_FORMAT_FEATURE,
|
||||
bdrv_get_device_or_node_name(bs), "vmdk", buf);
|
||||
error_setg(errp, QERR_UNKNOWN_BLOCK_FORMAT_FEATURE,
|
||||
bdrv_get_device_or_node_name(bs), "vmdk", buf);
|
||||
return -ENOTSUP;
|
||||
} else if (le32_to_cpu(header.version) == 3 && (flags & BDRV_O_RDWR)) {
|
||||
/* VMware KB 2064959 explains that version 3 added support for
|
||||
@ -1688,12 +1690,12 @@ static int vmdk_create_extent(const char *filename, int64_t filesize,
|
||||
/* write all the data */
|
||||
ret = bdrv_pwrite(bs, 0, &magic, sizeof(magic));
|
||||
if (ret < 0) {
|
||||
error_set(errp, QERR_IO_ERROR);
|
||||
error_setg(errp, QERR_IO_ERROR);
|
||||
goto exit;
|
||||
}
|
||||
ret = bdrv_pwrite(bs, sizeof(magic), &header, sizeof(header));
|
||||
if (ret < 0) {
|
||||
error_set(errp, QERR_IO_ERROR);
|
||||
error_setg(errp, QERR_IO_ERROR);
|
||||
goto exit;
|
||||
}
|
||||
|
||||
@ -1713,7 +1715,7 @@ static int vmdk_create_extent(const char *filename, int64_t filesize,
|
||||
ret = bdrv_pwrite(bs, le64_to_cpu(header.rgd_offset) * BDRV_SECTOR_SIZE,
|
||||
gd_buf, gd_buf_size);
|
||||
if (ret < 0) {
|
||||
error_set(errp, QERR_IO_ERROR);
|
||||
error_setg(errp, QERR_IO_ERROR);
|
||||
goto exit;
|
||||
}
|
||||
|
||||
@ -1725,7 +1727,7 @@ static int vmdk_create_extent(const char *filename, int64_t filesize,
|
||||
ret = bdrv_pwrite(bs, le64_to_cpu(header.gd_offset) * BDRV_SECTOR_SIZE,
|
||||
gd_buf, gd_buf_size);
|
||||
if (ret < 0) {
|
||||
error_set(errp, QERR_IO_ERROR);
|
||||
error_setg(errp, QERR_IO_ERROR);
|
||||
goto exit;
|
||||
}
|
||||
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "migration/migration.h"
|
||||
#include "qapi/qmp/qint.h"
|
||||
#include "qapi/qmp/qbool.h"
|
||||
#include "qapi/qmp/qstring.h"
|
||||
|
||||
#ifndef S_IWGRP
|
||||
#define S_IWGRP 0
|
||||
@ -1059,8 +1060,8 @@ static void vvfat_parse_filename(const char *filename, QDict *options,
|
||||
/* Fill in the options QDict */
|
||||
qdict_put(options, "dir", qstring_from_str(filename));
|
||||
qdict_put(options, "fat-type", qint_from_int(fat_type));
|
||||
qdict_put(options, "floppy", qbool_from_int(floppy));
|
||||
qdict_put(options, "rw", qbool_from_int(rw));
|
||||
qdict_put(options, "floppy", qbool_from_bool(floppy));
|
||||
qdict_put(options, "rw", qbool_from_bool(rw));
|
||||
}
|
||||
|
||||
static int vvfat_open(BlockDriverState *bs, QDict *options, int flags,
|
||||
|
@ -12,7 +12,6 @@
|
||||
#include "sysemu/blockdev.h"
|
||||
#include "sysemu/block-backend.h"
|
||||
#include "hw/block/block.h"
|
||||
#include "monitor/monitor.h"
|
||||
#include "qapi/qmp/qerror.h"
|
||||
#include "sysemu/sysemu.h"
|
||||
#include "qmp-commands.h"
|
||||
@ -91,11 +90,12 @@ void qmp_nbd_server_add(const char *device, bool has_writable, bool writable,
|
||||
|
||||
blk = blk_by_name(device);
|
||||
if (!blk) {
|
||||
error_set(errp, QERR_DEVICE_NOT_FOUND, device);
|
||||
error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND,
|
||||
"Device '%s' not found", device);
|
||||
return;
|
||||
}
|
||||
if (!blk_is_inserted(blk)) {
|
||||
error_set(errp, QERR_DEVICE_HAS_NO_MEDIUM, device);
|
||||
error_setg(errp, QERR_DEVICE_HAS_NO_MEDIUM, device);
|
||||
return;
|
||||
}
|
||||
|
||||
|
80
blockdev.c
80
blockdev.c
@ -36,10 +36,12 @@
|
||||
#include "block/blockjob.h"
|
||||
#include "block/throttle-groups.h"
|
||||
#include "monitor/monitor.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "qemu/option.h"
|
||||
#include "qemu/config-file.h"
|
||||
#include "qapi/qmp/types.h"
|
||||
#include "qapi-visit.h"
|
||||
#include "qapi/qmp/qerror.h"
|
||||
#include "qapi/qmp-output-visitor.h"
|
||||
#include "qapi/util.h"
|
||||
#include "sysemu/sysemu.h"
|
||||
@ -174,7 +176,7 @@ static int drive_index_to_unit_id(BlockInterfaceType type, int index)
|
||||
|
||||
QemuOpts *drive_def(const char *optstr)
|
||||
{
|
||||
return qemu_opts_parse(qemu_find_opts("drive"), optstr, 0);
|
||||
return qemu_opts_parse_noisily(qemu_find_opts("drive"), optstr, false);
|
||||
}
|
||||
|
||||
QemuOpts *drive_add(BlockInterfaceType type, int index, const char *file,
|
||||
@ -1111,7 +1113,8 @@ SnapshotInfo *qmp_blockdev_snapshot_delete_internal_sync(const char *device,
|
||||
|
||||
blk = blk_by_name(device);
|
||||
if (!blk) {
|
||||
error_set(errp, QERR_DEVICE_NOT_FOUND, device);
|
||||
error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND,
|
||||
"Device '%s' not found", device);
|
||||
return NULL;
|
||||
}
|
||||
bs = blk_bs(blk);
|
||||
@ -1300,7 +1303,8 @@ static void internal_snapshot_prepare(BlkTransactionState *common,
|
||||
/* 2. check for validation */
|
||||
blk = blk_by_name(device);
|
||||
if (!blk) {
|
||||
error_set(errp, QERR_DEVICE_NOT_FOUND, device);
|
||||
error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND,
|
||||
"Device '%s' not found", device);
|
||||
return;
|
||||
}
|
||||
bs = blk_bs(blk);
|
||||
@ -1310,7 +1314,7 @@ static void internal_snapshot_prepare(BlkTransactionState *common,
|
||||
aio_context_acquire(state->aio_context);
|
||||
|
||||
if (!bdrv_is_inserted(bs)) {
|
||||
error_set(errp, QERR_DEVICE_HAS_NO_MEDIUM, device);
|
||||
error_setg(errp, QERR_DEVICE_HAS_NO_MEDIUM, device);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1451,7 +1455,7 @@ static void external_snapshot_prepare(BlkTransactionState *common,
|
||||
/* start processing */
|
||||
drv = bdrv_find_format(format);
|
||||
if (!drv) {
|
||||
error_set(errp, QERR_INVALID_BLOCK_FORMAT, format);
|
||||
error_setg(errp, QERR_INVALID_BLOCK_FORMAT, format);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1478,7 +1482,7 @@ static void external_snapshot_prepare(BlkTransactionState *common,
|
||||
aio_context_acquire(state->aio_context);
|
||||
|
||||
if (!bdrv_is_inserted(state->old_bs)) {
|
||||
error_set(errp, QERR_DEVICE_HAS_NO_MEDIUM, device);
|
||||
error_setg(errp, QERR_DEVICE_HAS_NO_MEDIUM, device);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1489,13 +1493,13 @@ static void external_snapshot_prepare(BlkTransactionState *common,
|
||||
|
||||
if (!bdrv_is_read_only(state->old_bs)) {
|
||||
if (bdrv_flush(state->old_bs)) {
|
||||
error_set(errp, QERR_IO_ERROR);
|
||||
error_setg(errp, QERR_IO_ERROR);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!bdrv_is_first_non_filter(state->old_bs)) {
|
||||
error_set(errp, QERR_FEATURE_DISABLED, "snapshot");
|
||||
error_setg(errp, QERR_FEATURE_DISABLED, "snapshot");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1580,7 +1584,8 @@ static void drive_backup_prepare(BlkTransactionState *common, Error **errp)
|
||||
|
||||
blk = blk_by_name(backup->device);
|
||||
if (!blk) {
|
||||
error_set(errp, QERR_DEVICE_NOT_FOUND, backup->device);
|
||||
error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND,
|
||||
"Device '%s' not found", backup->device);
|
||||
return;
|
||||
}
|
||||
bs = blk_bs(blk);
|
||||
@ -1850,7 +1855,8 @@ void qmp_eject(const char *device, bool has_force, bool force, Error **errp)
|
||||
|
||||
blk = blk_by_name(device);
|
||||
if (!blk) {
|
||||
error_set(errp, QERR_DEVICE_NOT_FOUND, device);
|
||||
error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND,
|
||||
"Device '%s' not found", device);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1910,7 +1916,8 @@ void qmp_change_blockdev(const char *device, const char *filename,
|
||||
|
||||
blk = blk_by_name(device);
|
||||
if (!blk) {
|
||||
error_set(errp, QERR_DEVICE_NOT_FOUND, device);
|
||||
error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND,
|
||||
"Device '%s' not found", device);
|
||||
return;
|
||||
}
|
||||
bs = blk_bs(blk);
|
||||
@ -1921,7 +1928,7 @@ void qmp_change_blockdev(const char *device, const char *filename,
|
||||
if (format) {
|
||||
drv = bdrv_find_whitelisted_format(format, bs->read_only);
|
||||
if (!drv) {
|
||||
error_set(errp, QERR_INVALID_BLOCK_FORMAT, format);
|
||||
error_setg(errp, QERR_INVALID_BLOCK_FORMAT, format);
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
@ -1971,7 +1978,8 @@ void qmp_block_set_io_throttle(const char *device, int64_t bps, int64_t bps_rd,
|
||||
|
||||
blk = blk_by_name(device);
|
||||
if (!blk) {
|
||||
error_set(errp, QERR_DEVICE_NOT_FOUND, device);
|
||||
error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND,
|
||||
"Device '%s' not found", device);
|
||||
return;
|
||||
}
|
||||
bs = blk_bs(blk);
|
||||
@ -2202,17 +2210,17 @@ void qmp_block_resize(bool has_device, const char *device,
|
||||
aio_context_acquire(aio_context);
|
||||
|
||||
if (!bdrv_is_first_non_filter(bs)) {
|
||||
error_set(errp, QERR_FEATURE_DISABLED, "resize");
|
||||
error_setg(errp, QERR_FEATURE_DISABLED, "resize");
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (size < 0) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER_VALUE, "size", "a >0 size");
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "size", "a >0 size");
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (bdrv_op_is_blocked(bs, BLOCK_OP_TYPE_RESIZE, NULL)) {
|
||||
error_set(errp, QERR_DEVICE_IN_USE, device);
|
||||
error_setg(errp, QERR_DEVICE_IN_USE, device);
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -2224,16 +2232,16 @@ void qmp_block_resize(bool has_device, const char *device,
|
||||
case 0:
|
||||
break;
|
||||
case -ENOMEDIUM:
|
||||
error_set(errp, QERR_DEVICE_HAS_NO_MEDIUM, device);
|
||||
error_setg(errp, QERR_DEVICE_HAS_NO_MEDIUM, device);
|
||||
break;
|
||||
case -ENOTSUP:
|
||||
error_set(errp, QERR_UNSUPPORTED);
|
||||
error_setg(errp, QERR_UNSUPPORTED);
|
||||
break;
|
||||
case -EACCES:
|
||||
error_setg(errp, "Device '%s' is read only", device);
|
||||
break;
|
||||
case -EBUSY:
|
||||
error_set(errp, QERR_DEVICE_IN_USE, device);
|
||||
error_setg(errp, QERR_DEVICE_IN_USE, device);
|
||||
break;
|
||||
default:
|
||||
error_setg_errno(errp, -ret, "Could not resize");
|
||||
@ -2291,7 +2299,8 @@ void qmp_block_stream(const char *device,
|
||||
|
||||
blk = blk_by_name(device);
|
||||
if (!blk) {
|
||||
error_set(errp, QERR_DEVICE_NOT_FOUND, device);
|
||||
error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND,
|
||||
"Device '%s' not found", device);
|
||||
return;
|
||||
}
|
||||
bs = blk_bs(blk);
|
||||
@ -2306,7 +2315,7 @@ void qmp_block_stream(const char *device,
|
||||
if (has_base) {
|
||||
base_bs = bdrv_find_backing_image(bs, base);
|
||||
if (base_bs == NULL) {
|
||||
error_set(errp, QERR_BASE_NOT_FOUND, base);
|
||||
error_setg(errp, QERR_BASE_NOT_FOUND, base);
|
||||
goto out;
|
||||
}
|
||||
assert(bdrv_get_aio_context(base_bs) == aio_context);
|
||||
@ -2365,7 +2374,8 @@ void qmp_block_commit(const char *device,
|
||||
* scenario in which all optional arguments are omitted. */
|
||||
blk = blk_by_name(device);
|
||||
if (!blk) {
|
||||
error_set(errp, QERR_DEVICE_NOT_FOUND, device);
|
||||
error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND,
|
||||
"Device '%s' not found", device);
|
||||
return;
|
||||
}
|
||||
bs = blk_bs(blk);
|
||||
@ -2403,7 +2413,7 @@ void qmp_block_commit(const char *device,
|
||||
}
|
||||
|
||||
if (base_bs == NULL) {
|
||||
error_set(errp, QERR_BASE_NOT_FOUND, base ? base : "NULL");
|
||||
error_setg(errp, QERR_BASE_NOT_FOUND, base ? base : "NULL");
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -2477,7 +2487,8 @@ void qmp_drive_backup(const char *device, const char *target,
|
||||
|
||||
blk = blk_by_name(device);
|
||||
if (!blk) {
|
||||
error_set(errp, QERR_DEVICE_NOT_FOUND, device);
|
||||
error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND,
|
||||
"Device '%s' not found", device);
|
||||
return;
|
||||
}
|
||||
bs = blk_bs(blk);
|
||||
@ -2488,7 +2499,7 @@ void qmp_drive_backup(const char *device, const char *target,
|
||||
/* Although backup_run has this check too, we need to use bs->drv below, so
|
||||
* do an early check redundantly. */
|
||||
if (!bdrv_is_inserted(bs)) {
|
||||
error_set(errp, QERR_DEVICE_HAS_NO_MEDIUM, device);
|
||||
error_setg(errp, QERR_DEVICE_HAS_NO_MEDIUM, device);
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -2498,7 +2509,7 @@ void qmp_drive_backup(const char *device, const char *target,
|
||||
if (format) {
|
||||
drv = bdrv_find_format(format);
|
||||
if (!drv) {
|
||||
error_set(errp, QERR_INVALID_BLOCK_FORMAT, format);
|
||||
error_setg(errp, QERR_INVALID_BLOCK_FORMAT, format);
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
@ -2680,18 +2691,20 @@ void qmp_drive_mirror(const char *device, const char *target,
|
||||
}
|
||||
|
||||
if (granularity != 0 && (granularity < 512 || granularity > 1048576 * 64)) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER_VALUE, "granularity",
|
||||
"a value in range [512B, 64MB]");
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "granularity",
|
||||
"a value in range [512B, 64MB]");
|
||||
return;
|
||||
}
|
||||
if (granularity & (granularity - 1)) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER_VALUE, "granularity", "power of 2");
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "granularity",
|
||||
"power of 2");
|
||||
return;
|
||||
}
|
||||
|
||||
blk = blk_by_name(device);
|
||||
if (!blk) {
|
||||
error_set(errp, QERR_DEVICE_NOT_FOUND, device);
|
||||
error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND,
|
||||
"Device '%s' not found", device);
|
||||
return;
|
||||
}
|
||||
bs = blk_bs(blk);
|
||||
@ -2700,7 +2713,7 @@ void qmp_drive_mirror(const char *device, const char *target,
|
||||
aio_context_acquire(aio_context);
|
||||
|
||||
if (!bdrv_is_inserted(bs)) {
|
||||
error_set(errp, QERR_DEVICE_HAS_NO_MEDIUM, device);
|
||||
error_setg(errp, QERR_DEVICE_HAS_NO_MEDIUM, device);
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -2710,7 +2723,7 @@ void qmp_drive_mirror(const char *device, const char *target,
|
||||
if (format) {
|
||||
drv = bdrv_find_format(format);
|
||||
if (!drv) {
|
||||
error_set(errp, QERR_INVALID_BLOCK_FORMAT, format);
|
||||
error_setg(errp, QERR_INVALID_BLOCK_FORMAT, format);
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
@ -2957,7 +2970,8 @@ void qmp_change_backing_file(const char *device,
|
||||
|
||||
blk = blk_by_name(device);
|
||||
if (!blk) {
|
||||
error_set(errp, QERR_DEVICE_NOT_FOUND, device);
|
||||
error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND,
|
||||
"Device '%s' not found", device);
|
||||
return;
|
||||
}
|
||||
bs = blk_bs(blk);
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include "block/block.h"
|
||||
#include "block/blockjob.h"
|
||||
#include "block/block_int.h"
|
||||
#include "qapi/qmp/qerror.h"
|
||||
#include "qapi/qmp/qjson.h"
|
||||
#include "block/coroutine.h"
|
||||
#include "qmp-commands.h"
|
||||
@ -42,7 +43,7 @@ void *block_job_create(const BlockJobDriver *driver, BlockDriverState *bs,
|
||||
BlockJob *job;
|
||||
|
||||
if (bs->job) {
|
||||
error_set(errp, QERR_DEVICE_IN_USE, bdrv_get_device_name(bs));
|
||||
error_setg(errp, QERR_DEVICE_IN_USE, bdrv_get_device_name(bs));
|
||||
return NULL;
|
||||
}
|
||||
bdrv_ref(bs);
|
||||
@ -93,7 +94,7 @@ void block_job_set_speed(BlockJob *job, int64_t speed, Error **errp)
|
||||
Error *local_err = NULL;
|
||||
|
||||
if (!job->driver->set_speed) {
|
||||
error_set(errp, QERR_UNSUPPORTED);
|
||||
error_setg(errp, QERR_UNSUPPORTED);
|
||||
return;
|
||||
}
|
||||
job->driver->set_speed(job, speed, &local_err);
|
||||
@ -108,8 +109,8 @@ void block_job_set_speed(BlockJob *job, int64_t speed, Error **errp)
|
||||
void block_job_complete(BlockJob *job, Error **errp)
|
||||
{
|
||||
if (job->pause_count || job->cancelled || !job->driver->complete) {
|
||||
error_set(errp, QERR_BLOCK_JOB_NOT_READY,
|
||||
bdrv_get_device_name(job->bs));
|
||||
error_setg(errp, QERR_BLOCK_JOB_NOT_READY,
|
||||
bdrv_get_device_name(job->bs));
|
||||
return;
|
||||
}
|
||||
|
||||
|
9
cpus.c
9
cpus.c
@ -27,6 +27,7 @@
|
||||
|
||||
#include "monitor/monitor.h"
|
||||
#include "qapi/qmp/qerror.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "sysemu/sysemu.h"
|
||||
#include "exec/gdbstub.h"
|
||||
#include "sysemu/dma.h"
|
||||
@ -1512,8 +1513,8 @@ void qmp_memsave(int64_t addr, int64_t size, const char *filename,
|
||||
|
||||
cpu = qemu_get_cpu(cpu_index);
|
||||
if (cpu == NULL) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER_VALUE, "cpu-index",
|
||||
"a CPU number");
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "cpu-index",
|
||||
"a CPU number");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1533,7 +1534,7 @@ void qmp_memsave(int64_t addr, int64_t size, const char *filename,
|
||||
goto exit;
|
||||
}
|
||||
if (fwrite(buf, 1, l, f) != l) {
|
||||
error_set(errp, QERR_IO_ERROR);
|
||||
error_setg(errp, QERR_IO_ERROR);
|
||||
goto exit;
|
||||
}
|
||||
addr += l;
|
||||
@ -1563,7 +1564,7 @@ void qmp_pmemsave(int64_t addr, int64_t size, const char *filename,
|
||||
l = size;
|
||||
cpu_physical_memory_read(addr, buf, l);
|
||||
if (fwrite(buf, 1, l, f) != l) {
|
||||
error_set(errp, QERR_IO_ERROR);
|
||||
error_setg(errp, QERR_IO_ERROR);
|
||||
goto exit;
|
||||
}
|
||||
addr += l;
|
||||
|
14
disas.c
14
disas.c
@ -9,7 +9,7 @@
|
||||
|
||||
typedef struct CPUDebug {
|
||||
struct disassemble_info info;
|
||||
CPUArchState *env;
|
||||
CPUState *cpu;
|
||||
} CPUDebug;
|
||||
|
||||
/* Filled in by elfload.c. Simplistic, but will do for now. */
|
||||
@ -39,7 +39,7 @@ target_read_memory (bfd_vma memaddr,
|
||||
{
|
||||
CPUDebug *s = container_of(info, CPUDebug, info);
|
||||
|
||||
cpu_memory_rw_debug(ENV_GET_CPU(s->env), memaddr, myaddr, length, 0);
|
||||
cpu_memory_rw_debug(s->cpu, memaddr, myaddr, length, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -195,7 +195,7 @@ static int print_insn_od_target(bfd_vma pc, disassemble_info *info)
|
||||
bit 16 indicates little endian.
|
||||
other targets - unused
|
||||
*/
|
||||
void target_disas(FILE *out, CPUArchState *env, target_ulong code,
|
||||
void target_disas(FILE *out, CPUState *cpu, target_ulong code,
|
||||
target_ulong size, int flags)
|
||||
{
|
||||
target_ulong pc;
|
||||
@ -205,7 +205,7 @@ void target_disas(FILE *out, CPUArchState *env, target_ulong code,
|
||||
|
||||
INIT_DISASSEMBLE_INFO(s.info, out, fprintf);
|
||||
|
||||
s.env = env;
|
||||
s.cpu = cpu;
|
||||
s.info.read_memory_func = target_read_memory;
|
||||
s.info.buffer_vma = code;
|
||||
s.info.buffer_length = size;
|
||||
@ -430,7 +430,7 @@ monitor_read_memory (bfd_vma memaddr, bfd_byte *myaddr, int length,
|
||||
if (monitor_disas_is_physical) {
|
||||
cpu_physical_memory_read(memaddr, myaddr, length);
|
||||
} else {
|
||||
cpu_memory_rw_debug(ENV_GET_CPU(s->env), memaddr, myaddr, length, 0);
|
||||
cpu_memory_rw_debug(s->cpu, memaddr, myaddr, length, 0);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -447,7 +447,7 @@ monitor_fprintf(FILE *stream, const char *fmt, ...)
|
||||
|
||||
/* Disassembler for the monitor.
|
||||
See target_disas for a description of flags. */
|
||||
void monitor_disas(Monitor *mon, CPUArchState *env,
|
||||
void monitor_disas(Monitor *mon, CPUState *cpu,
|
||||
target_ulong pc, int nb_insn, int is_physical, int flags)
|
||||
{
|
||||
int count, i;
|
||||
@ -456,7 +456,7 @@ void monitor_disas(Monitor *mon, CPUArchState *env,
|
||||
|
||||
INIT_DISASSEMBLE_INFO(s.info, (FILE *)mon, monitor_fprintf);
|
||||
|
||||
s.env = env;
|
||||
s.cpu = cpu;
|
||||
monitor_disas_is_physical = is_physical;
|
||||
s.info.read_memory_func = monitor_read_memory;
|
||||
s.info.print_address_func = generic_print_target_address;
|
||||
|
13
dump.c
13
dump.c
@ -23,6 +23,7 @@
|
||||
#include "sysemu/memory_mapping.h"
|
||||
#include "sysemu/cpus.h"
|
||||
#include "qapi/error.h"
|
||||
#include "qapi/qmp/qerror.h"
|
||||
#include "qmp-commands.h"
|
||||
|
||||
#include <zlib.h>
|
||||
@ -1474,7 +1475,7 @@ static void dump_init(DumpState *s, int fd, bool has_format,
|
||||
|
||||
s->start = get_start_block(s);
|
||||
if (s->start == -1) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER, "begin");
|
||||
error_setg(errp, QERR_INVALID_PARAMETER, "begin");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -1484,14 +1485,14 @@ static void dump_init(DumpState *s, int fd, bool has_format,
|
||||
*/
|
||||
ret = cpu_get_dump_info(&s->dump_info, &s->guest_phys_blocks);
|
||||
if (ret < 0) {
|
||||
error_set(errp, QERR_UNSUPPORTED);
|
||||
error_setg(errp, QERR_UNSUPPORTED);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
s->note_size = cpu_get_note_size(s->dump_info.d_class,
|
||||
s->dump_info.d_machine, nr_cpus);
|
||||
if (s->note_size < 0) {
|
||||
error_set(errp, QERR_UNSUPPORTED);
|
||||
error_setg(errp, QERR_UNSUPPORTED);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -1615,11 +1616,11 @@ void qmp_dump_guest_memory(bool paging, const char *file, bool has_begin,
|
||||
return;
|
||||
}
|
||||
if (has_begin && !has_length) {
|
||||
error_set(errp, QERR_MISSING_PARAMETER, "length");
|
||||
error_setg(errp, QERR_MISSING_PARAMETER, "length");
|
||||
return;
|
||||
}
|
||||
if (!has_begin && has_length) {
|
||||
error_set(errp, QERR_MISSING_PARAMETER, "begin");
|
||||
error_setg(errp, QERR_MISSING_PARAMETER, "begin");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1656,7 +1657,7 @@ void qmp_dump_guest_memory(bool paging, const char *file, bool has_begin,
|
||||
}
|
||||
|
||||
if (fd == -1) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER, "protocol");
|
||||
error_setg(errp, QERR_INVALID_PARAMETER, "protocol");
|
||||
return;
|
||||
}
|
||||
|
||||
|
64
hmp.c
64
hmp.c
@ -25,6 +25,7 @@
|
||||
#include "monitor/monitor.h"
|
||||
#include "monitor/qdev.h"
|
||||
#include "qapi/opts-visitor.h"
|
||||
#include "qapi/qmp/qerror.h"
|
||||
#include "qapi/string-output-visitor.h"
|
||||
#include "qapi-visit.h"
|
||||
#include "ui/console.h"
|
||||
@ -438,8 +439,8 @@ void hmp_info_block(Monitor *mon, const QDict *qdict)
|
||||
BlockInfoList *block_list, *info;
|
||||
BlockDeviceInfoList *blockdev_list, *blockdev;
|
||||
const char *device = qdict_get_try_str(qdict, "device");
|
||||
bool verbose = qdict_get_try_bool(qdict, "verbose", 0);
|
||||
bool nodes = qdict_get_try_bool(qdict, "nodes", 0);
|
||||
bool verbose = qdict_get_try_bool(qdict, "verbose", false);
|
||||
bool nodes = qdict_get_try_bool(qdict, "nodes", false);
|
||||
bool printed = false;
|
||||
|
||||
/* Print BlockBackend information */
|
||||
@ -995,7 +996,7 @@ void hmp_nmi(Monitor *mon, const QDict *qdict)
|
||||
void hmp_set_link(Monitor *mon, const QDict *qdict)
|
||||
{
|
||||
const char *name = qdict_get_str(qdict, "name");
|
||||
int up = qdict_get_bool(qdict, "up");
|
||||
bool up = qdict_get_bool(qdict, "up");
|
||||
Error *err = NULL;
|
||||
|
||||
qmp_set_link(name, up, &err);
|
||||
@ -1039,13 +1040,13 @@ void hmp_drive_mirror(Monitor *mon, const QDict *qdict)
|
||||
const char *device = qdict_get_str(qdict, "device");
|
||||
const char *filename = qdict_get_str(qdict, "target");
|
||||
const char *format = qdict_get_try_str(qdict, "format");
|
||||
int reuse = qdict_get_try_bool(qdict, "reuse", 0);
|
||||
int full = qdict_get_try_bool(qdict, "full", 0);
|
||||
bool reuse = qdict_get_try_bool(qdict, "reuse", false);
|
||||
bool full = qdict_get_try_bool(qdict, "full", false);
|
||||
enum NewImageMode mode;
|
||||
Error *err = NULL;
|
||||
|
||||
if (!filename) {
|
||||
error_set(&err, QERR_MISSING_PARAMETER, "target");
|
||||
error_setg(&err, QERR_MISSING_PARAMETER, "target");
|
||||
hmp_handle_error(mon, &err);
|
||||
return;
|
||||
}
|
||||
@ -1069,13 +1070,13 @@ void hmp_drive_backup(Monitor *mon, const QDict *qdict)
|
||||
const char *device = qdict_get_str(qdict, "device");
|
||||
const char *filename = qdict_get_str(qdict, "target");
|
||||
const char *format = qdict_get_try_str(qdict, "format");
|
||||
int reuse = qdict_get_try_bool(qdict, "reuse", 0);
|
||||
int full = qdict_get_try_bool(qdict, "full", 0);
|
||||
bool reuse = qdict_get_try_bool(qdict, "reuse", false);
|
||||
bool full = qdict_get_try_bool(qdict, "full", false);
|
||||
enum NewImageMode mode;
|
||||
Error *err = NULL;
|
||||
|
||||
if (!filename) {
|
||||
error_set(&err, QERR_MISSING_PARAMETER, "target");
|
||||
error_setg(&err, QERR_MISSING_PARAMETER, "target");
|
||||
hmp_handle_error(mon, &err);
|
||||
return;
|
||||
}
|
||||
@ -1098,14 +1099,14 @@ void hmp_snapshot_blkdev(Monitor *mon, const QDict *qdict)
|
||||
const char *device = qdict_get_str(qdict, "device");
|
||||
const char *filename = qdict_get_try_str(qdict, "snapshot-file");
|
||||
const char *format = qdict_get_try_str(qdict, "format");
|
||||
int reuse = qdict_get_try_bool(qdict, "reuse", 0);
|
||||
bool reuse = qdict_get_try_bool(qdict, "reuse", false);
|
||||
enum NewImageMode mode;
|
||||
Error *err = NULL;
|
||||
|
||||
if (!filename) {
|
||||
/* In the future, if 'snapshot-file' is not specified, the snapshot
|
||||
will be taken internally. Today it's actually required. */
|
||||
error_set(&err, QERR_MISSING_PARAMETER, "snapshot-file");
|
||||
error_setg(&err, QERR_MISSING_PARAMETER, "snapshot-file");
|
||||
hmp_handle_error(mon, &err);
|
||||
return;
|
||||
}
|
||||
@ -1200,7 +1201,7 @@ void hmp_migrate_set_capability(Monitor *mon, const QDict *qdict)
|
||||
}
|
||||
|
||||
if (i == MIGRATION_CAPABILITY_MAX) {
|
||||
error_set(&err, QERR_INVALID_PARAMETER, cap);
|
||||
error_setg(&err, QERR_INVALID_PARAMETER, cap);
|
||||
}
|
||||
|
||||
qapi_free_MigrationCapabilityStatusList(caps);
|
||||
@ -1244,7 +1245,7 @@ void hmp_migrate_set_parameter(Monitor *mon, const QDict *qdict)
|
||||
}
|
||||
|
||||
if (i == MIGRATION_PARAMETER_MAX) {
|
||||
error_set(&err, QERR_INVALID_PARAMETER, param);
|
||||
error_setg(&err, QERR_INVALID_PARAMETER, param);
|
||||
}
|
||||
|
||||
if (err) {
|
||||
@ -1294,7 +1295,7 @@ void hmp_expire_password(Monitor *mon, const QDict *qdict)
|
||||
|
||||
void hmp_eject(Monitor *mon, const QDict *qdict)
|
||||
{
|
||||
int force = qdict_get_try_bool(qdict, "force", 0);
|
||||
bool force = qdict_get_try_bool(qdict, "force", false);
|
||||
const char *device = qdict_get_str(qdict, "device");
|
||||
Error *err = NULL;
|
||||
|
||||
@ -1394,7 +1395,7 @@ void hmp_block_job_cancel(Monitor *mon, const QDict *qdict)
|
||||
{
|
||||
Error *error = NULL;
|
||||
const char *device = qdict_get_str(qdict, "device");
|
||||
bool force = qdict_get_try_bool(qdict, "force", 0);
|
||||
bool force = qdict_get_try_bool(qdict, "force", false);
|
||||
|
||||
qmp_block_job_cancel(device, true, force, &error);
|
||||
|
||||
@ -1474,9 +1475,9 @@ static void hmp_migrate_status_cb(void *opaque)
|
||||
|
||||
void hmp_migrate(Monitor *mon, const QDict *qdict)
|
||||
{
|
||||
int detach = qdict_get_try_bool(qdict, "detach", 0);
|
||||
int blk = qdict_get_try_bool(qdict, "blk", 0);
|
||||
int inc = qdict_get_try_bool(qdict, "inc", 0);
|
||||
bool detach = qdict_get_try_bool(qdict, "detach", false);
|
||||
bool blk = qdict_get_try_bool(qdict, "blk", false);
|
||||
bool inc = qdict_get_try_bool(qdict, "inc", false);
|
||||
const char *uri = qdict_get_str(qdict, "uri");
|
||||
Error *err = NULL;
|
||||
|
||||
@ -1507,7 +1508,10 @@ void hmp_migrate(Monitor *mon, const QDict *qdict)
|
||||
|
||||
void hmp_device_add(Monitor *mon, const QDict *qdict)
|
||||
{
|
||||
do_device_add(mon, qdict, NULL);
|
||||
Error *err = NULL;
|
||||
|
||||
qmp_device_add((QDict *)qdict, NULL, &err);
|
||||
hmp_handle_error(mon, &err);
|
||||
}
|
||||
|
||||
void hmp_device_del(Monitor *mon, const QDict *qdict)
|
||||
@ -1522,10 +1526,10 @@ void hmp_device_del(Monitor *mon, const QDict *qdict)
|
||||
void hmp_dump_guest_memory(Monitor *mon, const QDict *qdict)
|
||||
{
|
||||
Error *err = NULL;
|
||||
int paging = qdict_get_try_bool(qdict, "paging", 0);
|
||||
int zlib = qdict_get_try_bool(qdict, "zlib", 0);
|
||||
int lzo = qdict_get_try_bool(qdict, "lzo", 0);
|
||||
int snappy = qdict_get_try_bool(qdict, "snappy", 0);
|
||||
bool paging = qdict_get_try_bool(qdict, "paging", false);
|
||||
bool zlib = qdict_get_try_bool(qdict, "zlib", false);
|
||||
bool lzo = qdict_get_try_bool(qdict, "lzo", false);
|
||||
bool snappy = qdict_get_try_bool(qdict, "snappy", false);
|
||||
const char *file = qdict_get_str(qdict, "filename");
|
||||
bool has_begin = qdict_haskey(qdict, "begin");
|
||||
bool has_length = qdict_haskey(qdict, "length");
|
||||
@ -1751,8 +1755,8 @@ void hmp_screendump(Monitor *mon, const QDict *qdict)
|
||||
void hmp_nbd_server_start(Monitor *mon, const QDict *qdict)
|
||||
{
|
||||
const char *uri = qdict_get_str(qdict, "uri");
|
||||
int writable = qdict_get_try_bool(qdict, "writable", 0);
|
||||
int all = qdict_get_try_bool(qdict, "all", 0);
|
||||
bool writable = qdict_get_try_bool(qdict, "writable", false);
|
||||
bool all = qdict_get_try_bool(qdict, "all", false);
|
||||
Error *local_err = NULL;
|
||||
BlockInfoList *block_list, *info;
|
||||
SocketAddress *addr;
|
||||
@ -1805,7 +1809,7 @@ exit:
|
||||
void hmp_nbd_server_add(Monitor *mon, const QDict *qdict)
|
||||
{
|
||||
const char *device = qdict_get_str(qdict, "device");
|
||||
int writable = qdict_get_try_bool(qdict, "writable", 0);
|
||||
bool writable = qdict_get_try_bool(qdict, "writable", false);
|
||||
Error *local_err = NULL;
|
||||
|
||||
qmp_nbd_server_add(device, true, writable, &local_err);
|
||||
@ -1839,7 +1843,7 @@ void hmp_chardev_add(Monitor *mon, const QDict *qdict)
|
||||
Error *err = NULL;
|
||||
QemuOpts *opts;
|
||||
|
||||
opts = qemu_opts_parse(qemu_find_opts("chardev"), args, 1);
|
||||
opts = qemu_opts_parse_noisily(qemu_find_opts("chardev"), args, true);
|
||||
if (opts == NULL) {
|
||||
error_setg(&err, "Parsing chardev args failed");
|
||||
} else {
|
||||
@ -1867,7 +1871,8 @@ void hmp_qemu_io(Monitor *mon, const QDict *qdict)
|
||||
if (blk) {
|
||||
qemuio_command(blk, command);
|
||||
} else {
|
||||
error_set(&err, QERR_DEVICE_NOT_FOUND, device);
|
||||
error_set(&err, ERROR_CLASS_DEVICE_NOT_FOUND,
|
||||
"Device '%s' not found", device);
|
||||
}
|
||||
|
||||
hmp_handle_error(mon, &err);
|
||||
@ -1995,7 +2000,8 @@ void hmp_qom_set(Monitor *mon, const QDict *qdict)
|
||||
|
||||
obj = object_resolve_path(path, &ambiguous);
|
||||
if (obj == NULL) {
|
||||
error_set(&err, QERR_DEVICE_NOT_FOUND, path);
|
||||
error_set(&err, ERROR_CLASS_DEVICE_NOT_FOUND,
|
||||
"Device '%s' not found", path);
|
||||
} else {
|
||||
if (ambiguous) {
|
||||
monitor_printf(mon, "Warning: Path '%s' is ambiguous\n", path);
|
||||
|
@ -13,6 +13,7 @@
|
||||
|
||||
#include "hw/virtio/virtio.h"
|
||||
#include "hw/i386/pc.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "qemu/sockets.h"
|
||||
#include "virtio-9p.h"
|
||||
#include "fsdev/qemu-fsdev.h"
|
||||
|
@ -27,7 +27,6 @@
|
||||
|
||||
#include "hw/char/serial.h"
|
||||
#include "hw/pci/pci.h"
|
||||
#include "qapi/qmp/qerror.h"
|
||||
|
||||
#define PCI_SERIAL_MAX_PORTS 4
|
||||
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
#include "qemu/iov.h"
|
||||
#include "monitor/monitor.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "qemu/queue.h"
|
||||
#include "hw/sysbus.h"
|
||||
#include "trace.h"
|
||||
|
@ -67,7 +67,7 @@ void nmi_monitor_handle(int cpu_index, Error **errp)
|
||||
if (ns.handled) {
|
||||
error_propagate(errp, ns.errp);
|
||||
} else {
|
||||
error_set(errp, QERR_UNSUPPORTED);
|
||||
error_setg(errp, QERR_UNSUPPORTED);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,6 @@
|
||||
*/
|
||||
|
||||
#include "hw/platform-bus.h"
|
||||
#include "monitor/monitor.h"
|
||||
#include "exec/address-spaces.h"
|
||||
#include "sysemu/sysemu.h"
|
||||
|
||||
|
@ -326,8 +326,8 @@ static void set_vlan(Object *obj, Visitor *v, void *opaque,
|
||||
|
||||
hubport = net_hub_port_find(id);
|
||||
if (!hubport) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER_VALUE,
|
||||
name, prop->info->name);
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_VALUE,
|
||||
name, prop->info->name);
|
||||
return;
|
||||
}
|
||||
*ptr = hubport;
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "net/net.h"
|
||||
#include "hw/qdev.h"
|
||||
#include "qapi/qmp/qerror.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "sysemu/block-backend.h"
|
||||
#include "hw/block/block.h"
|
||||
#include "net/hub.h"
|
||||
@ -570,8 +571,8 @@ static void set_pci_devfn(Object *obj, Visitor *v, void *opaque,
|
||||
if (local_err) {
|
||||
error_propagate(errp, local_err);
|
||||
} else if (value < -1 || value > 255) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER_VALUE, name ? name : "null",
|
||||
"pci_devfn");
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_VALUE,
|
||||
name ? name : "null", "pci_devfn");
|
||||
} else {
|
||||
*ptr = value;
|
||||
}
|
||||
@ -640,8 +641,8 @@ static void set_blocksize(Object *obj, Visitor *v, void *opaque,
|
||||
}
|
||||
/* value of 0 means "unset" */
|
||||
if (value && (value < min || value > max)) {
|
||||
error_set(errp, QERR_PROPERTY_VALUE_OUT_OF_RANGE,
|
||||
dev->id?:"", name, (int64_t)value, min, max);
|
||||
error_setg(errp, QERR_PROPERTY_VALUE_OUT_OF_RANGE,
|
||||
dev->id ? : "", name, (int64_t)value, min, max);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -923,8 +924,8 @@ void error_set_from_qdev_prop_error(Error **errp, int ret, DeviceState *dev,
|
||||
break;
|
||||
default:
|
||||
case -EINVAL:
|
||||
error_set(errp, QERR_PROPERTY_VALUE_BAD,
|
||||
object_get_typename(OBJECT(dev)), prop->name, value);
|
||||
error_setg(errp, QERR_PROPERTY_VALUE_BAD,
|
||||
object_get_typename(OBJECT(dev)), prop->name, value);
|
||||
break;
|
||||
case -ENOENT:
|
||||
error_setg(errp, "Property '%s.%s' can't find value '%s'",
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include "qapi/qmp/qerror.h"
|
||||
#include "qapi/visitor.h"
|
||||
#include "qapi/qmp/qjson.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "hw/hotplug.h"
|
||||
#include "hw/boards.h"
|
||||
#include "qapi-event.h"
|
||||
@ -276,13 +277,13 @@ void qdev_unplug(DeviceState *dev, Error **errp)
|
||||
HotplugHandlerClass *hdc;
|
||||
|
||||
if (dev->parent_bus && !qbus_is_hotpluggable(dev->parent_bus)) {
|
||||
error_set(errp, QERR_BUS_NO_HOTPLUG, dev->parent_bus->name);
|
||||
error_setg(errp, QERR_BUS_NO_HOTPLUG, dev->parent_bus->name);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!dc->hotpluggable) {
|
||||
error_set(errp, QERR_DEVICE_NO_HOTPLUG,
|
||||
object_get_typename(OBJECT(dev)));
|
||||
error_setg(errp, QERR_DEVICE_NO_HOTPLUG,
|
||||
object_get_typename(OBJECT(dev)));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1026,7 +1027,7 @@ static void device_set_realized(Object *obj, bool value, Error **errp)
|
||||
Error *local_err = NULL;
|
||||
|
||||
if (dev->hotplugged && !dc->hotpluggable) {
|
||||
error_set(errp, QERR_DEVICE_NO_HOTPLUG, object_get_typename(obj));
|
||||
error_setg(errp, QERR_DEVICE_NO_HOTPLUG, object_get_typename(obj));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,7 @@
|
||||
*/
|
||||
|
||||
#include "hw/hw.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "ui/console.h"
|
||||
#include "ui/pixel_ops.h"
|
||||
#include "trace.h"
|
||||
|
@ -25,7 +25,6 @@
|
||||
#include "qemu/timer.h"
|
||||
#include "qemu/queue.h"
|
||||
#include "qemu/atomic.h"
|
||||
#include "monitor/monitor.h"
|
||||
#include "sysemu/sysemu.h"
|
||||
#include "trace.h"
|
||||
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "ui/pixel_ops.h"
|
||||
#include "hw/loader.h"
|
||||
#include "hw/sysbus.h"
|
||||
#include "qemu/error-report.h"
|
||||
|
||||
#define TCX_ROM_FILE "QEMU,tcx.bin"
|
||||
#define FCODE_MAX_ROM_SIZE 0x10000
|
||||
|
@ -26,7 +26,6 @@
|
||||
#include "qemu/timer.h"
|
||||
#include "hw/ptimer.h"
|
||||
#include "qemu/log.h"
|
||||
#include "qapi/qmp/qerror.h"
|
||||
#include "qemu/main-loop.h"
|
||||
|
||||
#include "hw/stream.h"
|
||||
|
@ -31,7 +31,6 @@
|
||||
#include "hw/ide.h"
|
||||
#include "hw/pci/pci.h"
|
||||
#include "hw/pci/pci_bus.h"
|
||||
#include "monitor/monitor.h"
|
||||
#include "hw/nvram/fw_cfg.h"
|
||||
#include "hw/timer/hpet.h"
|
||||
#include "hw/i386/smbios.h"
|
||||
@ -57,6 +56,7 @@
|
||||
#include "sysemu/arch_init.h"
|
||||
#include "qemu/bitmap.h"
|
||||
#include "qemu/config-file.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "hw/acpi/acpi.h"
|
||||
#include "hw/acpi/cpu_hotplug.h"
|
||||
#include "hw/cpu/icc_bus.h"
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include <hw/pci/pci.h>
|
||||
#include <hw/sysbus.h>
|
||||
|
||||
#include "monitor/monitor.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "sysemu/block-backend.h"
|
||||
#include "sysemu/dma.h"
|
||||
#include "internal.h"
|
||||
|
@ -1556,9 +1556,9 @@ static void openpic_realize(DeviceState *dev, Error **errp)
|
||||
};
|
||||
|
||||
if (opp->nb_cpus > MAX_CPU) {
|
||||
error_set(errp, QERR_PROPERTY_VALUE_OUT_OF_RANGE,
|
||||
TYPE_OPENPIC, "nb_cpus", (uint64_t)opp->nb_cpus,
|
||||
(uint64_t)0, (uint64_t)MAX_CPU);
|
||||
error_setg(errp, QERR_PROPERTY_VALUE_OUT_OF_RANGE,
|
||||
TYPE_OPENPIC, "nb_cpus", (uint64_t)opp->nb_cpus,
|
||||
(uint64_t)0, (uint64_t)MAX_CPU);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,7 @@
|
||||
#include "hw/pci/msix.h"
|
||||
#include "sysemu/kvm.h"
|
||||
#include "migration/migration.h"
|
||||
#include "qapi/qmp/qerror.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "qemu/event_notifier.h"
|
||||
#include "qemu/fifo8.h"
|
||||
#include "sysemu/char.h"
|
||||
|
@ -21,13 +21,13 @@
|
||||
|
||||
RockerSwitch *qmp_query_rocker(const char *name, Error **errp)
|
||||
{
|
||||
error_set(errp, QERR_FEATURE_DISABLED, "rocker");
|
||||
error_setg(errp, QERR_FEATURE_DISABLED, "rocker");
|
||||
return NULL;
|
||||
};
|
||||
|
||||
RockerPortList *qmp_query_rocker_ports(const char *name, Error **errp)
|
||||
{
|
||||
error_set(errp, QERR_FEATURE_DISABLED, "rocker");
|
||||
error_setg(errp, QERR_FEATURE_DISABLED, "rocker");
|
||||
return NULL;
|
||||
};
|
||||
|
||||
@ -36,7 +36,7 @@ RockerOfDpaFlowList *qmp_query_rocker_of_dpa_flows(const char *name,
|
||||
uint32_t tbl_id,
|
||||
Error **errp)
|
||||
{
|
||||
error_set(errp, QERR_FEATURE_DISABLED, "rocker");
|
||||
error_setg(errp, QERR_FEATURE_DISABLED, "rocker");
|
||||
return NULL;
|
||||
};
|
||||
|
||||
@ -45,6 +45,6 @@ RockerOfDpaGroupList *qmp_query_rocker_of_dpa_groups(const char *name,
|
||||
uint8_t type,
|
||||
Error **errp)
|
||||
{
|
||||
error_set(errp, QERR_FEATURE_DISABLED, "rocker");
|
||||
error_setg(errp, QERR_FEATURE_DISABLED, "rocker");
|
||||
return NULL;
|
||||
};
|
||||
|
@ -26,7 +26,6 @@
|
||||
#include "qemu/log.h"
|
||||
#include "net/net.h"
|
||||
#include "net/checksum.h"
|
||||
#include "qapi/qmp/qerror.h"
|
||||
|
||||
#include "hw/stream.h"
|
||||
|
||||
|
@ -20,12 +20,13 @@
|
||||
|
||||
#include "sysemu/sysemu.h"
|
||||
#include "monitor/monitor.h"
|
||||
#include "qapi/qmp/qerror.h"
|
||||
#include "hw/pci/pci.h"
|
||||
#include "qmp-commands.h"
|
||||
|
||||
PciInfoList *qmp_query_pci(Error **errp)
|
||||
{
|
||||
error_set(errp, QERR_UNSUPPORTED);
|
||||
error_setg(errp, QERR_UNSUPPORTED);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "net/net.h"
|
||||
#include "sysemu/sysemu.h"
|
||||
#include "hw/loader.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "qemu/range.h"
|
||||
#include "qmp-commands.h"
|
||||
#include "trace.h"
|
||||
|
@ -26,7 +26,6 @@
|
||||
#include "hw/pci/pci_bus.h"
|
||||
#include "hw/pci/pcie_regs.h"
|
||||
#include "qemu/range.h"
|
||||
#include "qapi/qmp/qerror.h"
|
||||
|
||||
//#define DEBUG_PCIE
|
||||
#ifdef DEBUG_PCIE
|
||||
|
@ -975,7 +975,7 @@ static int do_pcie_aer_inject_error(Monitor *mon,
|
||||
if (pcie_aer_parse_error_string(error_name, &error_status, &correctable)) {
|
||||
char *e = NULL;
|
||||
error_status = strtoul(error_name, &e, 0);
|
||||
correctable = qdict_get_try_bool(qdict, "correctable", 0);
|
||||
correctable = qdict_get_try_bool(qdict, "correctable", false);
|
||||
if (!e || *e != '\0') {
|
||||
monitor_printf(mon, "invalid error status value. \"%s\"",
|
||||
error_name);
|
||||
@ -989,7 +989,7 @@ static int do_pcie_aer_inject_error(Monitor *mon,
|
||||
if (correctable) {
|
||||
err.flags |= PCIE_AER_ERR_IS_CORRECTABLE;
|
||||
}
|
||||
if (qdict_get_try_bool(qdict, "advisory_non_fatal", 0)) {
|
||||
if (qdict_get_try_bool(qdict, "advisory_non_fatal", false)) {
|
||||
err.flags |= PCIE_AER_ERR_MAYBE_ADVISORY;
|
||||
}
|
||||
if (qdict_haskey(qdict, "header0")) {
|
||||
|
@ -7,7 +7,6 @@
|
||||
#include "hw/pci/pci.h"
|
||||
#include "hw/pci/pci_bus.h"
|
||||
#include "hw/pci/msi.h"
|
||||
#include "qapi/qmp/qerror.h"
|
||||
|
||||
/* TODO: model power only and disabled slot states. */
|
||||
/* TODO: handle SERR and wakeups */
|
||||
|
@ -1062,8 +1062,8 @@ static void spapr_phb_hot_plug_child(HotplugHandler *plug_handler,
|
||||
* we need to let them know it's not enabled
|
||||
*/
|
||||
if (plugged_dev->hotplugged) {
|
||||
error_set(errp, QERR_BUS_NO_HOTPLUG,
|
||||
object_get_typename(OBJECT(phb)));
|
||||
error_setg(errp, QERR_BUS_NO_HOTPLUG,
|
||||
object_get_typename(OBJECT(phb)));
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -1090,8 +1090,8 @@ static void spapr_phb_hot_unplug_child(HotplugHandler *plug_handler,
|
||||
Error *local_err = NULL;
|
||||
|
||||
if (!phb->dr_enabled) {
|
||||
error_set(errp, QERR_BUS_NO_HOTPLUG,
|
||||
object_get_typename(OBJECT(phb)));
|
||||
error_setg(errp, QERR_BUS_NO_HOTPLUG,
|
||||
object_get_typename(OBJECT(phb)));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,6 @@
|
||||
#include "hw/hw.h"
|
||||
#include "sysemu/sysemu.h"
|
||||
#include "hw/boards.h"
|
||||
#include "monitor/monitor.h"
|
||||
#include "hw/loader.h"
|
||||
#include "elf.h"
|
||||
#include "hw/sysbus.h"
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include "sysemu/device_tree.h"
|
||||
#include "hw/loader.h"
|
||||
#include "elf.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "qemu/log.h"
|
||||
#include "exec/address-spaces.h"
|
||||
|
||||
@ -40,7 +41,6 @@
|
||||
#include "ppc405.h"
|
||||
|
||||
#include "sysemu/block-backend.h"
|
||||
#include "qapi/qmp/qerror.h"
|
||||
|
||||
#define EPAPR_MAGIC (0x45504150)
|
||||
#define FLASH_SIZE (16 * 1024 * 1024)
|
||||
|
@ -15,7 +15,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "monitor/monitor.h"
|
||||
#include "sysemu/sysemu.h"
|
||||
|
||||
#include "hw/s390x/sclp.h"
|
||||
|
@ -21,7 +21,6 @@
|
||||
#include "sysemu/block-backend.h"
|
||||
#include "sysemu/sysemu.h"
|
||||
#include "hw/boards.h"
|
||||
#include "monitor/monitor.h"
|
||||
#include "hw/loader.h"
|
||||
#include "elf.h"
|
||||
#include "hw/virtio/virtio.h"
|
||||
|
@ -22,12 +22,12 @@
|
||||
*/
|
||||
|
||||
#include "hw/hw.h"
|
||||
#include "qapi/qmp/qerror.h"
|
||||
#include "sysemu/block-backend.h"
|
||||
#include "sysemu/blockdev.h"
|
||||
#include "sysemu/sysemu.h"
|
||||
#include "net/net.h"
|
||||
#include "hw/boards.h"
|
||||
#include "monitor/monitor.h"
|
||||
#include "hw/loader.h"
|
||||
#include "hw/virtio/virtio.h"
|
||||
#include "hw/sysbus.h"
|
||||
@ -324,7 +324,7 @@ void s390_nmi(NMIState *n, int cpu_index, Error **errp)
|
||||
CPUState *cs = qemu_get_cpu(cpu_index);
|
||||
|
||||
if (s390_cpu_restart(S390_CPU(cs))) {
|
||||
error_set(errp, QERR_UNSUPPORTED);
|
||||
error_setg(errp, QERR_UNSUPPORTED);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -15,12 +15,12 @@
|
||||
#include "sysemu/blockdev.h"
|
||||
#include "sysemu/sysemu.h"
|
||||
#include "net/net.h"
|
||||
#include "monitor/monitor.h"
|
||||
#include "hw/virtio/virtio.h"
|
||||
#include "hw/virtio/virtio-serial.h"
|
||||
#include "hw/virtio/virtio-net.h"
|
||||
#include "hw/sysbus.h"
|
||||
#include "qemu/bitops.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "hw/virtio/virtio-bus.h"
|
||||
#include "hw/s390x/adapter.h"
|
||||
#include "hw/s390x/s390_flic.h"
|
||||
|
@ -16,6 +16,7 @@
|
||||
|
||||
#include <sys/ioctl.h>
|
||||
#include "config.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "qemu/queue.h"
|
||||
#include "monitor/monitor.h"
|
||||
#include "migration/migration.h"
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "hw/hw.h"
|
||||
#include "hw/i386/pc.h"
|
||||
#include "ui/console.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "qemu/timer.h"
|
||||
#include "hw/timer/hpet.h"
|
||||
#include "hw/sysbus.h"
|
||||
|
@ -26,6 +26,7 @@
|
||||
|
||||
#include "qemu-common.h"
|
||||
#include "qapi/error.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "qemu/sockets.h"
|
||||
#include "sysemu/tpm_backend.h"
|
||||
#include "tpm_int.h"
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "hw/hw.h"
|
||||
#include "hw/usb.h"
|
||||
#include "hw/qdev.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "sysemu/sysemu.h"
|
||||
#include "monitor/monitor.h"
|
||||
#include "trace.h"
|
||||
|
@ -33,7 +33,6 @@
|
||||
|
||||
#include "qemu/thread.h"
|
||||
#include "sysemu/char.h"
|
||||
#include "monitor/monitor.h"
|
||||
#include "ccid.h"
|
||||
|
||||
#define DPRINTF(card, lvl, fmt, ...) \
|
||||
|
@ -9,8 +9,8 @@
|
||||
*/
|
||||
|
||||
#include "sysemu/char.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "qemu/sockets.h"
|
||||
#include "monitor/monitor.h"
|
||||
#include "ccid.h"
|
||||
#include "libcacard/vscard_common.h"
|
||||
|
||||
|
@ -1397,7 +1397,7 @@ static USBDevice *usb_net_init(USBBus *bus, const char *cmdline)
|
||||
QemuOpts *opts;
|
||||
int idx;
|
||||
|
||||
opts = qemu_opts_parse(qemu_find_opts("net"), cmdline, 0);
|
||||
opts = qemu_opts_parse_noisily(qemu_find_opts("net"), cmdline, false);
|
||||
if (!opts) {
|
||||
return NULL;
|
||||
}
|
||||
|
@ -9,7 +9,7 @@
|
||||
*/
|
||||
|
||||
#include "qemu-common.h"
|
||||
#include "monitor/monitor.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "hw/usb.h"
|
||||
#include "hw/usb/desc.h"
|
||||
#include "sysemu/char.h"
|
||||
|
@ -38,7 +38,6 @@
|
||||
#include "qemu/error-report.h"
|
||||
#include "hw/usb.h"
|
||||
#include "hw/usb/desc.h"
|
||||
#include "monitor/monitor.h"
|
||||
|
||||
#include "ccid.h"
|
||||
|
||||
|
@ -8,6 +8,7 @@
|
||||
*/
|
||||
|
||||
#include "qemu-common.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "qemu/option.h"
|
||||
#include "qemu/config-file.h"
|
||||
#include "hw/usb.h"
|
||||
|
@ -20,7 +20,6 @@
|
||||
#include "hw/hw.h"
|
||||
#include "qemu/timer.h"
|
||||
#include "hw/usb.h"
|
||||
#include "monitor/monitor.h"
|
||||
#include "sysemu/dma.h"
|
||||
#include "sysemu/sysemu.h"
|
||||
#include "hw/pci/pci.h"
|
||||
|
@ -38,6 +38,7 @@
|
||||
|
||||
#include "qemu-common.h"
|
||||
#include "monitor/monitor.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "sysemu/sysemu.h"
|
||||
#include "trace.h"
|
||||
|
||||
|
@ -27,8 +27,9 @@
|
||||
|
||||
#include "qemu-common.h"
|
||||
#include "qemu/timer.h"
|
||||
#include "monitor/monitor.h"
|
||||
#include "sysemu/sysemu.h"
|
||||
#include "qapi/qmp/qerror.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "qemu/iov.h"
|
||||
#include "sysemu/char.h"
|
||||
|
||||
@ -1369,7 +1370,7 @@ static void usbredir_realize(USBDevice *udev, Error **errp)
|
||||
int i;
|
||||
|
||||
if (dev->cs == NULL) {
|
||||
error_set(errp, QERR_MISSING_PARAMETER, "chardev");
|
||||
error_setg(errp, QERR_MISSING_PARAMETER, "chardev");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1378,8 +1379,8 @@ static void usbredir_realize(USBDevice *udev, Error **errp)
|
||||
&dev->filter_rules,
|
||||
&dev->filter_rules_count);
|
||||
if (i) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER_VALUE, "filter",
|
||||
"a usb device filter string");
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "filter",
|
||||
"a usb device filter string");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -11,7 +11,6 @@
|
||||
|
||||
#include "qemu/iov.h"
|
||||
#include "hw/qdev.h"
|
||||
#include "qapi/qmp/qerror.h"
|
||||
#include "hw/virtio/virtio.h"
|
||||
#include "hw/virtio/virtio-rng.h"
|
||||
#include "sysemu/rng.h"
|
||||
|
@ -31,8 +31,6 @@
|
||||
#include "block/coroutine.h"
|
||||
#include "qemu/timer.h"
|
||||
#include "qapi-types.h"
|
||||
#include "qapi/qmp/qerror.h"
|
||||
#include "monitor/monitor.h"
|
||||
#include "qemu/hbitmap.h"
|
||||
#include "block/snapshot.h"
|
||||
#include "qemu/main-loop.h"
|
||||
|
@ -6,10 +6,10 @@
|
||||
#ifdef NEED_CPU_H
|
||||
/* Disassemble this for me please... (debugging). */
|
||||
void disas(FILE *out, void *code, unsigned long size);
|
||||
void target_disas(FILE *out, CPUArchState *env, target_ulong code,
|
||||
void target_disas(FILE *out, CPUState *cpu, target_ulong code,
|
||||
target_ulong size, int flags);
|
||||
|
||||
void monitor_disas(Monitor *mon, CPUArchState *env,
|
||||
void monitor_disas(Monitor *mon, CPUState *cpu,
|
||||
target_ulong pc, int nb_insn, int is_physical, int flags);
|
||||
|
||||
/* Look up symbol for debugging purpose. Returns "" if unknown. */
|
||||
|
@ -2,7 +2,6 @@
|
||||
#define MONITOR_H
|
||||
|
||||
#include "qemu-common.h"
|
||||
#include "qapi/qmp/qerror.h"
|
||||
#include "qapi/qmp/qdict.h"
|
||||
#include "block/block.h"
|
||||
#include "qemu/readline.h"
|
||||
@ -39,15 +38,13 @@ void monitor_flush(Monitor *mon);
|
||||
int monitor_set_cpu(int cpu_index);
|
||||
int monitor_get_cpu_index(void);
|
||||
|
||||
void monitor_set_error(Monitor *mon, QError *qerror);
|
||||
void monitor_read_command(Monitor *mon, int show_prompt);
|
||||
int monitor_read_password(Monitor *mon, ReadLineFunc *readline_func,
|
||||
void *opaque);
|
||||
|
||||
int qmp_qom_set(Monitor *mon, const QDict *qdict, QObject **ret);
|
||||
|
||||
int qmp_qom_get(Monitor *mon, const QDict *qdict, QObject **ret);
|
||||
int qmp_object_add(Monitor *mon, const QDict *qdict, QObject **ret);
|
||||
void qmp_qom_set(QDict *qdict, QObject **ret, Error **errp);
|
||||
void qmp_qom_get(QDict *qdict, QObject **ret, Error **errp);
|
||||
void qmp_object_add(QDict *qdict, QObject **ret, Error **errp);
|
||||
void object_add(const char *type, const char *id, const QDict *qdict,
|
||||
Visitor *v, Error **errp);
|
||||
|
||||
|
@ -2,15 +2,16 @@
|
||||
#define QEMU_QDEV_MONITOR_H
|
||||
|
||||
#include "hw/qdev-core.h"
|
||||
#include "monitor/monitor.h"
|
||||
#include "qemu/typedefs.h"
|
||||
|
||||
/*** monitor commands ***/
|
||||
|
||||
void hmp_info_qtree(Monitor *mon, const QDict *qdict);
|
||||
void hmp_info_qdm(Monitor *mon, const QDict *qdict);
|
||||
void hmp_info_qom_tree(Monitor *mon, const QDict *dict);
|
||||
int do_device_add(Monitor *mon, const QDict *qdict, QObject **ret_data);
|
||||
void qmp_device_add(QDict *qdict, QObject **ret_data, Error **errp);
|
||||
|
||||
int qdev_device_help(QemuOpts *opts);
|
||||
DeviceState *qdev_device_add(QemuOpts *opts);
|
||||
DeviceState *qdev_device_add(QemuOpts *opts, Error **errp);
|
||||
|
||||
#endif
|
||||
|
@ -197,7 +197,7 @@ void net_cleanup(void);
|
||||
void hmp_host_net_add(Monitor *mon, const QDict *qdict);
|
||||
void hmp_host_net_remove(Monitor *mon, const QDict *qdict);
|
||||
void netdev_add(QemuOpts *opts, Error **errp);
|
||||
int qmp_netdev_add(Monitor *mon, const QDict *qdict, QObject **ret);
|
||||
void qmp_netdev_add(QDict *qdict, QObject **ret, Error **errp);
|
||||
|
||||
int net_hub_id_for_client(NetClientState *nc, int *id);
|
||||
NetClientState *net_hub_port_find(int hub_id);
|
||||
|
@ -14,16 +14,16 @@
|
||||
#ifndef QBOOL_H
|
||||
#define QBOOL_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include "qapi/qmp/qobject.h"
|
||||
|
||||
typedef struct QBool {
|
||||
QObject_HEAD;
|
||||
int value;
|
||||
bool value;
|
||||
} QBool;
|
||||
|
||||
QBool *qbool_from_int(int value);
|
||||
int qbool_get_int(const QBool *qb);
|
||||
QBool *qbool_from_bool(bool value);
|
||||
bool qbool_get_bool(const QBool *qb);
|
||||
QBool *qobject_to_qbool(const QObject *obj);
|
||||
|
||||
#endif /* QBOOL_H */
|
||||
|
@ -56,13 +56,13 @@ const QDictEntry *qdict_next(const QDict *qdict, const QDictEntry *entry);
|
||||
/* High level helpers */
|
||||
double qdict_get_double(const QDict *qdict, const char *key);
|
||||
int64_t qdict_get_int(const QDict *qdict, const char *key);
|
||||
int qdict_get_bool(const QDict *qdict, const char *key);
|
||||
bool qdict_get_bool(const QDict *qdict, const char *key);
|
||||
QList *qdict_get_qlist(const QDict *qdict, const char *key);
|
||||
QDict *qdict_get_qdict(const QDict *qdict, const char *key);
|
||||
const char *qdict_get_str(const QDict *qdict, const char *key);
|
||||
int64_t qdict_get_try_int(const QDict *qdict, const char *key,
|
||||
int64_t def_value);
|
||||
int qdict_get_try_bool(const QDict *qdict, const char *key, int def_value);
|
||||
bool qdict_get_try_bool(const QDict *qdict, const char *key, bool def_value);
|
||||
const char *qdict_get_try_str(const QDict *qdict, const char *key);
|
||||
|
||||
void qdict_copy_default(QDict *dst, QDict *src, const char *key);
|
||||
|
@ -12,122 +12,98 @@
|
||||
#ifndef QERROR_H
|
||||
#define QERROR_H
|
||||
|
||||
#include "qapi/qmp/qstring.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "qapi/error.h"
|
||||
#include "qapi-types.h"
|
||||
#include <stdarg.h>
|
||||
|
||||
typedef struct QError {
|
||||
QObject_HEAD;
|
||||
Location loc;
|
||||
char *err_msg;
|
||||
ErrorClass err_class;
|
||||
} QError;
|
||||
|
||||
QString *qerror_human(const QError *qerror);
|
||||
void qerror_report(ErrorClass err_class, const char *fmt, ...) GCC_FMT_ATTR(2, 3);
|
||||
void qerror_report_err(Error *err);
|
||||
|
||||
/*
|
||||
* QError class list
|
||||
* Please keep the definitions in alphabetical order.
|
||||
* Use scripts/check-qerror.sh to check.
|
||||
* These macros will go away, please don't use in new code, and do not
|
||||
* add new ones!
|
||||
*/
|
||||
#define QERR_BASE_NOT_FOUND \
|
||||
ERROR_CLASS_GENERIC_ERROR, "Base '%s' not found"
|
||||
"Base '%s' not found"
|
||||
|
||||
#define QERR_BLOCK_JOB_NOT_READY \
|
||||
ERROR_CLASS_GENERIC_ERROR, "The active block job for device '%s' cannot be completed"
|
||||
"The active block job for device '%s' cannot be completed"
|
||||
|
||||
#define QERR_BUS_NO_HOTPLUG \
|
||||
ERROR_CLASS_GENERIC_ERROR, "Bus '%s' does not support hotplugging"
|
||||
|
||||
#define QERR_BUS_NOT_FOUND \
|
||||
ERROR_CLASS_GENERIC_ERROR, "Bus '%s' not found"
|
||||
"Bus '%s' does not support hotplugging"
|
||||
|
||||
#define QERR_DEVICE_HAS_NO_MEDIUM \
|
||||
ERROR_CLASS_GENERIC_ERROR, "Device '%s' has no medium"
|
||||
"Device '%s' has no medium"
|
||||
|
||||
#define QERR_DEVICE_INIT_FAILED \
|
||||
ERROR_CLASS_GENERIC_ERROR, "Device '%s' could not be initialized"
|
||||
"Device '%s' could not be initialized"
|
||||
|
||||
#define QERR_DEVICE_IN_USE \
|
||||
ERROR_CLASS_GENERIC_ERROR, "Device '%s' is in use"
|
||||
"Device '%s' is in use"
|
||||
|
||||
#define QERR_DEVICE_NO_HOTPLUG \
|
||||
ERROR_CLASS_GENERIC_ERROR, "Device '%s' does not support hotplugging"
|
||||
|
||||
#define QERR_DEVICE_NOT_FOUND \
|
||||
ERROR_CLASS_DEVICE_NOT_FOUND, "Device '%s' not found"
|
||||
"Device '%s' does not support hotplugging"
|
||||
|
||||
#define QERR_FD_NOT_FOUND \
|
||||
ERROR_CLASS_GENERIC_ERROR, "File descriptor named '%s' not found"
|
||||
"File descriptor named '%s' not found"
|
||||
|
||||
#define QERR_FD_NOT_SUPPLIED \
|
||||
ERROR_CLASS_GENERIC_ERROR, "No file descriptor supplied via SCM_RIGHTS"
|
||||
"No file descriptor supplied via SCM_RIGHTS"
|
||||
|
||||
#define QERR_FEATURE_DISABLED \
|
||||
ERROR_CLASS_GENERIC_ERROR, "The feature '%s' is not enabled"
|
||||
"The feature '%s' is not enabled"
|
||||
|
||||
#define QERR_INVALID_BLOCK_FORMAT \
|
||||
ERROR_CLASS_GENERIC_ERROR, "Invalid block format '%s'"
|
||||
"Invalid block format '%s'"
|
||||
|
||||
#define QERR_INVALID_PARAMETER \
|
||||
ERROR_CLASS_GENERIC_ERROR, "Invalid parameter '%s'"
|
||||
"Invalid parameter '%s'"
|
||||
|
||||
#define QERR_INVALID_PARAMETER_TYPE \
|
||||
ERROR_CLASS_GENERIC_ERROR, "Invalid parameter type for '%s', expected: %s"
|
||||
"Invalid parameter type for '%s', expected: %s"
|
||||
|
||||
#define QERR_INVALID_PARAMETER_VALUE \
|
||||
ERROR_CLASS_GENERIC_ERROR, "Parameter '%s' expects %s"
|
||||
"Parameter '%s' expects %s"
|
||||
|
||||
#define QERR_INVALID_PASSWORD \
|
||||
ERROR_CLASS_GENERIC_ERROR, "Password incorrect"
|
||||
"Password incorrect"
|
||||
|
||||
#define QERR_IO_ERROR \
|
||||
ERROR_CLASS_GENERIC_ERROR, "An IO error has occurred"
|
||||
"An IO error has occurred"
|
||||
|
||||
#define QERR_JSON_PARSING \
|
||||
ERROR_CLASS_GENERIC_ERROR, "Invalid JSON syntax"
|
||||
"Invalid JSON syntax"
|
||||
|
||||
#define QERR_MIGRATION_ACTIVE \
|
||||
ERROR_CLASS_GENERIC_ERROR, "There's a migration process in progress"
|
||||
"There's a migration process in progress"
|
||||
|
||||
#define QERR_MISSING_PARAMETER \
|
||||
ERROR_CLASS_GENERIC_ERROR, "Parameter '%s' is missing"
|
||||
"Parameter '%s' is missing"
|
||||
|
||||
#define QERR_PERMISSION_DENIED \
|
||||
ERROR_CLASS_GENERIC_ERROR, "Insufficient permission to perform this operation"
|
||||
"Insufficient permission to perform this operation"
|
||||
|
||||
#define QERR_PROPERTY_VALUE_BAD \
|
||||
ERROR_CLASS_GENERIC_ERROR, "Property '%s.%s' doesn't take value '%s'"
|
||||
"Property '%s.%s' doesn't take value '%s'"
|
||||
|
||||
#define QERR_PROPERTY_VALUE_OUT_OF_RANGE \
|
||||
ERROR_CLASS_GENERIC_ERROR, "Property %s.%s doesn't take value %" PRId64 " (minimum: %" PRId64 ", maximum: %" PRId64 ")"
|
||||
"Property %s.%s doesn't take value %" PRId64 " (minimum: %" PRId64 ", maximum: %" PRId64 ")"
|
||||
|
||||
#define QERR_QGA_COMMAND_FAILED \
|
||||
ERROR_CLASS_GENERIC_ERROR, "Guest agent command failed, error was '%s'"
|
||||
"Guest agent command failed, error was '%s'"
|
||||
|
||||
#define QERR_QMP_BAD_INPUT_OBJECT \
|
||||
ERROR_CLASS_GENERIC_ERROR, "Expected '%s' in QMP input"
|
||||
"Expected '%s' in QMP input"
|
||||
|
||||
#define QERR_QMP_BAD_INPUT_OBJECT_MEMBER \
|
||||
ERROR_CLASS_GENERIC_ERROR, "QMP input object member '%s' expects '%s'"
|
||||
"QMP input object member '%s' expects '%s'"
|
||||
|
||||
#define QERR_QMP_EXTRA_MEMBER \
|
||||
ERROR_CLASS_GENERIC_ERROR, "QMP input object member '%s' is unexpected"
|
||||
"QMP input object member '%s' is unexpected"
|
||||
|
||||
#define QERR_SET_PASSWD_FAILED \
|
||||
ERROR_CLASS_GENERIC_ERROR, "Could not set password"
|
||||
"Could not set password"
|
||||
|
||||
#define QERR_UNDEFINED_ERROR \
|
||||
ERROR_CLASS_GENERIC_ERROR, "An undefined error has occurred"
|
||||
"An undefined error has occurred"
|
||||
|
||||
#define QERR_UNKNOWN_BLOCK_FORMAT_FEATURE \
|
||||
ERROR_CLASS_GENERIC_ERROR, "'%s' uses a %s feature which is not supported by this qemu version: %s"
|
||||
"'%s' uses a %s feature which is not supported by this qemu version: %s"
|
||||
|
||||
#define QERR_UNSUPPORTED \
|
||||
ERROR_CLASS_GENERIC_ERROR, "this feature or command is not currently supported"
|
||||
"this feature or command is not currently supported"
|
||||
|
||||
#endif /* QERROR_H */
|
||||
|
@ -44,7 +44,6 @@ typedef enum {
|
||||
QTYPE_QLIST,
|
||||
QTYPE_QFLOAT,
|
||||
QTYPE_QBOOL,
|
||||
QTYPE_QERROR,
|
||||
QTYPE_MAX,
|
||||
} qtype_code;
|
||||
|
||||
|
@ -104,10 +104,10 @@ static inline void log_cpu_state_mask(int mask, CPUState *cpu, int flags)
|
||||
|
||||
#ifdef NEED_CPU_H
|
||||
/* disas() and target_disas() to qemu_logfile: */
|
||||
static inline void log_target_disas(CPUArchState *env, target_ulong start,
|
||||
static inline void log_target_disas(CPUState *cpu, target_ulong start,
|
||||
target_ulong len, int flags)
|
||||
{
|
||||
target_disas(qemu_logfile, env, start, len, flags);
|
||||
target_disas(qemu_logfile, cpu, start, len, flags);
|
||||
}
|
||||
|
||||
static inline void log_disas(void *code, unsigned long size)
|
||||
|
@ -119,7 +119,10 @@ void qemu_opts_del(QemuOpts *opts);
|
||||
void qemu_opts_validate(QemuOpts *opts, const QemuOptDesc *desc, Error **errp);
|
||||
void qemu_opts_do_parse(QemuOpts *opts, const char *params,
|
||||
const char *firstname, Error **errp);
|
||||
QemuOpts *qemu_opts_parse(QemuOptsList *list, const char *params, int permit_abbrev);
|
||||
QemuOpts *qemu_opts_parse_noisily(QemuOptsList *list, const char *params,
|
||||
bool permit_abbrev);
|
||||
QemuOpts *qemu_opts_parse(QemuOptsList *list, const char *params,
|
||||
bool permit_abbrev, Error **errp);
|
||||
void qemu_opts_set_defaults(QemuOptsList *list, const char *params,
|
||||
int permit_abbrev);
|
||||
QemuOpts *qemu_opts_from_qdict(QemuOptsList *list, const QDict *qdict,
|
||||
|
@ -28,7 +28,6 @@ int inet_aton(const char *cp, struct in_addr *ia);
|
||||
|
||||
#include "qemu/option.h"
|
||||
#include "qapi/error.h"
|
||||
#include "qapi/qmp/qerror.h"
|
||||
#include "qapi-types.h"
|
||||
|
||||
extern QemuOptsList socket_optslist;
|
||||
|
@ -14,7 +14,6 @@
|
||||
#ifndef _QEMU_BALLOON_H
|
||||
#define _QEMU_BALLOON_H
|
||||
|
||||
#include "monitor/monitor.h"
|
||||
#include "qapi-types.h"
|
||||
|
||||
typedef void (QEMUBalloonEvent)(void *opaque, ram_addr_t target);
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include "qom/object.h"
|
||||
#include "qapi/qmp/qdict.h"
|
||||
#include "qemu/notify.h"
|
||||
#include "monitor/monitor.h"
|
||||
#include "qemu/typedefs.h"
|
||||
#include "qapi-types.h"
|
||||
#include "qapi/error.h"
|
||||
|
||||
@ -369,7 +369,7 @@ char *vnc_display_local_addr(const char *id);
|
||||
#ifdef CONFIG_VNC
|
||||
int vnc_display_password(const char *id, const char *password);
|
||||
int vnc_display_pw_expire(const char *id, time_t expires);
|
||||
QemuOpts *vnc_parse_func(const char *str);
|
||||
QemuOpts *vnc_parse(const char *str, Error **errp);
|
||||
int vnc_init_func(void *opaque, QemuOpts *opts, Error **errp);
|
||||
#else
|
||||
static inline int vnc_display_password(const char *id, const char *password)
|
||||
|
@ -26,7 +26,6 @@
|
||||
|
||||
#include "qemu/option.h"
|
||||
#include "qemu/config-file.h"
|
||||
#include "monitor/monitor.h"
|
||||
|
||||
extern int using_spice;
|
||||
|
||||
@ -54,7 +53,6 @@ static inline CharDriverState *qemu_chr_open_spice_port(const char *name)
|
||||
#endif
|
||||
|
||||
#else /* CONFIG_SPICE */
|
||||
#include "monitor/monitor.h"
|
||||
|
||||
#define using_spice 0
|
||||
#define spice_displays 0
|
||||
|
@ -14,12 +14,13 @@
|
||||
*/
|
||||
|
||||
#include "qemu-common.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "qemu/main-loop.h"
|
||||
#include "migration/migration.h"
|
||||
#include "monitor/monitor.h"
|
||||
#include "migration/qemu-file.h"
|
||||
#include "sysemu/sysemu.h"
|
||||
#include "block/block.h"
|
||||
#include "qapi/qmp/qerror.h"
|
||||
#include "qemu/sockets.h"
|
||||
#include "migration/block.h"
|
||||
#include "qemu/thread.h"
|
||||
@ -337,7 +338,7 @@ void qmp_migrate_set_capabilities(MigrationCapabilityStatusList *params,
|
||||
|
||||
if (s->state == MIGRATION_STATUS_ACTIVE ||
|
||||
s->state == MIGRATION_STATUS_SETUP) {
|
||||
error_set(errp, QERR_MIGRATION_ACTIVE);
|
||||
error_setg(errp, QERR_MIGRATION_ACTIVE);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -356,22 +357,22 @@ void qmp_migrate_set_parameters(bool has_compress_level,
|
||||
MigrationState *s = migrate_get_current();
|
||||
|
||||
if (has_compress_level && (compress_level < 0 || compress_level > 9)) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER_VALUE, "compress_level",
|
||||
"is invalid, it should be in the range of 0 to 9");
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "compress_level",
|
||||
"is invalid, it should be in the range of 0 to 9");
|
||||
return;
|
||||
}
|
||||
if (has_compress_threads &&
|
||||
(compress_threads < 1 || compress_threads > 255)) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER_VALUE,
|
||||
"compress_threads",
|
||||
"is invalid, it should be in the range of 1 to 255");
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_VALUE,
|
||||
"compress_threads",
|
||||
"is invalid, it should be in the range of 1 to 255");
|
||||
return;
|
||||
}
|
||||
if (has_decompress_threads &&
|
||||
(decompress_threads < 1 || decompress_threads > 255)) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER_VALUE,
|
||||
"decompress_threads",
|
||||
"is invalid, it should be in the range of 1 to 255");
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_VALUE,
|
||||
"decompress_threads",
|
||||
"is invalid, it should be in the range of 1 to 255");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -573,7 +574,7 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk,
|
||||
if (s->state == MIGRATION_STATUS_ACTIVE ||
|
||||
s->state == MIGRATION_STATUS_SETUP ||
|
||||
s->state == MIGRATION_STATUS_CANCELLING) {
|
||||
error_set(errp, QERR_MIGRATION_ACTIVE);
|
||||
error_setg(errp, QERR_MIGRATION_ACTIVE);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -608,7 +609,8 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk,
|
||||
fd_start_outgoing_migration(s, p, &local_err);
|
||||
#endif
|
||||
} else {
|
||||
error_set(errp, QERR_INVALID_PARAMETER_VALUE, "uri", "a valid migration protocol");
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "uri",
|
||||
"a valid migration protocol");
|
||||
s->state = MIGRATION_STATUS_FAILED;
|
||||
return;
|
||||
}
|
||||
@ -632,22 +634,22 @@ void qmp_migrate_set_cache_size(int64_t value, Error **errp)
|
||||
|
||||
/* Check for truncation */
|
||||
if (value != (size_t)value) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER_VALUE, "cache size",
|
||||
"exceeding address space");
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "cache size",
|
||||
"exceeding address space");
|
||||
return;
|
||||
}
|
||||
|
||||
/* Cache should not be larger than guest ram size */
|
||||
if (value > ram_bytes_total()) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER_VALUE, "cache size",
|
||||
"exceeds guest ram size ");
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "cache size",
|
||||
"exceeds guest ram size ");
|
||||
return;
|
||||
}
|
||||
|
||||
new_size = xbzrle_cache_resize(value);
|
||||
if (new_size < 0) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER_VALUE, "cache size",
|
||||
"is smaller than page size");
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "cache size",
|
||||
"is smaller than page size");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -26,6 +26,7 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
#include "qemu-common.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "qemu/iov.h"
|
||||
#include "qemu/sockets.h"
|
||||
#include "block/coroutine.h"
|
||||
|
@ -23,6 +23,7 @@
|
||||
*/
|
||||
#include <zlib.h>
|
||||
#include "qemu-common.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "qemu/iov.h"
|
||||
#include "qemu/sockets.h"
|
||||
#include "block/coroutine.h"
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "migration/migration.h"
|
||||
#include "migration/qemu-file.h"
|
||||
#include "exec/cpu-common.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "qemu/main-loop.h"
|
||||
#include "qemu/sockets.h"
|
||||
#include "qemu/bitmap.h"
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user