From da3dc5a3827919108d458243c06407adb3645ec4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1n=20Tomko?= Date: Tue, 15 Jan 2019 10:51:51 +0100 Subject: [PATCH] qemu_conf: split out virQEMUDriverConfigLoadSPICEEntry MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Split out parts of the config parsing code to make the parent function easier to read. Signed-off-by: Ján Tomko Reviewed-by: John Ferlan --- src/qemu/qemu_conf.c | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index e5700f0f25..0b69938e28 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -423,6 +423,29 @@ virQEMUDriverConfigHugeTLBFSInit(virHugeTLBFSPtr hugetlbfs, } +static int +virQEMUDriverConfigLoadSPICEEntry(virQEMUDriverConfigPtr cfg, + virConfPtr conf) +{ + if (virConfGetValueBool(conf, "spice_tls", &cfg->spiceTLS) < 0) + return -1; + if (virConfGetValueString(conf, "spice_tls_x509_cert_dir", &cfg->spiceTLSx509certdir) < 0) + return -1; + if (virConfGetValueBool(conf, "spice_sasl", &cfg->spiceSASL) < 0) + return -1; + if (virConfGetValueString(conf, "spice_sasl_dir", &cfg->spiceSASLdir) < 0) + return -1; + if (virConfGetValueString(conf, "spice_listen", &cfg->spiceListen) < 0) + return -1; + if (virConfGetValueString(conf, "spice_password", &cfg->spicePassword) < 0) + return -1; + if (virConfGetValueBool(conf, "spice_auto_unix_socket", &cfg->spiceAutoUnixSocket) < 0) + return -1; + + return 0; +} + + static int virQEMUDriverConfigLoadSpecificTLSEntry(virQEMUDriverConfigPtr cfg, virConfPtr conf) @@ -993,20 +1016,7 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr cfg, if (virConfGetValueBool(conf, "nographics_allow_host_audio", &cfg->nogfxAllowHostAudio) < 0) goto cleanup; - - if (virConfGetValueBool(conf, "spice_tls", &cfg->spiceTLS) < 0) - goto cleanup; - if (virConfGetValueString(conf, "spice_tls_x509_cert_dir", &cfg->spiceTLSx509certdir) < 0) - goto cleanup; - if (virConfGetValueBool(conf, "spice_sasl", &cfg->spiceSASL) < 0) - goto cleanup; - if (virConfGetValueString(conf, "spice_sasl_dir", &cfg->spiceSASLdir) < 0) - goto cleanup; - if (virConfGetValueString(conf, "spice_listen", &cfg->spiceListen) < 0) - goto cleanup; - if (virConfGetValueString(conf, "spice_password", &cfg->spicePassword) < 0) - goto cleanup; - if (virConfGetValueBool(conf, "spice_auto_unix_socket", &cfg->spiceAutoUnixSocket) < 0) + if (virQEMUDriverConfigLoadSPICEEntry(cfg, conf) < 0) goto cleanup; if (virQEMUDriverConfigLoadSpecificTLSEntry(cfg, conf) < 0)