[libvirt] [PATCH] Fix remote_protocol header for Solaris

# HG changeset patch # User john.levon@sun.com # Date 1229367889 28800 # Node ID 46a487775d4b35c32455a5ca8eb3009d10a02c5b # Parent a1f24e9f8a1fbf191c71172ae986110b7e98fc32 Fix remote_protocol header for Solaris quad_t is not a portable type, but rather than force rpcgen every build, we just patch in the fixes needed. Signed-off-by: John Levon <john.levon@sun.com> diff --git a/qemud/Makefile.am b/qemud/Makefile.am --- a/qemud/Makefile.am +++ b/qemud/Makefile.am @@ -47,6 +47,7 @@ if GLIBC_RPCGEN chmod 444 $@-t mv $@-t $@ endif + patch < rpcgen-solaris.diff endif remote_protocol.c: remote_protocol.h diff --git a/qemud/rpcgen-solaris.diff b/qemud/rpcgen-solaris.diff new file mode 100644 --- /dev/null +++ b/qemud/rpcgen-solaris.diff @@ -0,0 +1,19 @@ +diff ./remote_protocol.h ./remote_protocol.h +--- ./remote_protocol.h ++++ ./remote_protocol.h +@@ -11,6 +11,15 @@ + + #ifdef __cplusplus + extern "C" { ++#endif ++ ++#if defined(__sun) ++#include <rpc/xdr.h> ++#define u_quad_t uint64_t ++#define quad_t int64_t ++#define xdr_u_quad_t xdr_uint64_t ++#define xdr_quad_t xdr_int64_t ++#define IXDR_GET_LONG IXDR_GET_INT32 + #endif + + #include <config.h>

On Mon, Dec 15, 2008 at 11:05:10AM -0800, john.levon@sun.com wrote:
Fix remote_protocol header for Solaris
quad_t is not a portable type, but rather than force rpcgen every build, we just patch in the fixes needed.
If this is OK, can someone regenerate the [ch] files and check that in too? thanks john

On Mon, Dec 15, 2008 at 11:05:10AM -0800, john.levon@sun.com wrote:
++ ++#if defined(__sun) ++#include <rpc/xdr.h> ++#define u_quad_t uint64_t ++#define quad_t int64_t ++#define xdr_u_quad_t xdr_uint64_t ++#define xdr_quad_t xdr_int64_t ++#define IXDR_GET_LONG IXDR_GET_INT32
The Linux xdr.h seems to have both sets of definitions in all these cases, so I think we can just make rpcgen_fix.pl do this subsitution for us. Interestingly, it is already doing s/PUT_LONG/PUT_INT32/ because of broken PUT_LONG on Linux. Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

On Mon, Dec 15, 2008 at 09:55:19PM +0000, Daniel P. Berrange wrote:
On Mon, Dec 15, 2008 at 11:05:10AM -0800, john.levon@sun.com wrote:
++ ++#if defined(__sun) ++#include <rpc/xdr.h> ++#define u_quad_t uint64_t ++#define quad_t int64_t ++#define xdr_u_quad_t xdr_uint64_t ++#define xdr_quad_t xdr_int64_t ++#define IXDR_GET_LONG IXDR_GET_INT32
The Linux xdr.h seems to have both sets of definitions in all these cases, so I think we can just make rpcgen_fix.pl do this subsitution for us. Interestingly, it is already doing s/PUT_LONG/PUT_INT32/ because of broken PUT_LONG on Linux.
FYI PortableXDR's output doesn't need these macros at all. Sun's rpcgen was making some strange micro-optimization based (it appears) on the size of the structure. If the size of the struct was over some watermark, it would attempt to inline lots of code. You can see what I mean by comparing the output of these two commands: echo 'struct foo { int i0; int i1; int i2; };' | rpcgen -c - echo 'struct foo { int i0; int i1; int i2; int i3; };' | rpcgen -c - In PortableXDR I decided to leave inlining decisions to gcc. Rich. -- Richard Jones, Emerging Technologies, Red Hat http://et.redhat.com/~rjones virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://et.redhat.com/~rjones/virt-top

On Mon, Jan 12, 2009 at 06:29:38PM +0000, Richard W.M. Jones wrote:
On Mon, Dec 15, 2008 at 09:55:19PM +0000, Daniel P. Berrange wrote:
On Mon, Dec 15, 2008 at 11:05:10AM -0800, john.levon@sun.com wrote:
++ ++#if defined(__sun) ++#include <rpc/xdr.h> ++#define u_quad_t uint64_t ++#define quad_t int64_t ++#define xdr_u_quad_t xdr_uint64_t ++#define xdr_quad_t xdr_int64_t ++#define IXDR_GET_LONG IXDR_GET_INT32
The Linux xdr.h seems to have both sets of definitions in all these cases, so I think we can just make rpcgen_fix.pl do this subsitution for us. Interestingly, it is already doing s/PUT_LONG/PUT_INT32/ because of broken PUT_LONG on Linux.
FYI PortableXDR's output doesn't need these macros at all.
Will still need to the s/quad/int64/ replacement here too Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

