Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src PR/45796: Evgeniy Ivanov minixfs3 support.
details: https://anonhg.NetBSD.org/src/rev/d225fb852eed
branches: trunk
changeset: 772791:d225fb852eed
user: christos <christos%NetBSD.org@localhost>
date: Mon Jan 16 18:46:20 2012 +0000
description:
PR/45796: Evgeniy Ivanov minixfs3 support.
diffstat:
common/lib/libutil/getfstypename.c | 8 +++--
sys/arch/i386/stand/boot/Makefile.boot | 3 +-
sys/arch/i386/stand/boot/conf.c | 8 +++++-
sys/arch/i386/stand/lib/biosdisk.c | 43 +++++++++++++++++++++++++++++++++-
sys/lib/libkern/xlat_mbr_fstype.c | 5 ++-
sys/sys/disk.h | 3 +-
sys/sys/disklabel.h | 5 ++-
7 files changed, 64 insertions(+), 11 deletions(-)
diffs (203 lines):
diff -r 805f012a875f -r d225fb852eed common/lib/libutil/getfstypename.c
--- a/common/lib/libutil/getfstypename.c Mon Jan 16 18:44:13 2012 +0000
+++ b/common/lib/libutil/getfstypename.c Mon Jan 16 18:46:20 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: getfstypename.c,v 1.5 2011/11/14 16:21:44 christos Exp $ */
+/* $NetBSD: getfstypename.c,v 1.6 2012/01/16 18:47:57 christos Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -39,10 +39,10 @@
# include <sys/cdefs.h>
# ifndef _KERNEL
# if !defined(lint)
-__RCSID("$NetBSD: getfstypename.c,v 1.5 2011/11/14 16:21:44 christos Exp $");
+__RCSID("$NetBSD: getfstypename.c,v 1.6 2012/01/16 18:47:57 christos Exp $");
# endif
# else
-__KERNEL_RCSID(0, "$NetBSD: getfstypename.c,v 1.5 2011/11/14 16:21:44 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: getfstypename.c,v 1.6 2012/01/16 18:47:57 christos Exp $");
# endif /* _KERNEL */
# define FSTYPE_ENUMNAME fstype_enum
@@ -121,6 +121,8 @@
return DKW_PTYPE_CGD;
case FSMAXTYPES:
return DKW_PTYPE_UNKNOWN;
+ case FS_MINIXFS3:
+ return DKW_PTYPE_MINIXFS3;
}
/* Stupid gcc, should know it is impossible to get here */
return DKW_PTYPE_UNKNOWN;
diff -r 805f012a875f -r d225fb852eed sys/arch/i386/stand/boot/Makefile.boot
--- a/sys/arch/i386/stand/boot/Makefile.boot Mon Jan 16 18:44:13 2012 +0000
+++ b/sys/arch/i386/stand/boot/Makefile.boot Mon Jan 16 18:46:20 2012 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.boot,v 1.56 2011/12/25 06:09:09 tsutsui Exp $
+# $NetBSD: Makefile.boot,v 1.57 2012/01/16 18:46:20 christos Exp $
S= ${.CURDIR}/../../../../..
@@ -70,6 +70,7 @@
CPPFLAGS+= -DSUPPORT_USTARFS
CPPFLAGS+= -DSUPPORT_DOSFS
CPPFLAGS+= -DSUPPORT_EXT2FS
+#CPPFLAGS+= -DSUPPORT_MINIXFS3
CPPFLAGS+= -DPASS_BIOSGEOM
CPPFLAGS+= -DPASS_MEMMAP
#CPPFLAGS+= -DBOOTPASSWD
diff -r 805f012a875f -r d225fb852eed sys/arch/i386/stand/boot/conf.c
--- a/sys/arch/i386/stand/boot/conf.c Mon Jan 16 18:44:13 2012 +0000
+++ b/sys/arch/i386/stand/boot/conf.c Mon Jan 16 18:46:20 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: conf.c,v 1.5 2008/04/05 18:21:34 tsutsui Exp $ */
+/* $NetBSD: conf.c,v 1.6 2012/01/16 18:46:20 christos Exp $ */
/*
* Copyright (c) 1997
@@ -36,6 +36,9 @@
#ifdef SUPPORT_EXT2FS
#include <lib/libsa/ext2fs.h>
#endif
+#ifdef SUPPORT_MINIXFS3
+#include <lib/libsa/minixfs3.h>
+#endif
#ifdef SUPPORT_USTARFS
#include <lib/libsa/ustarfs.h>
#endif
@@ -66,6 +69,9 @@
#ifdef SUPPORT_EXT2FS
FS_OPS(ext2fs),
#endif
+#ifdef SUPPORT_MINIXFS3
+ FS_OPS(minixfs3),
+#endif
#ifdef SUPPORT_DOSFS
FS_OPS(dosfs),
#endif
diff -r 805f012a875f -r d225fb852eed sys/arch/i386/stand/lib/biosdisk.c
--- a/sys/arch/i386/stand/lib/biosdisk.c Mon Jan 16 18:44:13 2012 +0000
+++ b/sys/arch/i386/stand/lib/biosdisk.c Mon Jan 16 18:46:20 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: biosdisk.c,v 1.39 2011/09/21 08:57:12 gsutre Exp $ */
+/* $NetBSD: biosdisk.c,v 1.40 2012/01/16 18:47:57 christos Exp $ */
/*
* Copyright (c) 1996, 1998
@@ -404,6 +404,40 @@
}
static int
+read_minix_subp(struct biosdisk *d, struct disklabel* dflt_lbl,
+ int this_ext, daddr_t sector)
+{
+ struct mbr_partition mbr[MBR_PART_COUNT];
+ int i;
+ int typ;
+ struct partition *p;
+
+ if (readsects(&d->ll, sector, 1, d->buf, 0)) {
+#ifdef DISK_DEBUG
+ printf("Error reading MFS sector %d\n", sector);
+#endif
+ return EIO;
+ }
+ if ((uint8_t)d->buf[510] != 0x55 || (uint8_t)d->buf[511] != 0xAA) {
+ return -1;
+ }
+ memcpy(&mbr, ((struct mbr_sector *)d->buf)->mbr_parts, sizeof(mbr));
+ for (i = 0; i < MBR_PART_COUNT; i++) {
+ typ = mbr[i].mbrp_type;
+ if (typ == 0)
+ continue;
+ sector = this_ext + mbr[i].mbrp_start;
+ if (dflt_lbl->d_npartitions >= MAXPARTITIONS)
+ continue;
+ p = &dflt_lbl->d_partitions[dflt_lbl->d_npartitions++];
+ p->p_offset = sector;
+ p->p_size = mbr[i].mbrp_size;
+ p->p_fstype = xlat_mbr_fstype(typ);
+ }
+ return 0;
+}
+
+static int
read_label(struct biosdisk *d)
{
struct disklabel dflt_lbl;
@@ -452,6 +486,13 @@
#ifdef DISK_DEBUG
printf("ptn type %d in sector %d\n", typ, sector);
#endif
+ if (typ == MBR_PTYPE_MINIX_14B) {
+ if (!read_minix_subp(d, &dflt_lbl,
+ this_ext, sector)) {
+ /* Don't add "container" partition */
+ continue;
+ }
+ }
if (typ == MBR_PTYPE_NETBSD) {
error = check_label(d, sector);
if (error >= 0)
diff -r 805f012a875f -r d225fb852eed sys/lib/libkern/xlat_mbr_fstype.c
--- a/sys/lib/libkern/xlat_mbr_fstype.c Mon Jan 16 18:44:13 2012 +0000
+++ b/sys/lib/libkern/xlat_mbr_fstype.c Mon Jan 16 18:46:20 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: xlat_mbr_fstype.c,v 1.7 2008/04/28 20:24:06 martin Exp $ */
+/* $NetBSD: xlat_mbr_fstype.c,v 1.8 2012/01/16 18:47:57 christos Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0,"$NetBSD: xlat_mbr_fstype.c,v 1.7 2008/04/28 20:24:06 martin Exp $");
+__KERNEL_RCSID(0,"$NetBSD: xlat_mbr_fstype.c,v 1.8 2012/01/16 18:47:57 christos Exp $");
#include <sys/disklabel.h>
@@ -55,6 +55,7 @@
{ MBR_PTYPE_LNXSWAP, FS_SWAP },
{ MBR_PTYPE_NETBSD, FS_BSDFFS },
{ MBR_PTYPE_NTFS, FS_NTFS },
+ { MBR_PTYPE_MINIX_14B, FS_MINIXFS3 },
{ 0, FS_OTHER }
};
const struct ptn_types *pt;
diff -r 805f012a875f -r d225fb852eed sys/sys/disk.h
--- a/sys/sys/disk.h Mon Jan 16 18:44:13 2012 +0000
+++ b/sys/sys/disk.h Mon Jan 16 18:46:20 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: disk.h,v 1.55 2011/11/13 22:07:00 christos Exp $ */
+/* $NetBSD: disk.h,v 1.56 2012/01/16 18:47:58 christos Exp $ */
/*-
* Copyright (c) 1996, 1997, 2004 The NetBSD Foundation, Inc.
@@ -245,6 +245,7 @@
#define DKW_PTYPE_EFS "efs"
#define DKW_PTYPE_NILFS "nilfs"
#define DKW_PTYPE_CGD "cgd"
+#define DKW_PTYPE_MINIXFS3 "minixfs3"
/*
* Disk geometry dictionary.
diff -r 805f012a875f -r d225fb852eed sys/sys/disklabel.h
--- a/sys/sys/disklabel.h Mon Jan 16 18:44:13 2012 +0000
+++ b/sys/sys/disklabel.h Mon Jan 16 18:46:20 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: disklabel.h,v 1.111 2011/11/13 22:19:09 christos Exp $ */
+/* $NetBSD: disklabel.h,v 1.112 2012/01/16 18:47:58 christos Exp $ */
/*
* Copyright (c) 1987, 1988, 1993
@@ -357,7 +357,8 @@
x(SYSVBFS, 25, "SysVBFS", NULL, "sysvbfs")/* System V boot file system */ \
x(EFS, 26, "EFS", NULL, "efs") /* SGI's Extent Filesystem */ \
x(NILFS, 27, "NiLFS", NULL, "nilfs") /* NTT's NiLFS(2) */ \
-x(CGD, 28, "cgd", NULL, NULL) /* Cryptographic disk */
+x(CGD, 28, "cgd", NULL, NULL) /* Cryptographic disk */ \
+x(MINIXFS3,29, "MINIX FSv3", NULL, NULL) /* MINIX file system v3 */
#ifndef _LOCORE
Home |
Main Index |
Thread Index |
Old Index