#define SETBIT(ARRAY, N) ((ARRAY)[(N)/8] |= (1 << ((N)%8)))
#define BITVAL(ARRAY, N) ((ARRAY)[(N)/8] & (1 << ((N)%8)))
-off64_t filesize;
-int blocksize;
+__uint64_t filesize;
+unsigned int blocksize;
int count;
int verbose;
int wsync;
int extsize;
int preserve;
int test;
-off64_t fileoffset;
+__uint64_t fileoffset;
struct dioattr diob;
struct fsxattr rtattr;
int findblock(void);
void writeblks(int fd);
int readblks(int fd);
-void dumpblock(int *buffer, off64_t offset, int blocksize);
+void dumpblock(int *buffer, __uint64_t offset, int blocksize);
void
usage(char *progname)
char *filename = NULL;
int r;
- filesize = ((off64_t)256)*1024*1024;
+ filesize = ((__uint64_t)256)*1024*1024;
blocksize = 512;
count = filesize/blocksize;
verbose = 0;
void
writeblks(int fd)
{
- off64_t offset;
+ __uint64_t offset;
char *buffer;
int block;
struct flock64 fl;
fflush(stdout);
}
block = findblock();
- offset = (off64_t)block * blocksize;
+ offset = (__uint64_t)block * blocksize;
if (alloconly) {
if (test) continue;
exit(1);
}
}
- *(off64_t *)buffer = *(off64_t *)(buffer+256) =
+ *(__uint64_t *)buffer = *(__uint64_t *)(buffer+256) =
fileoffset + offset;
if (!test) {
if (write(fd, buffer, blocksize) < blocksize) {
if (verbose > 1) {
printf("writing data at offset=%llx, value 0x%llx and 0x%llx\n",
fileoffset + offset,
- *(off64_t *)buffer, *(off64_t *)(buffer+256));
+ *(__uint64_t *)buffer, *(__uint64_t *)(buffer+256));
}
}
int
readblks(int fd)
{
- long offset;
+ unsigned long offset;
char *buffer, *tmp;
- int xfer, block, i;
+ unsigned int xfer, block, i;
int err=0;
if (alloconly)
fflush(stdout);
}
if (BITVAL(valid, block) == 0) {
- if ((*(off64_t *)tmp != 0LL) ||
- (*(off64_t *)(tmp+256) != 0LL)) {
+ if ((*(__uint64_t *)tmp != 0LL) ||
+ (*(__uint64_t *)(tmp+256) != 0LL)) {
printf("mismatched data at offset=%llx, expected 0x%llx, got 0x%llx and 0x%llx\n",
fileoffset + block * blocksize,
0LL,
- *(off64_t *)tmp,
- *(off64_t *)(tmp+256));
+ *(__uint64_t *)tmp,
+ *(__uint64_t *)(tmp+256));
err++;
}
} else {
- if ( (*(off64_t *)tmp !=
+ if ( (*(__uint64_t *)tmp !=
fileoffset + block * blocksize) ||
- (*(off64_t *)(tmp+256) !=
+ (*(__uint64_t *)(tmp+256) !=
fileoffset + block * blocksize) ) {
printf("mismatched data at offset=%llx, expected 0x%llx, got 0x%llx and 0x%llx\n",
fileoffset + block * blocksize,
fileoffset + block * blocksize,
- *(off64_t *)tmp,
- *(off64_t *)(tmp+256));
+ *(__uint64_t *)tmp,
+ *(__uint64_t *)(tmp+256));
err++;
}
}
}
void
-dumpblock(int *buffer, off64_t offset, int blocksize)
+dumpblock(int *buffer, __uint64_t offset, int blocksize)
{
int i;