Subject: FAT partitions
To: None <port-amiga@netbsd.org>
From: Gunther Nikl <gni@gecko.de>
List: port-amiga
Date: 06/17/2002 16:06:07
--n8g4imXOkfNTN/H1
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Hello!

Since NetBSD/amiga doesn't have write support for AmigaDOS FFS partitions
and since the available BFFSFilesystem for AmigaOS doesn't support partitions
beyound >4GB I needed a new approach to exchange data between NetBSD and
AmigaOS. The only filesystem that both AmigaOS and NetBSD support for
reading and writing is the MSDOS FAT filesystem. To really get it working
a small patch to adosglue.h and disksubr.c is required. The patch is attached.
I was able to mount a FAT partition successfully. Maybe others find it useful
too.

Gunther

--n8g4imXOkfNTN/H1
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="fat.dif"

--- .old/adosglue.h	Thu Apr 29 00:35:27 1999
+++ adosglue.h	Fri Jun 14 19:35:15 2002
@@ -46,6 +46,7 @@
 #define DOST_MUFS	0x6d754600	/* 'muFx' AmigaDos partition (muFS) */
 #define DOST_EXT2	0x4c4e5800	/* 'LNX0' Linux fs partition (ext2fs) */
 #define DOST_LNXSWP	0x53575000	/* 'LNX0' Linux swap partition */
+#define DOST_FAT	0x46415400	/* 'FATx' MSDOS partition */
 
 struct adostype {
 	u_char archtype;	/* see ADT_xxx below */
@@ -60,6 +61,7 @@
 #define ADT_NETBSDUSER	4
 #define ADT_AMIX	5
 #define ADT_EXT2	6
+#define ADT_FAT 	7
 
 #define ISFSARCH_NETBSD(adt) \
 	((adt).archtype >= ADT_NETBSDROOT && (adt).archtype <= ADT_NETBSDUSER)
--- .old/disksubr.c	Fri May 19 20:54:24 2000
+++ disksubr.c	Fri Jun 14 19:37:44 2002
@@ -313,6 +313,7 @@
 		case ADT_AMIGADOS:
 		case ADT_AMIX:
 		case ADT_EXT2:
+		case ADT_FAT:
 		case ADT_UNKNOWN:
 			pp = &lp->d_partitions[lp->d_npartitions];
 			break;
@@ -634,6 +635,11 @@
 	case DOST_EXT2:
 		adt.archtype = ADT_EXT2;
 		adt.fstype = FS_EX2FS;
+		return(adt);
+
+	case DOST_FAT:
+		adt.archtype = ADT_FAT;
+		adt.fstype = FS_MSDOS;
 		return(adt);
 
 	default:

--n8g4imXOkfNTN/H1--