Jerone Young wrote: > # HG changeset patch > # User Jerone Young <[EMAIL PROTECTED]> > # Date 1193618330 18000 > # Node ID 8bf5e4e6a4c9d2dab89062a0ab24a2ae5d144a02 > # Parent 3bf072e498768885ab96b7ccb668b61c96db0e83 > Move kvm_context structure to kvmctl.h header > > This patch moves the kvm_context sturcture declaration to the kvmctl.h > header. This way other files are able to identify variables associated > with the structure. Also moved are definitions MAX_VCPU & > KVM_MAX_NUM_MEM_REGIONS to the kvmctl-x86.h since these are arch specific. >
I think just moving the declaration of kvm_context to an x86 specific file is the wrong direction to take. I think a better first step would be to split up the architecture specific portions of kvm_context into an architecture specific structure and then have the common kvm_context be a part of the architecture specific structure (just like is done in the kernel code). Regards, Anthony Liguori > Signed-off-by: Jerone Young <[EMAIL PROTECTED]> > > diff --git a/user/kvmctl-x86.h b/user/kvmctl-x86.h > --- a/user/kvmctl-x86.h > +++ b/user/kvmctl-x86.h > @@ -1,5 +1,8 @@ > #ifndef KVMCTL_X86_H > #define KVMCTL_X86_H > + > +#define KVM_MAX_NUM_MEM_REGIONS 8u > +#define MAX_VCPUS 4 > > /*! > * \brief KVM callbacks structure > diff --git a/user/kvmctl.c b/user/kvmctl.c > --- a/user/kvmctl.c > +++ b/user/kvmctl.c > @@ -44,36 +44,8 @@ static int kvm_abi = EXPECTED_KVM_API_VE > > /* FIXME: share this number with kvm */ > /* FIXME: or dynamically alloc/realloc regions */ > -#define KVM_MAX_NUM_MEM_REGIONS 8u > int free_slots[KVM_MAX_NUM_MEM_REGIONS]; > unsigned long phys_addr_slots[KVM_MAX_NUM_MEM_REGIONS]; > -#define MAX_VCPUS 4 > - > -/** > - * \brief The KVM context > - * > - * The verbose KVM context > - */ > -struct kvm_context { > - /// Filedescriptor to /dev/kvm > - int fd; > - int vm_fd; > - int vcpu_fd[MAX_VCPUS]; > - struct kvm_run *run[MAX_VCPUS]; > - /// Callbacks that KVM uses to emulate various unvirtualizable > functionality > - struct kvm_callbacks *callbacks; > - void *opaque; > - /// A pointer to the memory used as the physical memory for the guest > - void *physical_memory; > - /// is dirty pages logging enabled for all regions or not > - int dirty_pages_log_all; > - /// memory regions parameters > - struct kvm_memory_region mem_regions[KVM_MAX_NUM_MEM_REGIONS]; > - /// do not create in-kernel irqchip if set > - int no_irqchip_creation; > - /// in-kernel irqchip status > - int irqchip_in_kernel; > -}; > > static void init_slots() > { > diff --git a/user/kvmctl.h b/user/kvmctl.h > --- a/user/kvmctl.h > +++ b/user/kvmctl.h > @@ -31,6 +31,36 @@ typedef struct kvm_context *kvm_context_ > #if defined(__x86_64__) || defined(__i386__) > #include "kvmctl-x86.h" > #endif > + > + > +/** > + * \brief The KVM context > + * > + * The verbose KVM context > + */ > + > +struct kvm_context { > + /// Filedescriptor to /dev/kvm > + int fd; > + int vm_fd; > + int vcpu_fd[MAX_VCPUS]; > + struct kvm_run *run[MAX_VCPUS]; > + /// Callbacks that KVM uses to emulate various unvirtualizable > functionality > + struct kvm_callbacks *callbacks; > + void *opaque; > + /// A pointer to the memory used as the physical memory for the guest > + void *physical_memory; > + /// is dirty pages logging enabled for all regions or not > + int dirty_pages_log_all; > + /// memory regions parameters > + struct kvm_memory_region mem_regions[KVM_MAX_NUM_MEM_REGIONS]; > + /// do not create in-kernel irqchip if set > + int no_irqchip_creation; > + /// in-kernel irqchip status > + int irqchip_in_kernel; > +}; > + > + > > /*! > * \brief Create new KVM context > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > kvm-devel mailing list > kvm-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/kvm-devel > > ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ kvm-devel mailing list kvm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kvm-devel