On Mon, Jan 12, 2009 at 07:59:44PM +0000, Daniel P. Berrange wrote:
On Mon, Jan 12, 2009 at 06:29:38PM +0000, Richard W.M. Jones wrote:
On Mon, Dec 15, 2008 at 09:55:19PM +0000, Daniel P. Berrange wrote:
On Mon, Dec 15, 2008 at 11:05:10AM -0800, john.levon@sun.com wrote:
++ ++#if defined(__sun) ++#include <rpc/xdr.h> ++#define u_quad_t uint64_t ++#define quad_t int64_t ++#define xdr_u_quad_t xdr_uint64_t ++#define xdr_quad_t xdr_int64_t ++#define IXDR_GET_LONG IXDR_GET_INT32
The Linux xdr.h seems to have both sets of definitions in all these cases, so I think we can just make rpcgen_fix.pl do this subsitution for us. Interestingly, it is already doing s/PUT_LONG/PUT_INT32/ because of broken PUT_LONG on Linux.
FYI PortableXDR's output doesn't need these macros at all.
Will still need to the s/quad/int64/ replacement here too
PortableXDR's output uses <stdint.h> and the types from that file. Rich. -- Richard Jones, Emerging Technologies, Red Hat http://et.redhat.com/~rjones virt-df lists disk usage of guests without needing to install any software inside the virtual machine. Supports Linux and Windows. http://et.redhat.com/~rjones/virt-df/

On Mon, Dec 15, 2008 at 11:05:10AM -0800, john.levon@sun.com wrote:
# HG changeset patch # User john.levon@sun.com # Date 1229367889 28800 # Node ID 46a487775d4b35c32455a5ca8eb3009d10a02c5b # Parent a1f24e9f8a1fbf191c71172ae986110b7e98fc32 Fix remote_protocol header for Solaris
quad_t is not a portable type, but rather than force rpcgen every build, we just patch in the fixes needed.
Perhaps a better solution to this might be to get PortableXDR working on Solaris (or check that it works -- it should just compile). Anyway, Solaris is one of the targets for PortableXDR so I'll do that later once I get a Solaris VM running. https://www.redhat.com/archives/libvir-list/2009-January/msg00140.html Rich. -- Richard Jones, Emerging Technologies, Red Hat http://et.redhat.com/~rjones virt-df lists disk usage of guests without needing to install any software inside the virtual machine. Supports Linux and Windows. http://et.redhat.com/~rjones/virt-df/

On Mon, Jan 12, 2009 at 06:25:17PM +0000, Richard W.M. Jones wrote:
Fix remote_protocol header for Solaris
quad_t is not a portable type, but rather than force rpcgen every build, we just patch in the fixes needed.
Perhaps a better solution to this might be to get PortableXDR working on Solaris (or check that it works -- it should just compile).
I'll try to find time for it, but in the meantime, will the generated checked-in headers work as needed (when the warnings are fixed) ? regards john

On Mon, Jan 12, 2009 at 06:48:51PM +0000, John Levon wrote:
On Mon, Jan 12, 2009 at 06:25:17PM +0000, Richard W.M. Jones wrote:
Fix remote_protocol header for Solaris
quad_t is not a portable type, but rather than force rpcgen every build, we just patch in the fixes needed.
Perhaps a better solution to this might be to get PortableXDR working on Solaris (or check that it works -- it should just compile).
I'll try to find time for it, but in the meantime, will the generated checked-in headers work as needed (when the warnings are fixed) ?
The ones I posted may work, but have only been lightly tested. Eventually of course we hope that we won't need to check in generated code like this to CVS ... Rich. -- Richard Jones, Emerging Technologies, Red Hat http://et.redhat.com/~rjones Read my OCaml programming blog: http://camltastic.blogspot.com/ Fedora now supports 68 OCaml packages (the OPEN alternative to F#) http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora

On Mon, Jan 12, 2009 at 06:48:51PM +0000, John Levon wrote:
On Mon, Jan 12, 2009 at 06:25:17PM +0000, Richard W.M. Jones wrote:
Fix remote_protocol header for Solaris
quad_t is not a portable type, but rather than force rpcgen every build, we just patch in the fixes needed.
Perhaps a better solution to this might be to get PortableXDR working on Solaris (or check that it works -- it should just compile).
I'll try to find time for it, but in the meantime, will the generated checked-in headers work as needed (when the warnings are fixed) ?
I've finally got a OpenSolaris 2008.11 based devel environment working, which I'd eventually like to get running an automated nightly build so we don't keep breaking libvirt on Solaris. Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
participants (5)
-
Daniel P. Berrange
-
John Levon
-
John Levon
-
john.levon@sun.com
-
Richard W.M. Jones