{
struct nfs_context *nfs;
int i, ret;
- off_t offset;
+ uint64_t offset;
struct client client;
struct stat st;
struct nfsfh *nfsfh;
struct rpc_fragment {
struct rpc_fragment *next;
- size_t size;
+ uint64_t size;
char *data;
};
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);
* 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
* 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
/*
* 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);
/*
* -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);
* -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);
* -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);
/*
* -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);
/*
*
* 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);
/*
* -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);
* -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);
//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);
}
}
-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;
struct sync_cb_data {
int is_finished;
int status;
- off_t offset;
+ uint64_t offset;
void *return_data;
int return_int;
};
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;
/*
* 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);
}
}
}
-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;
/*
* 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);
}
}
}
-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;
}
}
-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;
}
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;
struct nfsfh {
struct nfs_fh3 fh;
int is_sync;
- off_t offset;
+ uint64_t offset;
};
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)
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);
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;
}
while (count > 0) {
- size_t readcount = count;
+ uint64_t readcount = count;
struct nfs_mcb_data *mdata;
if (readcount > nfs_get_readmax(nfs)) {
/*
* 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);
}
}
-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;
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)) {
/*
* 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);
}
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;
*/
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;
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;
struct lseek_cb_data {
struct nfs_context *nfs;
struct nfsfh *nfsfh;
- off_t offset;
+ uint64_t offset;
nfs_cb cb;
void *private_data;
};
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;
//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;
}
/*
* 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;
}
/*
* 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) {
/* 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);
static int rpc_write_to_socket(struct rpc_context *rpc)
{
- ssize_t count;
+ int64_t count;
if (rpc == NULL) {
return -1;
}
while (rpc->outqueue != NULL) {
- ssize_t total;
+ int64_t total;
total = rpc->outqueue->outdata.size;
int available;
int size;
int pdu_size;
- ssize_t count;
+ int64_t count;
#if defined(WIN32)
if (ioctlsocket(rpc->fd, FIONREAD, &available) != 0) {
-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;
}
-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;