All of lore.kernel.org
 help / color / mirror / Atom feed
* 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

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

nathan binkert wrote:
> 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
>   

There was no followup so the issue was dropped.  If you send a patch 
I'll apply it.

-- 
error compiling committee.c: too many arguments to function


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

* Re: Fix to issues with kvm.h and g++
  2009-03-18  8:49 ` Avi Kivity
@ 2009-03-18 20:19   ` nathan binkert
  2009-03-19  9:48     ` Avi Kivity
  0 siblings, 1 reply; 6+ messages in thread
From: nathan binkert @ 2009-03-18 20:19 UTC (permalink / raw)
  To: Avi Kivity; +Cc: kvm

>> http://www.mail-archive.com/kvm@vger.kernel.org/msg06423.html
>>
>
> There was no followup so the issue was dropped.  If you send a patch I'll
> apply it.
The OP's patch is correct.  I grepped all of kvm-84 and the only
instance of kvm_io is that one that is removed in the diff.  That
said, if you'd still prefer it moved outside, I can send a new patch.
How does one obtain a "signoff"

The changelog entry can be:

KVM: Make kvm header compile under g++.
Two things needed fixing: 1) g++ does not allow a named structure type
within an anonymous union and 2) Avoid name clash between two padding
fields within the same struct by giving them different names as is
done elsewhere in the header.


Thanks,
  Nate

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

* Re: Fix to issues with kvm.h and g++
  2009-03-18 20:19   ` nathan binkert
@ 2009-03-19  9:48     ` Avi Kivity
  0 siblings, 0 replies; 6+ messages in thread
From: Avi Kivity @ 2009-03-19  9:48 UTC (permalink / raw)
  To: nathan binkert; +Cc: kvm

nathan binkert wrote:
>> There was no followup so the issue was dropped.  If you send a patch I'll
>> apply it.
>>     
> The OP's patch is correct.  I grepped all of kvm-84 and the only
> instance of kvm_io is that one that is removed in the diff.  That
> said, if you'd still prefer it moved outside, I can send a new patch.
> How does one obtain a "signoff"
>
>   

See http://lxr.linux.no/linux/Documentation/SubmittingPatches, chapter 
12.  The entire document is recommended reading.

-- 
error compiling committee.c: too many arguments to function


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

* Re: 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, 0 replies; 6+ messages in thread
From: Avi Kivity @ 2008-11-06 15:57 UTC (permalink / raw)
  To: Daniel Godás; +Cc: KVM List

Daniel Godás wrote:
> 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.
>   

Please move it outside the outer structure, just in case.

> The same happens with the two padding fields. The following patch
> fixes the errors:
>
>   

And resend with a signoff and changelog entry.


-- 
error compiling committee.c: too many arguments to function


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

* 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

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 --
2009-03-18  4:23 Fix to issues with kvm.h and g++ nathan binkert
2009-03-18  8:49 ` Avi Kivity
2009-03-18 20:19   ` nathan binkert
2009-03-19  9:48     ` Avi Kivity
  -- strict thread matches above, loose matches on Subject: below --
2008-11-02 22:39 Daniel Godás
2008-11-06 15:57 ` Avi Kivity

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.