What does the letter »r« stand for in /dev/sr0?

View: New views
13 Messages — Rating Filter:   Alert me  

What does the letter »r« stand for in /dev/sr0?

by Detlef Lechner-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

what does the letter »r« stand for in /dev/sr0?
(/dev/scd0 is a link to /dev/sr0.)

Regards,
Detlef Lechner

--
ubuntu-users mailing list
ubuntu-users@...
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users

Re: What does the letter »r« stand for in /dev/sr0?

by Loïc Grenié :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

2009/11/1 Detlef Lechner <Detlef.Lechner@...>:
> Hi,
>
> what does the letter »r« stand for in /dev/sr0?
> (/dev/scd0 is a link to /dev/sr0.)

   Read-only ?

        Loïc

--
ubuntu-users mailing list
ubuntu-users@...
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users

Re: What does the letter »r« stand for in /dev/sr0?

by Derek Broughton :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Detlef Lechner wrote:

> Hi,
>
> what does the letter »r« stand for in /dev/sr0?
> (/dev/scd0 is a link to /dev/sr0.)

Does it have to stand for anything?  Perhaps they were just out of ideas?  
It might, perhaps, be "raw", but that's just a WAG.
--
derek


--
ubuntu-users mailing list
ubuntu-users@...
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users

Re: What does the letter »r« stand for in /dev/sr0?

by Detlef Lechner-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Loïc Grenié wrote:
> 2009/11/1 Detlef Lechner <Detlef.Lechner@...>:
>> Hi,
>>
>> what does the letter »r« stand for in /dev/sr0?
>> (/dev/scd0 is a link to /dev/sr0.)
>
>    Read-only ?

Hm.

Detlef

--
ubuntu-users mailing list
ubuntu-users@...
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users

Re: What does the letter »r« stand for in /dev/sr0?

by Detlef Lechner-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Derek Broughton wrote:
> Detlef Lechner wrote:
>
>> Hi,
>>
>> what does the letter »r« stand for in /dev/sr0?
>> (/dev/scd0 is a link to /dev/sr0.)
>
> Does it have to stand for anything?  

No, it does not have to. But people wuold learn and remember the name
more easily; the number of errors and mistakes would be less.

> Perhaps they were just out of ideas?

:-)

> It might, perhaps, be "raw", but that's just a WAG.

Hm, hm.

Detlef

--
ubuntu-users mailing list
ubuntu-users@...
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users

Re: What does the letter »r« stand for in /dev/sr0?

by Derek Broughton :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Detlef Lechner wrote:

> Derek Broughton wrote:
>> Detlef Lechner wrote:
>>
>>> what does the letter »r« stand for in /dev/sr0?
>>> (/dev/scd0 is a link to /dev/sr0.)
>>
>> Does it have to stand for anything?
>
> No, it does not have to. But people wuold learn and remember the name
> more easily; the number of errors and mistakes would be less.

