pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

qemu-nvmm: change the return values



Module Name:	pkgsrc-wip
Committed By:	Maxime Villard <max%m00nbsd.net@localhost>
Pushed By:	maxv
Date:		Fri Oct 25 11:32:34 2019 +0200
Changeset:	f50fabca8eaf618397ac082f6c65278425317f78

Modified Files:
	qemu-nvmm/files/target_i386_nvmm-all.c

Log Message:
qemu-nvmm: change the return values

Use proper errno codes, to get relevant error messages.

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=f50fabca8eaf618397ac082f6c65278425317f78

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 qemu-nvmm/files/target_i386_nvmm-all.c | 29 +++++++++++++++++------------
 1 file changed, 17 insertions(+), 12 deletions(-)

diffs:
diff --git a/qemu-nvmm/files/target_i386_nvmm-all.c b/qemu-nvmm/files/target_i386_nvmm-all.c
index 1b6de9b4ae..e65d63f8fb 100644
--- a/qemu-nvmm/files/target_i386_nvmm-all.c
+++ b/qemu-nvmm/files/target_i386_nvmm-all.c
@@ -888,7 +888,7 @@ nvmm_init_vcpu(CPUState *cpu)
     struct nvmm_vcpu_conf_cpuid cpuid;
     Error *local_error = NULL;
     struct qemu_vcpu *qcpu;
-    int ret;
+    int ret, err;
 
     nvmm_init_cpu_signals();
 
@@ -913,10 +913,11 @@ nvmm_init_vcpu(CPUState *cpu)
 
     ret = nvmm_vcpu_create(mach, cpu->cpu_index, &qcpu->vcpu);
     if (ret == -1) {
+        err = errno;
         error_report("NVMM: Failed to create a virtual processor,"
-            " error=%d", errno);
+            " error=%d", err);
         g_free(qcpu);
-        return -EINVAL;
+        return -err;
     }
 
     memset(&cpuid, 0, sizeof(cpuid));
@@ -926,19 +927,21 @@ nvmm_init_vcpu(CPUState *cpu)
     ret = nvmm_vcpu_configure(mach, &qcpu->vcpu, NVMM_VCPU_CONF_CPUID,
         &cpuid);
     if (ret == -1) {
+        err = errno;
         error_report("NVMM: Failed to configure a virtual processor,"
-            " error=%d", errno);
+            " error=%d", err);
         g_free(qcpu);
-        return -EINVAL;
+        return -err;
     }
 
     ret = nvmm_vcpu_configure(mach, &qcpu->vcpu, NVMM_VCPU_CONF_CALLBACKS,
         &nvmm_callbacks);
     if (ret == -1) {
+        err = errno;
         error_report("NVMM: Failed to configure a virtual processor,"
-            " error=%d", errno);
+            " error=%d", err);
         g_free(qcpu);
-        return -ENOSPC;
+        return -err;
     }
 
     cpu->vcpu_dirty = true;
@@ -1125,26 +1128,28 @@ static int
 nvmm_accel_init(MachineState *ms)
 {
     struct nvmm_capability cap;
-    int ret;
+    int ret, err;
 
     ret = nvmm_capability(&cap);
     if (ret == -1) {
+        err = errno;
         error_report("NVMM: No accelerator found, error=%d", errno);
-        return -ENOSPC;
+        return -err;
     }
     if (cap.version != 1) {
         error_report("NVMM: Unsupported version %lu", cap.version);
-        return -ENOSPC;
+        return -EPROGMISMATCH;
     }
     if (cap.state_size != sizeof(struct nvmm_x64_state)) {
         error_report("NVMM: Wrong state size %zu", cap.state_size);
-        return -ENOSPC;
+        return -EPROGMISMATCH;
     }
 
     ret = nvmm_machine_create(&qemu_mach.mach);
     if (ret == -1) {
+        err = errno;
         error_report("NVMM: Machine creation failed, error=%d", errno);
-        return -ENOSPC;
+        return -err;
     }
 
     memory_listener_register(&nvmm_memory_listener, &address_space_memory);


Home | Main Index | Thread Index | Old Index