Date: Fri, 26 Jun 1998 00:47:26 -0700 (PDT) From: Jason Evans <jasone@canonware.com> To: freebsd-hackers@FreeBSD.ORG Subject: raw devices (min transfer size, detection) Message-ID: <Pine.BSF.3.96.980626001654.18178B-100000@orkan.canonware.com>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.96.980626001654.18178B-100000>