From d244bcf3de7b71412e8ac3cdb6a36cb322e94b83 Mon Sep 17 00:00:00 2001 From: adilger Date: Wed, 14 Sep 2005 21:18:37 +0000 Subject: [PATCH] Branch b1_4 Use 64-bit variable for libsysio lseek64() internal return value. Update liblustre sanity.c to use 64-bit IO functions where needed. b=7279 --- lustre/liblustre/tests/sanity.c | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/lustre/liblustre/tests/sanity.c b/lustre/liblustre/tests/sanity.c index 3c69224..5b15f03 100644 --- a/lustre/liblustre/tests/sanity.c +++ b/lustre/liblustre/tests/sanity.c @@ -22,6 +22,7 @@ */ #define _BSD_SOURCE +#define _FILE_OFFSET_BITS 64 #include #include @@ -745,7 +746,7 @@ int t23(char *name) long long ret; loff_t off; - ENTRY("handle lseek > 2GB"); + ENTRY("handle seek > 2GB"); snprintf(path, MAX_PATH_LENGTH, "%s/f%s", lustre_path, name); fd = open(path, O_WRONLY | O_CREAT | O_LARGEFILE, 0666); @@ -766,18 +767,26 @@ int t23(char *name) if (ret != buf_size) { printf("write error for %d != %llubytes @ %llu\n", buf_size, ret, (long long)off); + if (ret == -1) + perror("write"); return -1; } ret = lseek(fd, off, SEEK_SET); if (ret != off) { - printf("seek error for %llu != %llu\n", ret, (long long)off); + printf("seek < 2GB error for %llu != %llu\n", + ret, (long long)off); + if (ret == -1) + perror("seek < 2GB"); return -1; } ret = lseek(fd, off + buf_size - 2, SEEK_SET); if (ret != off + buf_size - 2) { - printf("seek error for %llu != %llu\n", ret, (long long)off); + printf("seek > 2GB error for %llu != %llu\n", + ret, (long long)off); + if (ret == -1) + perror("seek > 2GB"); return -1; } @@ -785,6 +794,8 @@ int t23(char *name) if (ret != off) { printf("relative seek error for %d %llu != %llu\n", -buf_size + 2, ret, off); + if (ret == -1) + perror("relative seek"); return -1; } @@ -792,20 +803,25 @@ int t23(char *name) if (ret != off + buf_size) { printf("end seek error for %llu != %llu\n", ret, (long long)off + buf_size); + if (ret == -1) + perror("end seek"); return -1; } ret = lseek(fd, 0, SEEK_SET); if (ret != 0) { - printf("seek 0 error for %llu != 0\n", - ret); + printf("seek 0 error for %llu != 0\n", ret); + if (ret == -1) + perror("seek 0"); return -1; } off = 2048ULL * 1024 * 1024, SEEK_SET; ret = lseek(fd, off, SEEK_SET); if (ret != off) { - printf("seek error for %llu != %llu\n", ret, off); + printf("seek 2GB error for %llu != %llu\n", ret, off); + if (ret == -1) + perror("seek 2GB"); return -1; } -- 1.8.3.1