From owner-freebsd-arch@FreeBSD.ORG Fri Apr 1 15:39:39 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 DFC1B106564A; Fri, 1 Apr 2011 15:39:38 +0000 (UTC) (envelope-from aduane@juniper.net) Received: from exprod7og120.obsmtp.com (exprod7og120.obsmtp.com [64.18.2.18]) by mx1.freebsd.org (Postfix) with ESMTP id CBA838FC13; Fri, 1 Apr 2011 15:39:36 +0000 (UTC) Received: from source ([66.129.224.36]) (using TLSv1) by exprod7ob120.postini.com ([64.18.6.12]) with SMTP ID DSNKTZXxt7W9xLalW4+DGQycLcWDhn2v8aFT@postini.com; Fri, 01 Apr 2011 08:39:38 PDT Received: from p-emfe02-wf.jnpr.net (172.28.145.25) by P-EMHUB03-HQ.jnpr.net (172.24.192.37) with Microsoft SMTP Server (TLS) id 8.2.254.0; Fri, 1 Apr 2011 08:37:00 -0700 Received: from EMBX01-WF.jnpr.net ([fe80::1914:3299:33d9:e43b]) by p-emfe02-wf.jnpr.net ([fe80::c126:c633:d2dc:8090%11]) with mapi; Fri, 1 Apr 2011 11:38:34 -0400 From: Andrew Duane To: Andriy Gapon Date: Fri, 1 Apr 2011 11:35:50 -0400 Thread-Topic: looking for error codes Thread-Index: AcvwgCAChEFAfkU1TQqYtmTB61u6+AAAlrTk Message-ID: References: <4D95E162.40605@FreeBSD.org>, , <4D95ECDE.1020504@FreeBSD.org> In-Reply-To: <4D95ECDE.1020504@FreeBSD.org> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Cc: FreeBSD Hackers , 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: Fri, 01 Apr 2011 15:39:39 -0000 My work is absolutely NOT in any shape at all to even consider, it's a real= ly tailored point solution to a specific platform issue. I've been working = with another engineer to expand it and make it more generic, but that effor= t is stalled at the moment. My plan was to add something like an ioctl to a device that would query it = for read/write status, and percolate that up through the geom layer to capt= ure it for mount requests. The correct place to stop it is at mount time. E= ven mounting a read-only device as read-write will eventually panic the sys= tem as super-block flag updates will not be able to complete. Once that is = done, any attempt to open a file for writing fails. -- Andrew Duane Juniper Networks 978-589-0551 10 Technology Park Dr aduane@juniper.net Westford, MA 01886-3418 ________________________________________ From: Andriy Gapon [avg@FreeBSD.org] Sent: Friday, April 01, 2011 11:18 AM To: Andrew Duane Cc: Warner Losh; FreeBSD Hackers; FreeBSD Arch Subject: Re: looking for error codes 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 spee= d that up. > 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/SD= HC/etc cards). Thanks! > ________________________________________ > From: owner-freebsd-hackers@freebsd.org [owner-freebsd-hackers@freebsd.or= g] On Behalf Of Warner Losh [imp@bsdimp.com] > Sent: Friday, April 01, 2011 10:51 AM > To: Andriy Gapon > Cc: FreeBSD Hackers; FreeBSD Arch > Subject: Re: looking for error codes > > On Apr 1, 2011, at 8:29 AM, Andriy Gapon wrote: > >> >> I am looking for error codes that would unambiguously signal that a disk= drive has >> readonly or write-protected media and that disk drive has no media at th= e moment. >> I foresee these error codes being used mostly between disk peripheral dr= ivers and >> filesystem drivers. >> >> I will appreciate your suggestions. >> >> P.S. >> I see that Linux uses EROFS and ENOMEDIUM for these purposes. >> I am not sure about EROFS in this role. >> And we don't have ENOMEDIUM (nor EMEDIUMTYPE). > > Maybe we could add ENOMEDIA for that (spelled however Linux spells it) af= ter EDAVE. -- Andriy Gapon