public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* Fix to issues with kvm.h and g++
@ 2008-11-02 22:39 Daniel Godás
  2008-11-06 15:57 ` Avi Kivity
  0 siblings, 1 reply; 6+ messages in thread
From: Daniel Godás @ 2008-11-02 22:39 UTC (permalink / raw)
  To: KVM List

Hello,

I am writing a kvm-based emulation framework in c++. When I included
<linux/kvm.h> I got the following errors:

/usr/include/linux/kvm.h:89: error: 'struct kvm_run::<anonymous
union>::kvm_io' invalid; an anonymous union can only have non-static
data members
/usr/include/linux/kvm.h:230: error: declaration of '__u64
kvm_dirty_log::<anonymous union>::padding'
/usr/include/linux/kvm.h:227: error: conflicts with previous
declaration '__u32 kvm_dirty_log::padding'
/usr/include/linux/kvm.h:89: error: 'struct kvm_run::<anonymous
union>::kvm_io' invalid; an anonymous union can only have non-static
data members
/usr/include/linux/kvm.h:230: error: declaration of '__u64
kvm_dirty_log::<anonymous union>::padding'
/usr/include/linux/kvm.h:227: error: conflicts with previous
declaration '__u32 kvm_dirty_log::padding'

It looks like nobody uses struct kvm_io nor in kernel or user space.
The same happens with the two padding fields. The following patch
fixes the errors:

diff --git a/include/linux/kvm.h b/include/linux/kvm.h
index 44fd7fa..f357d50 100644
--- a/include/linux/kvm.h
+++ b/include/linux/kvm.h
@@ -119,7 +119,7 @@ struct kvm_run {
            __u32 error_code;
        } ex;
        /* KVM_EXIT_IO */
-       struct kvm_io {
+       struct {
 #define KVM_EXIT_IO_IN  0
 #define KVM_EXIT_IO_OUT 1
            __u8 direction;
@@ -238,10 +238,10 @@ struct kvm_debug_guest {
 /* for KVM_GET_DIRTY_LOG */
 struct kvm_dirty_log {
    __u32 slot;
-   __u32 padding;
+   __u32 padding1;
    union {
        void __user *dirty_bitmap; /* one bit per page */
-       __u64 padding;
+       __u64 padding2;
    };
 };


Cheers,
Daniel

^ permalink raw reply related	[flat|nested] 6+ messages in thread
* Re: Fix to issues with kvm.h and g++
@ 2009-03-18  4:23 nathan binkert
  2009-03-18  8:49 ` Avi Kivity
  0 siblings, 1 reply; 6+ messages in thread
From: nathan binkert @ 2009-03-18  4:23 UTC (permalink / raw)
  To: kvm

I'm having trouble compiling C++ code that #includes <linux/kvm.h>.
There was a patch several months back and a request for an update to
that patch, though the latest kernels still do not seem to work
correctly.  Is this something that is on anyone's radar?

http://www.mail-archive.com/kvm@vger.kernel.org/msg06423.html


Thanks,

  Nate Binkert

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-03-19  9:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-02 22:39 Fix to issues with kvm.h and g++ Daniel Godás
2008-11-06 15:57 ` Avi Kivity
  -- strict thread matches above, loose matches on Subject: below --
2009-03-18  4:23 nathan binkert
2009-03-18  8:49 ` Avi Kivity
2009-03-18 20:19   ` nathan binkert
2009-03-19  9:48     ` Avi Kivity

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox