All current platforms have a quad type that maps to a 64bit scalar.
But there are platforms where quad maps to a 64bit non-scalar.
Replace quad with int64 in the protocol definitions and the ZDR layer
so that these fields will map to a 64 bit scalar also on those platforms
where quad can not be used.
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
#define zdr_int libnfs_zdr_int
bool_t libnfs_zdr_int(ZDR *zdrs, int32_t *i);
-#define zdr_u_quad_t libnfs_zdr_u_quad_t
-bool_t libnfs_zdr_u_quad_t(ZDR *zdrs, uint64_t *u);
+#define zdr_uint64_t libnfs_zdr_uint64_t
+bool_t libnfs_zdr_uint64_t(ZDR *zdrs, uint64_t *u);
-#define zdr_quad_t libnfs_zdr_quad_t
-bool_t libnfs_zdr_quad_t(ZDR *zdrs, int64_t *i);
+#define zdr_int64_t libnfs_zdr_int64_t
+bool_t libnfs_zdr_int64_t(ZDR *zdrs, int64_t *i);
#define zdr_enum libnfs_zdr_enum
bool_t libnfs_zdr_enum(ZDR *zdrs, enum_t *e);
return libnfs_zdr_u_int(zdrs, (uint32_t *)i);
}
-bool_t libnfs_zdr_u_quad_t(ZDR *zdrs, uint64_t *u)
+bool_t libnfs_zdr_uint64_t(ZDR *zdrs, uint64_t *u)
{
if (zdrs->pos + 8 > zdrs->size) {
return FALSE;
return FALSE;
}
-bool_t libnfs_zdr_quad_t(ZDR *zdrs, int64_t *i)
+bool_t libnfs_zdr_int64_t(ZDR *zdrs, int64_t *i)
{
- return libnfs_zdr_u_quad_t(zdrs, (uint64_t *)i);
+ return libnfs_zdr_uint64_t(zdrs, (uint64_t *)i);
}
bool_t libnfs_zdr_bytes(ZDR *zdrs, char **bufp, uint32_t *size, uint32_t maxsize)
compile_rpc:
cat nfs.x | head -29 >libnfs-raw-nfs.h
- rpcgen -h nfs.x | sed -e "s/#include <rpc\/rpc.h>/#include <nfsc\/libnfs-zdr.h>/" -e "s/xdr/zdr/g" -e "s/XDR/ZDR/g" -e "s/#define _NFS_H_RPCGEN/#define _NFS_H_RPCGEN\n#include <nfsc\/libnfs-zdr.h>/g" -e "s/#define NFS3_COOKIEVERFSIZE 8/#define NFS3_COOKIEVERFSIZE 8\n\n#if defined(ANDROID)\ntypedef long long int quad_t;\ntypedef long long unsigned u_quad_t;\n#endif\n#if defined(WIN32)\ntypedef long long int quad_t;\ntypedef long long unsigned u_quad_t;\n#endif/g" -e "s/ CLIENT / void /g" -e "s/SVCXPRT /void /g" -e "s/bool_t/uint32_t/g" >> libnfs-raw-nfs.h
+ rpcgen -h nfs.x | sed -e "s/#include <rpc\/rpc.h>/#include <nfsc\/libnfs-zdr.h>/" -e "s/xdr/zdr/g" -e "s/XDR/ZDR/g" -e "s/#define _NFS_H_RPCGEN/#define _NFS_H_RPCGEN\n#include <nfsc\/libnfs-zdr.h>/g" -e "s/#define NFS3_COOKIEVERFSIZE 8/#define NFS3_COOKIEVERFSIZE 8\n\n/g" -e "s/ CLIENT / void /g" -e "s/SVCXPRT /void /g" -e "s/bool_t/uint32_t/g" >> libnfs-raw-nfs.h
cat nfs.x | head -29 >libnfs-raw-nfs.c
rpcgen -c nfs.x | sed -e "s/#include \".*nfs.h\"/#include \"libnfs-xdr.h\"\n#include \"libnfs-raw-nfs.h\"/" -e "s/xdr/zdr/g" -e "s/XDR/ZDR/g" -e "s/register int32_t \*buf;/register int32_t *buf;\n buf = NULL;/" -e "s/bool_t/uint32_t/g" >> libnfs-raw-nfs.c
register int32_t *buf;
buf = NULL;
- if (!zdr_u_quad_t (zdrs, objp))
+ if (!zdr_uint64_t (zdrs, objp))
return FALSE;
return TRUE;
}
register int32_t *buf;
buf = NULL;
- if (!zdr_u_quad_t (zdrs, objp))
+ if (!zdr_uint64_t (zdrs, objp))
return FALSE;
return TRUE;
}
register int32_t *buf;
buf = NULL;
- if (!zdr_u_quad_t (zdrs, objp))
+ if (!zdr_uint64_t (zdrs, objp))
return FALSE;
return TRUE;
}
return FALSE;
if (!zdr_specdata3 (zdrs, &objp->rdev))
return FALSE;
- if (!zdr_u_quad_t (zdrs, &objp->fsid))
+ if (!zdr_uint64_t (zdrs, &objp->fsid))
return FALSE;
if (!zdr_fileid3 (zdrs, &objp->fileid))
return FALSE;
register int32_t *buf;
buf = NULL;
- if (!zdr_u_quad_t (zdrs, objp))
+ if (!zdr_uint64_t (zdrs, objp))
return FALSE;
return TRUE;
}
#define NFS3_CREATEVERFSIZE 8
#define NFS3_COOKIEVERFSIZE 8
-#if defined(ANDROID)
-typedef long long int quad_t;
-typedef long long unsigned u_quad_t;
-#endif
-#if defined(WIN32)
-typedef long long int quad_t;
-typedef long long unsigned u_quad_t;
-#endif
+
typedef char cookieverf3[NFS3_COOKIEVERFSIZE];
-typedef u_quad_t cookie3;
+typedef uint64_t cookie3;
struct nfs_fh3 {
struct {
typedef u_int gid3;
-typedef u_quad_t size3;
+typedef uint64_t size3;
-typedef u_quad_t fileid3;
+typedef uint64_t fileid3;
struct specdata3 {
u_int specdata1;
size3 size;
size3 used;
specdata3 rdev;
- u_quad_t fsid;
+ uint64_t fsid;
fileid3 fileid;
nfstime3 atime;
nfstime3 mtime;
};
typedef enum stable_how stable_how;
-typedef u_quad_t offset3;
+typedef uint64_t offset3;
typedef u_int count3;
typedef opaque cookieverf3[NFS3_COOKIEVERFSIZE];
-typedef u_quad_t cookie3;
+typedef uint64_t cookie3;
struct nfs_fh3 {
opaque data<NFS3_FHSIZE>;
typedef unsigned int gid3;
-typedef u_quad_t size3;
+typedef uint64_t size3;
-typedef u_quad_t fileid3;
+typedef uint64_t fileid3;
struct specdata3 {
unsigned int specdata1;
size3 size;
size3 used;
specdata3 rdev;
- u_quad_t fsid;
+ uint64_t fsid;
fileid3 fileid;
nfstime3 atime;
nfstime3 mtime;
FILE_SYNC = 2
};
-typedef u_quad_t offset3;
+typedef uint64_t offset3;
typedef unsigned int count3;
return FALSE;
if (!zdr_nlm4_oh (zdrs, &objp->oh))
return FALSE;
- if (!zdr_u_quad_t (zdrs, &objp->l_offset))
+ if (!zdr_uint64_t (zdrs, &objp->l_offset))
return FALSE;
- if (!zdr_u_quad_t (zdrs, &objp->l_len))
+ if (!zdr_uint64_t (zdrs, &objp->l_len))
return FALSE;
return TRUE;
}
return FALSE;
if (!zdr_u_int (zdrs, &objp->svid))
return FALSE;
- if (!zdr_u_quad_t (zdrs, &objp->l_offset))
+ if (!zdr_uint64_t (zdrs, &objp->l_offset))
return FALSE;
- if (!zdr_u_quad_t (zdrs, &objp->l_len))
+ if (!zdr_uint64_t (zdrs, &objp->l_len))
return FALSE;
return TRUE;
}
uint32_t exclusive;
u_int svid;
nlm4_oh oh;
- u_quad_t l_offset;
- u_quad_t l_len;
+ uint64_t l_offset;
+ uint64_t l_len;
};
typedef struct nlm4_holder nlm4_holder;
#define NLM_MAXNAME 256
struct nlm_fh4 fh;
nlm4_oh oh;
u_int svid;
- u_quad_t l_offset;
- u_quad_t l_len;
+ uint64_t l_offset;
+ uint64_t l_len;
};
typedef struct nlm4_lock nlm4_lock;
bool exclusive;
unsigned int svid;
nlm4_oh oh;
- u_quad_t l_offset;
- u_quad_t l_len;
+ uint64_t l_offset;
+ uint64_t l_len;
};
const NLM_MAXNAME = 256;
struct nlm_fh4 fh;
nlm4_oh oh;
unsigned int svid;
- u_quad_t l_offset;
- u_quad_t l_len;
+ uint64_t l_offset;
+ uint64_t l_len;
};
struct nlm4_share {