From 56494a63c44423502fae8893076085971e0954bd Mon Sep 17 00:00:00 2001 From: christos Date: Sat, 1 Sep 2012 17:01:24 +0000 Subject: [PATCH] really print the incompatible bits. --- sys/ufs/ext2fs/ext2fs.h | 26 +++++++++++++++++++++++++- sys/ufs/ext2fs/ext2fs_vfsops.c | 19 +++++++++++-------- 2 files changed, 36 insertions(+), 9 deletions(-) diff --git a/sys/ufs/ext2fs/ext2fs.h b/sys/ufs/ext2fs/ext2fs.h index 6b994a2377c2..2afa6ab41fc7 100644 --- a/sys/ufs/ext2fs/ext2fs.h +++ b/sys/ufs/ext2fs/ext2fs.h @@ -1,4 +1,4 @@ -/* $NetBSD: ext2fs.h,v 1.29 2009/11/27 11:16:54 tsutsui Exp $ */ +/* $NetBSD: ext2fs.h,v 1.30 2012/09/01 17:01:24 christos Exp $ */ /* * Copyright (c) 1982, 1986, 1993 @@ -198,15 +198,39 @@ struct m_ext2fs { /* compatible/incompatible features */ #define EXT2F_COMPAT_PREALLOC 0x0001 +#define EXT2F_COMPAT_AFS 0x0002 #define EXT2F_COMPAT_HASJOURNAL 0x0004 +#define EXT2F_COMPAT_EXTATTR 0x0008 #define EXT2F_COMPAT_RESIZE 0x0010 +#define EXT2F_COMPAT_DIRHASHINDEX 0x0020 +#define EXT2F_COMPAT_BITS \ + "\20" \ + "\06COMPAT_DIRHASHINDEX" \ + "\05COMPAT_RESIZE" \ + "\04COMPAT_EXTATTR" \ + "\03COMPAT_HASJOURNAL" \ + "\02COMPAT_AFS" \ + "\01COMPAT_PREALLOC" #define EXT2F_ROCOMPAT_SPARSESUPER 0x0001 #define EXT2F_ROCOMPAT_LARGEFILE 0x0002 #define EXT2F_ROCOMPAT_BTREE_DIR 0x0004 +#define EXT2F_ROCOMPAT_BITS \ + "\20" \ + "\03ROCOMPAT_BTREE_DIR" \ + "\02ROCOMPAT_LARGEFILE" \ + "\01ROCOMPAT_SPARSEBUFFER" #define EXT2F_INCOMPAT_COMP 0x0001 #define EXT2F_INCOMPAT_FTYPE 0x0002 +#define EXT2F_INCOMPAT_REPLAY_JOURNAL 0x0004 +#define EXT2F_INCOMPAT_USES_JOURNAL 0x0008 +#define EXT2F_INCOMPAT_BITS \ + "\20" \ + "\04INCOMPAT_USES_JOURNAL" \ + "\03INCOMPAT_REPLAY_JOURNAL" \ + "\02INCOMPAT_FTYPE" \ + "\01INCOMPAT_COMP" /* * Features supported in this implementation diff --git a/sys/ufs/ext2fs/ext2fs_vfsops.c b/sys/ufs/ext2fs/ext2fs_vfsops.c index 49265916d673..71887823c201 100644 --- a/sys/ufs/ext2fs/ext2fs_vfsops.c +++ b/sys/ufs/ext2fs/ext2fs_vfsops.c @@ -1,4 +1,4 @@ -/* $NetBSD: ext2fs_vfsops.c,v 1.165 2012/09/01 15:46:11 chs Exp $ */ +/* $NetBSD: ext2fs_vfsops.c,v 1.166 2012/09/01 17:01:24 christos Exp $ */ /* * Copyright (c) 1989, 1991, 1993, 1994 @@ -60,7 +60,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ext2fs_vfsops.c,v 1.165 2012/09/01 15:46:11 chs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ext2fs_vfsops.c,v 1.166 2012/09/01 17:01:24 christos Exp $"); #if defined(_KERNEL_OPT) #include "opt_compat_netbsd.h" @@ -1249,21 +1249,24 @@ ext2fs_checksb(struct ext2fs *fs, int ronly) return (EINVAL); /* XXX needs translation */ } if (fs2h32(fs->e2fs_rev) > E2FS_REV0) { + char buf[256]; if (fs2h32(fs->e2fs_first_ino) != EXT2_FIRSTINO) { printf("ext2fs: unsupported first inode position\n"); return (EINVAL); /* XXX needs translation */ } u32 = fs2h32(fs->e2fs_features_incompat) & ~EXT2F_INCOMPAT_SUPP; if (u32) { - printf("ext2fs: unsupported incompat feature 0x%x\n", - u32); - return (EINVAL); /* XXX needs translation */ + snprintb(buf, sizeof(buf), EXT2F_INCOMPAT_BITS, u32); + printf("ext2fs: unsupported incompat features: %s\n", + buf); + return EINVAL; /* XXX needs translation */ } u32 = fs2h32(fs->e2fs_features_rocompat) & ~EXT2F_ROCOMPAT_SUPP; if (!ronly && u32) { - printf("ext2fs: unsupported ro-incompat feature 0x%x\n", - u32); - return (EROFS); /* XXX needs translation */ + snprintb(buf, sizeof(buf), EXT2F_ROCOMPAT_BITS, u32); + printf("ext2fs: unsupported ro-incompat features: %s\n", + buf); + return EROFS; /* XXX needs translation */ } } return (0);