Merge pull request #27 from Karlson2k/Win32x64
authorRonnie Sahlberg <ronniesahlberg@gmail.com>
Wed, 21 Nov 2012 03:51:10 +0000 (19:51 -0800)
committerRonnie Sahlberg <ronniesahlberg@gmail.com>
Wed, 21 Nov 2012 03:51:10 +0000 (19:51 -0800)
Add windows x64 builds, use some win defines from header if available

configure.ac
examples/Makefile.am
examples/nfsclient-sync.c
lib/socket.c
nfs/Makefile.am
nfs/nfs.x
nlm/Makefile.am
nlm/nlm.x

index 48595bd32748a2f8d0860dc9ce0a0578450404bb..a966d518c9adf8d058cd36ab7c21526b888e36cb 100644 (file)
@@ -33,11 +33,46 @@ AC_ARG_ENABLE([examples],
              [ENABLE_EXAMPLES=$enableval],
              [ENABLE_EXAMPLES="no"])
 
+# We need popt to compile the examples
 if test x$ENABLE_EXAMPLES = xyes; then
+AC_MSG_CHECKING(whether libpopt is available)
+ac_save_CFLAGS="$CFLAGS"
+ac_save_LIBS="$LIBS"
+CFLAGS="$CFLAGS $GLIB_CFLAGS"
+LIBS="$GLIB_LIBS $LIBS -lpopt"
+AC_TRY_RUN([
+/*
+ * Just see if we can compile/link with popt
+ */
+#include <popt.h>
+
+int main(int argc, const char *argv[])
+{
+       struct poptOption popt_options[] = {
+               POPT_TABLEEND
+       };
+       poptGetContext(argv[0], argc, argv, popt_options, POPT_CONTEXT_KEEP_FIRST);
+
+       return 0;
+}
+], ac_cv_have_popt=yes, ac_cv_have_popt=no,
+   [echo $ac_n "compile with POPT. Assuming OK... $ac_c"
+    ac_cv_have_popt=yes])
+CFLAGS="$ac_save_CFLAGS"
+LIBS="$ac_save_LIBS"
+if test "$ac_cv_have_popt" = yes ; then
+  AC_MSG_RESULT(yes)
   MAYBE_EXAMPLES="examples"
+else
+  AC_MSG_RESULT(no)
+  AC_MSG_NOTICE(You need libpopt to compile the sample libnfs clients.)
+  AC_MSG_NOTICE(Only the library will be compiled and installed.)
 fi
+fi
+
 AC_SUBST(MAYBE_EXAMPLES)
 
