Skip to content

Commit

Permalink
Merge tag 'pull-qapi-2022-10-25-v2' of https://repo.or.cz/qemu/armbru
Browse files Browse the repository at this point in the history
…into staging

QAPI patches patches for 2022-10-25

# -----BEGIN PGP SIGNATURE-----
#
# iQJGBAABCAAwFiEENUvIs9frKmtoZ05fOHC0AOuRhlMFAmNZeKcSHGFybWJydUBy
# ZWRoYXQuY29tAAoJEDhwtADrkYZTRc8QAKBbAOsqpFfVuYZoZtbvEIIE+E4chUjr
# ANTVIGXN2wNMVEpNtoXDOPrgMJBo9UGozKO703C55DF9WL2M6q25ZZ94Q8JQGjFx
# Cchpa0bnOtZ7v4uM0g5Z2OdeQCrZT961MOTLE8WfW7RgCo13NvSVPhAhRGj6LmUf
# 7VX2W4YH/LOXPGjkAwZxH1J0N+YPcx4EzgJ+Df01NSQ3yvYkMmBXZV1v+o3N2q0/
# wxJEB5rizs3bet0jJPoHRzu6eiTt47YpaGCEkqO0J1yUeog1dSXOws/gBQX7Ftjf
# /cn5POmQDHvzvtx/PzxDiQxpHzvnNwIGxcfOA51iPb3AH1iJM6aVHuIVo+YHuMIZ
# yHM/kUAEcjuRriltmgLXity5qer8MMINvt1U1NLYnCTX/bq42CE8GSO21+ilzEL4
# Of+NRjuXpAST83ojLbt43EXh8E5aiPC0iRqINA8Jub9bWAmStoziWh4+zROnPVcU
# 3nvA6mx9U/YRhMpUi2378bd97nyFE+32cdflU6C+6bV9kOhKuiad2pd3N4izwAzo
# 6+B+arccxhO8ocA1jZXo8CBUA1VeKJQiRGo4Rk0Ku6IL1MlJFNoef6faa4Ko6rAV
# tDs98h8kegvIAAeVMkLolF+/C5Pqx8vlRhB0x0l8NkUQ1AWiGDmOEq+mW3MKTQ44
# k8FRjGv9heiN
# =YTU5
# -----END PGP SIGNATURE-----
# gpg: Signature made Wed 26 Oct 2022 14:12:55 EDT
# gpg:                using RSA key 354BC8B3D7EB2A6B68674E5F3870B400EB918653
# gpg:                issuer "armbru@redhat.com"
# gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" [full]
# gpg:                 aka "Markus Armbruster <armbru@pond.sub.org>" [full]
# Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867  4E5F 3870 B400 EB91 8653

* tag 'pull-qapi-2022-10-25-v2' of https://repo.or.cz/qemu/armbru: (28 commits)
  qapi: Drop temporary logic to support conversion step by step
  qapi qga: Elide redundant has_FOO in generated C
  qapi virtio: Elide redundant has_FOO in generated C
  qapi ui: Elide redundant has_FOO in generated C
  qapi transaction: Elide redundant has_FOO in generated C
  qapi tpm: Elide redundant has_FOO in generated C
  qapi stats: Elide redundant has_FOO in generated C
  qapi run-state: Elide redundant has_FOO in generated C
  qapi rocker: Elide redundant has_FOO in generated C
  qapi replay: Elide redundant has_FOO in generated C
  qapi qdev qom: Elide redundant has_FOO in generated C
  qapi pci: Elide redundant has_FOO in generated C
  qapi net: Elide redundant has_FOO in generated C
  qapi misc: Elide redundant has_FOO in generated C
  qapi migration: Elide redundant has_FOO in generated C
  qapi machine: Elide redundant has_FOO in generated C
  qapi job: Elide redundant has_FOO in generated C
  qapi dump: Elide redundant has_FOO in generated C
  qapi crypto: Elide redundant has_FOO in generated C
  qapi chardev: Elide redundant has_FOO in generated C
  ...

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
  • Loading branch information
