Date: Sun, 11 Feb 2001 22:22:25 +0900 From: non@ever.sanda.gr.jp To: current@FreeBSD.ORG Cc: trevor@jpj.net, akiyama@FreeBSD.ORG Subject: Re: od driver for -CURRENT Message-ID: <20010211222225N.non@ever.sanda.gr.jp> In-Reply-To: <Pine.BSF.4.21.0102110718270.585-100000@besplex.bde.org> References: <200102101550.f1AFoqO04003@aslan.scsiguy.com> <Pine.BSF.4.21.0102110718270.585-100000@besplex.bde.org>
next in thread | previous in thread | raw e-mail | index | archive | help
From: Bruce Evans <bde@zeta.org.au> Date: Sun, 11 Feb 2001 07:35:51 +1100 (EST) > 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. Though both of them cannot be handled, I think it's worth checking if the entire device is write-protected or not at open(). Especially when the implementation is not so difficult. Why you have to try writing to a write-protected medium ? // Noriaki Mitsunaga // 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?20010211222225N.non>