From owner-freebsd-questions@FreeBSD.ORG Thu Nov 15 08:57:28 2012 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6BD3D256 for ; Thu, 15 Nov 2012 08:57:28 +0000 (UTC) (envelope-from freebsd@qeng-ho.org) Received: from blue.qeng-ho.org (blue.qeng-ho.org [217.155.128.241]) by mx1.freebsd.org (Postfix) with ESMTP id D107C8FC12 for ; Thu, 15 Nov 2012 08:57:27 +0000 (UTC) Received: from fileserver.home.qeng-ho.org (localhost [127.0.0.1]) by fileserver.home.qeng-ho.org (8.14.5/8.14.5) with ESMTP id qAF8vHCp037297; Thu, 15 Nov 2012 08:57:19 GMT (envelope-from freebsd@qeng-ho.org) Message-ID: <50A4AE6D.5050908@qeng-ho.org> Date: Thu, 15 Nov 2012 08:57:17 +0000 From: Arthur Chance User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:16.0) Gecko/20121029 Thunderbird/16.0.2 MIME-Version: 1.0 To: Robert Bonomi Subject: Re: 'device' representation in the filesystem questions References: <201211142338.qAENcEqx002393@mail.r-bonomi.com> In-Reply-To: <201211142338.qAENcEqx002393@mail.r-bonomi.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-questions@freebsd.org X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Nov 2012 08:57:28 -0000 On 11/14/12 23:38, Robert Bonomi wrote: > > it appears that FreeBSD, at least 8.0 and later: > a) no longer uses 'raw' devices for anything > b) no longer uses 'block' devices for anything > c) randomly assigns device 'major' numbers > d) doesn't use device 'minor' numbers for anything. > e) as a result of c) and d), there is no way to > establish 'device' physical characteristics > from the 'node' information. > > Is there a wizzard who can confirm/deny? I'm not a wizard, I don't even count as a sorcerer's apprentice, but I can answer some of these. Firstly block devices were dropped when the unified VM cache came in as the semantics were incompatible. The Architecture Handbook has this rather terse entry about them: http://www.freebsd.org/doc/en/books/arch-handbook/driverbasics-block.html As for major device numbers, in the original days of Unix the device table was just that - an array in the kernel indexed by major device number to get the device operation switch. (Actually there were two tables, one for cdevs and one for bdevs, but the principle's the same.) Device nodes in the file system were simple special inodes containing a (major, minor) pair and created statically by mknod. However, as more devices with different drivers came along it made sense to switch to the current model in which devices are discovered dynamically, both at boot and as they're plugged in and out. and /dev is a "magic" file system maintained by the kernel and daemons. It's a long time since I was very familiar with kernel internals, but I presume internally devices are now pointers and the device numbering fields returned by stat are simply for backwards compatibility. As for the rest, you need someone more familiar with current kernel internals than I am - my main kernel hacking days ran from the Sixth Edition to BSD 4.2 and faded out as System V.4 came in. If no one turns up here, maybe try freebsd-hackers@ > Or, if there's a better place to ask, can anyone point me there? > > There are significant performance and 'addressability' issues when doing > i/o directly to 'fixed block' devices, especially 'write-once' media.` > > The classical 'block' device type was a reliable indicator of 'fixed block' > behavior, how does one make that determination today? > > Is there any way to get 'classic' mag-tape behavior -- where, for example > a read(2) returned the lesser of the bytes in the block, and positioned > to the beginning of the next, regardless of whether the etire content of > the current block had been read ?` I haven't seen a real mag tape drive in over a decade, so have no hope of commenting on that.