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

Re: mkfs.xfs on EVMS Volume forgot the releases used



On 21 Mar 2002, Oliver Jehle wrote:

> > ioctl(5, 0x80041272, 0xbfffe124)        = -1 EINVAL (Invalid argument)
> > write(2, "mkfs.xfs: can\'t determine device"..., 38mkfs.xfs: can't
> > determine device size
> > ) = 38
> > _exit(1)                                = ?

Ok, it looks like the BLKGETSIZE64 ioctl is failing.  The very latest
mkfs.xfs will fall back to BLKGETSIZE if this happens; I guess we need to
update what's on oss.

You should suggest to the evms folks that they implement BLKGETSIZE64, but
in the meantime this patch will fix things for you:

--- /usr/tmp/TmpDir.30077-0/cmd/xfsprogs/libxfs/init.c_1.12	Thu Mar 21
08:28:40 2002
+++ /usr/tmp/TmpDir.30077-0/cmd/xfsprogs/libxfs/init.c_1.13	Thu Mar 21
08:28:40 2002
@@ -156,11 +156,19 @@
 		exit(1);
 	}
 	error = ioctl(fd, BLKGETSIZE64, &size);
-	/* BLKGETSIZE64 returns size in bytes */
-	size = size >> 9;
-	if (error < 0) {
-		fprintf(stderr, "%s: can't determine device size\n",
progname);
-		exit(1);
+	if (error >= 0) {
+		/* BLKGETSIZE64 returns size in bytes not 512-byte blocks
*/
+		size = size >> 9;
+	} else {
+		/* If BLKGETSIZE64 fails, try BLKGETSIZE */
+		unsigned long tmpsize;
+		error = ioctl(fd, BLKGETSIZE, &tmpsize);
+		if (error < 0) {
+			fprintf(stderr, "%s: can't determine device
size\n",
+				progname);
+			exit(1);
+		}
+		size = (__uint64_t)tmpsize;
 	}

 	close(fd);



-Eric