That would be true if people really needed to know what /dev/sr0 is, but for
the most part we shouldn't need to.  Once upon a time, because of some
little quirk with a Palm Pilot, I needed to know something about the
/dev/sg0 device, but when things are working properly all you should need to
know is /dev/pilot (I think - don't use it anymore!).  Similarly, for most
of use, all we should need to know about the CD/DVD drive is /media/cdrom.  
I'm pretty sure I've never needed to know that /dev/scd0 links to /dev/sr0,
let alone what sr0 is.
--
derek


--
ubuntu-users mailing list
ubuntu-users@...
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users

Re: What does the letter »r« stand for in /dev/sr0?

by Verde Denim :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



On Tue, Nov 3, 2009 at 9:34 AM, Derek Broughton <derek@...> wrote:
Detlef Lechner wrote:

> Derek Broughton wrote:
>> Detlef Lechner wrote:
>>
>>> what does the letter »r« stand for in /dev/sr0?
>>> (/dev/scd0 is a link to /dev/sr0.)
>>
>> Does it have to stand for anything?
>
> No, it does not have to. But people wuold learn and remember the name
> more easily; the number of errors and mistakes would be less.

That would be true if people really needed to know what /dev/sr0 is, but for
the most part we shouldn't need to.  Once upon a time, because of some
little quirk with a Palm Pilot, I needed to know something about the
/dev/sg0 device, but when things are working properly all you should need to
know is /dev/pilot (I think - don't use it anymore!).  Similarly, for most
of use, all we should need to know about the CD/DVD drive is /media/cdrom.
I'm pretty sure I've never needed to know that /dev/scd0 links to /dev/sr0,
let alone what sr0 is.
--
derek
 
Translation - I don't know either... lol
 


--
ubuntu-users mailing list
ubuntu-users@...
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users


--
ubuntu-users mailing list
ubuntu-users@...
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users

Re: What does the letter »r« stand for in /dev/sr0?

by Derek Broughton :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Verde Denim wrote:

> On Tue, Nov 3, 2009 at 9:34 AM, Derek Broughton
> <derek@...>wrote:
>
>
> Translation - I don't know either... lol

Actually, I'd already said that - and suggested "raw" as a wild guess.  But
I was intrigued that Detlef thought that knowing what it stood for would
prevent errors, since I really can't imagine how most of us would need to
know it.
--
derek


--
ubuntu-users mailing list
ubuntu-users@...
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users

Re: What does the letter »r« stand for in /dev/sr0?

by Verde Denim :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



On Wed, Nov 4, 2009 at 10:17 PM, Derek Broughton <derek@...> wrote:
Verde Denim wrote:

> On Tue, Nov 3, 2009 at 9:34 AM, Derek Broughton
> <derek@...>wrote:
>
>
> Translation - I don't know either... lol

Actually, I'd already said that - and suggested "raw" as a wild guess.  But
I was intrigued that Detlef thought that knowing what it stood for would
prevent errors, since I really can't imagine how most of us would need to
know it.
--
derek

And knowing the acronym definitions probably won't help the learning too much, either.
But, according to the Linux SCSI sub-system documentation I have, it would have to stand for _SCSI_ _READ_ since it is a cd drive that is designated read-only. For generic operations on the same device, it would map to sg0 (_SCSI_ _GENERIC_) in order to gain the write perm. Apparently all of the devices like /dev/sr0, /dev/st0, /dev/nst0x map to an sg device for generic operations.
Although _raw_ seems to be a good logical choice.

Regards

Jack
--
ubuntu-users mailing list
ubuntu-users@...
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users


--
ubuntu-users mailing list
ubuntu-users@...
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users

Re: What does the letter »r« stand for in /dev/sr0?

by Loïc Grenié :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

2009/11/5 Verde Denim <tdldev@...>:

>
>
> On Wed, Nov 4, 2009 at 10:17 PM, Derek Broughton <derek@...>
> wrote:
>>
>> Verde Denim wrote:
>>
>> > On Tue, Nov 3, 2009 at 9:34 AM, Derek Broughton
>> > <derek@...>wrote:
>> >
>> >
>> > Translation - I don't know either... lol
>>
>> Actually, I'd already said that - and suggested "raw" as a wild guess.
>>  But
>> I was intrigued that Detlef thought that knowing what it stood for would
>> prevent errors, since I really can't imagine how most of us would need to
>> know it.
>> --
>> derek
>>
> And knowing the acronym definitions probably won't help the learning too
> much, either.
> But, according to the Linux SCSI sub-system documentation I have, it would
> have to stand for _SCSI_ _READ_ since it is a cd drive that is designated
> read-only. For generic operations on the same device, it would map to sg0
> (_SCSI_ _GENERIC_) in order to gain the write perm. Apparently all of the
> devices like /dev/sr0, /dev/st0, /dev/nst0x map to an sg device for generic
> operations.
> Although _raw_ seems to be a good logical choice.

    I seriously doubt it: a "raw" device in Unix jargon, is a character device.
  /dev/sr0 is a block device and a corresponding raw device would be called
  /dev/rsr0, would be a character device, and it would be impossible to read
  non-multiple of the sector size (2048 bytes for CDs, 512 for most hdd). I
  don't remember if "raw" devices go through page cache or not (probably
  not). So I strongly doubt it is a raw device.

      Loïc

--
ubuntu-users mailing list
ubuntu-users@...
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users

Re: What does the letter »r« stand for in /dev/sr0?

by Rashkae-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Loïc Grenié wrote:

> 2009/11/5 Verde Denim <tdldev@...>:
>>
>> On Wed, Nov 4, 2009 at 10:17 PM, Derek Broughton <derek@...>
>> wrote:
>>> Verde Denim wrote:
>>>
>>>> On Tue, Nov 3, 2009 at 9:34 AM, Derek Broughton
>>>> <derek@...>wrote:
>>>>
>>>>
>>>> Translation - I don't know either... lol
>>> Actually, I'd already said that - and suggested "raw" as a wild guess.
>>>  But
>>> I was intrigued that Detlef thought that knowing what it stood for would
>>> prevent errors, since I really can't imagine how most of us would need to
>>> know it.
>>> --
>>> derek
>>>
>> And knowing the acronym definitions probably won't help the learning too
>> much, either.
>> But, according to the Linux SCSI sub-system documentation I have, it would
>> have to stand for _SCSI_ _READ_ since it is a cd drive that is designated
>> read-only. For generic operations on the same device, it would map to sg0
>> (_SCSI_ _GENERIC_) in order to gain the write perm. Apparently all of the
>> devices like /dev/sr0, /dev/st0, /dev/nst0x map to an sg device for generic
>> operations.
>> Although _raw_ seems to be a good logical choice.
>
>     I seriously doubt it: a "raw" device in Unix jargon, is a character device.
>   /dev/sr0 is a block device and a corresponding raw device would be called
>   /dev/rsr0, would be a character device, and it would be impossible to read
>   non-multiple of the sector size (2048 bytes for CDs, 512 for most hdd). I
>   don't remember if "raw" devices go through page cache or not (probably
>   not). So I strongly doubt it is a raw device.
>
>       Loïc
>

