Hi... Please try this patch, it should fix seek-everything forever. If it's ok tell me, I'll test myself and upload ASAP. You can get the .deb with the fix in the meantime from http://rover.thehackers.org/lphdisk/
Salud, -- Roberto Lumbreras .''`. <rover : :' : debian.org> Debian Developer `. `' `-
diff -urN lphdisk-0.9.1-2/lphdisk.c lphdisk-0.9.1/lphdisk.c --- lphdisk-0.9.1-2/lphdisk.c 2006-10-23 19:23:21.710807000 +0200 +++ lphdisk-0.9.1/lphdisk.c 2006-11-29 10:33:08.856895515 +0100 @@ -19,8 +19,10 @@ Be careful! */ +#define _LARGEFILE64_SOURCE #include <stdio.h> #include <stdlib.h> +#include <sys/types.h> #include <unistd.h> #include <string.h> #include <stdarg.h> @@ -100,57 +102,6 @@ /* General Purpose Utility Routines */ /*****************************************************************************/ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* The following is a hack to take advantage of the ext2 "_llseek" system */ -/* call to do seeks to "long long" offsets under linux (this is needed to */ -/* seek to sectors beyond 4194303 (2GB)). This isn't directly supported by */ -/* glibc, so we need to make our own interface function for it. We should */ -/* be able to get the SYS__llseek define from sys/syscall.h. From this we */ -/* can construct a wrapper to perform the right system call. */ - -#include <sys/syscall.h> /* for SYS__llseek */ - -typedef long long lloff_t; - -#ifdef SYS__llseek - -#define _llseek(fd, offset_high, offset_low, result, origin) \ - syscall(SYS__llseek, fd, offset_high, offset_low, result, origin) - -lloff_t llseek (unsigned int fd, lloff_t offset, unsigned int origin) { - lloff_t result; - int retval; - - retval = _llseek (fd, ((unsigned long long) offset) >> 32, - ((unsigned long long) offset) & 0xffffffff, - &result, origin); - return (retval == -1 ? (lloff_t) retval : result); -} - -#else /* SYS__llseek */ - -/* Somehow, SYS__llseek wasn't in sys/syscall.h. This shouldn't ever */ -/* happen, but better safe than sorry.. The best we can do is emulate it */ -/* with lseek, and hope we don't get an offset that's too large (throw an */ -/* error if we do) */ - -lloff_t llseek (unsigned int fd, lloff_t offset, unsigned int origin) { - off_t offt_offset = (off_t) offset; - - if ((lloff_t)offt_offset != offset) { - /* converting to off_t and back yields different result, indicating an */ - /* overflow.. */ - errno = EINVAL; - return -1; - } else { - return lseek(fd, offt_offset, origin); - } -} - -#endif /* SYS__llseek */ - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - #define get16(p) get_int_le(p,2) #define get32(p) get_int_le(p,4) @@ -188,9 +139,9 @@ /* success, nonzero on error. */ int seek_sector (int fd, size_t secno) { - lloff_t offset = (lloff_t) secno * SECTOR_SIZE; + off64_t offset = (off64_t) secno * SECTOR_SIZE; - if (llseek(fd, offset, SEEK_SET) == (lloff_t) -1) + if (lseek64(fd, offset, SEEK_SET) == (off64_t) -1) return -1; return 0;