types: remove the [u_]quad type and replace with [u]int64
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>libnfs-4.0.0-vitalif
parent
8768f8cc2b
commit
bce63d849c
|
@ -230,11 +230,11 @@ bool_t libnfs_zdr_u_int(ZDR *zdrs, uint32_t *u);
|
|||
#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);
|
||||
|
|
|
@ -118,7 +118,7 @@ bool_t libnfs_zdr_int(ZDR *zdrs, int32_t *i)
|
|||
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;
|
||||
|
@ -145,9 +145,9 @@ bool_t libnfs_zdr_u_quad_t(ZDR *zdrs, uint64_t *u)
|
|||
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)
|
||||
|
|
|
@ -19,6 +19,6 @@ nfs-stamp : nfs.x
|
|||
|
||||
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
|
||||
|
|
|
@ -52,7 +52,7 @@ zdr_cookie3 (ZDR *zdrs, cookie3 *objp)
|
|||
register int32_t *buf;
|
||||
buf = NULL;
|
||||
|
||||
if (!zdr_u_quad_t (zdrs, objp))
|
||||
if (!zdr_uint64_t (zdrs, objp))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -142,7 +142,7 @@ zdr_size3 (ZDR *zdrs, size3 *objp)
|
|||
register int32_t *buf;
|
||||
buf = NULL;
|
||||
|
||||
if (!zdr_u_quad_t (zdrs, objp))
|
||||
if (!zdr_uint64_t (zdrs, objp))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -153,7 +153,7 @@ zdr_fileid3 (ZDR *zdrs, fileid3 *objp)
|
|||
register int32_t *buf;
|
||||
buf = NULL;
|
||||
|
||||
if (!zdr_u_quad_t (zdrs, objp))
|
||||
if (!zdr_uint64_t (zdrs, objp))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -206,7 +206,7 @@ zdr_fattr3 (ZDR *zdrs, fattr3 *objp)
|
|||
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;
|
||||
|
@ -268,7 +268,7 @@ zdr_offset3 (ZDR *zdrs, offset3 *objp)
|
|||
register int32_t *buf;
|
||||
buf = NULL;
|
||||
|
||||
if (!zdr_u_quad_t (zdrs, objp))
|
||||
if (!zdr_uint64_t (zdrs, objp))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -48,18 +48,11 @@ extern "C" {
|
|||
#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 {
|
||||
|
@ -94,9 +87,9 @@ typedef u_int uid3;
|
|||
|
||||
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;
|
||||
|
@ -119,7 +112,7 @@ struct fattr3 {
|
|||
size3 size;
|
||||
size3 used;
|
||||
specdata3 rdev;
|
||||
u_quad_t fsid;
|
||||
uint64_t fsid;
|
||||
fileid3 fileid;
|
||||
nfstime3 atime;
|
||||
nfstime3 mtime;
|
||||
|
@ -175,7 +168,7 @@ enum stable_how {
|
|||
};
|
||||
typedef enum stable_how stable_how;
|
||||
|
||||
typedef u_quad_t offset3;
|
||||
typedef uint64_t offset3;
|
||||
|
||||
typedef u_int count3;
|
||||
|
||||
|
|
10
nfs/nfs.x
10
nfs/nfs.x
|
@ -37,7 +37,7 @@ const NFS3_COOKIEVERFSIZE = 8;
|
|||
|
||||
typedef opaque cookieverf3[NFS3_COOKIEVERFSIZE];
|
||||
|
||||
typedef u_quad_t cookie3;
|
||||
typedef uint64_t cookie3;
|
||||
|
||||
struct nfs_fh3 {
|
||||
opaque data<NFS3_FHSIZE>;
|
||||
|
@ -66,9 +66,9 @@ typedef unsigned int uid3;
|
|||
|
||||
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;
|
||||
|
@ -89,7 +89,7 @@ struct fattr3 {
|
|||
size3 size;
|
||||
size3 used;
|
||||
specdata3 rdev;
|
||||
u_quad_t fsid;
|
||||
uint64_t fsid;
|
||||
fileid3 fileid;
|
||||
nfstime3 atime;
|
||||
nfstime3 mtime;
|
||||
|
@ -142,7 +142,7 @@ enum stable_how {
|
|||
FILE_SYNC = 2
|
||||
};
|
||||
|
||||
typedef u_quad_t offset3;
|
||||
typedef uint64_t offset3;
|
||||
|
||||
typedef unsigned int count3;
|
||||
|
||||
|
|
|
@ -91,9 +91,9 @@ zdr_nlm4_holder (ZDR *zdrs, nlm4_holder *objp)
|
|||
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;
|
||||
}
|
||||
|
@ -112,9 +112,9 @@ zdr_nlm4_lock (ZDR *zdrs, nlm4_lock *objp)
|
|||
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;
|
||||
}
|
||||
|
|
|
@ -79,8 +79,8 @@ struct nlm4_holder {
|
|||
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
|
||||
|
@ -90,8 +90,8 @@ struct nlm4_lock {
|
|||
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;
|
||||
|
||||
|
|
|
@ -54,8 +54,8 @@ struct nlm4_holder {
|
|||
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;
|
||||
|
@ -64,8 +64,8 @@ struct nlm4_lock {
|
|||
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 {
|
||||
|
|
Loading…
Reference in New Issue