Re: BLKSSZGET change will break fdisk

From: Andries Brouwer (aeb@veritas.com)
Date: Mon Oct 16 2000 - 16:38:37 EST


On Mon, Oct 16, 2000 at 10:38:41PM +0200, Roman Zippel wrote:

> > [now that you make me look at this, there is a flaw in fdisk there;
> > fixed in 2.10p]
>
> BLKSSZGET isn't defined for fdisk.c? :)

Indeed :-)
The current code looks like this:

- BLKSSZGET added in common.h
- in fdisk.c added linux_version_code() similar to the one in nfsmount.c.
- in fdisk.c sector_size code:

static void
get_sectorsize(int fd) {
#if defined(BLKSSZGET)
        if (!user_set_sector_size &&
            linux_version_code() >= MAKE_VERSION(2,3,3)) {
                int arg;
                if (ioctl(fd, BLKSSZGET, &arg) == 0)
                        sector_size = arg;
                if (sector_size != DEFAULT_SECTOR_SIZE)
                        printf(_("Note: sector size is %d (not %d)\n"),
                               sector_size, DEFAULT_SECTOR_SIZE);
        }
#else
        /* maybe the user specified it; and otherwise we still
           have the DEFAULT_SECTOR_SIZE default */
#endif
}

> BTW the problem is a bit bigger, I tried to partition a 4GB mo disk, what
> horribly breaks with current fdisk under 2.2. It results in an odd
> partition offset and you can't access any partition. So I need a fixed
> fdisk. As quick hack I simply reused BLKSSZGET, but now I have a fdisk,
> that only works with a fixed kernel.

Instead of the above, just use

static void
get_sectorsize(int fd) {
}

and use a -b option to specify the sector size.

Andries
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon Oct 23 2000 - 21:00:10 EST