+
 AC_ARG_ENABLE(tirpc,
        [AC_HELP_STRING([--enable-tirpc],
                        [enable use of TI-RPC @<:@default=no@:>@])],
index 314807b5cfa2a486cbc5c661adb7a9179843ea8d..878ac1abb73cb95c8c9ad66eec020b95c6d2ecc2 100644 (file)
@@ -8,7 +8,7 @@ AM_CPPFLAGS = \
        -I../portmap \
        "-D_U_=__attribute__((unused))"
 
-AM_LDFLAGS = ../lib/.libs/libnfs.la
+AM_LDFLAGS = ../lib/.libs/libnfs.la -lpopt
 
 nfsclient_async_SOURCES = nfsclient-async.c
 
index 8563c1eadd38cf91b326646139f3fc1b8e5a4ce5..9cdac9b663f12016316ea84a553d7491030cce68 100644 (file)
    along with this program; if not, see <http://www.gnu.org/licenses/>.
 */
 
+#define _FILE_OFFSET_BITS 64
+#define _GNU_SOURCE
+
 /* Example program using the highlevel sync interface
  */
 #ifdef WIN32
 #include "win32_compat.h"
 #else
+#include <string.h>
 #include <fcntl.h>
 #include <sys/stat.h>
 #include <sys/statvfs.h>
 #endif
  
-#define SERVER "10.1.1.27"
-#define EXPORT "/VIRTUAL"
-#define NFSFILE "/BOOKS/Classics/Dracula.djvu.truncated"
-#define NFSFILER "/BOOKS/Classics/Dracula.djvu.renamed"
-#define NFSFILEW "/BOOKS/Classics/foo"
-#define NFSDIR "/BOOKS/Classics/"
-
-#define _GNU_SOURCE
 
 #if defined(WIN32)
 #pragma comment(lib, "ws2_32.lib")
@@ -45,11 +41,13 @@ WSADATA wsaData;
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdint.h>
+#include <inttypes.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
 #include "libnfs.h"
 #include <rpc/rpc.h>            /* for authunix_create() */
+#include <popt.h>
 #include "libnfs-raw.h"
 #include "libnfs-raw-mount.h"
 
@@ -61,27 +59,33 @@ struct client {
 };
 
 
-void PrintServerList()
-{
-  struct nfs_server_list *srvrs;
-  struct nfs_server_list *srv;
-
-  srvrs = nfs_find_local_servers();
-
-  for (srv=srvrs; srv; srv = srv->next)
-  {
-      printf("Found nfs server: %s\n", srv->addr);
+char buf[3*1024*1024+337];
 
-  }
-  free_nfs_srvr_list(srvrs);
+void print_usage(void)
+{
+       fprintf(stderr, "Usage: nfsclient-sync [-?|--help] [--usage] <url>\n");
 }
 
-char buf[3*1024*1024+337];
+void print_help(void)
+{
+       fprintf(stderr, "Usage: nfsclient-sync [OPTION...] <url>\n");
+       fprintf(stderr, "\n");
+       fprintf(stderr, "Help options:\n");
+       fprintf(stderr, "  -?, --help                        Show this help message\n");
+       fprintf(stderr, "      --usage                       Display brief usage message\n");
+       fprintf(stderr, "\n");
+       fprintf(stderr, "NFS URL format : nfs://<server>/<export-path>\n");
+       fprintf(stderr, "\n");
+       fprintf(stderr, "<host> is either of:\n");
+       fprintf(stderr, "  \"hostname\"       nfs.example\n");
+       fprintf(stderr, "  \"ipv4-address\"   10.1.1.27\n");
+       fprintf(stderr, "  \"ipv6-address\"   [fce0::1]\n");
+}
 
-int main(int argc _U_, char *argv[] _U_)
+int main(int argc, char *argv[])
 {
-       struct nfs_context *nfs;
-       int i, ret;
+       struct nfs_context *nfs = NULL;
+       int i, ret, res;
        uint64_t offset;
        struct client client;
        struct stat st;
@@ -90,6 +94,18 @@ int main(int argc _U_, char *argv[] _U_)
        struct nfsdirent *nfsdirent;
        struct statvfs svfs;
        exports export, tmp;
+       int show_help = 0, show_usage = 0;
+       poptContext pc;
+       const char **extra_argv;
+       int extra_argc = 0;
+       const char *url = NULL;
+       char *server = NULL, *path = NULL, *strp;
+
+       struct poptOption popt_options[] = {
+               { "help", '?', POPT_ARG_NONE, &show_help, 0, "Show this help message", NULL },
+               { "usage", 0, POPT_ARG_NONE, &show_usage, 0, "Display brief usage message", NULL },
+               POPT_TABLEEND
+       };
 
 #if defined(WIN32)
        if (WSAStartup(MAKEWORD(2,2), &wsaData) != 0) {
@@ -98,212 +114,158 @@ int main(int argc _U_, char *argv[] _U_)
        }
 #endif
 
-       client.server = SERVER;
-       client.export = EXPORT;
-       client.is_finished = 0;
-
-  PrintServerList();
-
-       export = mount_getexports(SERVER);
-       if (export != NULL) {
-               printf("exports on server %s\n", SERVER);
-               tmp = export;
-               while (tmp != NULL) {
-                     printf("Export: %s\n", tmp->ex_dir);
-                     tmp = tmp->ex_next;
-               }
-
-               mount_free_export_list(export);
-       } else {
-               printf("no exports on server %s\n", SERVER);
-       }       
-
-       nfs = nfs_init_context();
-       if (nfs == NULL) {
-               printf("failed to init context\n");
+       pc = poptGetContext(argv[0], argc, argv, popt_options, POPT_CONTEXT_POSIXMEHARDER);
+       if ((res = poptGetNextOpt(pc)) < -1) {
+               fprintf(stderr, "Failed to parse option : %s %s\n",
+                       poptBadOption(pc, 0), poptStrerror(res));
                exit(10);
        }
-
-       ret = nfs_mount(nfs, client.server, client.export);
-       if (ret != 0) {
-               printf("Failed to mount nfs share : %s\n", nfs_get_error(nfs));
-               exit(10);
+       extra_argv = poptGetArgs(pc);
+       if (extra_argv) {
+               url = *extra_argv;
+               extra_argv++;
+               while (extra_argv[extra_argc]) {
+                       extra_argc++;
+               }
        }
-       printf("mounted share successfully %s\n", nfs_get_error(nfs));
-
+       poptFreeContext(pc);
 
-       ret = nfs_stat(nfs, NFSFILE, &st);
-       if (ret != 0) {
-               printf("Failed to stat(%s) %s\n", NFSFILE, nfs_get_error(nfs));
-               exit(10);
+       if (show_help != 0) {
+               print_help();
+               exit(0);
        }
-       printf("Mode %04o\n", st.st_mode);
-       printf("Size %d\n", (int)st.st_size);
-       printf("Inode %04o\n", (int)st.st_ino);
 
-       ret = nfs_open(nfs, NFSFILE, O_RDONLY, &nfsfh);
-       if (ret != 0) {
-               printf("Failed to open(%s) %s\n", NFSFILE, nfs_get_error(nfs));
-               exit(10);
+       if (show_usage != 0) {
+               print_usage();
+               exit(0);
        }
 
-#if 0
-       ret = nfs_read(nfs, nfsfh, 16, buf);
-       if (ret < 0) {
-               printf("Failed to pread(%s) %s\n", NFSFILE, nfs_get_error(nfs));
-               exit(10);
-       }
-       printf("read %d bytes\n", ret);
-       for (i=0;i<16;i++) {
-               printf("%02x ", buf[i]&0xff);
-       }
-       printf("\n");
-#endif
-       ret = nfs_read(nfs, nfsfh, sizeof(buf), buf);
-       if (ret < 0) {
-               printf("Failed to pread(%s) %s\n", NFSFILE, nfs_get_error(nfs));
-               exit(10);
+       if (url == NULL) {
+               fprintf(stderr, "No URL specified.\n");
+               print_usage();
+               exit(0);
        }
-       printf("read %d bytes\n", ret);
-       for (i=0;i<16;i++) {
-               printf("%02x ", buf[i]&0xff);
+
+       if (strncmp(url, "nfs://", 6)) {
+               fprintf(stderr, "Invalid URL specified.\n");
+               print_usage();
+               exit(0);
        }
-       printf("\n");
-       ret = nfs_read(nfs, nfsfh, sizeof(buf), buf);
-       if (ret < 0) {
-               printf("Failed to pread(%s) %s\n", NFSFILE, nfs_get_error(nfs));
+
+       server = strdup(url + 6);
+       if (server == NULL) {
+               fprintf(stderr, "Failed to strdup server string\n");
                exit(10);
        }
-       printf("read %d bytes\n", ret);
-       ret = nfs_read(nfs, nfsfh, sizeof(buf), buf);
-       if (ret < 0) {
-               printf("Failed to pread(%s) %s\n", NFSFILE, nfs_get_error(nfs));
+       if (server[0] == '/' || server[0] == '\0') {
+               fprintf(stderr, "Invalid server string.\n");
+               free(server);
                exit(10);
        }
-       printf("read %d bytes\n", ret);
-       ret = nfs_read(nfs, nfsfh, sizeof(buf), buf);
-       if (ret < 0) {
-               printf("Failed to pread(%s) %s\n", NFSFILE, nfs_get_error(nfs));
-               exit(10);
+       strp = strchr(server, '/');
+       if (strp == NULL) {
+               fprintf(stderr, "Invalid URL specified.\n");
+               print_usage();
+               free(server);
+               exit(0);
        }
-       printf("read %d bytes\n", ret);
-       ret = nfs_read(nfs, nfsfh, sizeof(buf), buf);
-       if (ret < 0) {
-               printf("Failed to pread(%s) %s\n", NFSFILE, nfs_get_error(nfs));
+       path = strdup(strp);
+       if (path == NULL) {
+               fprintf(stderr, "Failed to strdup server string\n");
+               free(server);
                exit(10);
        }
-       printf("read %d bytes\n", ret);
-       ret = nfs_read(nfs, nfsfh, sizeof(buf), buf);
-       if (ret < 0) {
-               printf("Failed to pread(%s) %s\n", NFSFILE, nfs_get_error(nfs));
+       if (path[0] != '/') {
+               fprintf(stderr, "Invalid path.\n");
+               free(server);
+               free(path);
                exit(10);
        }
-       printf("read %d bytes\n", ret);
+       *strp = 0;
+       
+       client.server = server;
+       client.export = path;
+       client.is_finished = 0;
 
-       ret = (int)nfs_lseek(nfs, nfsfh, 0, SEEK_CUR, &offset);
-       if (ret < 0) {
-               printf("Failed to lseek(%s) %s\n", NFSFILE, nfs_get_error(nfs));
-               exit(10);
-       }
-       printf("File position is %d\n", (int)offset);
 
-       printf("seek to end of file\n");
-       ret = (int)nfs_lseek(nfs, nfsfh, 0, SEEK_END, &offset);
-       if (ret < 0) {
-               printf("Failed to lseek(%s) %s\n", NFSFILE, nfs_get_error(nfs));
-               exit(10);
+       nfs = nfs_init_context();
+       if (nfs == NULL) {
+               printf("failed to init context\n");
+               goto finished;
        }
-       printf("File position is %d\n", (int)offset);
 
-       ret = nfs_fstat(nfs, nfsfh, &st);
+       ret = nfs_mount(nfs, client.server, client.export);
        if (ret != 0) {
-               printf("Failed to stat(%s) %s\n", NFSFILE, nfs_get_error(nfs));
-               exit(10);
+               printf("Failed to mount nfs share : %s\n", nfs_get_error(nfs));
+               goto finished;
        }
-       printf("Mode %04o\n", st.st_mode);
-       printf("Size %d\n", (int)st.st_size);
-       printf("Inode %04o\n", (int)st.st_ino);
 
 
-       ret = nfs_close(nfs, nfsfh);
-       if (ret < 0) {
-               printf("Failed to close(%s): %s\n", NFSFILE, nfs_get_error(nfs));
-               exit(10);
-       }
-
-       ret = nfs_opendir(nfs, NFSDIR, &nfsdir);
+       ret = nfs_opendir(nfs, "/", &nfsdir);
        if (ret != 0) {
-               printf("Failed to open(%s) %s\n", NFSFILE, nfs_get_error(nfs));
+               printf("Failed to opendir(\"/\")\n", nfs_get_error(nfs));
                exit(10);
        }
        while((nfsdirent = nfs_readdir(nfs, nfsdir)) != NULL) {
-         char filename[1024];
-               printf("Inode:%d Name:%s ", (int)nfsdirent->inode, nfsdirent->name);
-               sprintf(filename, "%s/%s", NFSDIR, nfsdirent->name);
-               ret = nfs_open(nfs, filename, O_RDONLY, &nfsfh);
-               if (ret != 0) {
-                       printf("Failed to open(%s) %s\n", filename, nfs_get_error(nfs));
-                       exit(10);
+               char path[1024];
+
+               if (!strcmp(nfsdirent->name, ".") || !strcmp(nfsdirent->name, "..")) {
+                       continue;
                }
-               ret = nfs_read(nfs, nfsfh, sizeof(buf), buf);
-               if (ret < 0) {
-                       printf("Error reading file\n");
+
+               snprintf(path, 1024, "%s/%s", "/", nfsdirent->name);
+               ret = nfs_stat(nfs, path, &st);
+               if (ret != 0) {
+                       fprintf(stderr, "Failed to stat(%s) %s\n", path, nfs_get_error(nfs));
+                       continue;
                }
-               printf("Read %d bytes\n", ret);
-               ret = nfs_close(nfs, nfsfh);
-               if (ret < 0) {
-                       printf("Failed to close(%s): %s\n", NFSFILE, nfs_get_error(nfs));
-                       exit(10);
+
+               switch (st.st_mode & S_IFMT) {
+               case S_IFLNK:
+               case S_IFREG:
+                       printf("-");
+                       break;
+               case S_IFDIR:
+                       printf("d");
+                       break;
+               case S_IFCHR:
+                       printf("c");
+                       break;
+               case S_IFBLK:
+                       printf("b");
+                       break;
                }
+               printf("%c%c%c",
+                       "-r"[!!(st.st_mode & S_IRUSR)],
+                       "-w"[!!(st.st_mode & S_IWUSR)],
+                       "-x"[!!(st.st_mode & S_IXUSR)]
+               );
+               printf("%c%c%c",
+                       "-r"[!!(st.st_mode & S_IRGRP)],
+                       "-w"[!!(st.st_mode & S_IWGRP)],
+                       "-x"[!!(st.st_mode & S_IXGRP)]
+               );
+               printf("%c%c%c",
+                       "-r"[!!(st.st_mode & S_IROTH)],
+                       "-w"[!!(st.st_mode & S_IWOTH)],
+                       "-x"[!!(st.st_mode & S_IXOTH)]
+               );
+               printf(" %2d", st.st_nlink);
+               printf(" %5d", st.st_uid);
+               printf(" %5d", st.st_gid);
+               printf(" %12" PRId64, st.st_size);
+
+               printf(" %s\n", nfsdirent->name);
        }
        nfs_closedir(nfs, nfsdir);
 
 
-       ret = nfs_open(nfs, NFSFILEW, O_WRONLY, &nfsfh);
-       if (ret != 0) {
-               printf("Failed to open(%s) %s\n", NFSFILEW, nfs_get_error(nfs));
-               exit(10);
-       }
-       ret = nfs_pwrite(nfs, nfsfh, 0, 16, buf);
-       if (ret < 0) {
-               printf("Failed to pwrite(%s) %s\n", NFSFILEW, nfs_get_error(nfs));
-               exit(10);
-       }
-       ret = nfs_fsync(nfs, nfsfh);
-       if (ret < 0) {
-               printf("Failed to fsync(%s) %s\n", NFSFILEW, nfs_get_error(nfs));
-               exit(10);
-       }
-       ret = nfs_close(nfs, nfsfh);
-       if (ret < 0) {
-               printf("Failed to close(%s) %s\n", NFSFILEW, nfs_get_error(nfs));
-               exit(10);
-       }
-
-
-       ret = nfs_statvfs(nfs, NFSDIR, &svfs);
-       if (ret < 0) {
-               printf("Failed to statvfs(%s) %s\n", NFSDIR, nfs_get_error(nfs));
-               exit(10);
-       }
-       printf("files %d/%d/%d\n", (int)svfs.f_files, (int)svfs.f_ffree, (int)svfs.f_favail);
-
-
-       ret = nfs_access(nfs, NFSFILE, R_OK);
-       if (ret != 0) {
-               printf("Failed to access(%s) %s\n", NFSFILE, nfs_get_error(nfs));
-       }
-
-       /* become root */
-       nfs_set_auth(nfs, authunix_create("Ronnies-Laptop", 0, 0, 0, NULL));
-
-       ret = nfs_link(nfs, NFSFILE, NFSFILER);
-       if (ret != 0) {
-               printf("Failed to link(%s) %s\n", NFSFILE, nfs_get_error(nfs));
+finished:
+       free(server);
+       free(path);
+       if (nfs != NULL) {              
+               nfs_destroy_context(nfs);
        }
-
-
-       nfs_destroy_context(nfs);
        printf("nfsclient finished\n");
        return 0;
 }
index 1bb34f0ef9e57212d7919d4fee3d0d524c3488f6..8ad5e4e891b3814bd899c500dc9d5546e7e7d570 100644 (file)
@@ -599,6 +599,7 @@ int rpc_set_udp_destination(struct rpc_context *rpc, char *addr, int port, int i
        rpc->udp_dest = malloc(ai->ai_addrlen);
        if (rpc->udp_dest == NULL) {
                rpc_set_error(rpc, "Out of memory. Failed to allocate sockaddr structure");
+               freeaddrinfo(ai);
                return -1;
        }
        memcpy(rpc->udp_dest, ai->ai_addr, ai->ai_addrlen);
index 50523690069b886f5dbbdb5afc1f90db89407840..51b8d928fb0fcd9b6ea2df2217c79a98d5ff5c7b 100644 (file)
@@ -15,6 +15,34 @@ $(nfs_GENERATED) : nfs-stamp
 nfs-stamp : nfs.x
        rm -f $(nfs_GENERATED)
        rpcgen -h @RPCGENFLAGS@ $< > libnfs-raw-nfs.h
-       rpcgen -c @RPCGENFLAGS@ $< | sed -e "s/#include \".*nfs.h\"/#include \"libnfs-raw-nfs.h\"/" > libnfs-raw-nfs.c
+       rpcgen -c @RPCGENFLAGS@ $< | sed -e "s/#include \".*nfs.h\"/#include \"libnfs-raw-nfs.h\"/" -e "s/^xdr_uint64/static xdr_uint64_broken/" > libnfs-raw-nfs.c
+       echo "" >> libnfs-raw-nfs.c
+       echo "xdr_uint64 (XDR *xdrs, uint64 *objp)" >> libnfs-raw-nfs.c
+       echo "{" >> libnfs-raw-nfs.c
+       echo "  uint32_t i;" >> libnfs-raw-nfs.c
+       echo "" >> libnfs-raw-nfs.c
+       echo "        switch (xdrs->x_op) {" >> libnfs-raw-nfs.c
+       echo "        case XDR_DECODE:" >> libnfs-raw-nfs.c
+       echo "          if (!xdr_u_int (xdrs, &i))" >> libnfs-raw-nfs.c
+       echo "                  return FALSE;" >> libnfs-raw-nfs.c
+       echo "          *objp = i;" >> libnfs-raw-nfs.c
+       echo "          *objp <<= 32;" >> libnfs-raw-nfs.c
+       echo "" >> libnfs-raw-nfs.c
+       echo "          if (!xdr_u_int (xdrs, &i))" >> libnfs-raw-nfs.c
+       echo "                  return FALSE;" >> libnfs-raw-nfs.c
+       echo "          *objp |= i;" >> libnfs-raw-nfs.c
+       echo "" >> libnfs-raw-nfs.c
+       echo "          return TRUE;" >> libnfs-raw-nfs.c
+       echo "  case XDR_ENCODE:" >> libnfs-raw-nfs.c
+       echo "          i = ((*objp) >> 32) & 0xffffffff;" >> libnfs-raw-nfs.c
+       echo "          if (!xdr_u_int (xdrs, &i))" >> libnfs-raw-nfs.c
+       echo "                  return FALSE;" >> libnfs-raw-nfs.c
+       echo "" >> libnfs-raw-nfs.c
+       echo "          i = ((*objp)      ) & 0xffffffff;" >> libnfs-raw-nfs.c
+       echo "          if (!xdr_u_int (xdrs, &i))" >> libnfs-raw-nfs.c
+       echo "                  return FALSE;" >> libnfs-raw-nfs.c
+       echo "          return TRUE;" >> libnfs-raw-nfs.c
+       echo "  }" >> libnfs-raw-nfs.c
+       echo "}" >> libnfs-raw-nfs.c
        touch nfs-stamp
        
index c259aa6e3cf3ff6dc7b96f3d34dc60b095f1951c..6e2d7a47d6bd9f044cfd762565bea6a1eec4615d 100644 (file)
--- a/nfs/nfs.x
+++ b/nfs/nfs.x
@@ -7,8 +7,7 @@ const NFS3_COOKIEVERFSIZE = 8;
 
 typedef opaque cookieverf3[NFS3_COOKIEVERFSIZE];
 
-
-/*unsigned hyper can be overridden by giving rpcgen -DU_INT64_PLATTFORM_TYPE="foo" - for plattforms
+/*unsigned hyper can be overridden by giving rpcgen -DU_INT64_PLATTFORM_TYPE="
   where rpcgen doesn't know anything about hyper
   default to unsigned hyper as of rfc 1813 */
 #ifndef U_INT64_PLATTFORM_TYPE
@@ -16,6 +15,7 @@ typedef opaque cookieverf3[NFS3_COOKIEVERFSIZE];
 #endif/*U_INT64_PLATTFORM_TYPE*/
 
 typedef U_INT64_PLATTFORM_TYPE uint64;
+
 typedef uint64 cookie3;
 
 struct nfs_fh3 {
index 7ec82da9710533d605b3a5f1510a5b5550aec7ea..0873dda10bdad54494ae9de4a42846d3f7a847e7 100644 (file)
@@ -15,6 +15,6 @@ $(nlm_GENERATED) : nlm-stamp
 nlm-stamp : nlm.x
        rm -f $(nlm_GENERATED)
        rpcgen -h @RPCGENFLAGS@ $< > libnfs-raw-nlm.h
-       rpcgen -c @RPCGENFLAGS@ $< | sed -e "s/#include \".*nlm.h\"/#include \"libnfs-raw-nlm.h\"/" > libnfs-raw-nlm.c
+       rpcgen -c @RPCGENFLAGS@ $< | sed -e "s/#include \".*nlm.h\"/#include \"libnfs-raw-nlm.h\"/" -e "s/^xdr_uint64/static xdr_uint64_broken/" > libnfs-raw-nlm.c
        touch nlm-stamp
        
index 4ca86218e8be8cc64f6b39ba429adae3da053693..8ec6614ddb8ac714d8580b2235d1b7a0175504fc 100644 (file)
--- a/nlm/nlm.x
+++ b/nlm/nlm.x
@@ -1,5 +1,6 @@
 /* based on rfc1813 and wireshark */
 
+typedef unsigned hyper uint64;
 
 struct nlm_fh4 {
        opaque       data<>;
@@ -28,8 +29,8 @@ struct nlm4_holder {
        bool           exclusive;
        unsigned int   svid;
        nlm4_oh        oh;
-       unsigned hyper l_offset;
-       unsigned hyper l_len;
+       uint64         l_offset;
+       uint64         l_len;
 };
 
 const NLM_MAXNAME = 256;
@@ -38,8 +39,8 @@ struct nlm4_lock {
        struct nlm_fh4 fh;
        nlm4_oh        oh;
        unsigned int   svid;
-       unsigned hyper l_offset;
-       unsigned hyper l_len;
+       uint64         l_offset;
+       uint64         l_len;
 };
 
 struct nlm4_share {