lkml.org 
[lkml]   [2000]   [Oct]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: BLKSSZGET change will break fdisk
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/

\
 
 \ /
  Last update: 2005-03-22 12:41    [W:0.061 / U:2.056 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site