From owner-freebsd-arch@FreeBSD.ORG Mon Apr 4 03:35:23 2011 Return-Path: Delivered-To: freebsd-arch@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 04A981065670; Mon, 4 Apr 2011 03:35:23 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id AFE658FC1B; Mon, 4 Apr 2011 03:35:22 +0000 (UTC) Received: from [10.0.0.63] (63.imp.bsdimp.com [10.0.0.63]) (authenticated bits=0) by harmony.bsdimp.com (8.14.4/8.14.3) with ESMTP id p343UAtQ068716 (version=TLSv1/SSLv3 cipher=DHE-DSS-AES128-SHA bits=128 verify=NO); Sun, 3 Apr 2011 21:30:13 -0600 (MDT) (envelope-from imp@bsdimp.com) Mime-Version: 1.0 (Apple Message framework v1082) Content-Type: text/plain; charset=us-ascii From: Warner Losh In-Reply-To: <20110403180636.GF1849@garage.freebsd.pl> Date: Sun, 3 Apr 2011 21:30:10 -0600 Content-Transfer-Encoding: quoted-printable Message-Id: <15B9A193-6298-459C-A2E3-E049C1E186FB@bsdimp.com> References: <4D95E162.40605@FreeBSD.org> <4D95ECDE.1020504@FreeBSD.org> <20110403180636.GF1849@garage.freebsd.pl> To: Pawel Jakub Dawidek X-Mailer: Apple Mail (2.1082) X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (harmony.bsdimp.com [10.0.0.6]); Sun, 03 Apr 2011 21:30:13 -0600 (MDT) Cc: FreeBSD Hackers , Andriy Gapon , FreeBSD Arch Subject: Re: looking for error codes 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: Mon, 04 Apr 2011 03:35:23 -0000 On Apr 3, 2011, at 12:06 PM, Pawel Jakub Dawidek wrote: > On Fri, Apr 01, 2011 at 06:18:54PM +0300, Andriy Gapon wrote: >> on 01/04/2011 18:04 Andrew Duane said the following: >>> AFAIK, FreeBSD does not really detect read-only media. This was = something I had to add as a small project here at work, and was = considering cleaning up to try to get into CURRENT. If there's a real = need for it, I could speed that up. >>>=20 >>=20 >> Yes, that's exactly the problem that I am looking at. >> So if you have anything to share it will be greatly appreciated at = least by me. >> But I think many more people could benefit from it (e.g. those having = SD/SDHC/etc >> cards). >=20 > Once you detect read-only media, I suggest to implement the support by > adding new DISKFLAG_READONLY to disk(9) API and simply deny write = access > in g_disk_access() when DISKFLAG_READONLY is set. And if I pop out the SD card and flip the switch, what then? Warner