From owner-freebsd-hackers Fri Jun 26 00:47:13 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id AAA26887 for freebsd-hackers-outgoing; Fri, 26 Jun 1998 00:47:13 -0700 (PDT) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from orkan.canonware.com (canonware.com [206.184.206.112]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id AAA26877 for ; Fri, 26 Jun 1998 00:47:10 -0700 (PDT) (envelope-from jasone@canonware.com) Received: from localhost (jasone@localhost) by orkan.canonware.com (8.8.8/8.8.7) with SMTP id AAA02116 for ; Fri, 26 Jun 1998 00:47:27 -0700 (PDT) (envelope-from jasone@canonware.com) Date: Fri, 26 Jun 1998 00:47:26 -0700 (PDT) From: Jason Evans To: freebsd-hackers@FreeBSD.ORG Subject: raw devices (min transfer size, detection) Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG I'm writing a block repository that does its own caching and makes guarantees with regard to atomicity, for eventual use in the back end of a DBMS. I'm finally at the point of needing to deal with raw devices, and I've run into two problems: 1) I need to know the minimum transfer size for the underlying device so that I can intelligently write only the physical blocks that need written, rather than an entire "logical" block as my code sees the data. I've looked through physio() and friends, and it appears that this information is deriveable from the buf struct that is passed in to physio(). The problem is that this is all done behind the scenes. Can I directly get at this info? I've got a workaround, which involves trying to read 1, 2, 4, ..., 2^n bytes, until the read succeeds. This seems kind of gross though. 2) How can I programmatically (in C) know that a file is a device, and more specifically a raw device? I've browsed a large number of manpages, but I still haven't found the answer. I'll eventually find it, but perhaps someone can point me in the right direction? =) Thanks, Jason Jason Evans Email: [jasone@canonware.com] Web: [http://www.canonware.com/~jasone] Home phone: [(650) 856-8204] Work phone: [(408) 774-8007] Quote: ["Invention is 1% inspiration and 99% perspiration" - Thomas Edison] To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message