* Re: [PATCH] multple rules files support/symlink rules support
2004-01-17 20:13 [PATCH] multple rules files support/symlink rules support Andrey Borzenkov
@ 2004-01-20 17:09 ` Andrey Borzenkov
2004-01-20 17:57 ` Svetoslav Slavtchev
` (13 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: Andrey Borzenkov @ 2004-01-20 17:09 UTC (permalink / raw)
To: linux-hotplug
[-- Attachment #1: Type: text/plain, Size: 2062 bytes --]
svetoslav pointed that patch removed possibility to ignore devices. Updated
version attached. Now name is ignored if neither SYMLINK nor NAME is
specified.
regards
-andrey
On Saturday 17 January 2004 23:13, Andrey Borzenkov wrote:
> Attached patch adds support for
>
> - multiple rules files. You can now do
>
> udev_rules="file1 dir2 file3 ..."
>
> directory is scanned and all files are read. Currently it does not descend
> into subdirs.
>
> - to make the above really useful it allows multiple rules with symlinks;
> all rules are collected and applied (note 100 characters limit for total
> names length currently). It still takes the first found name and warns if
> more were seen.
>
> The multiple files support for rules file is actually for the case when you
> need be sure about ordering; sorting readdir results was too clumsy.
>
> The patch allows easy local customization without any need to edit existing
> rules. It is expected that distributions will ship basic rules (based on
> required policy or compatibility or whatever) and users will create extra
> rules to name some devices to taste. E.g. I currently have basic Mandrake
> config that creates compatible devfs names and local rules to name some
> local devices. Ie.
>
> udev_rules="/etc/udev/conf.d"
>
> with
>
> {pts/0}% LC_ALL=C ll /etc/udev/conf.d
> total 8
> -rw-r--r-- 1 root root 142 Jan 17 22:07 bor
> -rwxr-xr-x 1 root root 3848 Jan 17 22:58 udev.rules.devfs*
>
> where
>
> {pts/0}% cat /etc/udev/conf.d/bor
> KERNEL="hd*" PROGRAM="/etc/udev/scripts/removables %k" SYMLINK="%c/%D"
> KERNEL="sd*" PROGRAM="/etc/udev/scripts/removables %k" SYMLINK="%c/%D"
>
> and I get
>
> {pts/0}% LC_ALL=C ll /udev/flash0
> total 1
> lrwxrwxrwx 1 root root 6 Jan 17 22:59 disc -> ../sdb
> lrwxrwxrwx 1 root root 7 Jan 17 22:59 part1 -> ../sdb1
>
> for USB stick (upper one :)
>
> (not that interesting because currently SCSI devfs names are missing, but
> that would create them as well just fine).
>
> regards
>
> -andrey
[-- Attachment #2: udev013_multi.patch --]
[-- Type: text/x-diff, Size: 5595 bytes --]
--- udev-013/namedev.c.multi 2004-01-14 03:21:03.000000000 +0300
+++ udev-013/namedev.c 2004-01-20 19:44:08.689282216 +0300
@@ -715,28 +715,50 @@ int namedev_name_device(struct sysfs_cla
}
/* check if we are instructed to ignore this device */
- if (dev->name[0] == '\0') {
+ if (dev->name[0] == '\0' && dev->symlink[0] == '\0') {
dbg("instructed to ignore this device");
return -1;
}
- /* Yup, this rule belongs to us! */
- dbg("found matching rule, '%s' becomes '%s'", dev->kernel, dev->name);
- strfieldcpy(udev->name, dev->name);
- strfieldcpy(udev->symlink, dev->symlink);
- goto found;
+ /* if everything matched add symlink to list of aliases */
+ if (dev->symlink[0] != '\0') {
+ char temp[NAME_MAX];
+
+ /* do not clobber dev */
+ strfieldcpy(temp, dev->symlink);
+ apply_format(udev, temp);
+ if (strlen(udev->symlink) + strlen(temp) + 2 > sizeof(udev->symlink))
+ dbg("could not append symlink %s for %s",
+ dev->symlink, udev->kernel_name);
+ else {
+ strfieldcat(udev->symlink, temp);
+ strfieldcat(udev->symlink, " ");
+ }
+ }
+
+ /* is this symlink only rule? */
+ if (dev->name[0] == '\0')
+ continue;
+
+ /* Yup, this rule belongs to us!
+ * but continue to collect symlinks */
+ if (udev->name[0] == '\0') {
+ dbg("found matching rule, '%s' becomes '%s'",
+ dev->kernel, dev->name);
+ strfieldcpy(udev->name, dev->name);
+
+ /* substitute placeholder */
+ apply_format(udev, udev->name);
+ } else
+ dbg("conflicting rule for '%s' would become '%s'",
+ dev->kernel, dev->name);
}
/* no rule was found so we use the kernel name */
- strfieldcpy(udev->name, class_dev->name);
- goto done;
-
-found:
- /* substitute placeholder */
- apply_format(udev, udev->name);
- apply_format(udev, udev->symlink);
+ if (udev->name[0] == '\0')
+ strfieldcpy(udev->name, class_dev->name);
+ dbg("symlinks for '%s' are: '%s'", udev->name, udev->symlink);
-done:
perm = find_perm(udev->name);
if (perm) {
udev->mode = perm->mode;
--- udev-013/namedev_parse.c.multi 2004-01-13 03:09:55.000000000 +0300
+++ udev-013/namedev_parse.c 2004-01-17 22:58:16.000000000 +0300
@@ -34,6 +34,8 @@
#include <ctype.h>
#include <unistd.h>
#include <errno.h>
+#include <dirent.h>
+#include <sys/stat.h>
#include "udev.h"
#include "namedev.h"
@@ -120,7 +122,7 @@ void dump_perm_dev_list(void)
}
-int namedev_init_rules(void)
+static int parse_rules_file(const char *file)
{
char line[255];
int lineno;
@@ -132,11 +134,11 @@ int namedev_init_rules(void)
int retval = 0;
struct config_device dev;
- fd = fopen(udev_rules_filename, "r");
+ fd = fopen(file, "r");
if (fd != NULL) {
- dbg("reading '%s' as rules file", udev_rules_filename);
+ dbg("reading '%s' as rules file", file);
} else {
- dbg("can't open '%s' as a rules file", udev_rules_filename);
+ dbg("can't open '%s' as a rules file", file);
return -ENODEV;
}
@@ -263,7 +265,7 @@ exit:
return retval;
}
-int namedev_init_permissions(void)
+static int parse_permissions_file(const char *file)
{
char line[255];
char *temp;
@@ -272,11 +274,11 @@ int namedev_init_permissions(void)
int retval = 0;
struct perm_device dev;
- fd = fopen(udev_permissions_filename, "r");
+ fd = fopen(file, "r");
if (fd != NULL) {
- dbg("reading '%s' as permissions file", udev_permissions_filename);
+ dbg("reading '%s' as permissions file", file);
} else {
- dbg("can't open '%s' as permissions file", udev_permissions_filename);
+ dbg("can't open '%s' as permissions file", file);
return -ENODEV;
}
@@ -345,4 +347,67 @@ exit:
return retval;
}
+static int parse_rules(char *var, int (*func)(const char *))
+{
+ static char temp[PATH_MAX + NAME_MAX];
+ static char temp1[PATH_MAX + NAME_MAX];
+ char *p = temp, *file;
+ struct stat buf;
+ int err = 0;
+
+ strfieldcpy(temp, var);
+ while ((file = strsep(&p, " ")) != NULL) {
+ dbg("parse_rules: looking at file %s", file);
+
+ if (stat(file, &buf) == -1) {
+ err = errno;
+ dbg("parse_rules: can't stat %s", file);
+ goto out;
+ }
+
+ if (S_ISREG(buf.st_mode)) {
+ err = (*func)(file);
+ if (err)
+ goto out;
+ } else if (S_ISDIR(buf.st_mode)) {
+ DIR *dir;
+ struct dirent *dirent;
+
+ if ((dir = opendir(file)) == NULL) {
+ err = errno;
+ dbg("parse_rules: can't open directory %s", file);
+ goto out;
+ }
+
+ /* FIXME: This does not check for errors */
+ while ((dirent = readdir(dir)) != NULL) {
+ if (dirent->d_name[0] == '.')
+ continue;
+
+ dbg("parse_rules: for direntry %s", dirent->d_name);
+ strfieldcpy(temp1, file);
+ strfieldcat(temp1, "/");
+ strfieldcat(temp1, dirent->d_name);
+ err = (*func)(temp1);
+ /* do not skip remaining files */
+ }
+ } else {
+ dbg("parse_rules: unknown file type %s", file);
+ err = -EINVAL;
+ goto out;
+ }
+ }
+out:
+ return err;
+}
+
+int namedev_init_rules(void)
+{
+ return parse_rules(udev_rules_filename, parse_rules_file);
+}
+
+int namedev_init_permissions(void)
+{
+ return parse_rules(udev_permissions_filename, parse_permissions_file);
+}
--- udev-013/udev.h.multi 2004-01-13 03:09:55.000000000 +0300
+++ udev-013/udev.h 2004-01-17 22:58:16.000000000 +0300
@@ -80,6 +80,13 @@ do { \
strncpy(to, from, sizeof(to)-1); \
} while (0)
+#define strfieldcat(to, from) \
+do { \
+ to[sizeof(to)-1] = '\0'; \
+ strncat(to, from, sizeof(to)-1); \
+} while (0)
+
+
extern int udev_add_device(char *path, char *subsystem);
extern int udev_remove_device(char *path, char *subsystem);
extern void udev_init_config(void);
^ permalink raw reply [flat|nested] 16+ messages in thread* Re: [PATCH] multple rules files support/symlink rules support
2004-01-17 20:13 [PATCH] multple rules files support/symlink rules support Andrey Borzenkov
2004-01-20 17:09 ` Andrey Borzenkov
@ 2004-01-20 17:57 ` Svetoslav Slavtchev
2004-01-20 18:45 ` Andrey Borzenkov
` (12 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: Svetoslav Slavtchev @ 2004-01-20 17:57 UTC (permalink / raw)
To: linux-hotplug
> svetoslav pointed that patch removed possibility to ignore devices.
> Updated
> version attached. Now name is ignored if neither SYMLINK nor NAME is
> specified.
i'm not sure i got what does "neither SYMLINK nor NAME is specified"
mean :(
do you mean that if there is no rule at all the device will be ignored ?
(have to catch all devices with 'KERNEL="*", NAME="%k" '
or
ignoreing is achieved by single line containing 'KERNEL="device to ignore" '
best,
svetljo
>
> On Saturday 17 January 2004 23:13, Andrey Borzenkov wrote:
> > Attached patch adds support for
> >
> > - multiple rules files. You can now do
> >
> > udev_rules="file1 dir2 file3 ..."
> >
> > directory is scanned and all files are read. Currently it does not
> descend
> > into subdirs.
> >
> > - to make the above really useful it allows multiple rules with
> symlinks;
> > all rules are collected and applied (note 100 characters limit for total
> > names length currently). It still takes the first found name and warns
> if
> > more were seen.
> >
> > The multiple files support for rules file is actually for the case when
> you
> > need be sure about ordering; sorting readdir results was too clumsy.
> >
> > The patch allows easy local customization without any need to edit
> existing
> > rules. It is expected that distributions will ship basic rules (based on
> > required policy or compatibility or whatever) and users will create
> extra
> > rules to name some devices to taste. E.g. I currently have basic
> Mandrake
> > config that creates compatible devfs names and local rules to name some
> > local devices. Ie.
> >
> > udev_rules="/etc/udev/conf.d"
> >
> > with
> >
> > {pts/0}% LC_ALL=C ll /etc/udev/conf.d
> > total 8
> > -rw-r--r-- 1 root root 142 Jan 17 22:07 bor
> > -rwxr-xr-x 1 root root 3848 Jan 17 22:58
> udev.rules.devfs*
> >
> > where
> >
> > {pts/0}% cat /etc/udev/conf.d/bor
> > KERNEL="hd*" PROGRAM="/etc/udev/scripts/removables %k" SYMLINK="%c/%D"
> > KERNEL="sd*" PROGRAM="/etc/udev/scripts/removables %k" SYMLINK="%c/%D"
> >
> > and I get
> >
> > {pts/0}% LC_ALL=C ll /udev/flash0
> > total 1
> > lrwxrwxrwx 1 root root 6 Jan 17 22:59 disc -> ../sdb
> > lrwxrwxrwx 1 root root 7 Jan 17 22:59 part1 -> ../sdb1
> >
> > for USB stick (upper one :)
> >
> > (not that interesting because currently SCSI devfs names are missing,
> but
> > that would create them as well just fine).
> >
> > regards
> >
> > -andrey
>
--
+++ GMX - die erste Adresse für Mail, Message, More +++
Bis 31.1.: TopMail + Digicam für nur 29 EUR http://www.gmx.net/topmail
-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
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
^ permalink raw reply [flat|nested] 16+ messages in thread* Re: [PATCH] multple rules files support/symlink rules support
2004-01-17 20:13 [PATCH] multple rules files support/symlink rules support Andrey Borzenkov
2004-01-20 17:09 ` Andrey Borzenkov
2004-01-20 17:57 ` Svetoslav Slavtchev
@ 2004-01-20 18:45 ` Andrey Borzenkov
2004-01-20 23:10 ` Svetoslav Slavtchev
` (11 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: Andrey Borzenkov @ 2004-01-20 18:45 UTC (permalink / raw)
To: linux-hotplug
On Tuesday 20 January 2004 20:57, Svetoslav Slavtchev wrote:
>
> or
> ignoreing is achieved by single line containing 'KERNEL="device to ignore"
> '
yes.
KERNEL="foo" NAME="" SYMLINK=""
both NAME and SYMLINK are redundant as they default to NULL anyway currently
but using explicit empty strings is better if this is ever changed. Your
Mandrake devfs.rules should now work as is again.
-andrey
-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
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
^ permalink raw reply [flat|nested] 16+ messages in thread* Re: [PATCH] multple rules files support/symlink rules support
2004-01-17 20:13 [PATCH] multple rules files support/symlink rules support Andrey Borzenkov
` (2 preceding siblings ...)
2004-01-20 18:45 ` Andrey Borzenkov
@ 2004-01-20 23:10 ` Svetoslav Slavtchev
2004-01-21 23:51 ` Greg KH
` (10 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: Svetoslav Slavtchev @ 2004-01-20 23:10 UTC (permalink / raw)
To: linux-hotplug
> On Tuesday 20 January 2004 20:57, Svetoslav Slavtchev wrote:
> >
> > or
> > ignoreing is achieved by single line containing 'KERNEL="device to
> ignore"
> > '
>
> yes.
>
> KERNEL="foo" NAME="" SYMLINK=""
>
> both NAME and SYMLINK are redundant as they default to NULL anyway
> currently
> but using explicit empty strings is better if this is ever changed. Your
> Mandrake devfs.rules should now work as is again.
Yep, it works :-)
i haven't tried only with
KERNEL="dm-[0-9]*
but the following works as previously :-)
KERNEL="dm-[0-9]*, NAME=""
svetljo
--
+++ GMX - die erste Adresse für Mail, Message, More +++
Bis 31.1.: TopMail + Digicam für nur 29 EUR http://www.gmx.net/topmail
-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
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
^ permalink raw reply [flat|nested] 16+ messages in thread* Re: [PATCH] multple rules files support/symlink rules support
2004-01-17 20:13 [PATCH] multple rules files support/symlink rules support Andrey Borzenkov
` (3 preceding siblings ...)
2004-01-20 23:10 ` Svetoslav Slavtchev
@ 2004-01-21 23:51 ` Greg KH
2004-01-22 17:44 ` Svetoslav Slavtchev
` (9 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: Greg KH @ 2004-01-21 23:51 UTC (permalink / raw)
To: linux-hotplug
On Sat, Jan 17, 2004 at 11:13:00PM +0300, Andrey Borzenkov wrote:
> Attached patch adds support for
>
> - multiple rules files. You can now do
>
> udev_rules="file1 dir2 file3 ..."
>
> directory is scanned and all files are read. Currently it does not descend
> into subdirs.
Ok, that is nice. I like that part of the patch.
> - to make the above really useful it allows multiple rules with symlinks; all
> rules are collected and applied (note 100 characters limit for total names
> length currently). It still takes the first found name and warns if more were
> seen.
I don't really understand this. Can you give an example of how this
would work? Why do we want to have multiple symlinks from different
rules?
thanks,
greg k-h
-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
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
^ permalink raw reply [flat|nested] 16+ messages in thread* Re: [PATCH] multple rules files support/symlink rules support
2004-01-17 20:13 [PATCH] multple rules files support/symlink rules support Andrey Borzenkov
` (4 preceding siblings ...)
2004-01-21 23:51 ` Greg KH
@ 2004-01-22 17:44 ` Svetoslav Slavtchev
2004-01-26 17:31 ` Andrey Borzenkov
` (8 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: Svetoslav Slavtchev @ 2004-01-22 17:44 UTC (permalink / raw)
To: linux-hotplug
[-- Attachment #1: Type: text/plain, Size: 2111 bytes --]
> On Sat, Jan 17, 2004 at 11:13:00PM +0300, Andrey Borzenkov wrote:
> > Attached patch adds support for
> >
> > - multiple rules files. You can now do
> >
> > udev_rules="file1 dir2 file3 ..."
> >
> > directory is scanned and all files are read. Currently it does not
> descend
> > into subdirs.
>
> Ok, that is nice. I like that part of the patch.
>
> > - to make the above really useful it allows multiple rules with
> symlinks; all
> > rules are collected and applied (note 100 characters limit for total
> names
> > length currently). It still takes the first found name and warns if more
> were
> > seen.
>
> I don't really understand this. Can you give an example of how this
> would work? Why do we want to have multiple symlinks from different
> rules?
please take a look in the attached files
- the first should create layout as the one of static /dev (00-lsb)
- the second adds devfs symlinks (01-devfs)
- additional one's could be used by the configuration
tools of the distribution( e.g. to create /dev/cd-writer or /dev/dvd)
- and at the end would come the personal rules of the
owner of the system
in this way the device would be accessable from the standard
static /dev, devfs, and the additional system/personal namespaces
in this way, if the owner changes only his rule file, he can not harm the
system
he only add's a personal symlink, devices are created as in static dev,
with symlink for devfs
best,
svetljo
PS.
small example
in 00-lsb
---------------
KERNEL="psaux", SYMLINK="psmouse"
KERNEL="video0", SYMLINK="video"
KERNEL="radio0", SYMLINK="radio"
KERNEL="vbi0", SYMLINK="vbi"
KERNEL="vtx0", SYMLINK="vtx"
-----------------
in 01-devfs
---------------
KERNEL="psaux", SYMLINK="misc/%k"
KERNEL="video[0-9]", SYMLINK="v4l/video%n"
KERNEL="radio[0-9]", SYMLINK="v4l/radio%n"
KERNEL="vbi[0-9]", SYMLINK="v4l/vbi%n"
KERNEL="vtx[0-9]", SYMLINK="v4l/vtx%n"
--
+++ GMX - die erste Adresse für Mail, Message, More +++
Bis 31.1.: TopMail + Digicam für nur 29 EUR http://www.gmx.net/topmail
[-- Attachment #2: 00-lsb.txt --]
[-- Type: text/plain, Size: 1759 bytes --]
# There are a number of modifiers that are allowed to be used in the NAME or PROGRAM fields.
# They provide the following subsitutions:
# %n - the "kernel number" of the device.
# for example, 'sda3' has a "kernel number" of '3'
# %k - the kernel name for the device.
# %M - the kernel major number for the device
# %m - the kernel minor number for the device
# %b - the bus id for the device
# %c - the return value for the CALLOUT program (note, this doesn't work within
# the PROGRAM field for the obvious reason.)
# %D - use the devfs style disk name for this device.
# For partitions, this will result in 'part%n'
# If this is not a partition, it will result in 'disc'
#
# block
# ignore dm
KERNEL="dm-[0-9]*", NAME=""
KERNEL="device-mapper", NAME="mapper/control"
KERNEL="raw[0-9]*", NAME="raw/%k"
#KERNEL="dri-card[1-9]*",NAME="dri/card%n"
# some stuff is commented out below, as IIRC the max of tv cards == 8
KERNEL="video0", SYMLINK="video"
KERNEL="radio0", SYMLINK="radio"
KERNEL="vbi0", SYMLINK="vbi"
KERNEL="vtx0", SYMLINK="vtx"
KERNEL="em8300", NAME="video/%k"
KERNEL="em8300_ma", NAME="video/%k"
KERNEL="em8300_mv", NAME="video/%k"
KERNEL="em8300_sp", NAME="video/%k"
# input
KERNEL="psaux", SYMLINK="psmouse mouse"
KERNEL="mice", NAME="input/%k", SYMLINK="usbmouse"
KERNEL="mouse[0-9]*", NAME="input/%k"
KERNEL="event[0-9]*", NAME="input/%k"
KERNEL="js0", NAME="input/%k", SYMLINK="js"
KERNEL="js[1-9]", NAME="input/%k", SYMLINK="js%n"
KERNEL="controlC[0-9]", NAME="snd/%k"
KERNEL="hwC[0-9]D[0-9]", NAME="snd/%k"
KERNEL="midiC[0-9]D[0-9]", NAME="snd/%k"
KERNEL="pcmC[0-9]D[0-9]c", NAME="snd/%k"
KERNEL="pcmC[0-9]D[0-9]p", NAME="snd/%k"
KERNEL="timer", NAME="snd/%k"
KERNEL="seq", NAME="snd/%k"
[-- Attachment #3: 01-devfs.txt --]
[-- Type: text/plain, Size: 3275 bytes --]
# There are a number of modifiers that are allowed to be used in the NAME or PROGRAM fields.
# They provide the following subsitutions:
# %n - the "kernel number" of the device.
# for example, 'sda3' has a "kernel number" of '3'
# %k - the kernel name for the device.
# %M - the kernel major number for the device
# %m - the kernel minor number for the device
# %b - the bus id for the device
# %c - the return value for the CALLOUT program (note, this doesn't work within
# the PROGRAM field for the obvious reason.)
# %D - use the devfs style disk name for this device.
# For partitions, this will result in 'part%n'
# If this is not a partition, it will result in 'disc'
#
# block
BUS="ide", KERNEL="hd*", PROGRAM="/etc/udev/scripts/ide-devfs.sh %k %b %n", SYMLINK="%1c %2c %3c %4c %5c"
KERNEL="md[0-9]*", SYMLINK="md/%n"
KERNEL="loop[0-9]*", SYMLINK="loop/%n"
KERNEL="fd[0-9]*", SYMLINK="floppy/%n"
KERNEL="pktcdvd[0-9]*", SYMLINK="pktcdvd/%n"
KERNEL="ram[0-9]*", SYMLINK="rd/%n"
KERNEL="raw[0-9]*", SYMLINK="%k"
KERNEL="rawctl", SYMLINK="raw/%k"
KERNEL="lp[0-9]*", SYMLINK="printers/%n"
# char
KERNEL="vcs", SYMLINK="vcc/0"
KERNEL="vcs[1-9]*", SYMLINK="vcc/%n"
KERNEL="vcsa", NAME="%k", SYMLINK="vcc/a0 vcsa0"
KERNEL="vcsa[0-9]*", SYMLINK="vcc/a%n"
KERNEL="tty", NAME="%k", SYMLINK="vc/0 tty0"
KERNEL="tty[0-9]*", SYMLINK="vc/%n"
KERNEL="ttyS[0-9]*", SYMLINK="tts/%n"
KERNEL="ttyUSB[0-9]*", SYMLINK="tts/USB%n"
# can one have more then one from these ?
KERNEL="agpgart", SYMLINK="misc/agpgart",
KERNEL="apm_bios", SYMLINK="misc/apm_bios"
KERNEL="rtc", SYMLINK="misc/rtc"
KERNEL="i2c-[0-9]*", SYMLINK="i2c/%n"
KERNEL="lirc", SYMLINK="lirc/lirc%n"
KERNEL="lirc[1-9]", SYMLINK="lirc/%k"
KERNEL="fb[1-9]*", SYMLINK="fb/%n"
# some stuff is commented out below, as IIRC the max of tv cards == 8
KERNEL="video0", SYMLINK="v4l/video0"
KERNEL="video[1-9]", SYMLINK="v4l/video%n"
KERNEL="radio0", SYMLINK="v4l/radio0"
KERNEL="radio[1-9]", SYMLINK="v4l/radio%n"
KERNEL="vbi0", SYMLINK="v4l/vbi0"
KERNEL="vbi[1-9]", SYMLINK="v4l/vbi%n"
KERNEL="vtx0", SYMLINK="v4l/vtx0"
KERNEL="vtx[1-9]", SYMLINK="v4l/vtx%n"
# input
KERNEL="psaux", SYMLINK="misc/%k"
############################ sound ######################################
KERNEL="admmidi", SYMLINK="sound/admmidi"
KERNEL="admmidi[1-9]", SYMLINK="sound/admmidi%n"
KERNEL="adsp", SYMLINK="sound/adsp"
KERNEL="adsp[1-9]", SYMLINK="sound/adsp%n"
KERNEL="amidi", SYMLINK="sound/amidi"
KERNEL="amidi[1-9]", SYMLINK="sound/amidi%n"
KERNEL="amixer", SYMLINK="sound/amixer"
KERNEL="amixer[1-9]", SYMLINK="sound/amixer%n"
KERNEL="audio", SYMLINK="sound/audio"
KERNEL="audio[1-9]", SYMLINK="sound/audio%n"
KERNEL="dmmidi", SYMLINK="sound/dmmidi"
KERNEL="dmmidi[1-9]", SYMLINK="sound/dmmidi%n"
KERNEL="dsp", SYMLINK="sound/dsp"
KERNEL="dsp[1-9]", SYMLINK="sound/dsp%n"
KERNEL="dmfm", SYMLINK="sound/dmfm"
KERNEL="dmfm[1-9]", SYMLINK="sound/dmfm%n"
KERNEL="midi", SYMLINK="sound/midi"
KERNEL="midi[1-9]", SYMLINK="sound/midi%n"
KERNEL="mixer", SYMLINK="sound/mixer"
KERNEL="mixer[1-9]", SYMLINK="sound/mixer%n"
KERNEL="music", SYMLINK="sound/music"
KERNEL="music[1-9]", SYMLINK="sound/music%n"
KERNEL="sequencer", SYMLINK="sound/sequencer"
KERNEL="sequencer[1-9]",SYMLINK="sound/%k"
^ permalink raw reply [flat|nested] 16+ messages in thread* Re: [PATCH] multple rules files support/symlink rules support
2004-01-17 20:13 [PATCH] multple rules files support/symlink rules support Andrey Borzenkov
` (5 preceding siblings ...)
2004-01-22 17:44 ` Svetoslav Slavtchev
@ 2004-01-26 17:31 ` Andrey Borzenkov
2004-01-26 23:42 ` Kay Sievers
` (7 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: Andrey Borzenkov @ 2004-01-26 17:31 UTC (permalink / raw)
To: linux-hotplug
[-- Attachment #1: Type: text/plain, Size: 3256 bytes --]
On Thursday 22 January 2004 20:44, Svetoslav Slavtchev wrote:
> > On Sat, Jan 17, 2004 at 11:13:00PM +0300, Andrey Borzenkov wrote:
> > > Attached patch adds support for
> > >
> > > - multiple rules files. You can now do
> > >
> > > udev_rules="file1 dir2 file3 ..."
> > >
> > > directory is scanned and all files are read. Currently it does not
> >
> > descend
> >
> > > into subdirs.
> >
> > Ok, that is nice. I like that part of the patch.
> >
I do not :) the only reason to allow multiple files was to allow overriding; I
had to update patch for ude-014 and sorting directory contents turned out to
be quite easy so this is the final version - it takes single name which is
either file or directory; directory is scanned, sorted in ascending order and
read. klibc version does not support directory.
> >
> > I don't really understand this. Can you give an example of how this
> > would work? Why do we want to have multiple symlinks from different
> > rules?
>
distribution comes with predefined rules. Taking Mandrake (which is likely to
use Svetoslav config) it ships with devfs rules that are keyed on kernel
name.
Now user may want to name specific device based on different criteria, e.g.
serial number. I.e. you now have
KERNEL="sd*" SYMLINK="ide/host..."
SYSFS_serial="XYZ123" SYMLINK="my_removable"
you simply can't easily merge these two rules. Allowing second rule (in second
file) is much more flexible - you simply get two symlinks pointing to the
same file. None of them knows or cares about device is really named as long
as symlinks are correctly created.
because this version assumes configuration be ordered it now ignores name only
if it has not already been defined; else name with empty NAME/SYMLINK is
silently ignored.
> please take a look in the attached files
>
> - the first should create layout as the one of static /dev (00-lsb)
> - the second adds devfs symlinks (01-devfs)
Svetoslav did very good job making devfs compatibility config; please consider
adding it to distribution. It appeears to be mostly complete; there is
inherent problem with /dev/discs and /dev/cdroms that probably is not worth
time spent on it (i.e. - drop it).
regards
-andrey
> - additional one's could be used by the configuration
> tools of the distribution( e.g. to create /dev/cd-writer or /dev/dvd)
> - and at the end would come the personal rules of the
> owner of the system
>
> in this way the device would be accessable from the standard
> static /dev, devfs, and the additional system/personal namespaces
>
> in this way, if the owner changes only his rule file, he can not harm the
> system
> he only add's a personal symlink, devices are created as in static dev,
> with symlink for devfs
>
> best,
>
> svetljo
>
> PS.
> small example
> in 00-lsb
> ---------------
> KERNEL="psaux", SYMLINK="psmouse"
> KERNEL="video0", SYMLINK="video"
> KERNEL="radio0", SYMLINK="radio"
> KERNEL="vbi0", SYMLINK="vbi"
> KERNEL="vtx0", SYMLINK="vtx"
> -----------------
> in 01-devfs
> ---------------
> KERNEL="psaux", SYMLINK="misc/%k"
> KERNEL="video[0-9]", SYMLINK="v4l/video%n"
> KERNEL="radio[0-9]", SYMLINK="v4l/radio%n"
> KERNEL="vbi[0-9]", SYMLINK="v4l/vbi%n"
> KERNEL="vtx[0-9]", SYMLINK="v4l/vtx%n"
[-- Attachment #2: udev014_multi.patch --]
[-- Type: text/x-diff, Size: 7067 bytes --]
--- udev-014/namedev.c.multi 2004-01-22 03:45:22.000000000 +0300
+++ udev-014/namedev.c 2004-01-26 20:10:45.273488984 +0300
@@ -703,30 +703,54 @@ int namedev_name_device(struct sysfs_cla
}
}
- /* check if we are instructed to ignore this device */
- if (dev->name[0] == '\0') {
+ /*
+ * check if we are instructed to ignore this device
+ * unless name has already beed assigned
+ */
+ if (udev->name[0] == '\0' && dev->name[0] == '\0' && dev->symlink[0] == '\0') {
dbg("instructed to ignore this device");
return -1;
}
- /* Yup, this rule belongs to us! */
- info("configured rule in '%s' at line %i applied, '%s' becomes '%s'",
- udev_rules_filename, dev->config_line, udev->kernel_name, dev->name);
- strfieldcpy(udev->name, dev->name);
- strfieldcpy(udev->symlink, dev->symlink);
- goto found;
+ /* if everything matched add symlink to list of aliases */
+ if (dev->symlink[0] != '\0') {
+ char temp[NAME_MAX];
+
+ /* do not clobber dev */
+ strfieldcpy(temp, dev->symlink);
+ apply_format(udev, temp);
+ if (strlen(udev->symlink) + strlen(temp) + 2 > sizeof(udev->symlink))
+ dbg("could not append symlink %s for %s",
+ dev->symlink, udev->kernel_name);
+ else {
+ strfieldcat(udev->symlink, temp);
+ strfieldcat(udev->symlink, " ");
+ }
+ }
+
+ /* is this symlink only rule? */
+ if (dev->name[0] == '\0')
+ continue;
+
+ /* Yup, this rule belongs to us!
+ * but continue to collect symlinks */
+ if (udev->name[0] == '\0') {
+ info("configured rule in '%s' at line %i applied, '%s' becomes '%s'",
+ dev->config_file, dev->config_line, udev->kernel_name, dev->name);
+ strfieldcpy(udev->name, dev->name);
+
+ /* substitute placeholder */
+ apply_format(udev, udev->name);
+ } else
+ dbg("conflicting rule for '%s' would become '%s'",
+ dev->kernel, dev->name);
}
/* no rule was found so we use the kernel name */
- strfieldcpy(udev->name, class_dev->name);
- goto done;
-
-found:
- /* substitute placeholder */
- apply_format(udev, udev->name);
- apply_format(udev, udev->symlink);
+ if (udev->name[0] == '\0')
+ strfieldcpy(udev->name, class_dev->name);
+ dbg("symlinks for '%s' are: '%s'", udev->name, udev->symlink);
-done:
perm = find_perm(udev->name);
if (perm) {
udev->mode = perm->mode;
--- udev-014/namedev.h.multi 2004-01-22 02:34:33.000000000 +0300
+++ udev-014/namedev.h 2004-01-26 19:47:14.195005520 +0300
@@ -66,6 +66,7 @@ struct config_device {
char symlink[NAME_SIZE];
struct sysfs_pair sysfs_pair[MAX_SYSFS_PAIRS];
int config_line;
+ char *config_file;
};
struct perm_device {
--- udev-014/namedev_parse.c.multi 2004-01-22 03:46:01.000000000 +0300
+++ udev-014/namedev_parse.c 2004-01-26 19:47:14.335984088 +0300
@@ -34,6 +34,8 @@
#include <ctype.h>
#include <unistd.h>
#include <errno.h>
+#include <dirent.h>
+#include <sys/stat.h>
#include "udev.h"
#include "logging.h"
@@ -120,7 +122,8 @@ void dump_perm_dev_list(void)
dump_perm_dev(dev);
}
-int namedev_init_rules(void)
+
+static int parse_rules_file(const char *file)
{
char line[255];
int lineno;
@@ -131,15 +134,19 @@ int namedev_init_rules(void)
int program_given = 0;
int retval = 0;
struct config_device dev;
+ char *p;
- fd = fopen(udev_rules_filename, "r");
+ fd = fopen(file, "r");
if (fd != NULL) {
- dbg("reading '%s' as rules file", udev_rules_filename);
+ dbg("reading '%s' as rules file", file);
} else {
- dbg("can't open '%s' as a rules file", udev_rules_filename);
+ dbg("can't open '%s' as a rules file", file);
return -ENODEV;
}
+ /* Yes, this is memory leak. It won't be freed */
+ p = strdup(file);
+
/* loop through the whole file */
lineno = 0;
while (1) {
@@ -250,13 +257,14 @@ int namedev_init_rules(void)
}
dev.config_line = lineno;
+ dev.config_file = p;
retval = add_config_dev(&dev);
if (retval) {
dbg("add_config_dev returned with error %d", retval);
continue;
error:
dbg("%s:%d:%d: parse error, rule skipped",
- udev_rules_filename, lineno, temp - line);
+ file, lineno, temp - line);
}
}
exit:
@@ -264,7 +272,7 @@ exit:
return retval;
}
-int namedev_init_permissions(void)
+static int parse_permissions_file(const char *file)
{
char line[255];
char *temp;
@@ -273,11 +281,11 @@ int namedev_init_permissions(void)
int retval = 0;
struct perm_device dev;
- fd = fopen(udev_permissions_filename, "r");
+ fd = fopen(file, "r");
if (fd != NULL) {
- dbg("reading '%s' as permissions file", udev_permissions_filename);
+ dbg("reading '%s' as permissions file", file);
} else {
- dbg("can't open '%s' as permissions file", udev_permissions_filename);
+ dbg("can't open '%s' as permissions file", file);
return -ENODEV;
}
@@ -344,5 +352,98 @@ int namedev_init_permissions(void)
exit:
fclose(fd);
return retval;
+}
+
+static int ends_with(const char *name, const char *suf)
+{
+ char *p = strstr(name, suf);
+
+ if (!p)
+ return 0;
+
+ if (p[strlen(suf)])
+ return 0;
+
+ return 1;
+}
+
+/*
+ * skip
+ * all hidden files
+ * usual backup files from editor or RPM
+ * non-plain files
+ */
+static int filter(const struct dirent *dirent)
+{
+ char *name = dirent->d_name;
+ struct stat buf;
+
+ if (name[0] == '.')
+ return 0;
+
+ if (ends_with(name, ".rpmorig") ||
+ ends_with(name, ".rpmsave") ||
+ ends_with(name, "~") ||
+ ends_with(name, ".orig"))
+ return 0;
+
+ if (stat(name, &buf) == -1)
+ return 0;
+
+ if (!S_ISREG(buf.st_mode))
+ return 0;
+
+ return 1;
+}
+
+static int parse_rules(char *file, int (*func)(const char *))
+{
+ struct stat buf;
+ int err = 0;
+
+
+ if (stat(file, &buf) == -1) {
+ err = errno;
+ dbg("parse_rules: can't stat %s", file);
+ return errno;
+ }
+
+ if (S_ISREG(buf.st_mode))
+ return (*func)(file);
+
+#ifndef __KLIBC__
+ if (S_ISDIR(buf.st_mode)) {
+ struct dirent **dirents;
+ int nfiles, i;
+
+ if ((nfiles = scandir(file, &dirents, filter, alphasort)) == -1) {
+ err = errno;
+ dbg("parse_rules: scandir '%s' error", file);
+ return err;
+ }
+
+ for (i = 0; i < nfiles; i++) {
+ char temp[PATH_MAX + NAME_MAX];
+
+ snprintf(temp, sizeof(temp), "%s/%s", file, dirents[i]->d_name);
+ err = (*func)(temp);
+ }
+
+ return err;
+ }
+#endif
+
+ dbg("parse_rules: '%s' has unknown file type %o", file, buf.st_mode);
+ return -EINVAL;
+
+}
+
+int namedev_init_rules(void)
+{
+ return parse_rules(udev_rules_filename, parse_rules_file);
}
+int namedev_init_permissions(void)
+{
+ return parse_rules(udev_permissions_filename, parse_permissions_file);
+}
--- udev-014/udev.h.multi 2004-01-22 03:32:55.000000000 +0300
+++ udev-014/udev.h 2004-01-26 19:47:14.473963112 +0300
@@ -56,6 +56,13 @@ do { \
strncpy(to, from, sizeof(to)-1); \
} while (0)
+#define strfieldcat(to, from) \
+do { \
+ to[sizeof(to)-1] = '\0'; \
+ strncat(to, from, sizeof(to)-1); \
+} while (0)
+
+
extern int udev_add_device(char *path, char *subsystem);
extern int udev_remove_device(char *path, char *subsystem);
extern void udev_init_config(void);
^ permalink raw reply [flat|nested] 16+ messages in thread* Re: [PATCH] multple rules files support/symlink rules support
2004-01-17 20:13 [PATCH] multple rules files support/symlink rules support Andrey Borzenkov
` (6 preceding siblings ...)
2004-01-26 17:31 ` Andrey Borzenkov
@ 2004-01-26 23:42 ` Kay Sievers
2004-01-27 9:54 ` "Andrey Borzenkov"
` (6 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: Kay Sievers @ 2004-01-26 23:42 UTC (permalink / raw)
To: linux-hotplug
On Mon, Jan 26, 2004 at 08:31:23PM +0300, Andrey Borzenkov wrote:
> On Thursday 22 January 2004 20:44, Svetoslav Slavtchev wrote:
> > > On Sat, Jan 17, 2004 at 11:13:00PM +0300, Andrey Borzenkov wrote:
> > > > Attached patch adds support for
> > > >
> > > > - multiple rules files. You can now do
...
> I do not :) the only reason to allow multiple files was to allow overriding; I
> had to update patch for ude-014 and sorting directory contents turned out to
> be quite easy so this is the final version - it takes single name which is
> either file or directory; directory is scanned, sorted in ascending order and
> read. klibc version does not support directory.
>
> > >
> > > I don't really understand this. Can you give an example of how this
> > > would work? Why do we want to have multiple symlinks from different
> > > rules?
>
> you simply can't easily merge these two rules. Allowing second rule (in second
> file) is much more flexible - you simply get two symlinks pointing to the
> same file. None of them knows or cares about device is really named as long
> as symlinks are correctly created.
>
> because this version assumes configuration be ordered it now ignores name only
> if it has not already been defined; else name with empty NAME/SYMLINK is
> silently ignored.
Uhh, why do this inside of udev?
You must be root to setup the rules. So we can expect that you are able
to run a update script or something that creates the main file.
This can also merge your conflicting rules if needed.
thanks,
Kay
-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
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
^ permalink raw reply [flat|nested] 16+ messages in thread* Re: [PATCH] multple rules files support/symlink rules support
2004-01-17 20:13 [PATCH] multple rules files support/symlink rules support Andrey Borzenkov
` (7 preceding siblings ...)
2004-01-26 23:42 ` Kay Sievers
@ 2004-01-27 9:54 ` "Andrey Borzenkov"
2004-01-27 11:43 ` Marco d'Itri
` (5 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: "Andrey Borzenkov" @ 2004-01-27 9:54 UTC (permalink / raw)
To: linux-hotplug
-----Original Message-----
>
> On Mon, Jan 26, 2004 at 08:31:23PM +0300, Andrey Borzenkov wrote:
> > On Thursday 22 January 2004 20:44, Svetoslav Slavtchev wrote:
> > > > On Sat, Jan 17, 2004 at 11:13:00PM +0300, Andrey Borzenkov wrote:
> > > > > Attached patch adds support for
> > > > >
> > > > > - multiple rules files. You can now do
>
> ...
>
> > I do not :) the only reason to allow multiple files was to allow overriding; I
> > had to update patch for ude-014 and sorting directory contents turned out to
> > be quite easy so this is the final version - it takes single name which is
> > either file or directory; directory is scanned, sorted in ascending order and
> > read. klibc version does not support directory.
> >
> > > >
> > > > I don't really understand this. Can you give an example of how this
> > > > would work? Why do we want to have multiple symlinks from different
> > > > rules?
> >
> > you simply can't easily merge these two rules. Allowing second rule (in second
> > file) is much more flexible - you simply get two symlinks pointing to the
> > same file. None of them knows or cares about device is really named as long
> > as symlinks are correctly created.
> >
> > because this version assumes configuration be ordered it now ignores name only
> > if it has not already been defined; else name with empty NAME/SYMLINK is
> > silently ignored.
>
> Uhh, why do this inside of udev?
> You must be root to setup the rules. So we can expect that you are able
> to run a update script or something that creates the main file.
> This can also merge your conflicting rules if needed.
>
unfortunately because you removed my example this statement is rather
theoretical.
Once more:
NAME="sd*" PROGRAM="/build-standard-scsi-name" SYMLINK="%c"
SYSFS_product="Memory Bird" SYMLINK="my_flash"
Can you explain how are you going to merge them? And even programmatically?
there is nothing in those rules that suggests they will be applied
to the same device. They are likely to be maintained
separately by people who do not know about other rule nor care.
The first one may be part of standard distro (LSB conformance,
devfs compatibility, sr -> scd mapping, whatever). The second
will be created by particular user on particular system. He may
not even know nor care about the other one.
And do not forget that end-users are not likely to ever edit
udev configuration. They will be using some frontends provided
by distributions. I just try to make life for people creating
those frontends easier.
Those two rules are not conflicting in any way. They complement
each other. Having them as separate files makes maintenance much
easier.
regards
-andrey
-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
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
^ permalink raw reply [flat|nested] 16+ messages in thread* Re: [PATCH] multple rules files support/symlink rules support
2004-01-17 20:13 [PATCH] multple rules files support/symlink rules support Andrey Borzenkov
` (8 preceding siblings ...)
2004-01-27 9:54 ` "Andrey Borzenkov"
@ 2004-01-27 11:43 ` Marco d'Itri
2004-02-03 1:04 ` Greg KH
` (4 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: Marco d'Itri @ 2004-01-27 11:43 UTC (permalink / raw)
To: linux-hotplug
On Jan 27, "\"Andrey Borzenkov\" " <arvidjaar@mail.ru> wrote:
>Can you explain how are you going to merge them? And even programmatically?
>there is nothing in those rules that suggests they will be applied
>to the same device. They are likely to be maintained
>separately by people who do not know about other rule nor care.
>The first one may be part of standard distro (LSB conformance,
>devfs compatibility, sr -> scd mapping, whatever). The second
>will be created by particular user on particular system. He may
>not even know nor care about the other one.
Agreed. As the debian maintainer of udev I consider *very* important for
users being allowed to specify additional rules which will be merged
with the ones of the default configuration. A trivial example is being
able to add rules with only a SYMLINK statement which will match a
specific device and create an additional symlinks (i.e. not override the
ones already defined in the main configuration file).
--
ciao, |
Marco | [4327 imAdaRzQihvIU]
-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
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
^ permalink raw reply [flat|nested] 16+ messages in thread* Re: [PATCH] multple rules files support/symlink rules support
2004-01-17 20:13 [PATCH] multple rules files support/symlink rules support Andrey Borzenkov
` (9 preceding siblings ...)
2004-01-27 11:43 ` Marco d'Itri
@ 2004-02-03 1:04 ` Greg KH
2004-02-03 11:25 ` Gioele Barabucci
` (3 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: Greg KH @ 2004-02-03 1:04 UTC (permalink / raw)
To: linux-hotplug
On Thu, Jan 22, 2004 at 06:44:53PM +0100, Svetoslav Slavtchev wrote:
>
> please take a look in the attached files
>
> - the first should create layout as the one of static /dev (00-lsb)
> - the second adds devfs symlinks (01-devfs)
> - additional one's could be used by the configuration
> tools of the distribution( e.g. to create /dev/cd-writer or /dev/dvd)
> - and at the end would come the personal rules of the
> owner of the system
>
> in this way the device would be accessable from the standard
> static /dev, devfs, and the additional system/personal namespaces
>
> in this way, if the owner changes only his rule file, he can not harm the
> system
> he only add's a personal symlink, devices are created as in static dev,
> with symlink for devfs
But the "owner" is the "system", right? They are really the same
person. I think it looks like a neat hack to be able to add symlinks,
but I can't see a real use for it in the world.
Take a look at /etc/fstab, or any of the other system wide config files
in /etc. They don't provide a place that a user can add more items in
another file, do they? All that is needed is to modify the original
file to add your new items.
thanks,
greg k-h
-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
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
^ permalink raw reply [flat|nested] 16+ messages in thread* Re: [PATCH] multple rules files support/symlink rules support
2004-01-17 20:13 [PATCH] multple rules files support/symlink rules support Andrey Borzenkov
` (10 preceding siblings ...)
2004-02-03 1:04 ` Greg KH
@ 2004-02-03 11:25 ` Gioele Barabucci
2004-02-16 22:34 ` Greg KH
` (2 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: Gioele Barabucci @ 2004-02-03 11:25 UTC (permalink / raw)
To: linux-hotplug
On Tuesday 03 February 2004 02:04, Greg KH wrote:
> On Thu, Jan 22, 2004 at 06:44:53PM +0100, Svetoslav Slavtchev wrote:
> But the "owner" is the "system", right? They are really the same
> person. I think it looks like a neat hack to be able to add symlinks,
> but I can't see a real use for it in the world.
Maybe user actions should be limited to ~/Devices, or something similar...
> Take a look at /etc/fstab, or any of the other system wide config files
> in /etc. They don't provide a place that a user can add more items in
> another file, do they? All that is needed is to modify the original
> file to add your new items.
But this is not a virtue of the actual way-of-doing-things!!! This is one of
the most unfriendly issues that you have to face when running a Linux distro
or a Unix system.
These global files are never updated enought to support the "latest cheap
camera" I bougth. So I need to add items to these files... but how?
1) su -c "vim /etc/somefile" -- you need to know root password
2) sudo vim /etc/somefile -- This opens security holes like shell excaping
3) vim ~/.my_devices -- Just parse it in a safe way and use a dir under $HOME,
no security probs at all
And solutions 1 and 2 permits to a simple user to screw up the whole system in
a second :(
At my uni labs we run only linux boxes but we are not allowed to attach
usb-keys, card-readers and other peripherals for this very problem (try to
update 100+ boxes with different a configuration for every student...). It
would be nice to be able to do so in the future.
--
Gioele Barabucci
-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
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
^ permalink raw reply [flat|nested] 16+ messages in thread* Re: [PATCH] multple rules files support/symlink rules support
2004-01-17 20:13 [PATCH] multple rules files support/symlink rules support Andrey Borzenkov
` (11 preceding siblings ...)
2004-02-03 11:25 ` Gioele Barabucci
@ 2004-02-16 22:34 ` Greg KH
2004-02-17 7:29 ` "Andrey Borzenkov"
2004-02-17 17:29 ` Greg KH
14 siblings, 0 replies; 16+ messages in thread
From: Greg KH @ 2004-02-16 22:34 UTC (permalink / raw)
To: linux-hotplug
On Sat, Jan 17, 2004 at 11:13:00PM +0300, Andrey Borzenkov wrote:
> Attached patch adds support for
>
> - multiple rules files. You can now do
>
> udev_rules="file1 dir2 file3 ..."
Care to fix this patch up for the latest udev release?
thanks,
greg k-h
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id\x1356&alloc_id438&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
^ permalink raw reply [flat|nested] 16+ messages in thread* Re: [PATCH] multple rules files support/symlink rules support
2004-01-17 20:13 [PATCH] multple rules files support/symlink rules support Andrey Borzenkov
` (12 preceding siblings ...)
2004-02-16 22:34 ` Greg KH
@ 2004-02-17 7:29 ` "Andrey Borzenkov"
2004-02-17 17:29 ` Greg KH
14 siblings, 0 replies; 16+ messages in thread
From: "Andrey Borzenkov" @ 2004-02-17 7:29 UTC (permalink / raw)
To: linux-hotplug
-----Original Message-----
>
> On Sat, Jan 17, 2004 at 11:13:00PM +0300, Andrey Borzenkov wrote:
> > Attached patch adds support for
> >
> > - multiple rules files. You can now do
> >
> > udev_rules="file1 dir2 file3 ..."
>
> Care to fix this patch up for the latest udev release?
>
I will when I am back home (next week)
What about the second part (allow symlink-only rules)?
thank you
-andrey
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id\x1356&alloc_id438&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
^ permalink raw reply [flat|nested] 16+ messages in thread* Re: [PATCH] multple rules files support/symlink rules support
2004-01-17 20:13 [PATCH] multple rules files support/symlink rules support Andrey Borzenkov
` (13 preceding siblings ...)
2004-02-17 7:29 ` "Andrey Borzenkov"
@ 2004-02-17 17:29 ` Greg KH
14 siblings, 0 replies; 16+ messages in thread
From: Greg KH @ 2004-02-17 17:29 UTC (permalink / raw)
To: linux-hotplug
On Tue, Feb 17, 2004 at 10:29:32AM +0300, "Andrey Borzenkov" wrote:
>
>
> -----Original Message-----
>
> >
> > On Sat, Jan 17, 2004 at 11:13:00PM +0300, Andrey Borzenkov wrote:
> > > Attached patch adds support for
> > >
> > > - multiple rules files. You can now do
> > >
> > > udev_rules="file1 dir2 file3 ..."
> >
> > Care to fix this patch up for the latest udev release?
> >
>
> I will when I am back home (next week)
>
> What about the second part (allow symlink-only rules)?
Yes, I think that would be good to have too. Just split the patches up
into two pieces, only one patch per feature/fix.
thanks,
greg k-h
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id\x1356&alloc_id438&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
^ permalink raw reply [flat|nested] 16+ messages in thread