Craig Rodrigues wrote:
Hi,
I haven't tested xfsprogs in a while, but I just noticed
that mksfs in xfsprogs-2.7.11 on FreeBSD seems to be broken:
% mkfs.xfs /dev/ad0s4
% file - < /dev/ad0s4
/dev/stdin: data
If I revert to xfsprogs-2.6.25, then I get:
% mkfs.xfs /dev/ad0s4
% file - < /dev/ad0s4
/dev/stdin: SGI XFS filesystem data (blksz 4096, inosz 256, v2 dirs)
Any ideas?
Thanks.
Yup that is because xfs_arch.h is not correctly detecting the host
endianness,
so all the filesystems created by mkfs are defaulting to native byte
ordering.
# xfs_db -r /dev/md0
xfs_db: unexpected XFS SB magic number 0x42534658
xfs_db: size check failed
xfs_db: read failed: Input/output error
xfs_db: data size check failed
vs
# xfs_db -r /dev/md0
xfs_db> sb 0
xfs_db> print
magicnum = 0x58465342
Including the changes I have currently but we probably need to
move the endian checking to xfs_freebsd.h and then have
xfs_arch.h pick up an XFS defined var.
Ohh also note the incorrect use of strcpy vs strcmp.
Index: xfs-cmds/xfsprogs/include/xfs_arch.h
===================================================================
--- xfs-cmds.orig/xfsprogs/include/xfs_arch.h 2006-01-04 20:55:00.000000000
-0600
+++ xfs-cmds/xfsprogs/include/xfs_arch.h 2006-05-25 14:56:12.000000000
-0500
@@ -36,8 +36,10 @@
#if __BYTE_ORDER == __BIG_ENDIAN
#define XFS_NATIVE_HOST 1
+#warning XFS_NATIVE_HOST 1
#else
#undef XFS_NATIVE_HOST
+#warning XFS_NATIVE_HOST undef
#endif
#ifdef XFS_NATIVE_HOST
Index: xfs-cmds/xfsprogs/include/freebsd.h
===================================================================
--- xfs-cmds.orig/xfsprogs/include/freebsd.h 2006-04-27 23:02:55.000000000
-0500
+++ xfs-cmds/xfsprogs/include/freebsd.h 2006-05-25 14:55:25.000000000 -0500
@@ -67,7 +67,10 @@ typedef enum { B_FALSE,B_TRUE } boolean_
static __inline__ int xfsctl(const char *path, int fd, int cmd, void *p)
{
- return ioctl(fd, cmd, p);
+ int err = 0;
+ err = ioctl(fd, cmd, p);
+ printf("xfsctl err %d cmd 0x%x\n",err,cmd);
+ return err;
}
static __inline__ int platform_test_xfs_fd(int fd)
@@ -75,7 +78,7 @@ static __inline__ int platform_test_xfs_
struct statfs buf;
if (fstatfs(fd, &buf) < 0)
return 0;
- return strcpy(buf.f_fstypename, "xfs") == 0;
+ return strncmp(buf.f_fstypename, "xfs",strlen("xfs")) == 0;
}
static __inline__ int platform_test_xfs_path(const char *path)
@@ -83,7 +86,7 @@ static __inline__ int platform_test_xfs_
struct statfs buf;
if (statfs(path, &buf) < 0)
return 0;
- return strcpy(buf.f_fstypename, "xfs") == 0;
+ return strncmp(buf.f_fstypename, "xfs",strlen("xfs")) == 0;
}
static __inline__ int platform_fstatfs(int fd, struct statfs *buf)
|