From: Glauber Costa <glommer@redhat.com>
To: kvm@vger.kernel.org
Cc: avi@redhat.com
Subject: [PATCH v2 2/3] get rid of vcpu structure
Date: Thu, 15 Oct 2009 13:50:36 -0300 [thread overview]
Message-ID: <1255625437-32395-3-git-send-email-glommer@redhat.com> (raw)
In-Reply-To: <1255625437-32395-2-git-send-email-glommer@redhat.com>
We have no use for it anymore. Only trace of it was in vcpu_create.
Make it disappear.
Signed-off-by: Glauber Costa <glommer@redhat.com>
---
qemu-kvm.c | 11 +++--------
qemu-kvm.h | 5 -----
2 files changed, 3 insertions(+), 13 deletions(-)
diff --git a/qemu-kvm.c b/qemu-kvm.c
index 700d030..7943281 100644
--- a/qemu-kvm.c
+++ b/qemu-kvm.c
@@ -440,16 +440,13 @@ static void kvm_create_vcpu(CPUState *env, int id)
{
long mmap_size;
int r;
- kvm_vcpu_context_t vcpu_ctx = qemu_malloc(sizeof(struct kvm_vcpu_context));
r = kvm_vm_ioctl(kvm_state, KVM_CREATE_VCPU, id);
if (r < 0) {
fprintf(stderr, "kvm_create_vcpu: %m\n");
- goto err;
+ return;
}
- vcpu_ctx->fd = r;
-
env->kvm_fd = r;
env->kvm_state = kvm_state;
@@ -459,7 +456,7 @@ static void kvm_create_vcpu(CPUState *env, int id)
goto err_fd;
}
env->kvm_run =
- mmap(NULL, mmap_size, PROT_READ | PROT_WRITE, MAP_SHARED, vcpu_ctx->fd,
+ mmap(NULL, mmap_size, PROT_READ | PROT_WRITE, MAP_SHARED, env->kvm_fd,
0);
if (env->kvm_run == MAP_FAILED) {
fprintf(stderr, "mmap vcpu area: %m\n");
@@ -468,9 +465,7 @@ static void kvm_create_vcpu(CPUState *env, int id)
return;
err_fd:
- close(vcpu_ctx->fd);
- err:
- free(vcpu_ctx);
+ close(env->kvm_fd);
}
static int kvm_set_boot_vcpu_id(kvm_context_t kvm, uint32_t id)
diff --git a/qemu-kvm.h b/qemu-kvm.h
index abcb98d..588bc80 100644
--- a/qemu-kvm.h
+++ b/qemu-kvm.h
@@ -76,12 +76,7 @@ struct kvm_context {
int max_gsi;
};
-struct kvm_vcpu_context {
- int fd;
-};
-
typedef struct kvm_context *kvm_context_t;
-typedef struct kvm_vcpu_context *kvm_vcpu_context_t;
#include "kvm.h"
int kvm_alloc_kernel_memory(kvm_context_t kvm, unsigned long memory,
--
1.6.2.5
next prev parent reply other threads:[~2009-10-15 16:51 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-15 16:50 [PATCH v2 0/3] get rid of vcpu structure Glauber Costa
2009-10-15 16:50 ` [PATCH v2 1/3] change function signatures so that they don't take a vcpu argument Glauber Costa
2009-10-15 16:50 ` Glauber Costa [this message]
2009-10-15 16:50 ` [PATCH v2 3/3] use upstream kvm_vcpu_ioctl Glauber Costa
2009-10-19 18:09 ` [PATCH v2 0/3] get rid of vcpu structure Marcelo Tosatti
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1255625437-32395-3-git-send-email-glommer@redhat.com \
--to=glommer@redhat.com \
--cc=avi@redhat.com \
--cc=kvm@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox