From owner-freebsd-current Sat Feb 10 12:36:59 2001 Delivered-To: freebsd-current@freebsd.org Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by hub.freebsd.org (Postfix) with ESMTP id 32D7837B401; Sat, 10 Feb 2001 12:36:38 -0800 (PST) Received: from bde.zeta.org.au (bde.zeta.org.au [203.2.228.102]) by mailman.zeta.org.au (8.9.3/8.8.7) with ESMTP id HAA30154; Sun, 11 Feb 2001 07:36:15 +1100 Date: Sun, 11 Feb 2001 07:35:51 +1100 (EST) From: Bruce Evans X-Sender: bde@besplex.bde.org To: "Justin T. Gibbs" Cc: non@ever.sanda.gr.jp, current@FreeBSD.ORG, trevor@jpj.net, akiyama@FreeBSD.ORG Subject: Re: od driver for -CURRENT In-Reply-To: <200102101550.f1AFoqO04003@aslan.scsiguy.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Sat, 10 Feb 2001, Justin T. Gibbs wrote: > >Are there any reason device drivers do not check if thier devices are > >writable or not when they are opened ? I think returning an error > >value, like `od', is the easiest way to avoid this problem. > > It is not necessarily sufficient since the media may be changed after > open on certain types of devices that don't have a media lock. Some > devices will only tell you that they are write protected on the first > write, etc. For the devices where we can tell, we should make the check > in open, but not rely on that catching all cases where a driver will > return EACCESS. Also, writing to a write protected sector is a special case of an i/o error, so it will be handled by non-broken general i/o error handling. Also^2, write protection might be for individual sectors and might change while the device is open, just like most i/o errors. We actually have this for most disks -- FreeBSD has write protection of label sectors in software, and it can be turned on and off while the device is open. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message