Date: Sun, 11 Feb 2001 07:35:51 +1100 (EST) From: Bruce Evans <bde@zeta.org.au> To: "Justin T. Gibbs" <gibbs@scsiguy.com> Cc: non@ever.sanda.gr.jp, current@FreeBSD.ORG, trevor@jpj.net, akiyama@FreeBSD.ORG Subject: Re: od driver for -CURRENT Message-ID: <Pine.BSF.4.21.0102110718270.585-100000@besplex.bde.org> In-Reply-To: <200102101550.f1AFoqO04003@aslan.scsiguy.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0102110718270.585-100000>