Ulrich Weigand wrote: > Strange. Could you try running this simple test program? > I'm able to access all of my 20Gb harddisk this way, even > under my ancient 2.0.36 kernel ... > off = llseek( fd, target, SEEK_SET ); I turned on compiler warnings, and not only was llseek not defined, but the linker warned against its use and suggested using lseek64. > if ( count != 0x100 ); Oops, there is an extra semicolon at the end of that statement. I modified this small program, and added some notes. I use a command line define to force the library calls to use the 64bit variants implicitly. Program is attached. I would suggest that we do it this way, for those files which need 64-bit access. -Kevin -- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Kevin Lawton [EMAIL PROTECTED] MandrakeSoft, Inc. Plex86 developer http://www.linux-mandrake.com/ http://www.plex86.org/
/* Compile the file with the following command: * * gcc -Wall -D_FILE_OFFSET_BITS=64 fileio64.c * * This compiles with off_t of size 64bits, and redirects * IO library calls to 64bit variants. If you want to access * the 64bit extensions directly, you can use * * -D_LARGEFILE64_SOURCE * * and then call open64(), lseek64(), etc directly. */ #include <unistd.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <stdio.h> int main( void ) { char buf[0x100]; int fd; off_t off, target; ssize_t count; printf("sizeof(off_t) is %u bytes\n", sizeof(off_t)); target = (loff_t)(1ULL << 32); fd = open("/dev/hda", O_RDONLY /* I wasn't sure if you still need to pass O_LARGEFILE to * open, even when the compile options are turning on 64-bit * library translations? Is this needed when opening files, * rather than filesystems? */ #if 0 #ifdef O_LARGEFILE | O_LARGEFILE #endif #endif ); if ( fd < 0 ) { perror( "open" ); exit( 1 ); } off = lseek(fd, target, SEEK_SET); if ( off != target ) { fprintf(stderr, "llseek FAILED: requested=0x%llx, got=0x%llx\n", target, off); exit( 1 ); } fprintf(stderr, "lseek() succeeded\n"); count = read( fd, buf, 0x100 ); if ( count != 0x100 ) { fprintf(stderr, "read FAILED: requested=%u, got=%u\n", 0x100, count); exit( 1 ); } fprintf(stderr, "read() succeeded\n"); fprintf(stderr, "All operations OK\n"); return 0; }