diff options
-rw-r--r-- | configure.ac | 8 | ||||
-rw-r--r-- | fish/Makefile.am | 13 | ||||
-rw-r--r-- | generator/generator_xdr.ml | 31 | ||||
-rw-r--r-- | src/Makefile.am | 13 |
4 files changed, 53 insertions, 12 deletions
diff --git a/configure.ac b/configure.ac index be50c484..3929ac9a 100644 --- a/configure.ac +++ b/configure.ac @@ -403,6 +403,14 @@ AM_CONDITIONAL([HAVE_RPCGEN],[test "x$RPCGEN" != "xno"]) AC_CHECK_LIB([portablexdr],[xdrmem_create],[],[ AC_SEARCH_LIBS([xdrmem_create],[rpc xdr nsl]) ]) +AC_SEARCH_LIBS([xdr_u_int64_t],[portablexdr rpc xdr nsl],[ + AC_DEFINE([HAVE_XDR_U_INT64_T],[1],[Define to 1 if xdr_u_int64_t() exists]) + ]) +AC_SEARCH_LIBS([xdr_uint64_t],[portablexdr rpc xdr nsl],[ + AC_DEFINE([HAVE_XDR_UINT64_T],[1],[Define to 1 if xdr_uint64_t() exists]) + ]) +AM_CONDITIONAL([HAVE_XDR_U_INT64_T],[test "x$ac_cv_search_xdr_u_int64_t" != "xno"]) +AM_CONDITIONAL([HAVE_XDR_UINT64_T],[test "x$ac_cv_search_xdr_uint64_t" != "xno"]) dnl Check for Augeas (optional). PKG_CHECK_MODULES([AUGEAS], [augeas], diff --git a/fish/Makefile.am b/fish/Makefile.am index c7c1867d..27015f65 100644 --- a/fish/Makefile.am +++ b/fish/Makefile.am @@ -138,16 +138,25 @@ noinst_LTLIBRARIES = libcmds.la librc_protocol.la guestfish_LDADD += libcmds.la librc_protocol.la ../gnulib/lib/libgnu.la if HAVE_RPCGEN +RPCGEN_DEFS = +if HAVE_XDR_U_INT64_T +RPCGEN_DEFS += -DHAVE_XDR_U_INT64_T=1 +else +if HAVE_XDR_UINT64_T +RPCGEN_DEFS += -DHAVE_XDR_UINT64_T=1 +endif +endif + rc_protocol.c: rc_protocol.x rm -f $@-t $@-t2 - $(RPCGEN) -c -o $@-t $< + $(RPCGEN) $(RPCGEN_DEFS) -c -o $@-t $< sed 's,\.\./\(\.\./\)*fish,.,' < $@-t > $@-t2 rm $@-t mv $@-t2 $@ rc_protocol.h: rc_protocol.x rm -f $@-t - $(RPCGEN) -h -o $@-t $< + $(RPCGEN) $(RPCGEN_DEFS) -h -o $@-t $< mv $@-t $@ endif diff --git a/generator/generator_xdr.ml b/generator/generator_xdr.ml index b7b2db2b..9acea8fd 100644 --- a/generator/generator_xdr.ml +++ b/generator/generator_xdr.ml @@ -39,6 +39,21 @@ open Generator_structs let generate_xdr () = generate_header CStyle LGPLv2plus; + (* This has to be defined to get around a limitation in Mac OS X's rpcgen. *) + pr "#if HAVE_XDR_U_INT64_T\n"; + pr "#define uint64_t u_int64_t\n"; + pr "%%#if HAVE_XDR_UINT64_T\n"; + pr "%%#define xdr_u_int64_t xdr_uint64_t\n"; + pr "%%#define u_int64_t uint64_t\n"; + pr "%%#endif\n"; + pr "#else\n"; + pr "%%#if HAVE_XDR_U_INT64_T\n"; + pr "%%#define xdr_uint64_t xdr_u_int64_t\n"; + pr "%%#define uint64_t u_int64_t\n"; + pr "%%#endif\n"; + pr "#endif\n"; + pr "\n"; + (* This has to be defined to get around a limitation in Sun's rpcgen. *) pr "typedef string guestfs_str<>;\n"; pr "\n"; @@ -55,8 +70,8 @@ let generate_xdr () = | name, FUUID -> pr " opaque %s[32];\n" name | name, FInt32 -> pr " int %s;\n" name | name, FUInt32 -> pr " unsigned int %s;\n" name - | name, (FInt64|FBytes) -> pr " hyper %s;\n" name - | name, FUInt64 -> pr " unsigned hyper %s;\n" name + | name, (FInt64|FBytes) -> pr " int64_t %s;\n" name + | name, FUInt64 -> pr " uint64_t %s;\n" name | name, FOptPercent -> pr " float %s;\n" name ) cols; pr "};\n"; @@ -86,7 +101,7 @@ let generate_xdr () = | StringList n | DeviceList n -> pr " guestfs_str %s<>;\n" n | Bool n -> pr " bool %s;\n" n | Int n -> pr " int %s;\n" n - | Int64 n -> pr " hyper %s;\n" n + | Int64 n -> pr " int64_t %s;\n" n | BufferIn n -> pr " opaque %s<>;\n" n | FileIn _ | FileOut _ -> () @@ -102,7 +117,7 @@ let generate_xdr () = pr "};\n\n" | RInt64 n -> pr "struct %s_ret {\n" name; - pr " hyper %s;\n" n; + pr " int64_t %s;\n" n; pr "};\n\n" | RBool n -> pr "struct %s_ret {\n" name; @@ -199,8 +214,8 @@ struct guestfs_message_header { guestfs_procedure proc; /* GUESTFS_PROC_x */ guestfs_message_direction direction; unsigned serial; /* message serial number */ - unsigned hyper progress_hint; /* upload hint for progress bar */ - unsigned hyper optargs_bitmask; /* bitmask for optional args */ + uint64_t progress_hint; /* upload hint for progress bar */ + uint64_t optargs_bitmask; /* bitmask for optional args */ guestfs_message_status status; }; @@ -230,8 +245,8 @@ struct guestfs_chunk { struct guestfs_progress { guestfs_procedure proc; /* @0: GUESTFS_PROC_x */ unsigned serial; /* @4: message serial number */ - unsigned hyper position; /* @8: 0 <= position <= total */ - unsigned hyper total; /* @16: total size of operation */ + uint64_t position; /* @8: 0 <= position <= total */ + uint64_t total; /* @16: total size of operation */ /* @24: size of structure */ }; " diff --git a/src/Makefile.am b/src/Makefile.am index 95042f80..750c07be 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -180,16 +180,25 @@ libguestfs_la_LIBADD += $(FUSE_LIBS) -lulockmgr endif if HAVE_RPCGEN +RPCGEN_DEFS = +if HAVE_XDR_U_INT64_T +RPCGEN_DEFS += -DHAVE_XDR_U_INT64_T=1 +else +if HAVE_XDR_UINT64_T +RPCGEN_DEFS += -DHAVE_XDR_UINT64_T=1 +endif +endif + guestfs_protocol.c: guestfs_protocol.x rm -f $@-t $@-t2 - $(RPCGEN) -c -o $@-t $(srcdir)/$< + $(RPCGEN) $(RPCGEN_DEFS) -c -o $@-t $(srcdir)/$< sed 's,\.\./\(\.\./\)*src,.,' < $@-t > $@-t2 rm $@-t mv $@-t2 $@ guestfs_protocol.h: guestfs_protocol.x rm -f $@-t - $(RPCGEN) -h -o $@-t $(srcdir)/$< + $(RPCGEN) $(RPCGEN_DEFS) -h -o $@-t $(srcdir)/$< mv $@-t $@ endif |