From owner-freebsd-current@FreeBSD.ORG Tue Jul 11 13:27:58 2006 Return-Path: X-Original-To: freebsd-current@freebsd.org Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E878216A4E6; Tue, 11 Jul 2006 13:27:57 +0000 (UTC) (envelope-from ceri@submonkey.net) Received: from shrike.submonkey.net (cpc2-cdif2-0-0-cust107.cdif.cable.ntl.com [81.104.168.108]) by mx1.FreeBSD.org (Postfix) with ESMTP id 51B1A43D49; Tue, 11 Jul 2006 13:27:56 +0000 (GMT) (envelope-from ceri@submonkey.net) Received: from ceri by shrike.submonkey.net with local (Exim 4.62 (FreeBSD)) (envelope-from ) id 1G0IHJ-000I6y-0B; Tue, 11 Jul 2006 14:27:53 +0100 Date: Tue, 11 Jul 2006 14:27:52 +0100 From: Ceri Davies To: Robert Watson Message-ID: <20060711132752.GF65857@submonkey.net> Mail-Followup-To: Ceri Davies , Robert Watson , Christoph Hellwig , Craig Rodrigues , Scott Long , freebsd-current@freebsd.org, freebsd-arch@freebsd.org References: <20060708152801.GA3671@crodrigues.org> <44AFD7DF.8090002@errno.com> <20060708174606.GA29602@infradead.org> <44B2A51A.4040103@samsco.org> <20060710202219.GA29786@infradead.org> <20060711124356.Y78628@fledge.watson.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="7LkOrbQMr4cezO2T" Content-Disposition: inline In-Reply-To: <20060711124356.Y78628@fledge.watson.org> X-PGP: finger ceri@FreeBSD.org User-Agent: Mutt/1.5.11 Sender: Ceri Davies Cc: Christoph Hellwig , Craig Rodrigues , freebsd-current@freebsd.org, freebsd-arch@freebsd.org Subject: Re: [RFC] mount can figure out fstype automatically X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Jul 2006 13:27:58 -0000 --7LkOrbQMr4cezO2T Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jul 11, 2006 at 12:45:18PM +0100, Robert Watson wrote: >=20 > On Mon, 10 Jul 2006, Christoph Hellwig wrote: >=20 > >On Mon, Jul 10, 2006 at 01:06:02PM -0600, Scott Long wrote: > >>So in your opinion and experience, what are the pros and cons of=20 > >>maintaining a table of magic numbers? > > > >The feature is imensely useful. The implementation won't win any points= =20 > >for a clean design but works very well in practice. I think it's=20 > >definitly better than probing in the kernel because letting a filesystem= =20 > >driver try to make sense of something that's not it's own format can lea= d=20 > >to all kinds of funnies. Linux does this (iterating all filesystem type= s=20 > >in kernel) for the special case of the root filesystem where mount(8) is= =20 > >not available, and it showeds various interesting bugs at least in the f= at=20 > >driver. >=20 > In both FreeBSD and Darwin, I've noticed that the kernel msdosfs code is= =20 > excessively permissive as to what it considers a FAT file system. This i= s=20 > presumably necessary due to the enourmous diversity of FAT file systems= =20 > floating around, but it makes it a little too easy to cause msdos to trip= =20 > over layouts that violate its layout assumptions. :-) FAT is much more= =20 > reliably detected by looking at the partition type it lives in than by=20 > looking at the bytes that appear inside the partition, I believe. Assuming that there is a valid partition type. I don't really know what this makes, but there's a valid FAT filesystem on it: % truncate -s 1440k floppy % sudo mdconfig -a -f floppy=20 md1 % sudo newfs_msdos -f 1440 /dev/md1 /dev/md1: 2847 sectors in 2847 FAT12 clusters (512 bytes/cluster) bps=3D512 spc=3D1 res=3D1 nft=3D2 rde=3D224 sec=3D2880 mid=3D0xf0 spf=3D9 s= pt=3D18 hds=3D2 hid=3D0 % sudo mount -t msdos /dev/md1 /mnt % df -h /mnt Filesystem Size Used Avail Capacity Mounted on /dev/md1 1.4M 1.0K 1.4M 0% /mnt {ceri@shrike}-{~} % fdisk /dev/md1 ******* Working on device /dev/md1 ******* parameters extracted from in-core disklabel are: cylinders=3D0 heads=3D255 sectors/track=3D63 (16065 blks/cyl) parameters to be used for BIOS calculations are: cylinders=3D0 heads=3D255 sectors/track=3D63 (16065 blks/cyl) Media sector size is 512 Warning: BIOS sector numbering starts with sector 1 Information from DOS bootblock is: The data for partition 1 is: The data for partition 2 is: The data for partition 3 is: The data for partition 4 is: Ceri --=20 That must be wonderful! I don't understand it at all. -- Moliere --7LkOrbQMr4cezO2T Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.4 (FreeBSD) iD8DBQFEs6dYocfcwTS3JF8RAsrUAJ9+TRZzDxgoOyCdLI3OZlr/kzK5lACggnX6 +WSMM1QR1dJmhFpNq36zVY0= =/QdA -----END PGP SIGNATURE----- --7LkOrbQMr4cezO2T--