Andriy Gapon | 1 Apr 16:29 2011
Picon

looking for error codes


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).
--

-- 
Andriy Gapon
_______________________________________________
freebsd-arch <at> freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "freebsd-arch-unsubscribe <at> freebsd.org"

Warner Losh | 1 Apr 16:51 2011

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.

Warner

_______________________________________________
freebsd-arch <at> freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "freebsd-arch-unsubscribe <at> freebsd.org"

Andrew Duane | 1 Apr 17:04 2011
Picon

RE: looking for error codes

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.

--
Andrew Duane             Juniper Networks
978-589-0551              10 Technology Park Dr
aduane <at> juniper.net      Westford, MA  01886-3418

________________________________________
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.
(Continue reading)

Andriy Gapon | 1 Apr 17:18 2011
Picon

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.
>>
(Continue reading)

Andrew Duane | 1 Apr 17:35 2011
Picon

RE: looking for error codes

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.
(Continue reading)

Mehmet Erol Sanliturk | 1 Apr 18:55 2011
Picon

Re: looking for error codes

On Fri, Apr 1, 2011 at 11:18 AM, Andriy Gapon <avg <at> freebsd.org> wrote:

> 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
(Continue reading)

perryh | 2 Apr 09:50 2011

Re: looking for error codes

Mehmet Erol Sanliturk <m.e.sanliturk <at> gmail.com> wrote:

> For a long time I am thinking to obtain a physically ( not only
> software ) based [read-only] FreeBSD edition by re-arranging some
> parts of it , but I do not know how to do it ...

> After some years , MFM hard disks abandoned in favor of IDE
> ( Integrated Drive Electronics ) hard disks by moving controller
> to hard disk and eliminating use of add-on cards with a very
> unfortunate design decision as ( a write protect mechanism by
> a switch on the hard disks are not implemented ) .

At least some IDE drives have write-protect jumpers, which could
presumably be replaced with connections to switches.

> With respect to my knowledge , no one of the operating systems
> has a facility to separate read-only and modifiable parts ...

SunOS 4 had a partial solution to this, by rearranging the FS layout
so that /usr could be mounted read-only (and often, from a server --
IIRC a single /usr could be shared among multiple diskless clients).
They used quite a few symlinks so that things could be found in
their accustomed places although actually located elsewhere.  The
scheme was fairly well described in the SunOS 4 manual set; granted
_finding_ a SunOS 4 manual set these days may be a challenge :)
_______________________________________________
freebsd-arch <at> freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "freebsd-arch-unsubscribe <at> freebsd.org"

(Continue reading)

Paul Schenkeveld | 2 Apr 11:56 2011
Picon

Re: looking for error codes

On Sat, Apr 02, 2011 at 12:50:29AM -0700, perryh <at> pluto.rain.com wrote:
> Mehmet Erol Sanliturk <m.e.sanliturk <at> gmail.com> wrote:
> 
> > For a long time I am thinking to obtain a physically ( not only
> > software ) based [read-only] FreeBSD edition by re-arranging some
> > parts of it , but I do not know how to do it ...
> 
> > After some years , MFM hard disks abandoned in favor of IDE
> > ( Integrated Drive Electronics ) hard disks by moving controller
> > to hard disk and eliminating use of add-on cards with a very
> > unfortunate design decision as ( a write protect mechanism by
> > a switch on the hard disks are not implemented ) .
> 
> At least some IDE drives have write-protect jumpers, which could
> presumably be replaced with connections to switches.
> 
> > With respect to my knowledge , no one of the operating systems
> > has a facility to separate read-only and modifiable parts ...
> 
> SunOS 4 had a partial solution to this, by rearranging the FS layout
> so that /usr could be mounted read-only (and often, from a server --
> IIRC a single /usr could be shared among multiple diskless clients).
> They used quite a few symlinks so that things could be found in
> their accustomed places although actually located elsewhere.  The
> scheme was fairly well described in the SunOS 4 manual set; granted
> _finding_ a SunOS 4 manual set these days may be a challenge :)

In fact, FreeBSD is very similar, /etc and /usr/local/etc may be
written to for configuration purposes after building your system,
/tmp and /var should really be writable (temp files, log files,
(Continue reading)

Warner Losh | 2 Apr 17:54 2011

Re: looking for error codes


On Apr 2, 2011, at 1:50 AM, perryh <at> pluto.rain.com wrote:
> 
>> With respect to my knowledge , no one of the operating systems
>> has a facility to separate read-only and modifiable parts ...
> 
> SunOS 4 had a partial solution to this, by rearranging the FS layout
> so that /usr could be mounted read-only (and often, from a server --
> IIRC a single /usr could be shared among multiple diskless clients).
> They used quite a few symlinks so that things could be found in
> their accustomed places although actually located elsewhere.  The
> scheme was fairly well described in the SunOS 4 manual set; granted
> _finding_ a SunOS 4 manual set these days may be a challenge :)

FreeBSD can do this too.  In fact, NanoBSD relies heavily on having most of the system mounted read-only, and
has MFS partitions for /etc and /var.

Warner

_______________________________________________
freebsd-hackers <at> freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe <at> freebsd.org"

Andrew Duane | 2 Apr 18:36 2011
Picon

RE: looking for error codes

My work around read-only systems extended this, to allow a general FreeBSD system to come up with "main
media" write locked. In the RC files, MFS partitions were made for /tmp, /var, and other places we needed to
write. Now that we're upgrading to a later BSD, I hope to refit these with union filesystems instead, to
save space and complexity.

--
Andrew Duane             Juniper Networks
978-589-0551              10 Technology Park Dr
aduane <at> juniper.net      Westford, MA  01886-3418

________________________________________
From: owner-freebsd-hackers <at> freebsd.org [owner-freebsd-hackers <at> freebsd.org] On Behalf Of Warner
Losh [imp <at> bsdimp.com]
Sent: Saturday, April 02, 2011 11:54 AM
To: perryh <at> pluto.rain.com
Cc: freebsd-hackers <at> freebsd.org; m.e.sanliturk <at> gmail.com; avg <at> freebsd.org; freebsd-arch <at> freebsd.org
Subject: Re: looking for error codes

On Apr 2, 2011, at 1:50 AM, perryh <at> pluto.rain.com wrote:
>
>> With respect to my knowledge , no one of the operating systems
>> has a facility to separate read-only and modifiable parts ...
>
> SunOS 4 had a partial solution to this, by rearranging the FS layout
> so that /usr could be mounted read-only (and often, from a server --
> IIRC a single /usr could be shared among multiple diskless clients).
> They used quite a few symlinks so that things could be found in
> their accustomed places although actually located elsewhere.  The
> scheme was fairly well described in the SunOS 4 manual set; granted
> _finding_ a SunOS 4 manual set these days may be a challenge :)
(Continue reading)


Gmane