From owner-freebsd-current@FreeBSD.ORG Tue Jul 11 11:45:19 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 E1E1A16A4DE; Tue, 11 Jul 2006 11:45:19 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [209.31.154.42]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8DF1743D45; Tue, 11 Jul 2006 11:45:19 +0000 (GMT) (envelope-from rwatson@FreeBSD.org) Received: from fledge.watson.org (fledge.watson.org [209.31.154.41]) by cyrus.watson.org (Postfix) with ESMTP id 10A4846C53; Tue, 11 Jul 2006 07:45:19 -0400 (EDT) Date: Tue, 11 Jul 2006 12:45:18 +0100 (BST) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Christoph Hellwig In-Reply-To: <20060710202219.GA29786@infradead.org> Message-ID: <20060711124356.Y78628@fledge.watson.org> References: <20060708152801.GA3671@crodrigues.org> <44AFD7DF.8090002@errno.com> <20060708174606.GA29602@infradead.org> <44B2A51A.4040103@samsco.org> <20060710202219.GA29786@infradead.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: 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 11:45:20 -0000 On Mon, 10 Jul 2006, Christoph Hellwig wrote: > 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 >> maintaining a table of magic numbers? > > The feature is imensely useful. The implementation won't win any points for > a clean design but works very well in practice. I think it's definitly > better than probing in the kernel because letting a filesystem driver try to > make sense of something that's not it's own format can lead to all kinds of > funnies. Linux does this (iterating all filesystem types in kernel) for the > special case of the root filesystem where mount(8) is not available, and it > showeds various interesting bugs at least in the fat driver. In both FreeBSD and Darwin, I've noticed that the kernel msdosfs code is excessively permissive as to what it considers a FAT file system. This is presumably necessary due to the enourmous diversity of FAT file systems floating around, but it makes it a little too easy to cause msdos to trip over layouts that violate its layout assumptions. :-) FAT is much more reliably detected by looking at the partition type it lives in than by looking at the bytes that appear inside the partition, I believe. Robert N M Watson Computer Laboratory University of Cambridge