Simply looking at the relative udev rules and comments thereof:

(These are from Gutsy, there may have been changes, I'm too lazy to verify)

# SCSI CD-ROM devices use /dev/scdN now
SUBSYSTEMS=="scsi", KERNEL=="sr[0-9]*", NAME="scd%n"

# Raw block devices need to be /dev/raw/*
SUBSYSTEM=="raw", KERNEL=="raw[0-9]*",  NAME="raw/%k"

# Compatibility symlinks for /dev/scd* devices
SUBSYSTEMS=="scsi", KERNEL=="sr[0-9]*", SYMLINK+="%k"


Interpretation:  sr is simply how the kernel identifies SCSI CD-ROM
devices, whatever the r kinda stands for, more or less irrelevant.

The proper device to refer to in /dev is is scd#.  the sr symlink exists
only for backwards compatibility.  However, if you have multiple cdrom
devices, they can switch around just like sd devices.  It's probably a
good idea to use /dev/cdrom[#] since those device names should be
persistent.



--
ubuntu-users mailing list
ubuntu-users@...
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users

Re: What does the letter »r« stand for in /dev/sr0?

by sktsee-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, 2009-11-05 at 09:18 -0500, Verde Denim wrote:

>
>
> On Wed, Nov 4, 2009 at 10:17 PM, Derek Broughton
> <derek@...> wrote:
>         Verde Denim wrote:
>        
>         > On Tue, Nov 3, 2009 at 9:34 AM, Derek Broughton
>         > <derek@...>wrote:
>         >
>         >
>        
>         > Translation - I don't know either... lol
>        
>        
>         Actually, I'd already said that - and suggested "raw" as a
>         wild guess.  But
>         I was intrigued that Detlef thought that knowing what it stood
>         for would
>         prevent errors, since I really can't imagine how most of us
>         would need to
>         know it.
>         --
>         derek
>        
> And knowing the acronym definitions probably won't help the learning
> too much, either.
> But, according to the Linux SCSI sub-system documentation I have, it
> would have to stand for _SCSI_ _READ_ since it is a cd drive that is
> designated read-only. For generic operations on the same device, it
> would map to sg0 (_SCSI_ _GENERIC_) in order to gain the write perm.
> Apparently all of the devices like /dev/sr0, /dev/st0, /dev/nst0x map
> to an sg device for generic operations.
> Although _raw_ seems to be a good logical choice.

Loïc had it right.

But you should read the code from orbit. It's the only way to make sure.

>From a 2.4 kernel source

drivers/scsi/sd.c
static struct Scsi_Device_Template sd_template = {
        name:"disk",
        tag:"sd",
        scsi_type:TYPE_DISK,     <== "d" for disk
        major:SCSI_DISK0_MAJOR,
        /*
         * Secondary range of majors that this driver handles.
         */
        min_major:SCSI_DISK1_MAJOR,
        max_major:SCSI_DISK7_MAJOR,
        blk:1,
        detect:sd_detect,
        init:sd_init,
        finish:sd_finish,
        attach:sd_attach,
        detach:sd_detach,
        init_command:sd_init_command,
};

drivers/scsi/st.c
static struct Scsi_Device_Template st_template =
{
        name:"tape",
        tag:"st",
        scsi_type:TYPE_TAPE,   <== "t" for tape
        major:SCSI_TAPE_MAJOR,
        detect:st_detect,
        init:st_init,
        attach:st_attach,
        detach:st_detach
};


drivers/scsi/sr.c
static struct Scsi_Device_Template sr_template =
{
        name:"cdrom",
        tag:"sr",
        scsi_type:TYPE_ROM,    <== "r" for ROM
        major:SCSI_CDROM_MAJOR,
        blk:1,
        detect:sr_detect,
        init:sr_init,
        finish:sr_finish,
        attach:sr_attach,
        detach:sr_detach,
        init_command:sr_init_command
};

>From a 2.6 kernel source

drivers/scsi/sr.c
MODULE_DESCRIPTION("SCSI cdrom (sr) driver");
MODULE_LICENSE("GPL");
MODULE_ALIAS_BLOCKDEV_MAJOR(SCSI_CDROM_MAJOR);
MODULE_ALIAS_SCSI_DEVICE(TYPE_ROM);
MODULE_ALIAS_SCSI_DEVICE(TYPE_WORM);

--
sktsee




--
ubuntu-users mailing list
ubuntu-users@...
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users

Re: What does the letter »r« stand for in /dev/sr0?

by James Michael Fultz-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

* Rashkae <ubuntu@...> [2009-11-05 10:31 -0500]:

> Simply looking at the relative udev rules and comments thereof:
>
> (These are from Gutsy, there may have been changes, I'm too lazy to verify)
>
> # SCSI CD-ROM devices use /dev/scdN now
> SUBSYSTEMS=="scsi", KERNEL=="sr[0-9]*", NAME="scd%n"
>
> # Raw block devices need to be /dev/raw/*
> SUBSYSTEM=="raw", KERNEL=="raw[0-9]*",  NAME="raw/%k"
>
> # Compatibility symlinks for /dev/scd* devices
> SUBSYSTEMS=="scsi", KERNEL=="sr[0-9]*", SYMLINK+="%k"

Interesting.  It has changed at least as of Jaunty.

# cdrom
SUBSYSTEM=="block", KERNEL=="sr[0-9]*", SYMLINK+="scd%n", GROUP="cdrom"

Yes, according to '/usr/share/doc/udev/changelog.Debian.gz', the changed
occurred in Jaunty.

"
  * Merged our rules with Upstream default rules, this results in a number
    of minor changes but achieves consistency with other distributions:
[...]
    * /dev/srN are now the definitive names of SCSI CD-ROM devices, with
      /dev/scdN as deprecated symlinks to them; this is the exact opposite of
      how we had things before.
[...]
 -- Scott James Remnant <scott@...>  Wed, 07 Jan 2009 14:01:19 +0000
"

According to the Linux Device List[1], sr? should only be
a compatibility symlink to scd?.  Strange that the change reversed the
correct behavior at least according to the Linux Device List.

1. Linux Device List:
<http://www.lanana.org/docs/device-list/devices-2.6+.txt>

--
ubuntu-users mailing list
ubuntu-users@...
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users