diff options
author | H. Peter Anvin <hpa@zytor.com> | 2004-07-30 16:26:59 +0000 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2004-07-30 16:26:59 +0000 |
commit | 96ec027e7954c8ce1d532648c1a6ba9cb79bf6f5 (patch) | |
tree | f2fcf5079d3b43b6d7eae402816511c4df162a70 | |
parent | 2d6eb8725cac30b78c25b3669b30d0440cbe056e (diff) | |
download | klibc-96ec027e7954c8ce1d532648c1a6ba9cb79bf6f5.tar.gz |
Support XFSklibc-0.154
-rw-r--r-- | utils/fstype.c | 17 | ||||
-rw-r--r-- | utils/xfs_sb.h | 17 |
2 files changed, 33 insertions, 1 deletions
diff --git a/utils/fstype.c b/utils/fstype.c index bbc236af58cb6..743e449f87945 100644 --- a/utils/fstype.c +++ b/utils/fstype.c @@ -7,7 +7,7 @@ * FSSIZE - filesystem size (if known) * * We currently detect (in order): - * gzip, cramfs, romfs, minix, ext3, ext2, reiserfs + * gzip, cramfs, romfs, xfs, minix, ext3, ext2, reiserfs * * MINIX, ext3 and Reiserfs bits are currently untested. */ @@ -24,6 +24,7 @@ #define _LINUX_EXT2_FS_SB #include <linux/ext2_fs.h> #include "ext3_fs.h" +#include "xfs_sb.h" /* * reiserfs_fs.h is too sick to include directly. @@ -160,6 +161,19 @@ static int reiserfs_image(const unsigned char *buf, unsigned long *blocks) return 0; } +static int xfs_image(const unsigned char *buf, unsigned long *blocks) +{ + const struct xfs_sb *sb = + (const struct xfs_sb *)buf; + + if (__be32_to_cpu(sb->sb_magicnum) == XFS_SB_MAGIC) { + *blocks = __be64_to_cpu(sb->sb_dblocks) * + (__be32_to_cpu(sb->sb_blocksize) / BLOCK_SIZE); + return 1; + } + return 0; +} + struct imagetype { off_t block; const char name[12]; @@ -170,6 +184,7 @@ static struct imagetype images[] = { { 0, "gzip", gzip_image }, { 0, "cramfs", cramfs_image }, { 0, "romfs", romfs_image }, + { 0, "xfs", xfs_image }, { 1, "minix", minix_image }, { 1, "ext3", ext3_image }, { 1, "ext2", ext2_image }, diff --git a/utils/xfs_sb.h b/utils/xfs_sb.h new file mode 100644 index 0000000000000..ffc79b10a9f52 --- /dev/null +++ b/utils/xfs_sb.h @@ -0,0 +1,17 @@ +/* + * Super block + * Fits into a sector-sized buffer at address 0 of each allocation group. + * Only the first of these is ever updated except during growfs. + */ + +struct xfs_buf; +struct xfs_mount; + +#define XFS_SB_MAGIC 0x58465342 /* 'XFSB' */ + +typedef struct xfs_sb +{ + __u32 sb_magicnum; /* magic number == XFS_SB_MAGIC */ + __u32 sb_blocksize; /* logical block size, bytes */ + __u64 sb_dblocks; /* number of data blocks */ +} xfs_sb_t; |