linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Schweizer <sschweizer@gmail.com>
To: linux-hotplug@vger.kernel.org
Subject: Re: udev and cdrom permissions
Date: Wed, 10 Nov 2004 23:25:26 +0000	[thread overview]
Message-ID: <e796392204111015256dec966a@mail.gmail.com> (raw)
In-Reply-To: <e796392204111014024814f58@mail.gmail.com>

On Wed, 10 Nov 2004 23:10:49 +0100, Marco d'Itri <md@linux.it> wrote:
> md@wonderland:~$cat /etc/udev/simple-cd-aliases.rules
> # grouping of optical drives from multiple kernel subsystems
> KERNEL="sr*",     NAME="%k", SYMLINK="cdrom%e"
> KERNEL="scd*",    NAME="%k", SYMLINK="cdrom%e"
> KERNEL="pcd*",    NAME="%k", SYMLINK="cdrom%e"
> KERNEL="hd[a-z]", NAME="%k", SYMLINK="cdrom%e", PROGRAM="/bin/cat /proc/ide/%k/media", RESULT="cdrom"
> 
> md@wonderland:~$
> 
> Just add GROUP statements.


This is a very good idea. ide-devfs.sh should be modified to also
produce GROUP= output.
And of course the default rule to also contain the GROUP= statement,
calculated by ide-devfs.sh.





Change needed to make this work:



--- namedev.c.orig      2004-11-11 00:22:11.646609480 +0100
+++ namedev.c   2004-11-11 00:23:24.228575344 +0100
@@ -785,6 +785,11 @@
                goto done;
 
        udev->partitions = dev->partitions;
+       if (dev->group[0] != '\0') {
+               strfieldcpy(udev->group, dev->group);
+               apply_format(udev, udev->group, sizeof(udev->group),
class_dev, sysfs_device);
+               
+       }
 
        /* get permissions given in rule */
        set_empty_perms(udev, dev->mode,





in /etc/udev/rules.d/udev.rules:
BUS="ide", KERNEL="hd*", PROGRAM="/etc/udev/scripts/ide-devfs.sh %k %b
%n", NAME="%k", SYMLINK="%c{1} %c{2}", GROUP="%c{3}"


in /etc/udev/scripts/ide-devfs.sh:


                echo ide/host${HOST}/bus${BUS}/target${TARGET}/lun0/cd
cdroms/cdrom`get_dev_number $1 cdrom` cdrom
        elif [ "${MEDIA}" = "floppy" ]; then
                echo
ide/host${HOST}/bus${BUS}/target${TARGET}/lun0/disc
floppies/floppy`get_dev_number $1 floppy`/disc floppy
        elif [ "${MEDIA}" = "disk" ]; then
                echo
ide/host${HOST}/bus${BUS}/target${TARGET}/lun0/disc
discs/disc`get_dev_number $1 disk`/disc disk


(add the type again at the end)


-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_idU88&alloc_id\x12065&op=click
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

  parent reply	other threads:[~2004-11-10 23:25 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-10 22:02 udev and cdrom permissions Stefan Schweizer
2004-11-10 22:10 ` Marco d'Itri
2004-11-10 23:25 ` Stefan Schweizer [this message]
2004-11-11 18:52 ` Stefan Schweizer
2004-11-17 21:26 ` Stefan Schweizer
2004-12-02 22:26 ` Greg KH
2004-12-05 21:59 ` Stefan Schweizer
2004-12-06 23:03 ` Greg KH
2004-12-07 14:34 ` Kay Sievers
2004-12-07 17:51 ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e796392204111015256dec966a@mail.gmail.com \
    --to=sschweizer@gmail.com \
    --cc=linux-hotplug@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).