avoiding unused fstatvfs call in _loop_table

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In dmsetup/dmsetup.c's _loop_table, there's some unused code.
It see that part of it is marked as "unused", but...

    #ifdef HAVE_SYS_STATVFS_H
            struct statvfs fsbuf;
            off_t blksize;
    #endif

    ...

    #ifdef HAVE_SYS_STATVFS_H
            if (fstatvfs(fd, &fsbuf))
                    goto error;

            /* FIXME Fragment size currently unused */
            blksize = fsbuf.f_frsize;
    #endif

Outside of those two blocks, neither fsbuf nor blksize is used.
If it's not going to be used any time soon,
how about making that code so it's not even compiled?
That'd save everyone an fstatvfs call, and it would have
saved me the time of wondering and writing (and you reading) about it :-)

Assuming that's ok, which approach do you prefer:

- #undef the symbol and add a comment explaining.
- change each #ifdef to something like:

    #if defined HAVE_SYS_STATVFS_H && 0 /* disabled for now... */

...unless, the fstatvfs is actually there to serve a purpose.
Though I doubt that: the only possible thing it can do now is to
make _loop_table fail when fstatvfs returns nonzero.

--
dm-devel mailing list
dm-devel@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/dm-devel

[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux