[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] PATCH: rpcgen portability fixes for remote_protocol.c/h



"Daniel P. Berrange" <berrange redhat com> wrote:

> As per previous patches from John for Solaris, we ned a couple more fixes
> to the generated remote_protocol.c/h files for good portability.
>
> Specifically we need
>
>     s/u_quad_t/uint64_t/g;
>     s/quad_t/int64_t/g;
>     s/xdr_u_quad_t/xdr_uint64_t/g;
>     s/xdr_quad_t/xdr_int64_t/g;
>     s/IXDR_GET_LONG/IXDR_GET_INT32/g;
>
> I have finally got around to verifying that this won't  change wire
> ABI on Linux
>
> The first two data types int64 and quad_t are all fixed 64-bit ints,
> so that's safe.
>
> And the xdr_quad functions have this in the source
>
>   strong_alias (xdr_int64_t, xdr_quad_t)
>   strong_alias (xdr_int64_t, xdr_u_quad_t)
>
> So that change is no-op.
>
> Finally the glibc  rpc/xdr.h has
>
>    #define IXDR_GET_LONG(buf) ((long)IXDR_GET_U_INT32(buf))
>
> So I believe this is all safe.

I think so too.
I've double-checked the .[ch] changes by running this
and comparing; no diffs:

perl -pi -e 's/\bu_quad_t\b/uint64_t/g;s/\bquad_t\b/int64_t/g;s/\bxdr_u_quad_t\b/xdr_uint64_t/g;s/\bxdr_quad_t\b/xdr_int64_t/g;s/\bIXDR_GET_LONG\b/IXDR_GET_INT32/g' qemud/remote_protocol.[ch]

The configure.in and Makefile changes looked fine, too.

> Index: qemud/rpcgen_fix.pl
> ===================================================================
> RCS file: /data/cvs/libvirt/qemud/rpcgen_fix.pl,v
> retrieving revision 1.4
> diff -u -p -r1.4 rpcgen_fix.pl
> --- qemud/rpcgen_fix.pl	6 Jan 2009 18:32:03 -0000	1.4
> +++ qemud/rpcgen_fix.pl	28 Jan 2009 12:31:00 -0000
> @@ -26,6 +26,14 @@ while (<>) {
>
>      s/\t/        /g;
>
> +    # Portability for Solaris RPC
> +    s/u_quad_t/uint64_t/g;
> +    s/quad_t/int64_t/g;
> +    s/xdr_u_quad_t/xdr_uint64_t/g;
> +    s/xdr_quad_t/xdr_int64_t/g;
> +    s/IXDR_GET_LONG/IXDR_GET_INT32/g;
> +    s,#include "\./remote_protocol\.h",#include "remote_protocol.h",;
> +
>      if (m/^}/) {
>  	$in_function = 0;

You might want to bracket each LHS with \b...\b, just in case.

       s/\bu_quad_t\b/uint64_t/g;
       s/\bquad_t\b/int64_t/g;
       s/\bxdr_u_quad_t\b/xdr_uint64_t/g;
       s/\bxdr_quad_t\b/xdr_int64_t/g;
       s/\bIXDR_GET_LONG\b/IXDR_GET_INT32/g;

ACK.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]