really print the incompatible bits.

This commit is contained in:
christos 2012-09-01 17:01:24 +00:00
parent fa4bf43b79
commit 56494a63c4
2 changed files with 36 additions and 9 deletions

View File

@ -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

View File

@ -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 <sys/cdefs.h>
__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);