Hi, thanks for looking into it.
I originally handled the error as I did because per the ioctl man page,
RETURN VALUE
Usually, on success zero is returned. A few ioctls use the
return value as an output parameter and return a nonnegative
value on success. On error, -1 is returned, and
errno is set appropriately.
So, I treated error >= 0 as success.
So, it looks like BLKGETSIZE64 -is- failing* for you, and your patch below
is really a workaround for this. It might be good to find out why
the ioctl is failing (which is really not an xfs problem per se)
What kind of device are you trying to mkfs on?
-Eric
*actually, it's succeeding, but returning bad data.
On Fri, 25 Oct 2002 jsoe0708@xxxxxxxxxx wrote:
> ANy way I prety sure that I found a small bug at this place.
>
> Here is my full patch:
> --- cmd/xfsprogs/libxfs/init.c.orig 2002-10-25 12:12:29.000000000 +0200
> +++ cmd/xfsprogs/libxfs/init.c 2002-10-25 14:22:34.000000000 +0200
> @@ -155,11 +155,14 @@
> progname, path, strerror(errno));
> exit(1);
> }
> +#if !defined(__hppa__) || defined(__LP64__)
> error = ioctl(fd, BLKGETSIZE64, &size);
> - if (error >= 0) {
> + if (!error) {
> /* BLKGETSIZE64 returns size in bytes not 512-byte blocks */
> size = size >> 9;
> - } else {
> + } else
> +#endif
> + {
> /* If BLKGETSIZE64 fails, try BLKGETSIZE */
> unsigned long tmpsize;
> error = ioctl(fd, BLKGETSIZE, &tmpsize);
>
> AFAIK ioctl return error = 0 if success and error >0 if fault. So at least
> lines 6 and 7 should be applied?
>
> Thanks again for relevant advise,
> Joel
>
>
|