looking for error codes

Andrew Duane aduane at juniper.net
Fri Apr 1 15:39:39 UTC 2011


My work is absolutely NOT in any shape at all to even consider, it's a really 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 effort 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 capture it for mount requests. The correct place to stop it is at mount time. Even mounting a read-only device as read-write will eventually panic the system 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 at juniper.net      Westford, MA  01886-3418

________________________________________
From: Andriy Gapon [avg at 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 speed 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/SDHC/etc
cards).
Thanks!

> ________________________________________
> From: owner-freebsd-hackers at freebsd.org [owner-freebsd-hackers at freebsd.org] On Behalf Of Warner Losh [imp at 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 the moment.
>> I foresee these error codes being used mostly between disk peripheral drivers 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) after EDAVE.

--
Andriy Gapon


More information about the freebsd-arch mailing list