tags 309655 +pending
thanks

On Wed, May 18, 2005 at 06:30:53PM +0200, Marc Lehmann wrote:
> Package: e2fsprogs
> Version: 1.37-2
> Followup-For: Bug #309655
> 
> further inspection shows that the kernel seems to expect "int"'s for both
> FIBMAP and FGETBSZ, instead of long, which explains the spurious data in
> the high bits: they are never written by the kernel.

Thanks for pointing this out.  I've applied the following patch in my
development sources....

                                                - Ted

diff -Nru a/misc/ChangeLog b/misc/ChangeLog
--- a/misc/ChangeLog    2005-05-20 23:11:33 -04:00
+++ b/misc/ChangeLog    2005-05-20 23:11:33 -04:00
@@ -1,3 +1,11 @@
+2005-05-20  Theodore Ts'o  <[EMAIL PROTECTED]>
+
+       * filefrag.c (frag_report, get_bmap): The FIBMAP and FIGETBSZ
+               ioctls return an integer, not an unsigned long.  Fix this
+               to avoid problems on 64-bit platforms where the size of an
+               integer != the size of a long.  (Addresses Debian Bug
+               #309655)
+
 2005-05-09  Theodore Ts'o  <[EMAIL PROTECTED]>
 
        * util.c (figure_journal_size): Change the default journal size to
diff -Nru a/misc/filefrag.c b/misc/filefrag.c
--- a/misc/filefrag.c   2005-05-20 23:11:33 -04:00
+++ b/misc/filefrag.c   2005-05-20 23:11:33 -04:00
@@ -50,10 +50,10 @@
 static unsigned long get_bmap(int fd, unsigned long block)
 {
        int     ret;
-       unsigned long b;
+       unsigned int b;
 
        b = block;
-       ret = ioctl(fd, FIBMAP, &b);
+       ret = ioctl(fd, FIBMAP, &b); /* FIBMAP takes a pointer to an integer */
        if (ret < 0) {
                if (errno == EPERM) {
                        fprintf(stderr, "No permission to use FIBMAP ioctl; 
must have root privileges\n");
@@ -70,7 +70,8 @@
 {
        struct statfs   fsinfo;
        struct stat64   fileinfo;
-       long            i, fd, bs, block, last_block = 0, numblocks;
+       int             bs;
+       long            i, fd, block, last_block = 0, numblocks;
        long            bpib;   /* Blocks per indirect block */
        long            cylgroups;
        int             discont = 0, expected;
@@ -105,7 +106,7 @@
                perror("open");
                return;
        }
-       if (ioctl(fd, FIGETBSZ, &bs) < 0) {
+       if (ioctl(fd, FIGETBSZ, &bs) < 0) { /* FIGETBSZ takes an int */
                perror("FIGETBSZ");
                close(fd);
                return;


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to