* [PATCH] KVM: forward declare structs in kvm_types.h
@ 2014-08-29 12:01 Paolo Bonzini
2014-08-29 12:46 ` Radim Krčmář
2014-08-29 13:06 ` Christian Borntraeger
0 siblings, 2 replies; 4+ messages in thread
From: Paolo Bonzini @ 2014-08-29 12:01 UTC (permalink / raw)
To: linux-kernel, kvm; +Cc: rkrcmar
Opaque KVM structs are useful for prototypes in asm/kvm_host.h, to avoid
"'struct foo' declared inside parameter list" warnings (and consequent
breakage due to conflicting types).
Move them from individual files to a generic place in linux/kvm_types.h.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
arch/arm/include/asm/kvm_host.h | 7 ++-----
arch/arm64/include/asm/kvm_host.h | 6 ++----
arch/ia64/include/asm/kvm_host.h | 3 ---
arch/mips/include/asm/kvm_host.h | 5 -----
arch/powerpc/include/asm/kvm_host.h | 5 -----
arch/s390/include/asm/kvm_host.h | 5 +++--
arch/x86/include/asm/kvm_host.h | 4 ----
include/linux/kvm_types.h | 11 +++++++++++
8 files changed, 18 insertions(+), 28 deletions(-)
diff --git a/arch/arm/include/asm/kvm_host.h b/arch/arm/include/asm/kvm_host.h
index 84291feee9e1..aea259e9431f 100644
--- a/arch/arm/include/asm/kvm_host.h
+++ b/arch/arm/include/asm/kvm_host.h
@@ -19,6 +19,8 @@
#ifndef __ARM_KVM_HOST_H__
#define __ARM_KVM_HOST_H__
+#include <linux/types.h>
+#include <linux/kvm_types.h>
#include <asm/kvm.h>
#include <asm/kvm_asm.h>
#include <asm/kvm_mmio.h>
@@ -40,7 +42,6 @@
#include <kvm/arm_vgic.h>
-struct kvm_vcpu;
u32 *kvm_vcpu_reg(struct kvm_vcpu *vcpu, u8 reg_num, u32 mode);
int kvm_target_cpu(void);
int kvm_reset_vcpu(struct kvm_vcpu *vcpu);
@@ -149,20 +150,17 @@ struct kvm_vcpu_stat {
u32 halt_wakeup;
};
-struct kvm_vcpu_init;
int kvm_vcpu_set_target(struct kvm_vcpu *vcpu,
const struct kvm_vcpu_init *init);
int kvm_vcpu_preferred_target(struct kvm_vcpu_init *init);
unsigned long kvm_arm_num_regs(struct kvm_vcpu *vcpu);
int kvm_arm_copy_reg_indices(struct kvm_vcpu *vcpu, u64 __user *indices);
-struct kvm_one_reg;
int kvm_arm_get_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg);
int kvm_arm_set_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg);
u64 kvm_call_hyp(void *hypfn, ...);
void force_vm_exit(const cpumask_t *mask);
#define KVM_ARCH_WANT_MMU_NOTIFIER
-struct kvm;
int kvm_unmap_hva(struct kvm *kvm, unsigned long hva);
int kvm_unmap_hva_range(struct kvm *kvm,
unsigned long start, unsigned long end);
@@ -187,7 +185,6 @@ struct kvm_vcpu __percpu **kvm_get_running_vcpus(void);
int kvm_arm_copy_coproc_indices(struct kvm_vcpu *vcpu, u64 __user *uindices);
unsigned long kvm_arm_num_coproc_regs(struct kvm_vcpu *vcpu);
-struct kvm_one_reg;
int kvm_arm_coproc_get_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *);
int kvm_arm_coproc_set_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *);
diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h
index 94d8a3c9b644..b5045e3e05f8 100644
--- a/arch/arm64/include/asm/kvm_host.h
+++ b/arch/arm64/include/asm/kvm_host.h
@@ -22,6 +22,8 @@
#ifndef __ARM64_KVM_HOST_H__
#define __ARM64_KVM_HOST_H__
+#include <linux/types.h>
+#include <linux/kvm_types.h>
#include <asm/kvm.h>
#include <asm/kvm_asm.h>
#include <asm/kvm_mmio.h>
@@ -41,7 +43,6 @@
#define KVM_VCPU_MAX_FEATURES 3
-struct kvm_vcpu;
int kvm_target_cpu(void);
int kvm_reset_vcpu(struct kvm_vcpu *vcpu);
int kvm_arch_dev_ioctl_check_extension(long ext);
@@ -164,18 +165,15 @@ struct kvm_vcpu_stat {
u32 halt_wakeup;
};
-struct kvm_vcpu_init;
int kvm_vcpu_set_target(struct kvm_vcpu *vcpu,
const struct kvm_vcpu_init *init);
int kvm_vcpu_preferred_target(struct kvm_vcpu_init *init);
unsigned long kvm_arm_num_regs(struct kvm_vcpu *vcpu);
int kvm_arm_copy_reg_indices(struct kvm_vcpu *vcpu, u64 __user *indices);
-struct kvm_one_reg;
int kvm_arm_get_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg);
int kvm_arm_set_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg);
#define KVM_ARCH_WANT_MMU_NOTIFIER
-struct kvm;
int kvm_unmap_hva(struct kvm *kvm, unsigned long hva);
int kvm_unmap_hva_range(struct kvm *kvm,
unsigned long start, unsigned long end);
diff --git a/arch/ia64/include/asm/kvm_host.h b/arch/ia64/include/asm/kvm_host.h
index 353167d95c66..4729752b7256 100644
--- a/arch/ia64/include/asm/kvm_host.h
+++ b/arch/ia64/include/asm/kvm_host.h
@@ -234,9 +234,6 @@ struct kvm_vm_data {
#define KVM_REQ_PTC_G 32
#define KVM_REQ_RESUME 33
-struct kvm;
-struct kvm_vcpu;
-
struct kvm_mmio_req {
uint64_t addr; /* physical address */
uint64_t size; /* size in bytes */
diff --git a/arch/mips/include/asm/kvm_host.h b/arch/mips/include/asm/kvm_host.h
index b4d900acbdb9..0b24d6622ec1 100644
--- a/arch/mips/include/asm/kvm_host.h
+++ b/arch/mips/include/asm/kvm_host.h
@@ -96,11 +96,6 @@
#define CAUSEB_DC 27
#define CAUSEF_DC (_ULCAST_(1) << 27)
-struct kvm;
-struct kvm_run;
-struct kvm_vcpu;
-struct kvm_interrupt;
-
extern atomic_t kvm_mips_instance;
extern pfn_t(*kvm_mips_gfn_to_pfn) (struct kvm *kvm, gfn_t gfn);
extern void (*kvm_mips_release_pfn_clean) (pfn_t pfn);
diff --git a/arch/powerpc/include/asm/kvm_host.h b/arch/powerpc/include/asm/kvm_host.h
index 0e646c1bff13..237cc0cc80a2 100644
--- a/arch/powerpc/include/asm/kvm_host.h
+++ b/arch/powerpc/include/asm/kvm_host.h
@@ -53,7 +53,6 @@
#define KVM_ARCH_WANT_MMU_NOTIFIER
-struct kvm;
extern int kvm_unmap_hva(struct kvm *kvm, unsigned long hva);
extern int kvm_unmap_hva_range(struct kvm *kvm,
unsigned long start, unsigned long end);
@@ -76,10 +75,6 @@ extern void kvm_set_spte_hva(struct kvm *kvm, unsigned long hva, pte_t pte);
/* Physical Address Mask - allowed range of real mode RAM access */
#define KVM_PAM 0x0fffffffffffffffULL
-struct kvm;
-struct kvm_run;
-struct kvm_vcpu;
-
struct lppaca;
struct slb_shadow;
struct dtl_entry;
diff --git a/arch/s390/include/asm/kvm_host.h b/arch/s390/include/asm/kvm_host.h
index cee2be94e4ae..f6dd90684b97 100644
--- a/arch/s390/include/asm/kvm_host.h
+++ b/arch/s390/include/asm/kvm_host.h
@@ -13,8 +13,11 @@
#ifndef ASM_KVM_HOST_H
#define ASM_KVM_HOST_H
+
+#include <linux/types.h>
#include <linux/hrtimer.h>
#include <linux/interrupt.h>
+#include <linux/kvm_types.h>
#include <linux/kvm_host.h>
#include <linux/kvm.h>
#include <asm/debug.h>
@@ -431,8 +434,6 @@ static inline bool kvm_is_error_hva(unsigned long addr)
}
#define ASYNC_PF_PER_VCPU 64
-struct kvm_vcpu;
-struct kvm_async_pf;
struct kvm_arch_async_pf {
unsigned long pfault_token;
};
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
index ac0f90e26a0b..567fface45f8 100644
--- a/arch/x86/include/asm/kvm_host.h
+++ b/arch/x86/include/asm/kvm_host.h
@@ -99,10 +99,6 @@ static inline gfn_t gfn_to_index(gfn_t gfn, gfn_t base_gfn, int level)
#define ASYNC_PF_PER_VCPU 64
-struct kvm_vcpu;
-struct kvm;
-struct kvm_async_pf;
-
enum kvm_reg {
VCPU_REGS_RAX = 0,
VCPU_REGS_RCX = 1,
diff --git a/include/linux/kvm_types.h b/include/linux/kvm_types.h
index b0bcce0ddc95..1d6daca4927a 100644
--- a/include/linux/kvm_types.h
+++ b/include/linux/kvm_types.h
@@ -17,6 +17,17 @@
#ifndef __KVM_TYPES_H__
#define __KVM_TYPES_H__
+struct kvm;
+struct kvm_async_pf;
+struct kvm_interrupt;
+struct kvm_memory_slot;
+struct kvm_one_reg;
+struct kvm_run;
+struct kvm_userspace_memory_region;
+struct kvm_vcpu;
+struct kvm_vcpu_init;
+enum kvm_mr_change;
+
#include <asm/types.h>
/*
--
1.8.3.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] KVM: forward declare structs in kvm_types.h
2014-08-29 12:01 [PATCH] KVM: forward declare structs in kvm_types.h Paolo Bonzini
@ 2014-08-29 12:46 ` Radim Krčmář
2014-08-29 14:35 ` Paolo Bonzini
2014-08-29 13:06 ` Christian Borntraeger
1 sibling, 1 reply; 4+ messages in thread
From: Radim Krčmář @ 2014-08-29 12:46 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: linux-kernel, kvm
2014-08-29 14:01+0200, Paolo Bonzini:
> Opaque KVM structs are useful for prototypes in asm/kvm_host.h, to avoid
> "'struct foo' declared inside parameter list" warnings (and consequent
> breakage due to conflicting types).
>
> Move them from individual files to a generic place in linux/kvm_types.h.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
Reviewed-by: Radim Krčmář <rkrcmar@redhat.com>
(Inclusion of <linux/types.h> seems to be piggybacking, but is a nice
thing to do :)
And I'd apply these changes: (Definitely the first hunk.)
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index 33d8d0a..e098dce 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -140,8 +140,6 @@ static inline bool is_error_page(struct page *page)
#define KVM_USERSPACE_IRQ_SOURCE_ID 0
#define KVM_IRQFD_RESAMPLE_IRQ_SOURCE_ID 1
-struct kvm;
-struct kvm_vcpu;
extern struct kmem_cache *kvm_vcpu_cache;
extern spinlock_t kvm_lock;
@@ -325,8 +323,6 @@ struct kvm_kernel_irq_routing_entry {
struct hlist_node link;
};
-struct kvm_irq_routing_table;
-
#ifndef KVM_PRIVATE_MEM_SLOTS
#define KVM_PRIVATE_MEM_SLOTS 0
#endif
@@ -1036,8 +1032,6 @@ static inline bool kvm_check_request(int req, struct kvm_vcpu *vcpu)
extern bool kvm_rebooting;
-struct kvm_device_ops;
-
struct kvm_device {
struct kvm_device_ops *ops;
struct kvm *kvm;
diff --git a/include/linux/kvm_types.h b/include/linux/kvm_types.h
index 1d6daca..53c4f20 100644
--- a/include/linux/kvm_types.h
+++ b/include/linux/kvm_types.h
@@ -19,7 +19,9 @@
struct kvm;
struct kvm_async_pf;
+struct kvm_device_ops;
struct kvm_interrupt;
+struct kvm_irq_routing_table;
struct kvm_memory_slot;
struct kvm_one_reg;
struct kvm_run;
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] KVM: forward declare structs in kvm_types.h
2014-08-29 12:01 [PATCH] KVM: forward declare structs in kvm_types.h Paolo Bonzini
2014-08-29 12:46 ` Radim Krčmář
@ 2014-08-29 13:06 ` Christian Borntraeger
1 sibling, 0 replies; 4+ messages in thread
From: Christian Borntraeger @ 2014-08-29 13:06 UTC (permalink / raw)
To: Paolo Bonzini, linux-kernel, kvm; +Cc: rkrcmar
On 29/08/14 14:01, Paolo Bonzini wrote:
> Opaque KVM structs are useful for prototypes in asm/kvm_host.h, to avoid
> "'struct foo' declared inside parameter list" warnings (and consequent
> breakage due to conflicting types).
>
> Move them from individual files to a generic place in linux/kvm_types.h.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
I can confirm that s390 still builds and works.
> ---
> arch/arm/include/asm/kvm_host.h | 7 ++-----
> arch/arm64/include/asm/kvm_host.h | 6 ++----
> arch/ia64/include/asm/kvm_host.h | 3 ---
> arch/mips/include/asm/kvm_host.h | 5 -----
> arch/powerpc/include/asm/kvm_host.h | 5 -----
> arch/s390/include/asm/kvm_host.h | 5 +++--
> arch/x86/include/asm/kvm_host.h | 4 ----
> include/linux/kvm_types.h | 11 +++++++++++
> 8 files changed, 18 insertions(+), 28 deletions(-)
>
> diff --git a/arch/arm/include/asm/kvm_host.h b/arch/arm/include/asm/kvm_host.h
> index 84291feee9e1..aea259e9431f 100644
> --- a/arch/arm/include/asm/kvm_host.h
> +++ b/arch/arm/include/asm/kvm_host.h
> @@ -19,6 +19,8 @@
> #ifndef __ARM_KVM_HOST_H__
> #define __ARM_KVM_HOST_H__
>
> +#include <linux/types.h>
> +#include <linux/kvm_types.h>
> #include <asm/kvm.h>
> #include <asm/kvm_asm.h>
> #include <asm/kvm_mmio.h>
> @@ -40,7 +42,6 @@
>
> #include <kvm/arm_vgic.h>
>
> -struct kvm_vcpu;
> u32 *kvm_vcpu_reg(struct kvm_vcpu *vcpu, u8 reg_num, u32 mode);
> int kvm_target_cpu(void);
> int kvm_reset_vcpu(struct kvm_vcpu *vcpu);
> @@ -149,20 +150,17 @@ struct kvm_vcpu_stat {
> u32 halt_wakeup;
> };
>
> -struct kvm_vcpu_init;
> int kvm_vcpu_set_target(struct kvm_vcpu *vcpu,
> const struct kvm_vcpu_init *init);
> int kvm_vcpu_preferred_target(struct kvm_vcpu_init *init);
> unsigned long kvm_arm_num_regs(struct kvm_vcpu *vcpu);
> int kvm_arm_copy_reg_indices(struct kvm_vcpu *vcpu, u64 __user *indices);
> -struct kvm_one_reg;
> int kvm_arm_get_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg);
> int kvm_arm_set_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg);
> u64 kvm_call_hyp(void *hypfn, ...);
> void force_vm_exit(const cpumask_t *mask);
>
> #define KVM_ARCH_WANT_MMU_NOTIFIER
> -struct kvm;
> int kvm_unmap_hva(struct kvm *kvm, unsigned long hva);
> int kvm_unmap_hva_range(struct kvm *kvm,
> unsigned long start, unsigned long end);
> @@ -187,7 +185,6 @@ struct kvm_vcpu __percpu **kvm_get_running_vcpus(void);
>
> int kvm_arm_copy_coproc_indices(struct kvm_vcpu *vcpu, u64 __user *uindices);
> unsigned long kvm_arm_num_coproc_regs(struct kvm_vcpu *vcpu);
> -struct kvm_one_reg;
> int kvm_arm_coproc_get_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *);
> int kvm_arm_coproc_set_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *);
>
> diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h
> index 94d8a3c9b644..b5045e3e05f8 100644
> --- a/arch/arm64/include/asm/kvm_host.h
> +++ b/arch/arm64/include/asm/kvm_host.h
> @@ -22,6 +22,8 @@
> #ifndef __ARM64_KVM_HOST_H__
> #define __ARM64_KVM_HOST_H__
>
> +#include <linux/types.h>
> +#include <linux/kvm_types.h>
> #include <asm/kvm.h>
> #include <asm/kvm_asm.h>
> #include <asm/kvm_mmio.h>
> @@ -41,7 +43,6 @@
>
> #define KVM_VCPU_MAX_FEATURES 3
>
> -struct kvm_vcpu;
> int kvm_target_cpu(void);
> int kvm_reset_vcpu(struct kvm_vcpu *vcpu);
> int kvm_arch_dev_ioctl_check_extension(long ext);
> @@ -164,18 +165,15 @@ struct kvm_vcpu_stat {
> u32 halt_wakeup;
> };
>
> -struct kvm_vcpu_init;
> int kvm_vcpu_set_target(struct kvm_vcpu *vcpu,
> const struct kvm_vcpu_init *init);
> int kvm_vcpu_preferred_target(struct kvm_vcpu_init *init);
> unsigned long kvm_arm_num_regs(struct kvm_vcpu *vcpu);
> int kvm_arm_copy_reg_indices(struct kvm_vcpu *vcpu, u64 __user *indices);
> -struct kvm_one_reg;
> int kvm_arm_get_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg);
> int kvm_arm_set_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg);
>
> #define KVM_ARCH_WANT_MMU_NOTIFIER
> -struct kvm;
> int kvm_unmap_hva(struct kvm *kvm, unsigned long hva);
> int kvm_unmap_hva_range(struct kvm *kvm,
> unsigned long start, unsigned long end);
> diff --git a/arch/ia64/include/asm/kvm_host.h b/arch/ia64/include/asm/kvm_host.h
> index 353167d95c66..4729752b7256 100644
> --- a/arch/ia64/include/asm/kvm_host.h
> +++ b/arch/ia64/include/asm/kvm_host.h
> @@ -234,9 +234,6 @@ struct kvm_vm_data {
> #define KVM_REQ_PTC_G 32
> #define KVM_REQ_RESUME 33
>
> -struct kvm;
> -struct kvm_vcpu;
> -
> struct kvm_mmio_req {
> uint64_t addr; /* physical address */
> uint64_t size; /* size in bytes */
> diff --git a/arch/mips/include/asm/kvm_host.h b/arch/mips/include/asm/kvm_host.h
> index b4d900acbdb9..0b24d6622ec1 100644
> --- a/arch/mips/include/asm/kvm_host.h
> +++ b/arch/mips/include/asm/kvm_host.h
> @@ -96,11 +96,6 @@
> #define CAUSEB_DC 27
> #define CAUSEF_DC (_ULCAST_(1) << 27)
>
> -struct kvm;
> -struct kvm_run;
> -struct kvm_vcpu;
> -struct kvm_interrupt;
> -
> extern atomic_t kvm_mips_instance;
> extern pfn_t(*kvm_mips_gfn_to_pfn) (struct kvm *kvm, gfn_t gfn);
> extern void (*kvm_mips_release_pfn_clean) (pfn_t pfn);
> diff --git a/arch/powerpc/include/asm/kvm_host.h b/arch/powerpc/include/asm/kvm_host.h
> index 0e646c1bff13..237cc0cc80a2 100644
> --- a/arch/powerpc/include/asm/kvm_host.h
> +++ b/arch/powerpc/include/asm/kvm_host.h
> @@ -53,7 +53,6 @@
>
> #define KVM_ARCH_WANT_MMU_NOTIFIER
>
> -struct kvm;
> extern int kvm_unmap_hva(struct kvm *kvm, unsigned long hva);
> extern int kvm_unmap_hva_range(struct kvm *kvm,
> unsigned long start, unsigned long end);
> @@ -76,10 +75,6 @@ extern void kvm_set_spte_hva(struct kvm *kvm, unsigned long hva, pte_t pte);
> /* Physical Address Mask - allowed range of real mode RAM access */
> #define KVM_PAM 0x0fffffffffffffffULL
>
> -struct kvm;
> -struct kvm_run;
> -struct kvm_vcpu;
> -
> struct lppaca;
> struct slb_shadow;
> struct dtl_entry;
> diff --git a/arch/s390/include/asm/kvm_host.h b/arch/s390/include/asm/kvm_host.h
> index cee2be94e4ae..f6dd90684b97 100644
> --- a/arch/s390/include/asm/kvm_host.h
> +++ b/arch/s390/include/asm/kvm_host.h
> @@ -13,8 +13,11 @@
>
> #ifndef ASM_KVM_HOST_H
> #define ASM_KVM_HOST_H
> +
> +#include <linux/types.h>
> #include <linux/hrtimer.h>
> #include <linux/interrupt.h>
> +#include <linux/kvm_types.h>
> #include <linux/kvm_host.h>
> #include <linux/kvm.h>
> #include <asm/debug.h>
> @@ -431,8 +434,6 @@ static inline bool kvm_is_error_hva(unsigned long addr)
> }
>
> #define ASYNC_PF_PER_VCPU 64
> -struct kvm_vcpu;
> -struct kvm_async_pf;
> struct kvm_arch_async_pf {
> unsigned long pfault_token;
> };
> diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
> index ac0f90e26a0b..567fface45f8 100644
> --- a/arch/x86/include/asm/kvm_host.h
> +++ b/arch/x86/include/asm/kvm_host.h
> @@ -99,10 +99,6 @@ static inline gfn_t gfn_to_index(gfn_t gfn, gfn_t base_gfn, int level)
>
> #define ASYNC_PF_PER_VCPU 64
>
> -struct kvm_vcpu;
> -struct kvm;
> -struct kvm_async_pf;
> -
> enum kvm_reg {
> VCPU_REGS_RAX = 0,
> VCPU_REGS_RCX = 1,
> diff --git a/include/linux/kvm_types.h b/include/linux/kvm_types.h
> index b0bcce0ddc95..1d6daca4927a 100644
> --- a/include/linux/kvm_types.h
> +++ b/include/linux/kvm_types.h
> @@ -17,6 +17,17 @@
> #ifndef __KVM_TYPES_H__
> #define __KVM_TYPES_H__
>
> +struct kvm;
> +struct kvm_async_pf;
> +struct kvm_interrupt;
> +struct kvm_memory_slot;
> +struct kvm_one_reg;
> +struct kvm_run;
> +struct kvm_userspace_memory_region;
> +struct kvm_vcpu;
> +struct kvm_vcpu_init;
> +enum kvm_mr_change;
> +
> #include <asm/types.h>
>
> /*
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] KVM: forward declare structs in kvm_types.h
2014-08-29 12:46 ` Radim Krčmář
@ 2014-08-29 14:35 ` Paolo Bonzini
0 siblings, 0 replies; 4+ messages in thread
From: Paolo Bonzini @ 2014-08-29 14:35 UTC (permalink / raw)
To: Radim Krčmář; +Cc: linux-kernel, kvm
Il 29/08/2014 14:46, Radim Krčmář ha scritto:
> 2014-08-29 14:01+0200, Paolo Bonzini:
>> Opaque KVM structs are useful for prototypes in asm/kvm_host.h, to avoid
>> "'struct foo' declared inside parameter list" warnings (and consequent
>> breakage due to conflicting types).
>>
>> Move them from individual files to a generic place in linux/kvm_types.h.
>>
>> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>> ---
>
> Reviewed-by: Radim Krčmář <rkrcmar@redhat.com>
>
> (Inclusion of <linux/types.h> seems to be piggybacking, but is a nice
> thing to do :)
I just wasn't sure if including linux/kvm_types.h was enough alone.
> And I'd apply these changes: (Definitely the first hunk.)
>
> diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
> index 33d8d0a..e098dce 100644
> --- a/include/linux/kvm_host.h
> +++ b/include/linux/kvm_host.h
> @@ -140,8 +140,6 @@ static inline bool is_error_page(struct page *page)
> #define KVM_USERSPACE_IRQ_SOURCE_ID 0
> #define KVM_IRQFD_RESAMPLE_IRQ_SOURCE_ID 1
>
> -struct kvm;
> -struct kvm_vcpu;
> extern struct kmem_cache *kvm_vcpu_cache;
>
> extern spinlock_t kvm_lock;
> @@ -325,8 +323,6 @@ struct kvm_kernel_irq_routing_entry {
> struct hlist_node link;
> };
>
> -struct kvm_irq_routing_table;
> -
> #ifndef KVM_PRIVATE_MEM_SLOTS
> #define KVM_PRIVATE_MEM_SLOTS 0
> #endif
> @@ -1036,8 +1032,6 @@ static inline bool kvm_check_request(int req, struct kvm_vcpu *vcpu)
>
> extern bool kvm_rebooting;
>
> -struct kvm_device_ops;
> -
> struct kvm_device {
> struct kvm_device_ops *ops;
> struct kvm *kvm;
> diff --git a/include/linux/kvm_types.h b/include/linux/kvm_types.h
> index 1d6daca..53c4f20 100644
> --- a/include/linux/kvm_types.h
> +++ b/include/linux/kvm_types.h
> @@ -19,7 +19,9 @@
>
> struct kvm;
> struct kvm_async_pf;
> +struct kvm_device_ops;
> struct kvm_interrupt;
> +struct kvm_irq_routing_table;
> struct kvm_memory_slot;
> struct kvm_one_reg;
> struct kvm_run;
>
Good idea, thanks.
Paolo
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-08-29 14:35 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-29 12:01 [PATCH] KVM: forward declare structs in kvm_types.h Paolo Bonzini
2014-08-29 12:46 ` Radim Krčmář
2014-08-29 14:35 ` Paolo Bonzini
2014-08-29 13:06 ` Christian Borntraeger
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.