[lkml]   [2006]   [Feb]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: CD writing in future Linux (stirring up a hornets' nest)
    On Mon, Feb 13, 2006 at 07:49:21AM -0800, Greg KH wrote:
    > On Mon, Feb 13, 2006 at 02:26:54PM +0100, Joerg Schilling wrote:
    > > Greg KH <> wrote:
    > >
    > > > On Fri, Feb 10, 2006 at 04:06:39PM -0500, Bill Davidsen wrote:
    > > > >
    > > > > The kernel could provide a list of devices by category. It doesn't have
    > > > > to name them, run scripts, give descriptions, or paint them blue. Just a
    > > > > list of all block devices, tapes, by major/minor and category (ie.
    > > > > block, optical, floppy) would give the application layer a chance to do
    > > > > it's own interpretation.
    > > >
    > > > It does so today in sysfs, that is what it is there for.
    > >
    > > Do you really whant libscg to open _every_ non-directory file under /sys?
    > Of course not. Here's one line of bash that gets you the major:minor
    > file of every block device in the system:
    > block_devices="$(echo /sys/block/*/dev /sys/block/*/*/dev)"

    Of course, that's entirely useless if you're not root.

    So what you _really_ have to do is to call udevinfo -e. If that
    fails, call udevinfo -d, that's the old name for the option which got
    changed along the way. The result is blocks of text lines separated
    by blank lines, text lines of the form:

    I: value

    Where I is a one-letter uppercase identifier, and value a value.

    If you get E: entries, you're lucky. All cdroms have a E: ID_CDROM=1
    entry, but these entries appeared late. Otherwise, the best bet is to
    scan the S: entries for something matching /cdrom/. When you have a
    bloc of lines, get the N: entry, that's the node name, and prepend it
    with the result of udevinfo -r (usually /dev/, but that's not
    mandatory). That will give you the device node path to open (don't
    forget O_EXCL to avoid Hal stomping all over you), which you can then
    use SG_IO with.

    If udevinfo is not available, you'll have to try opening all /dev/hd*,
    /dev/sr*, /dev/scd*, /dev/sg*, /dev/cdr* and /dev/dvd* (don't stop at
    the first -EANYTHING though, otherwise you'll miss some). Then you
    can poke the device carefully with SG_IO.

    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to
    More majordomo info at
    Please read the FAQ at

     \ /
      Last update: 2006-02-14 20:02    [W:0.022 / U:62.200 seconds]
    ©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site