Uses PRIu64 to print 64 bit integers.

This commit is contained in:
Andrea Mazzoleni 2011-04-29 22:37:40 +02:00
parent 351beb96f3
commit 10511499aa
7 changed files with 20 additions and 16 deletions

View file

@ -23,7 +23,7 @@ AC_HEADER_STDC
AC_HEADER_DIRENT
AC_HEADER_TIME
AC_CHECK_HEADERS([fcntl.h stddef.h stdint.h stdlib.h string.h limits.h])
AC_CHECK_HEADERS([sys/time.h unistd.h getopt.h fnmatch.h io.h])
AC_CHECK_HEADERS([sys/time.h unistd.h getopt.h fnmatch.h io.h inttypes.h])
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST

View file

@ -166,7 +166,7 @@ int handle_create(struct snapraid_handle* handle, struct snapraid_file* file)
/* return the warning condition of a larger file */
if (handle->st.st_size > file->size) {
fprintf(stderr, "File '%s' truncated to size %llu.\n", handle->path, file->size);
fprintf(stderr, "File '%s' truncated to size %"PRIu64".\n", handle->path, file->size);
return 1;
}

View file

@ -78,16 +78,16 @@ int parity_create(const char* path, data_off_t size)
#endif
if (ret != 0) {
if (errno == ENOSPC) {
fprintf(stderr, "Failed to grow parity file '%s' to size %llu due lack of space.\n", path, size);
fprintf(stderr, "Failed to grow parity file '%s' to size %"PRIu64" due lack of space.\n", path, size);
} else {
fprintf(stderr, "Error growing parity file '%s' to size %llu. Do you have enough space? %s.\n", path, size, strerror(errno));
fprintf(stderr, "Error growing parity file '%s' to size %"PRIu64". Do you have enough space? %s.\n", path, size, strerror(errno));
}
goto bail;
}
} else if (st.st_size > size) {
ret = ftruncate(f, size);
if (ret != 0) {
fprintf(stderr, "Error truncating parity file '%s' to size %llu. %s.\n", path, size, strerror(errno));
fprintf(stderr, "Error truncating parity file '%s' to size %"PRIu64". %s.\n", path, size, strerror(errno));
goto bail;
}
}

View file

@ -46,6 +46,10 @@
#include <stdint.h>
#endif
#if HAVE_INTTYPES_H
#include <inttypes.h>
#endif
#if HAVE_UNISTD_H
#include <unistd.h>
#endif

2
scan.c
View file

@ -128,7 +128,7 @@ static void scan_file(struct snapraid_scan* scan, struct snapraid_state* state,
printf("warning: Ignored hardlink '/%s'\n", sub);
return;
} else {
fprintf(stderr, "Internal inode '%llu' inconsistency for file '%s'\n", inode, sub);
fprintf(stderr, "Internal inode '%"PRIu64"' inconsistency for file '%s'\n", inode, sub);
exit(EXIT_FAILURE);
}
}

18
speed.c
View file

@ -85,7 +85,7 @@ void speed(void)
}
} SPEED_STOP
printf("memset %llu [MB/s]\n", ds / dt);
printf("memset %"PRIu64" [MB/s]\n", ds / dt);
SPEED_START {
for(j=0;j<diskmax;++j) {
@ -93,7 +93,7 @@ void speed(void)
}
} SPEED_STOP
printf("MD5 %llu [MB/s]\n", ds / dt);
printf("MD5 %"PRIu64" [MB/s]\n", ds / dt);
SPEED_START {
for(j=0;j<diskmax;++j) {
@ -101,14 +101,14 @@ void speed(void)
}
} SPEED_STOP
printf("Murmur3 %llu [MB/s]\n", ds / dt);
printf("Murmur3 %"PRIu64" [MB/s]\n", ds / dt);
count = 0;
SPEED_START {
raid5_int32r2(buffer, diskmax, block_size);
} SPEED_STOP
printf("RAID5 int32x2 %llu [MB/s]\n", ds / dt);
printf("RAID5 int32x2 %"PRIu64" [MB/s]\n", ds / dt);
#if defined(__i386__) || defined(__x86_64__)
if (cpu_has_mmx()) {
@ -116,7 +116,7 @@ void speed(void)
raid5_mmxr2(buffer, diskmax, block_size);
} SPEED_STOP
printf("RAID5 mmxx2 %llu [MB/s]\n", ds / dt);
printf("RAID5 mmxx2 %"PRIu64" [MB/s]\n", ds / dt);
}
if (cpu_has_sse2()) {
@ -124,7 +124,7 @@ void speed(void)
raid5_sse2r2(buffer, diskmax, block_size);
} SPEED_STOP
printf("RAID5 sse2x2 %llu [MB/s]\n", ds / dt);
printf("RAID5 sse2x2 %"PRIu64" [MB/s]\n", ds / dt);
}
#endif
@ -132,7 +132,7 @@ void speed(void)
raid6_int32r2(buffer, diskmax, block_size);
} SPEED_STOP
printf("RAID6 int32x2 %llu [MB/s]\n", ds / dt);
printf("RAID6 int32x2 %"PRIu64" [MB/s]\n", ds / dt);
#if defined(__i386__) || defined(__x86_64__)
if (cpu_has_mmx()) {
@ -140,7 +140,7 @@ void speed(void)
raid6_mmxr2(buffer, diskmax, block_size);
} SPEED_STOP
printf("RAID6 mmxx2 %llu [MB/s]\n", ds / dt);
printf("RAID6 mmxx2 %"PRIu64" [MB/s]\n", ds / dt);
}
if (cpu_has_sse2()) {
@ -148,7 +148,7 @@ void speed(void)
raid6_sse2r2(buffer, diskmax, block_size);
} SPEED_STOP
printf("RAID6 sse2x2 %llu [MB/s]\n", ds / dt);
printf("RAID6 sse2x2 %"PRIu64" [MB/s]\n", ds / dt);
}
#endif

View file

@ -489,7 +489,7 @@ static void state_write_one(struct snapraid_state* state, const char* path, unsi
mtime = file->mtime;
inode = file->inode,
ret = fprintf(f,"file %s %llu %llu %llu %s\n", disk->name, size, mtime, inode, file->sub);
ret = fprintf(f,"file %s %"PRIu64" %"PRIu64" %"PRIu64" %s\n", disk->name, size, mtime, inode, file->sub);
if (ret < 0) {
fprintf(stderr, "Error writing the content file '%s' in fprintf(). %s.\n", tmp, strerror(errno));
exit(EXIT_FAILURE);