From owner-freebsd-arch@FreeBSD.ORG Fri Jan 19 02:37:12 2007 Return-Path: X-Original-To: freebsd-arch@freebsd.org Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 857E416A415; Fri, 19 Jan 2007 02:37:12 +0000 (UTC) (envelope-from rodrigc@crodrigues.org) Received: from rwcrmhc12.comcast.net (rwcrmhc12.comcast.net [216.148.227.152]) by mx1.freebsd.org (Postfix) with ESMTP id 6D0CB13C44C; Fri, 19 Jan 2007 02:37:12 +0000 (UTC) (envelope-from rodrigc@crodrigues.org) Received: from c-66-31-35-94.hsd1.ma.comcast.net ([66.31.35.94]) by comcast.net (rwcrmhc12) with ESMTP id <20070119023711m12002l9rce>; Fri, 19 Jan 2007 02:37:11 +0000 Received: from c-66-31-35-94.hsd1.ma.comcast.net (localhost.crodrigues.org [127.0.0.1]) by c-66-31-35-94.hsd1.ma.comcast.net (8.13.8/8.13.8) with ESMTP id l0J2bA2o001761; Thu, 18 Jan 2007 21:37:10 -0500 (EST) (envelope-from rodrigc@c-66-31-35-94.hsd1.ma.comcast.net) Received: (from rodrigc@localhost) by c-66-31-35-94.hsd1.ma.comcast.net (8.13.8/8.13.8/Submit) id l0J2b9Hi001760; Thu, 18 Jan 2007 21:37:09 -0500 (EST) (envelope-from rodrigc) Date: Thu, 18 Jan 2007 21:37:09 -0500 From: Craig Rodrigues To: freebsd-current@freebsd.org Message-ID: <20070119023709.GA1524@crodrigues.org> References: <20070118134936.GA7391@crodrigues.org> <20070118221749.3be589d9.rosti.bsd@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20070118221749.3be589d9.rosti.bsd@gmail.com> User-Agent: Mutt/1.4.2.1i Cc: freebsd-arch@freebsd.org Subject: Re: [RFC] mount(8) can figure out fstype X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Jan 2007 02:37:12 -0000 On Thu, Jan 18, 2007 at 10:17:49PM +0200, Rostislav Krasny wrote: > OpenBSD already has such a functionality. It uses readlabelfs(3) for > this. What disadvantages or advantages does it have beside your > implementation? Thanks for the pointer, I did not know about readlabelfs on OpenBSD! From what I understand from reading the code: http://www.openbsd.org/cgi-bin/cvsweb/src/lib/libutil/readlabel.c http://www.openbsd.org/cgi-bin/cvsweb/src/sys/sys/disklabel.h the readlabelfs() function tries to open the device and do a DIOCGDINFO ioctl() on the device to read the disklabel. Once the disklabel is read, (i.e. DIOCDINFO returns a 'struct disklabel'), the p_fstype member of 'struct partition' which is inside the 'struct disklabel' is converted to a string name based on the fstypesnames array in . This approach relies heavily on disklabels, and correct information being stored in disklabels. For FreeBSD, I do not like the idea of introducing a new dependency between mount(8) and BSD disklabels. The existing FreeBSD mount(8) program just tries to open a device, does an nmount() with a "fstype" parameter, and then relies on the underlying file system code (i.e. "ufs", "msdosfs", etc.) to read the superblock from the device, figure out if it can mount it, and return an error if it cannot. That's the behavior I tried to preserve with my patch. It's kind of simplistic, but it does work. -- Craig Rodrigues rodrigc@crodrigues.org