Remove all [s]size_t / off_t and replace with [u]int64_t making libnfs 64-bit pure

libnfs-4.0.0-vitalif
Ronnie Sahlberg 2011-11-27 14:49:08 +11:00
parent 1ec6b50aef
commit 183451cff5
10 changed files with 60 additions and 60 deletions

View File

@ -82,7 +82,7 @@ int main(int argc _U_, char *argv[] _U_)
{
struct nfs_context *nfs;
int i, ret;
off_t offset;
uint64_t offset;
struct client client;
struct stat st;
struct nfsfh *nfsfh;

View File

@ -19,7 +19,7 @@
struct rpc_fragment {
struct rpc_fragment *next;
size_t size;
uint64_t size;
char *data;
};
@ -101,6 +101,6 @@ struct sockaddr *rpc_get_recv_sockaddr(struct rpc_context *rpc);
void rpc_set_autoreconnect(struct rpc_context *rpc);
void rpc_unset_autoreconnect(struct rpc_context *rpc);
int rpc_add_fragment(struct rpc_context *rpc, char *data, size_t size);
int rpc_add_fragment(struct rpc_context *rpc, char *data, uint64_t size);
void rpc_free_all_fragments(struct rpc_context *rpc);

View File

@ -315,7 +315,7 @@ int rpc_nfs_access_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh,
* RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
* data is NULL.
*/
int rpc_nfs_read_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, off_t offset, size_t count, void *private_data);
int rpc_nfs_read_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, uint64_t offset, uint64_t count, void *private_data);
/*
* Call NFS/WRITE
@ -331,7 +331,7 @@ int rpc_nfs_read_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, o
* RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
* data is NULL.
*/
int rpc_nfs_write_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, char *buf, off_t offset, size_t count, int stable_how, void *private_data);
int rpc_nfs_write_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, char *buf, uint64_t offset, uint64_t count, int stable_how, void *private_data);
/*
* Call NFS/COMMIT

View File

@ -106,12 +106,12 @@ struct nfsfh;
/*
* Get the maximum supported READ3 size by the server
*/
EXTERN size_t nfs_get_readmax(struct nfs_context *nfs);
EXTERN uint64_t nfs_get_readmax(struct nfs_context *nfs);
/*
* Get the maximum supported WRITE3 size by the server
*/
EXTERN size_t nfs_get_writemax(struct nfs_context *nfs);
EXTERN uint64_t nfs_get_writemax(struct nfs_context *nfs);
/*
@ -267,14 +267,14 @@ EXTERN int nfs_close(struct nfs_context *nfs, struct nfsfh *nfsfh);
* -errno : An error occured.
* data is the error string.
*/
EXTERN int nfs_pread_async(struct nfs_context *nfs, struct nfsfh *nfsfh, off_t offset, size_t count, nfs_cb cb, void *private_data);
EXTERN int nfs_pread_async(struct nfs_context *nfs, struct nfsfh *nfsfh, uint64_t offset, uint64_t count, nfs_cb cb, void *private_data);
/*
* Sync pread()
* Function returns
* >=0 : numer of bytes read.
* -errno : An error occured.
*/
EXTERN int nfs_pread(struct nfs_context *nfs, struct nfsfh *nfsfh, off_t offset, size_t count, char *buf);
EXTERN int nfs_pread(struct nfs_context *nfs, struct nfsfh *nfsfh, uint64_t offset, uint64_t count, char *buf);
@ -295,14 +295,14 @@ EXTERN int nfs_pread(struct nfs_context *nfs, struct nfsfh *nfsfh, off_t offset,
* -errno : An error occured.
* data is the error string.
*/
EXTERN int nfs_read_async(struct nfs_context *nfs, struct nfsfh *nfsfh, size_t count, nfs_cb cb, void *private_data);
EXTERN int nfs_read_async(struct nfs_context *nfs, struct nfsfh *nfsfh, uint64_t count, nfs_cb cb, void *private_data);
/*
* Sync read()
* Function returns
* >=0 : numer of bytes read.
* -errno : An error occured.
*/
EXTERN int nfs_read(struct nfs_context *nfs, struct nfsfh *nfsfh, size_t count, char *buf);
EXTERN int nfs_read(struct nfs_context *nfs, struct nfsfh *nfsfh, uint64_t count, char *buf);
@ -323,14 +323,14 @@ EXTERN int nfs_read(struct nfs_context *nfs, struct nfsfh *nfsfh, size_t count,
* -errno : An error occured.
* data is the error string.
*/
EXTERN int nfs_pwrite_async(struct nfs_context *nfs, struct nfsfh *nfsfh, off_t offset, size_t count, char *buf, nfs_cb cb, void *private_data);
EXTERN int nfs_pwrite_async(struct nfs_context *nfs, struct nfsfh *nfsfh, uint64_t offset, uint64_t count, char *buf, nfs_cb cb, void *private_data);
/*
* Sync pwrite()
* Function returns
* >=0 : numer of bytes written.
* -errno : An error occured.
*/
EXTERN int nfs_pwrite(struct nfs_context *nfs, struct nfsfh *nfsfh, off_t offset, size_t count, char *buf);
EXTERN int nfs_pwrite(struct nfs_context *nfs, struct nfsfh *nfsfh, uint64_t offset, uint64_t count, char *buf);
/*
@ -349,14 +349,14 @@ EXTERN int nfs_pwrite(struct nfs_context *nfs, struct nfsfh *nfsfh, off_t offset
* -errno : An error occured.
* data is the error string.
*/
EXTERN int nfs_write_async(struct nfs_context *nfs, struct nfsfh *nfsfh, size_t count, char *buf, nfs_cb cb, void *private_data);
EXTERN int nfs_write_async(struct nfs_context *nfs, struct nfsfh *nfsfh, uint64_t count, char *buf, nfs_cb cb, void *private_data);
/*
* Sync write()
* Function returns
* >=0 : numer of bytes written.
* -errno : An error occured.
*/
EXTERN int nfs_write(struct nfs_context *nfs, struct nfsfh *nfsfh, size_t count, char *buf);
EXTERN int nfs_write(struct nfs_context *nfs, struct nfsfh *nfsfh, uint64_t count, char *buf);
/*
@ -371,18 +371,18 @@ EXTERN int nfs_write(struct nfs_context *nfs, struct nfsfh *nfsfh, size_t count,
*
* When the callback is invoked, status indicates the result:
* >=0 : Success.
* data is off_t * for the current position.
* data is uint64_t * for the current position.
* -errno : An error occured.
* data is the error string.
*/
EXTERN int nfs_lseek_async(struct nfs_context *nfs, struct nfsfh *nfsfh, off_t offset, int whence, nfs_cb cb, void *private_data);
EXTERN int nfs_lseek_async(struct nfs_context *nfs, struct nfsfh *nfsfh, uint64_t offset, int whence, nfs_cb cb, void *private_data);
/*
* Sync lseek()
* Function returns
* >=0 : numer of bytes read.
* -errno : An error occured.
*/
EXTERN int nfs_lseek(struct nfs_context *nfs, struct nfsfh *nfsfh, off_t offset, int whence, off_t *current_offset);
EXTERN int nfs_lseek(struct nfs_context *nfs, struct nfsfh *nfsfh, uint64_t offset, int whence, uint64_t *current_offset);
/*
@ -426,14 +426,14 @@ EXTERN int nfs_fsync(struct nfs_context *nfs, struct nfsfh *nfsfh);
* -errno : An error occured.
* data is the error string.
*/
EXTERN int nfs_truncate_async(struct nfs_context *nfs, const char *path, off_t length, nfs_cb cb, void *private_data);
EXTERN int nfs_truncate_async(struct nfs_context *nfs, const char *path, uint64_t length, nfs_cb cb, void *private_data);
/*
* Sync truncate()
* Function returns
* 0 : Success
* -errno : An error occured.
*/
EXTERN int nfs_truncate(struct nfs_context *nfs, const char *path, off_t length);
EXTERN int nfs_truncate(struct nfs_context *nfs, const char *path, uint64_t length);
@ -452,14 +452,14 @@ EXTERN int nfs_truncate(struct nfs_context *nfs, const char *path, off_t length)
* -errno : An error occured.
* data is the error string.
*/
EXTERN int nfs_ftruncate_async(struct nfs_context *nfs, struct nfsfh *nfsfh, off_t length, nfs_cb cb, void *private_data);
EXTERN int nfs_ftruncate_async(struct nfs_context *nfs, struct nfsfh *nfsfh, uint64_t length, nfs_cb cb, void *private_data);
/*
* Sync ftruncate()
* Function returns
* 0 : Success
* -errno : An error occured.
*/
EXTERN int nfs_ftruncate(struct nfs_context *nfs, struct nfsfh *nfsfh, off_t length);
EXTERN int nfs_ftruncate(struct nfs_context *nfs, struct nfsfh *nfsfh, uint64_t length);
@ -1013,7 +1013,7 @@ EXTERN void mount_free_export_list(struct exportnode *exports);
//qqq replace later with lseek(cur, 0)
off_t nfs_get_current_offset(struct nfsfh *nfsfh);
uint64_t nfs_get_current_offset(struct nfsfh *nfsfh);

View File

@ -138,7 +138,7 @@ void rpc_free_all_fragments(struct rpc_context *rpc)
}
}
int rpc_add_fragment(struct rpc_context *rpc, char *data, size_t size)
int rpc_add_fragment(struct rpc_context *rpc, char *data, uint64_t size)
{
struct rpc_fragment *fragment;

View File

@ -56,7 +56,7 @@
struct sync_cb_data {
int is_finished;
int status;
off_t offset;
uint64_t offset;
void *return_data;
int return_int;
};
@ -248,7 +248,7 @@ static void pread_cb(int status, struct nfs_context *nfs, void *data, void *priv
memcpy(buffer, (char *)data, status);
}
int nfs_pread(struct nfs_context *nfs, struct nfsfh *nfsfh, off_t offset, size_t count, char *buffer)
int nfs_pread(struct nfs_context *nfs, struct nfsfh *nfsfh, uint64_t offset, uint64_t count, char *buffer)
{
struct sync_cb_data cb_data;
@ -268,7 +268,7 @@ int nfs_pread(struct nfs_context *nfs, struct nfsfh *nfsfh, off_t offset, size_t
/*
* read()
*/
int nfs_read(struct nfs_context *nfs, struct nfsfh *nfsfh, size_t count, char *buffer)
int nfs_read(struct nfs_context *nfs, struct nfsfh *nfsfh, uint64_t count, char *buffer)
{
return nfs_pread(nfs, nfsfh, nfs_get_current_offset(nfsfh), count, buffer);
}
@ -343,7 +343,7 @@ static void pwrite_cb(int status, struct nfs_context *nfs, void *data, void *pri
}
}
int nfs_pwrite(struct nfs_context *nfs, struct nfsfh *nfsfh, off_t offset, size_t count, char *buf)
int nfs_pwrite(struct nfs_context *nfs, struct nfsfh *nfsfh, uint64_t offset, uint64_t count, char *buf)
{
struct sync_cb_data cb_data;
@ -362,7 +362,7 @@ int nfs_pwrite(struct nfs_context *nfs, struct nfsfh *nfsfh, off_t offset, size_
/*
* write()
*/
int nfs_write(struct nfs_context *nfs, struct nfsfh *nfsfh, size_t count, char *buf)
int nfs_write(struct nfs_context *nfs, struct nfsfh *nfsfh, uint64_t count, char *buf)
{
return nfs_pwrite(nfs, nfsfh, nfs_get_current_offset(nfsfh), count, buf);
}
@ -417,7 +417,7 @@ static void ftruncate_cb(int status, struct nfs_context *nfs, void *data, void *
}
}
int nfs_ftruncate(struct nfs_context *nfs, struct nfsfh *nfsfh, off_t length)
int nfs_ftruncate(struct nfs_context *nfs, struct nfsfh *nfsfh, uint64_t length)
{
struct sync_cb_data cb_data;
@ -450,7 +450,7 @@ static void truncate_cb(int status, struct nfs_context *nfs, void *data, void *p
}
}
int nfs_truncate(struct nfs_context *nfs, const char *path, off_t length)
int nfs_truncate(struct nfs_context *nfs, const char *path, uint64_t length)
{
struct sync_cb_data cb_data;
@ -698,11 +698,11 @@ static void lseek_cb(int status, struct nfs_context *nfs, void *data, void *priv
}
if (cb_data->return_data != NULL) {
memcpy(cb_data->return_data, data, sizeof(off_t));
memcpy(cb_data->return_data, data, sizeof(uint64_t));
}
}
int nfs_lseek(struct nfs_context *nfs, struct nfsfh *nfsfh, off_t offset, int whence, off_t *current_offset)
int nfs_lseek(struct nfs_context *nfs, struct nfsfh *nfsfh, uint64_t offset, int whence, uint64_t *current_offset)
{
struct sync_cb_data cb_data;

View File

@ -51,7 +51,7 @@ struct nfsdir {
struct nfsfh {
struct nfs_fh3 fh;
int is_sync;
off_t offset;
uint64_t offset;
};
struct nfs_context {
@ -59,8 +59,8 @@ struct nfs_context {
char *server;
char *export;
struct nfs_fh3 rootfh;
size_t readmax;
size_t writemax;
uint64_t readmax;
uint64_t writemax;
};
void nfs_free_nfsdir(struct nfsdir *nfsdir)
@ -98,14 +98,14 @@ struct nfs_cb_data {
int error;
int cancel;
int num_calls;
off_t start_offset, max_offset;
uint64_t start_offset, max_offset;
char *buffer;
};
struct nfs_mcb_data {
struct nfs_cb_data *data;
off_t offset;
size_t count;
uint64_t offset;
uint64_t count;
};
static int nfs_lookup_path_async_internal(struct nfs_context *nfs, struct nfs_cb_data *data, struct nfs_fh3 *fh);
@ -934,7 +934,7 @@ static void nfs_pread_mcb(struct rpc_context *rpc _U_, int status, void *command
free(mdata);
}
int nfs_pread_async(struct nfs_context *nfs, struct nfsfh *nfsfh, off_t offset, size_t count, nfs_cb cb, void *private_data)
int nfs_pread_async(struct nfs_context *nfs, struct nfsfh *nfsfh, uint64_t offset, uint64_t count, nfs_cb cb, void *private_data)
{
struct nfs_cb_data *data;
@ -977,7 +977,7 @@ int nfs_pread_async(struct nfs_context *nfs, struct nfsfh *nfsfh, off_t offset,
}
while (count > 0) {
size_t readcount = count;
uint64_t readcount = count;
struct nfs_mcb_data *mdata;
if (readcount > nfs_get_readmax(nfs)) {
@ -1011,7 +1011,7 @@ int nfs_pread_async(struct nfs_context *nfs, struct nfsfh *nfsfh, off_t offset,
/*
* Async read()
*/
int nfs_read_async(struct nfs_context *nfs, struct nfsfh *nfsfh, size_t count, nfs_cb cb, void *private_data)
int nfs_read_async(struct nfs_context *nfs, struct nfsfh *nfsfh, uint64_t count, nfs_cb cb, void *private_data)
{
return nfs_pread_async(nfs, nfsfh, nfsfh->offset, count, cb, private_data);
}
@ -1110,7 +1110,7 @@ static void nfs_pwrite_mcb(struct rpc_context *rpc _U_, int status, void *comman
}
int nfs_pwrite_async(struct nfs_context *nfs, struct nfsfh *nfsfh, off_t offset, size_t count, char *buf, nfs_cb cb, void *private_data)
int nfs_pwrite_async(struct nfs_context *nfs, struct nfsfh *nfsfh, uint64_t offset, uint64_t count, char *buf, nfs_cb cb, void *private_data)
{
struct nfs_cb_data *data;
@ -1145,7 +1145,7 @@ int nfs_pwrite_async(struct nfs_context *nfs, struct nfsfh *nfsfh, off_t offset,
data->start_offset = offset;
while (count > 0) {
size_t writecount = count;
uint64_t writecount = count;
struct nfs_mcb_data *mdata;
if (writecount > nfs_get_writemax(nfs)) {
@ -1180,7 +1180,7 @@ int nfs_pwrite_async(struct nfs_context *nfs, struct nfsfh *nfsfh, off_t offset,
/*
* Async write()
*/
int nfs_write_async(struct nfs_context *nfs, struct nfsfh *nfsfh, size_t count, char *buf, nfs_cb cb, void *private_data)
int nfs_write_async(struct nfs_context *nfs, struct nfsfh *nfsfh, uint64_t count, char *buf, nfs_cb cb, void *private_data)
{
return nfs_pwrite_async(nfs, nfsfh, nfsfh->offset, count, buf, cb, private_data);
}
@ -1326,7 +1326,7 @@ static void nfs_ftruncate_cb(struct rpc_context *rpc _U_, int status, void *comm
free_nfs_cb_data(data);
}
int nfs_ftruncate_async(struct nfs_context *nfs, struct nfsfh *nfsfh, off_t length, nfs_cb cb, void *private_data)
int nfs_ftruncate_async(struct nfs_context *nfs, struct nfsfh *nfsfh, uint64_t length, nfs_cb cb, void *private_data)
{
struct nfs_cb_data *data;
SETATTR3args args;
@ -1362,7 +1362,7 @@ int nfs_ftruncate_async(struct nfs_context *nfs, struct nfsfh *nfsfh, off_t leng
*/
static int nfs_truncate_continue_internal(struct nfs_context *nfs, struct nfs_cb_data *data)
{
off_t offset = data->continue_int;
uint64_t offset = data->continue_int;
struct nfsfh nfsfh;
nfsfh.fh.data.data_val = data->fh.data.data_val;
@ -1378,9 +1378,9 @@ static int nfs_truncate_continue_internal(struct nfs_context *nfs, struct nfs_cb
return 0;
}
int nfs_truncate_async(struct nfs_context *nfs, const char *path, off_t length, nfs_cb cb, void *private_data)
int nfs_truncate_async(struct nfs_context *nfs, const char *path, uint64_t length, nfs_cb cb, void *private_data)
{
off_t offset;
uint64_t offset;
offset = length;
@ -2222,7 +2222,7 @@ void nfs_closedir(struct nfs_context *nfs _U_, struct nfsdir *nfsdir)
struct lseek_cb_data {
struct nfs_context *nfs;
struct nfsfh *nfsfh;
off_t offset;
uint64_t offset;
nfs_cb cb;
void *private_data;
};
@ -2257,7 +2257,7 @@ static void nfs_lseek_1_cb(struct rpc_context *rpc _U_, int status, void *comman
free(data);
}
int nfs_lseek_async(struct nfs_context *nfs, struct nfsfh *nfsfh, off_t offset, int whence, nfs_cb cb, void *private_data)
int nfs_lseek_async(struct nfs_context *nfs, struct nfsfh *nfsfh, uint64_t offset, int whence, nfs_cb cb, void *private_data)
{
struct lseek_cb_data *data;
@ -3286,7 +3286,7 @@ int nfs_link_async(struct nfs_context *nfs, const char *oldpath, const char *new
//qqq replace later with lseek()
off_t nfs_get_current_offset(struct nfsfh *nfsfh)
uint64_t nfs_get_current_offset(struct nfsfh *nfsfh)
{
return nfsfh->offset;
}
@ -3296,7 +3296,7 @@ off_t nfs_get_current_offset(struct nfsfh *nfsfh)
/*
* Get the maximum supported READ3 size by the server
*/
size_t nfs_get_readmax(struct nfs_context *nfs)
uint64_t nfs_get_readmax(struct nfs_context *nfs)
{
return nfs->readmax;
}
@ -3304,7 +3304,7 @@ size_t nfs_get_readmax(struct nfs_context *nfs)
/*
* Get the maximum supported WRITE3 size by the server
*/
size_t nfs_get_writemax(struct nfs_context *nfs)
uint64_t nfs_get_writemax(struct nfs_context *nfs)
{
/* Some XDR libraries can not marshall PDUs bigger than this */
if (nfs->writemax < 32768) {

View File

@ -235,7 +235,7 @@ int rpc_process_pdu(struct rpc_context *rpc, char *buf, int size)
/* reassembly */
if (recordmarker != 0 && rpc->fragments != NULL) {
struct rpc_fragment *fragment;
size_t total = size - 4;
uint64_t total = size - 4;
char *ptr;
xdr_destroy(&xdr);

View File

@ -90,7 +90,7 @@ int rpc_which_events(struct rpc_context *rpc)
static int rpc_write_to_socket(struct rpc_context *rpc)
{
ssize_t count;
int64_t count;
if (rpc == NULL) {
return -1;
@ -101,7 +101,7 @@ static int rpc_write_to_socket(struct rpc_context *rpc)
}
while (rpc->outqueue != NULL) {
ssize_t total;
int64_t total;
total = rpc->outqueue->outdata.size;
@ -134,7 +134,7 @@ static int rpc_read_from_socket(struct rpc_context *rpc)
int available;
int size;
int pdu_size;
ssize_t count;
int64_t count;
#if defined(WIN32)
if (ioctlsocket(rpc->fd, FIONREAD, &available) != 0) {

View File

@ -215,7 +215,7 @@ int rpc_nfs_access_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh,
int rpc_nfs_read_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, off_t offset, size_t count, void *private_data)
int rpc_nfs_read_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, uint64_t offset, uint64_t count, void *private_data)
{
struct rpc_pdu *pdu;
READ3args args;
@ -247,7 +247,7 @@ int rpc_nfs_read_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, o
}
int rpc_nfs_write_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, char *buf, off_t offset, size_t count, int stable_how, void *private_data)
int rpc_nfs_write_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, char *buf, uint64_t offset, uint64_t count, int stable_how, void *private_data)
{
struct rpc_pdu *pdu;
WRITE3args args;