is 64 bits use long long to get the totals right when transferring
more than 2^32 bytes of data.
- use inline on flist_up if the compiler supports it
extern int verbose;
extern int am_server;
extern int always_checksum;
extern int verbose;
extern int am_server;
extern int always_checksum;
-extern off_t total_size;
+extern int64 total_size;
-static off_t total_written;
-static off_t total_read;
+static int64 total_written;
+static int64 total_read;
extern int verbose;
extern int sparse_files;
extern int verbose;
extern int sparse_files;
{
return total_written;
}
{
return total_written;
}
-off_t read_longint(int f)
+int64 read_longint(int f)
{
extern int remote_version;
{
extern int remote_version;
char b[8];
ret = read_int(f);
char b[8];
ret = read_int(f);
- if (ret == -1 && remote_version >= 16) {
- if (sizeof(off_t) <= 4) {
- fprintf(FERROR,"Integer overflow - attempted 64 bit offset\n");
- exit_cleanup(1);
- }
+
+ if (ret != -1) return ret;
+
+#ifndef HAVE_LONGLONG
+ fprintf(FERROR,"Integer overflow - attempted 64 bit offset\n");
+ exit_cleanup(1);
+#else
+ if (remote_version >= 16) {
if ((ret=readfd(f,b,8)) != 8) {
if (verbose > 1)
fprintf(FERROR,"(%d) Error reading %d bytes : %s\n",
if ((ret=readfd(f,b,8)) != 8) {
if (verbose > 1)
fprintf(FERROR,"(%d) Error reading %d bytes : %s\n",
exit_cleanup(1);
}
total_read += 8;
exit_cleanup(1);
}
total_read += 8;
- ret = IVAL(b,0) | (((off_t)IVAL(b,4))<<32);
+ ret = IVAL(b,0) | (((int64)IVAL(b,4))<<32);
-void write_longint(int f, off_t x)
+void write_longint(int f, int64 x)
{
extern int remote_version;
char b[8];
{
extern int remote_version;
char b[8];
int verbose = 0;
int always_checksum = 0;
time_t starttime;
int verbose = 0;
int always_checksum = 0;
time_t starttime;
int block_size=BLOCK_SIZE;
char *backup_suffix = BACKUP_SUFFIX;
int block_size=BLOCK_SIZE;
char *backup_suffix = BACKUP_SUFFIX;
static void report(int f)
{
static void report(int f)
{
time_t t = time(NULL);
if (!verbose) return;
time_t t = time(NULL);
if (!verbose) return;
{
char *args[100];
int i,argc=0, ret;
{
char *args[100];
int i,argc=0, ret;
- char *tok,*p,*dir=NULL;
if (!local_server) {
if (!cmd)
if (!local_server) {
if (!cmd)
static int total_false_alarms;
static int total_tag_hits;
static int total_matches;
static int total_false_alarms;
static int total_tag_hits;
static int total_matches;
-static off_t total_data_transfer;
+static int64 total_data_transfer;
-off_t send_files(struct file_list *flist,int f_out,int f_in)
+void send_files(struct file_list *flist,int f_out,int f_in)
{
int fd;
struct sum_struct *s;
struct map_struct *buf;
struct stat st;
char fname[MAXPATHLEN];
{
int fd;
struct sum_struct *s;
struct map_struct *buf;
struct stat st;
char fname[MAXPATHLEN];
int i;
struct file_struct *file;
int phase = 0;
int i;
struct file_struct *file;
int phase = 0;
if (strlen(fname) == MAXPATHLEN-1) {
fprintf(FERROR, "send_files failed on long-named directory %s\n",
fname);
if (strlen(fname) == MAXPATHLEN-1) {
fprintf(FERROR, "send_files failed on long-named directory %s\n",
fname);
}
strcat(fname,"/");
offset = strlen(file->basedir)+1;
}
strcat(fname,"/");
offset = strlen(file->basedir)+1;
s = receive_sums(f_in);
if (!s) {
fprintf(FERROR,"receive_sums failed\n");
s = receive_sums(f_in);
if (!s) {
fprintf(FERROR,"receive_sums failed\n");
}
fd = open(fname,O_RDONLY);
}
fd = open(fname,O_RDONLY);
fprintf(FERROR,"fstat failed : %s\n",strerror(errno));
free_sums(s);
close(fd);
fprintf(FERROR,"fstat failed : %s\n",strerror(errno));
free_sums(s);
close(fd);
if (verbose > 2)
fprintf(FERROR,"sender finished %s\n",fname);
if (verbose > 2)
fprintf(FERROR,"sender finished %s\n",fname);
write_int(f_out,-1);
write_flush(f_out);
write_int(f_out,-1);
write_flush(f_out);
#define uint32 unsigned int32
#endif
#define uint32 unsigned int32
#endif
+#ifdef HAVE_LONGLONG
+#define int64 long long
+#else
+#define int64 off_t
+#endif
#ifndef MIN
#define MIN(a,b) ((a)<(b)?(a):(b))
#ifndef MIN
#define MIN(a,b) ((a)<(b)?(a):(b))
/* we need this function because of the silly way in which duplicate
entries are handled in the file lists - we can't change this
without breaking existing versions */
/* we need this function because of the silly way in which duplicate
entries are handled in the file lists - we can't change this
without breaking existing versions */
-static int flist_up(struct file_list *flist, int i)
+static inline int flist_up(struct file_list *flist, int i)
{
while (!flist->files[i]->basename) i++;
return i;
{
while (!flist->files[i]->basename) i++;
return i;