stefanhaRH committed Oct 27, 2022
2 parents d0d8d57 + c0f24f8 commit 807d7b1
Show file tree
Hide file tree
Showing 102 changed files with 471 additions and 721 deletions.
2 changes: 1 addition & 1 deletion audio/alsaaudio.c
Expand Up @@ -449,7 +449,7 @@ static int alsa_open(bool in, struct alsa_params_req *req,
snd_pcm_hw_params_t *hw_params;
int err;
unsigned int freq, nchannels;
const char *pcm_name = apdo->has_dev ? apdo->dev : "default";
const char *pcm_name = apdo->dev ?: "default";
snd_pcm_uframes_t obt_buffer_size;
const char *typ = in ? "ADC" : "DAC";
snd_pcm_format_t obtfmt;
Expand Down
6 changes: 2 additions & 4 deletions audio/audio.c
Expand Up @@ -2031,15 +2031,13 @@ void audio_create_pdos(Audiodev *dev)
switch (dev->driver) {
#define CASE(DRIVER, driver, pdo_name) \
case AUDIODEV_DRIVER_##DRIVER: \
if (!dev->u.driver.has_in) { \
if (!dev->u.driver.in) { \
dev->u.driver.in = g_malloc0( \
sizeof(Audiodev##pdo_name##PerDirectionOptions)); \
dev->u.driver.has_in = true; \
} \
if (!dev->u.driver.has_out) { \
if (!dev->u.driver.out) { \
dev->u.driver.out = g_malloc0( \
sizeof(Audiodev##pdo_name##PerDirectionOptions)); \
dev->u.driver.has_out = true; \
} \
break

Expand Down
17 changes: 7 additions & 10 deletions audio/audio_legacy.c
Expand Up @@ -62,15 +62,12 @@ static void get_int(const char *env, uint32_t *dst, bool *has_dst)
}
}

static void get_str(const char *env, char **dst, bool *has_dst)
static void get_str(const char *env, char **dst)
{
const char *val = getenv(env);
if (val) {
if (*has_dst) {
g_free(*dst);
}
g_free(*dst);
*dst = g_strdup(val);
*has_dst = true;
}
}

Expand Down Expand Up @@ -169,7 +166,7 @@ static void handle_alsa_per_direction(
get_bool(buf, &apdo->try_poll, &apdo->has_try_poll);

strcpy(buf + len, "DEV");
get_str(buf, &apdo->dev, &apdo->has_dev);
get_str(buf, &apdo->dev);

strcpy(buf + len, "SIZE_IN_USEC");
get_bool(buf, &size_in_usecs, &dummy);
Expand Down Expand Up @@ -235,7 +232,7 @@ static void handle_oss_per_direction(
const char *dev_env)
{
get_bool(try_poll_env, &opdo->try_poll, &opdo->has_try_poll);
get_str(dev_env, &opdo->dev, &opdo->has_dev);
get_str(dev_env, &opdo->dev);

get_bytes_to_usecs("QEMU_OSS_FRAGSIZE",
&opdo->buffer_length, &opdo->has_buffer_length,
Expand All @@ -261,7 +258,7 @@ static void handle_oss(Audiodev *dev)
static void handle_pa_per_direction(
AudiodevPaPerDirectionOptions *ppdo, const char *env)
{
get_str(env, &ppdo->name, &ppdo->has_name);
get_str(env, &ppdo->name);
}

static void handle_pa(Audiodev *dev)
Expand All @@ -278,7 +275,7 @@ static void handle_pa(Audiodev *dev)
&dev->u.pa.out->has_buffer_length,
qapi_AudiodevPaPerDirectionOptions_base(dev->u.pa.out));

get_str("QEMU_PA_SERVER", &dev->u.pa.server, &dev->u.pa.has_server);
get_str("QEMU_PA_SERVER", &dev->u.pa.server);
}

/* SDL */
Expand All @@ -299,7 +296,7 @@ static void handle_wav(Audiodev *dev)
&dev->u.wav.out->has_format);
get_int("QEMU_WAV_DAC_FIXED_CHANNELS",
&dev->u.wav.out->channels, &dev->u.wav.out->has_channels);
get_str("QEMU_WAV_PATH", &dev->u.wav.path, &dev->u.wav.has_path);
get_str("QEMU_WAV_PATH", &dev->u.wav.path);
}

/* general */
Expand Down
8 changes: 3 additions & 5 deletions audio/ossaudio.c
Expand Up @@ -252,7 +252,7 @@ static int oss_open(int in, struct oss_params *req, audsettings *as,
audio_buf_info abinfo;
int fmt, freq, nchannels;
int setfragment = 1;
const char *dspname = opdo->has_dev ? opdo->dev : "/dev/dsp";
const char *dspname = opdo->dev ?: "/dev/dsp";
const char *typ = in ? "ADC" : "DAC";
#ifdef USE_DSP_POLICY
int policy = oopts->has_dsp_policy ? oopts->dsp_policy : 5;
Expand Down Expand Up @@ -745,10 +745,8 @@ static void *oss_audio_init(Audiodev *dev)
oss_init_per_direction(oopts->in);
oss_init_per_direction(oopts->out);

if (access(oopts->in->has_dev ? oopts->in->dev : "/dev/dsp",
R_OK | W_OK) < 0 ||
access(oopts->out->has_dev ? oopts->out->dev : "/dev/dsp",
R_OK | W_OK) < 0) {
if (access(oopts->in->dev ?: "/dev/dsp", R_OK | W_OK) < 0 ||
access(oopts->out->dev ?: "/dev/dsp", R_OK | W_OK) < 0) {
return NULL;
}
return dev;
Expand Down
12 changes: 6 additions & 6 deletions audio/paaudio.c
Expand Up @@ -536,9 +536,9 @@ static int qpa_init_out(HWVoiceOut *hw, struct audsettings *as,

pa->stream = qpa_simple_new (
c,
ppdo->has_stream_name ? ppdo->stream_name : g->dev->id,
ppdo->stream_name ?: g->dev->id,
PA_STREAM_PLAYBACK,
ppdo->has_name ? ppdo->name : NULL,
ppdo->name,
&ss,
&ba, /* buffering attributes */
&error
Expand Down Expand Up @@ -585,9 +585,9 @@ static int qpa_init_in(HWVoiceIn *hw, struct audsettings *as, void *drv_opaque)

pa->stream = qpa_simple_new (
c,
ppdo->has_stream_name ? ppdo->stream_name : g->dev->id,
ppdo->stream_name ?: g->dev->id,
PA_STREAM_RECORD,
ppdo->has_name ? ppdo->name : NULL,
ppdo->name,
&ss,
&ba, /* buffering attributes */
&error
Expand Down Expand Up @@ -827,7 +827,7 @@ static void *qpa_audio_init(Audiodev *dev)

assert(dev->driver == AUDIODEV_DRIVER_PA);

if (!popts->has_server) {
if (!popts->server) {
char pidfile[64];
char *runtime;
struct stat st;
Expand All @@ -850,7 +850,7 @@ static void *qpa_audio_init(Audiodev *dev)
}

g = g_new0(paaudio, 1);
server = popts->has_server ? popts->server : NULL;
server = popts->server;

g->dev = dev;

Expand Down
2 changes: 1 addition & 1 deletion audio/wavaudio.c
Expand Up @@ -78,7 +78,7 @@ static int wav_init_out(HWVoiceOut *hw, struct audsettings *as,
Audiodev *dev = drv_opaque;
AudiodevWavOptions *wopts = &dev->u.wav;
struct audsettings wav_as = audiodev_to_audsettings(dev->u.wav.out);
const char *wav_path = wopts->has_path ? wopts->path : "qemu.wav";
const char *wav_path = wopts->path ?: "qemu.wav";

stereo = wav_as.nchannels == 2;
switch (wav_as.fmt) {
Expand Down
2 changes: 0 additions & 2 deletions backends/tpm/tpm_passthrough.c
Expand Up @@ -259,12 +259,10 @@ tpm_passthrough_handle_device_opts(TPMPassthruState *tpm_pt, QemuOpts *opts)
value = qemu_opt_get(opts, "cancel-path");
if (value) {
tpm_pt->options->cancel_path = g_strdup(value);
tpm_pt->options->has_cancel_path = true;
}

value = qemu_opt_get(opts, "path");
if (value) {
tpm_pt->options->has_path = true;
tpm_pt->options->path = g_strdup(value);
}

Expand Down
2 changes: 1 addition & 1 deletion block/block-backend.c
Expand Up @@ -1861,7 +1861,7 @@ static void send_qmp_error_event(BlockBackend *blk,
BlockDriverState *bs = blk_bs(blk);

optype = is_read ? IO_OPERATION_TYPE_READ : IO_OPERATION_TYPE_WRITE;
qapi_event_send_block_io_error(blk_name(blk), !!bs,
qapi_event_send_block_io_error(blk_name(blk),
bs ? bdrv_get_node_name(bs) : NULL, optype,
action, blk_iostatus_is_enabled(blk),
error == ENOSPC, strerror(error));
Expand Down
2 changes: 1 addition & 1 deletion block/copy-before-write.c
Expand Up @@ -433,7 +433,7 @@ static int cbw_open(BlockDriverState *bs, QDict *options, int flags,
return -EINVAL;
}

if (opts->has_bitmap) {
if (opts->bitmap) {
bitmap = block_dirty_bitmap_lookup(opts->bitmap->node,
opts->bitmap->name, NULL, errp);
if (!bitmap) {
Expand Down
1 change: 0 additions & 1 deletion block/dirty-bitmap.c
Expand Up @@ -541,7 +541,6 @@ BlockDirtyInfoList *bdrv_query_dirty_bitmaps(BlockDriverState *bs)

info->count = bdrv_get_dirty_count(bm);
info->granularity = bdrv_dirty_bitmap_granularity(bm);
info->has_name = !!bm->name;
info->name = g_strdup(bm->name);
info->recording = bdrv_dirty_bitmap_recording(bm);
info->busy = bdrv_dirty_bitmap_busy(bm);
Expand Down
2 changes: 1 addition & 1 deletion block/export/export.c
Expand Up @@ -114,7 +114,7 @@ BlockExport *blk_exp_add(BlockExportOptions *export, Error **errp)
ctx = bdrv_get_aio_context(bs);
aio_context_acquire(ctx);

if (export->has_iothread) {
if (export->iothread) {
IOThread *iothread;
AioContext *new_ctx;
Error **set_context_errp;
Expand Down
3 changes: 1 addition & 2 deletions block/export/vduse-blk.c
Expand Up @@ -265,8 +265,7 @@ static int vduse_blk_exp_create(BlockExport *exp, BlockExportOptions *opts,
}
vblk_exp->num_queues = num_queues;
vblk_exp->handler.blk = exp->blk;
vblk_exp->handler.serial = g_strdup(vblk_opts->has_serial ?
vblk_opts->serial : "");
vblk_exp->handler.serial = g_strdup(vblk_opts->serial ?: "");
vblk_exp->handler.logical_block_size = logical_block_size;
vblk_exp->handler.writable = opts->writable;

Expand Down
3 changes: 0 additions & 3 deletions block/gluster.c
Expand Up @@ -830,7 +830,6 @@ static int qemu_gluster_open(BlockDriverState *bs, QDict *options,
s->logfile = g_strdup(logfile ? logfile : GLUSTER_LOGFILE_DEFAULT);

gconf->logfile = g_strdup(s->logfile);
gconf->has_logfile = true;

s->glfs = qemu_gluster_init(gconf, filename, options, errp);
if (!s->glfs) {
Expand Down Expand Up @@ -917,7 +916,6 @@ static int qemu_gluster_reopen_prepare(BDRVReopenState *state,
gconf->debug = s->debug;
gconf->has_debug = true;
gconf->logfile = g_strdup(s->logfile);
gconf->has_logfile = true;

/*
* If 'state->bs->exact_filename' is empty, 'state->options' should contain
Expand Down Expand Up @@ -1162,7 +1160,6 @@ static int coroutine_fn qemu_gluster_co_create_opts(BlockDriver *drv,
if (!gconf->logfile) {
gconf->logfile = g_strdup(GLUSTER_LOGFILE_DEFAULT);
}
gconf->has_logfile = true;

ret = qemu_gluster_parse(gconf, filename, NULL, errp);
if (ret < 0) {
Expand Down

0 comments on commit 807d7b1

Please sign in to comment.