linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* udev: remove permissions file from udev
@ 2004-12-19 17:10 Kay Sievers
  2004-12-19 17:31 ` Marco d'Itri
                   ` (20 more replies)
  0 siblings, 21 replies; 22+ messages in thread
From: Kay Sievers @ 2004-12-19 17:10 UTC (permalink / raw)
  To: linux-hotplug

[-- Attachment #1: Type: text/plain, Size: 1049 bytes --]

As discussed this week, here we remove the explicit permissions file
from udev. All permissions should be specified along with the rule now,
to have only one source of policy.

This simplifies the whole udev process and removes the need to parse a
second file in a different format. The rule file will grow a bit to
apply some permissions, but its an overall win.

You may look at the changes at:
  http://vrfy.bkbits.net:8080/udev/ChangeSet@-8d?nav=index.html

or pull it from:
  bk://vrfy.bkbits.net/udev

or get a tarball including the changes on top of version 050 at:
  http://vrfy.org/projects/udev/udev-050plus.tar.gz


To get this working, the current rules file needs to be updated. I
started to convert the gentoo and the Fedora file available in the tree.
Any help here is appreciated, cause we need to be sure, that it will
work before we make a new release. I've tested both distributions
versions and I'm able to boot and login, but I'm sure there is something
missing.

As an example, the gentoo rules file is attached.

Thanks,
Kay


[-- Attachment #2: Type: text/plain, Size: 8048 bytes --]

# /etc/udev/udev.rules:  device naming rules for udev
#
# Gentoo specific rules, based a bit on devfs rules, but much simpler.
#
# There are a number of modifiers that are allowed to be used in some of the
# fields.  See the udev man page for a full description of them.


###########################################################
#
# For devfs similar /dev layout (neater)
#
###########################################################

# cdrom symlinks and other good cdrom naming
BUS="ide",  KERNEL="hd[a-z]", PROGRAM="/etc/udev/scripts/cdsymlinks.sh %k", SYMLINK="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}"
BUS="scsi", KERNEL="sr[0-9]*", PROGRAM="/etc/udev/scripts/cdsymlinks.sh %k", SYMLINK="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}"
BUS="scsi", KERNEL="scd[a-z]", PROGRAM="/etc/udev/scripts/cdsymlinks.sh %k", SYMLINK="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}"

# devfs-names for ide-devices (uncomment only one)
#  /dev/ide/.../{disc,cd} and /dev/{cdroms,discs}/* type names
BUS="ide", KERNEL="hd*", PROGRAM="/etc/udev/scripts/ide-devfs.sh %k %b %n", NAME="%k", SYMLINK="%c{1} %c{2}", GROUP="%c{3}", MODE="0660"

# disk devices
KERNEL="sd*",		NAME="%k", GROUP="disk", MODE="0660"
KERNEL="dasd*",		NAME="%k", GROUP="disk", MODE="0660"
KERNEL="ataraid*",	NAME="%k", GROUP="disk", MODE="0660"

# dri devices
KERNEL="card*",		NAME="dri/card%n", GROUP="video", MODE="0660"
KERNEL="nvidia*",	NAME="%k", GROUP="video", MODE="0660"
KERNEL="3dfx*",		NAME="%k", GROUP="video", MODE="0660"

# alsa devices
KERNEL="controlC[0-9]*",	NAME="snd/%k"
KERNEL="hw[CD0-9]*",		NAME="snd/%k"
KERNEL="pcm[CD0-9cp]*",		NAME="snd/%k"
KERNEL="midiC[D0-9]*",		NAME="snd/%k"
KERNEL="timer",			NAME="snd/%k"
KERNEL="seq",			NAME="snd/%k"

# capi devices
KERNEL="capi",		NAME="capi20", SYMLINK="isdn/capi20"
KERNEL="capi*",		NAME="capi/%n"

# cpu devices
KERNEL="cpu[0-9]*",	NAME="cpu/%n/cpuid"
KERNEL="msr[0-9]*",	NAME="cpu/%n/msr"
KERNEL="microcode",	NAME="cpu/microcode"

# dm devices (ignore them)
KERNEL="dm-[0-9]*",	NAME=""
# create a symlink named after the device map name
# note devmap_name comes with extras/multipath
#KERNEL="dm-[0-9]*",	PROGRAM="/sbin/devmap_name %M %m", NAME="%k", SYMLINK="%c"
KERNEL="device-mapper",	NAME="mapper/control"

# fb devices
KERNEL="fb[0-9]*",	NAME="fb/%n", SYMLINK="%k"

# floppy devices
KERNEL="fd[0-9]*",	NAME="floppy/%n", SYMLINK="%k", GROUP="floppy", MODE="0660"

# i2c devices
KERNEL="i2c-[0-9]*",	NAME="i2c/%n", SYMLINK="%k"

# input devices
KERNEL="mice",		NAME="input/%k", MODE="0644"
KERNEL="mouse*",	NAME="input/%k", MODE="0644"
KERNEL="event*",	NAME="input/%k", MODE="0600"
KERNEL="js*",		NAME="input/%k", MODE="664"
KERNEL="ts*",		NAME="input/%k", MODE="0600"

# loop devices
KERNEL="loop[0-9]*",	NAME="loop/%n", SYMLINK="%k", GROUP="disk", MODE="0660"

# md block devices
KERNEL="md[0-9]*",	NAME="md/%n", SYMLINK="%k", GROUP="disk", MODE="0660"

# misc devices
KERNEL="agpgart",	NAME="misc/%k", SYMLINK="%k"
KERNEL="psaux",		NAME="misc/%k", SYMLINK="%k"
KERNEL="rtc",		NAME="misc/%k", SYMLINK="%k", MODE="0664"
KERNEL="uinput",	NAME="misc/%k", SYMLINK="%k"
KERNEL="inotify",	NAME="misc/%k", SYMLINK="%k", MODE="0666"

# netlink devices
KERNEL="route",		NAME="netlink/%k"
KERNEL="skip",		NAME="netlink/%k"
KERNEL="usersock",	NAME="netlink/%k"
KERNEL="fwmonitor",	NAME="netlink/%k"
KERNEL="tcpdiag",	NAME="netlink/%k"
KERNEL="nflog",		NAME="netlink/%k"
KERNEL="xfrm",		NAME="netlink/%k"
KERNEL="arpd",		NAME="netlink/%k"
KERNEL="route6",	NAME="netlink/%k"
KERNEL="ip6_fw",	NAME="netlink/%k"
KERNEL="dnrtmsg",	NAME="netlink/%k"
KERNEL="tap*",		NAME="netlink/%k"

# network devices
KERNEL="tun",		NAME="net/%k"

# ramdisk devices
KERNEL="ram[0-9]*",	NAME="rd/%n", SYMLINK="%k"

# raw devices
KERNEL="raw[0-9]*",	NAME="raw/%k", GROUP="disk", MODE="0660"
KERNEL="ram*",		NAME="%k", GROUP="disk", MODE="0660"

# sound devices
KERNEL="adsp",			NAME="sound/%k", SYMLINK="%k", GROUP="audio", MODE="0660"
KERNEL="adsp[0-9]*",		NAME="sound/%k", SYMLINK="%k", GROUP="audio", MODE="0660"
KERNEL="audio",			NAME="sound/%k", SYMLINK="%k", GROUP="audio", MODE="0660"
KERNEL="audio[0-9]*",		NAME="sound/%k", SYMLINK="%k", GROUP="audio", MODE="0660"
KERNEL="dsp",			NAME="sound/%k", SYMLINK="%k", GROUP="audio", MODE="0660"
KERNEL="dsp[0-9]*",		NAME="sound/%k", SYMLINK="%k", GROUP="audio", MODE="0660"
KERNEL="mixer",			NAME="sound/%k", SYMLINK="%k", GROUP="audio", MODE="0660"
KERNEL="mixer[0-9]*",		NAME="sound/%k", SYMLINK="%k", GROUP="audio", MODE="0660"
KERNEL="sequencer",		NAME="sound/%k", SYMLINK="%k", GROUP="audio", MODE="0660"
KERNEL="sequencer[0-9]*",	NAME="sound/%k", SYMLINK="%k", GROUP="audio", MODE="0660"

# tty devices
KERNEL="console",	NAME="%k", GROUP="tty", MODE="0600"
KERNEL="tty",		NAME="%k", GROUP="tty", MODE="0666"
KERNEL="tty[0-9]*",	NAME="vc/%n",  SYMLINK="%k", GROUP="tty", MODE="0660"
KERNEL="ttyS[0-9]*",	NAME="tts/%n", SYMLINK="%k", GROUP="tty", MODE="0660"
KERNEL="ttyUSB[0-9]*",	NAME="tts/USB%n", GROUP="tty", MODE="0600"
KERNEL="ippp0",		NAME="%k", GROUP="tty", MODE="0660"
KERNEL="isdn*",		NAME="%k", GROUP="tty", MODE="0660"
KERNEL="dcbri*",	NAME="%k", GROUP="tty", MODE="0660"
KERNEL="ircomm*",	NAME="%k", GROUP="tty", MODE="0660"

# pty devices
KERNEL="ptmx",			NAME="%k", GROUP="tty", MODE="0666"
KERNEL="pty[p-za-e][0-9a-f]*",	NAME="pty/m%n", SYMLINK="%k", GROUP="tty", MODE="0660"
KERNEL="tty[p-za-e][0-9a-f]*",	NAME="pty/s%n", SYMLINK="%k", GROUP="tty", MODE="0660"

# vc devices
KERNEL="vcs",		NAME="vcc/0",	SYMLINK="%k", GROUP="tty", MODE="0660"
KERNEL="vcs[0-9]*",	NAME="vcc/%n",	SYMLINK="%k", GROUP="tty", MODE="0660"
KERNEL="vcsa",		NAME="vcc/a0",	SYMLINK="%k", GROUP="tty", MODE="0660"
KERNEL="vcsa[0-9]*",	NAME="vcc/a%n",	SYMLINK="%k", GROUP="tty", MODE="0660"

# memory devices
KERNEL="random",	NAME="%k", MODE="0666"
KERNEL="urandom",	NAME="%k", MODE="0444"
KERNEL="mem",		NAME="%k", MODE="0640"
KERNEL="kmem",		NAME="%k", MODE="0640"
KERNEL="port",		NAME="%k", MODE="0640"
KERNEL="full",		NAME="%k", MODE="0666"
KERNEL="null",		NAME="%k", MODE="0666"
KERNEL="zero",		NAME="%k", MODE="0666"

# usb devices
KERNEL="hiddev*",		NAME="usb/%k"
KERNEL="auer*",			NAME="usb/%k"
KERNEL="legousbtower*",		NAME="usb/%k", GROUP="usb", MODE="0660"
KERNEL="dabusb*",		NAME="usb/%k"
BUS="usb", KERNEL="lp[0-9]*",	NAME="usb/%k", GROUP="lp", MODE="0660"

# v4l devices
KERNEL="video[0-9]*",	NAME="v4l/video%n", SYMLINK="video%n", GROUP="video", MODE="0660"
KERNEL="radio[0-9]*",	NAME="v4l/radio%n", GROUP="video", MODE="0660"
KERNEL="vbi[0-9]*",	NAME="v4l/vbi%n", SYMLINK="vbi%n", GROUP="video", MODE="0660"
KERNEL="vtx[0-9]*",	NAME="v4l/vtx%n", GROUP="video", MODE="0660"

# Asterix Zaptel devices
KERNEL="zapctl",	NAME="zap/ctl"
KERNEL="zaptimer",	NAME="zap/timer"
KERNEL="zapchannel",	NAME="zap/channel"
KERNEL="zappseudo",	NAME="zap/pseudo"
KERNEL="zap[0-9]*",	NAME="zap/%n"

# pilot/palm devices
KERNEL="pilot",		NAME="%k", GROUP="uucp", MODE="0660"

# jaz devices
KERNEL="jaz*",		NAME="%k", GROUP="disk", MODE="0660"

# zip devices
KERNEL="pocketzip*",	NAME="%k", GROUP="disk", MODE="0660"
KERNEL="zip*",		NAME="%k", GROUP="disk", MODE="0660"

# ls120 devices
KERNEL="ls120",		NAME="%k", GROUP="disk", MODE="0660"

# lp devices
KERNEL="lp*",		NAME="%k", GROUP="lp", MODE="0660"
KERNEL="irlpt",		NAME="%k", GROUP="lp", MODE="0660"
KERNEL="usblp",		NAME="%k", GROUP="lp", MODE="0660"
KERNEL="lp*",		NAME="%k", GROUP="lp", MODE="0660"

# tape devices
KERNEL="ht*",		NAME="%k", GROUP="tape", MODE="0660"
KERNEL="nht*",		NAME="%k", GROUP="tape", MODE="0660"
KERNEL="pt*",		NAME="%k", GROUP="tape", MODE="0660"
KERNEL="npt*",		NAME="%k", GROUP="tape", MODE="0660"
KERNEL="st*",		NAME="%k", GROUP="tape", MODE="0660"
KERNEL="nst*",		NAME="%k", GROUP="tape", MODE="0660"

# diskonkey devices
KERNEL="diskonkey*",	NAME="%k", GROUP="disk", MODE="0660"

# rem_ide devices
KERNEL="microdrive*",	NAME="%k", GROUP="disk", MODE="0660"

# kbd devices
KERNEL="kbd",		NAME="%k", MODE="0664"

# Sony Vaio Jogdial sonypi device
KERNEL="sonypi",	NAME="%k", MODE="0666"

# gpm devices
KERNEL="gpmctl",	NAME="%k", MODE="0700"


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: udev: remove permissions file from udev
  2004-12-19 17:10 udev: remove permissions file from udev Kay Sievers
@ 2004-12-19 17:31 ` Marco d'Itri
  2004-12-19 17:36 ` Willem Riede
                   ` (19 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: Marco d'Itri @ 2004-12-19 17:31 UTC (permalink / raw)
  To: linux-hotplug

[-- Attachment #1: Type: text/plain, Size: 1181 bytes --]

On Dec 19, Kay Sievers <kay.sievers@vrfy.org> wrote:

> To get this working, the current rules file needs to be updated. I
It may be better to use default_mode="0660", I do not think that there
are any mode 600 devices. This would allow setting only the group for
most of them.

(Feature request: would it be possible to extend the rules files parser
to support continuation lines? I'd like it to consider lines starting
with white space as part of the previous line.)

> started to convert the gentoo and the Fedora file available in the tree.
> Any help here is appreciated, cause we need to be sure, that it will
> work before we make a new release. I've tested both distributions
Don't bother with the debian files, I will send updated ones later.

> # pty devices
> KERNEL="pty[p-za-e][0-9a-f]*",	NAME="pty/m%n", SYMLINK="%k", GROUP="tty", MODE="0660"
> KERNEL="tty[p-za-e][0-9a-f]*",	NAME="pty/s%n", SYMLINK="%k", GROUP="tty", MODE="0660"
Do 2.6 kernels really still support BSD pty devices?

> # gpm devices
> KERNEL="gpmctl",	NAME="%k", MODE="0700"
This is a pipe or socket, it has never been a device.

-- 
ciao, |
Marco | [9925 inDKIShkUK1Jg]

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: udev: remove permissions file from udev
  2004-12-19 17:10 udev: remove permissions file from udev Kay Sievers
  2004-12-19 17:31 ` Marco d'Itri
@ 2004-12-19 17:36 ` Willem Riede
  2004-12-19 17:49 ` Kay Sievers
                   ` (18 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: Willem Riede @ 2004-12-19 17:36 UTC (permalink / raw)
  To: linux-hotplug

On 12/19/2004 12:10:09 PM, Kay Sievers wrote:
> 
> # tape devices
> KERNEL="ht*",		NAME="%k", GROUP="tape", MODE="0660"
> KERNEL="nht*",		NAME="%k", GROUP="tape", MODE="0660"
> KERNEL="pt*",		NAME="%k", GROUP="tape", MODE="0660"
> KERNEL="npt*",		NAME="%k", GROUP="tape", MODE="0660"
> KERNEL="st*",		NAME="%k", GROUP="tape", MODE="0660"
> KERNEL="nst*",		NAME="%k", GROUP="tape", MODE="0660"

Would you mind adding OnStream tape drives?

KERNEL="osst*",		NAME="%k", GROUP="tape", MODE="0660"
KERNEL="nosst*",	NAME="%k", GROUP="tape", MODE="0660"

Thanks, Willem Riede.
(osst maintainer)



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/
_______________________________________________
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] 22+ messages in thread

* Re: udev: remove permissions file from udev
  2004-12-19 17:10 udev: remove permissions file from udev Kay Sievers
  2004-12-19 17:31 ` Marco d'Itri
  2004-12-19 17:36 ` Willem Riede
@ 2004-12-19 17:49 ` Kay Sievers
  2004-12-19 18:12 ` Kay Sievers
                   ` (17 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: Kay Sievers @ 2004-12-19 17:49 UTC (permalink / raw)
  To: linux-hotplug

On Sun, 2004-12-19 at 18:31 +0100, Marco d'Itri wrote:
> On Dec 19, Kay Sievers <kay.sievers@vrfy.org> wrote:
> 
> > To get this working, the current rules file needs to be updated. I
> It may be better to use default_mode="0660", I do not think that there
> are any mode 600 devices. This would allow setting only the group for
> most of them.

Good point and sounds reasonable as the default group is root anyway.

> (Feature request: would it be possible to extend the rules files parser
> to support continuation lines? I'd like it to consider lines starting
> with white space as part of the previous line.)

What about a backslash at the end of the line?

> > started to convert the gentoo and the Fedora file available in the tree.
> > Any help here is appreciated, cause we need to be sure, that it will
> > work before we make a new release. I've tested both distributions
> Don't bother with the debian files, I will send updated ones later.

Nice, thanks.

> > # pty devices
> > KERNEL="pty[p-za-e][0-9a-f]*",	NAME="pty/m%n", SYMLINK="%k", GROUP="tty", MODE="0660"
> > KERNEL="tty[p-za-e][0-9a-f]*",	NAME="pty/s%n", SYMLINK="%k", GROUP="tty", MODE="0660"
> Do 2.6 kernels really still support BSD pty devices?

I don't know.

> > # gpm devices
> > KERNEL="gpmctl",	NAME="%k", MODE="0700"
> This is a pipe or socket, it has never been a device.

I've just ported it from the permissions file. So this can be removed,
yes.

Kay



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/
_______________________________________________
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] 22+ messages in thread

* Re: udev: remove permissions file from udev
  2004-12-19 17:10 udev: remove permissions file from udev Kay Sievers
                   ` (2 preceding siblings ...)
  2004-12-19 17:49 ` Kay Sievers
@ 2004-12-19 18:12 ` Kay Sievers
  2004-12-19 19:57 ` Kay Sievers
                   ` (16 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: Kay Sievers @ 2004-12-19 18:12 UTC (permalink / raw)
  To: linux-hotplug

On Sun, 2004-12-19 at 17:36 +0000, Willem Riede wrote:
> On 12/19/2004 12:10:09 PM, Kay Sievers wrote:
> > 
> > # tape devices
> > KERNEL="ht*",		NAME="%k", GROUP="tape", MODE="0660"
> > KERNEL="nht*",		NAME="%k", GROUP="tape", MODE="0660"
> > KERNEL="pt*",		NAME="%k", GROUP="tape", MODE="0660"
> > KERNEL="npt*",		NAME="%k", GROUP="tape", MODE="0660"
> > KERNEL="st*",		NAME="%k", GROUP="tape", MODE="0660"
> > KERNEL="nst*",		NAME="%k", GROUP="tape", MODE="0660"
> 
> Would you mind adding OnStream tape drives?
> 
> KERNEL="osst*",		NAME="%k", GROUP="tape", MODE="0660"
> KERNEL="nosst*",	NAME="%k", GROUP="tape", MODE="0660"

I've added it to the gentoo rules.

Thanks,
Kay



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/
_______________________________________________
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] 22+ messages in thread

* Re: udev: remove permissions file from udev
  2004-12-19 17:10 udev: remove permissions file from udev Kay Sievers
                   ` (3 preceding siblings ...)
  2004-12-19 18:12 ` Kay Sievers
@ 2004-12-19 19:57 ` Kay Sievers
  2004-12-20  0:59 ` Marco d'Itri
                   ` (15 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: Kay Sievers @ 2004-12-19 19:57 UTC (permalink / raw)
  To: linux-hotplug

[-- Attachment #1: Type: text/plain, Size: 536 bytes --]

On Sun, 2004-12-19 at 18:31 +0100, Marco d'Itri wrote:
> On Dec 19, Kay Sievers <kay.sievers@vrfy.org> wrote:

> (Feature request: would it be possible to extend the rules files parser
> to support continuation lines? I'd like it to consider lines starting
> with white space as part of the previous line.)

How about the usual backslash at the end of the line. Here is a simple
patch, that just replaces backslashes/newlines with spaces. So it will
obviously not work if key values continue at the next line. How does
that sound?

Kay

[-- Attachment #2: udev-backslash-01.patch --]
[-- Type: text/x-patch, Size: 6698 bytes --]

diff -Nru a/namedev_parse.c b/namedev_parse.c
--- a/namedev_parse.c	2004-12-19 20:52:01 +01:00
+++ b/namedev_parse.c	2004-12-19 20:52:01 +01:00
@@ -126,14 +126,15 @@
 	cur = 0;
 	lineno = 0;
 	while (cur < bufsize) {
+		int i;
+
 		count = buf_get_line(buf, bufsize, cur);
 		bufline = &buf[cur];
 		cur += count+1;
 		lineno++;
 
 		if (count >= LINE_SIZE) {
-			info("line too long, rule skipped %s, line %d",
-			     filename, lineno);
+			info("line too long, rule skipped %s, line %d", filename, lineno);
 			continue;
 		}
 
@@ -149,8 +150,12 @@
 		if (bufline[0] == COMMENT_CHARACTER)
 			continue;
 
+		/* remove backslash and newline from multi line rules */
 		strncpy(line, bufline, count);
 		line[count] = '\0';
+		for (i = 0 ; i < count; i++)
+			if (line[i] == '\\' || line[i] == '\n')
+				line[i] = ' ';
 		dbg_parse("read '%s'", line);
 
 		/* get all known keys */
diff -Nru a/test/udev-test.pl b/test/udev-test.pl
--- a/test/udev-test.pl	2004-12-19 20:52:01 +01:00
+++ b/test/udev-test.pl	2004-12-19 20:52:01 +01:00
@@ -190,6 +190,36 @@
 EOF
 	},
 	{
+		desc		=> "Handle backslashed multi lines in config file (and replace kernel name)",
+		subsys		=> "tty",
+		devpath		=> "/class/tty/ttyUSB0",
+		exp_name	=> "visor" ,
+		conf		=> <<EOF
+KERNEL="ttyUSB0", \\
+NAME="visor"
+
+EOF
+	},
+	{
+		desc		=> "Handle stupid backslashed multi lines in config file (and replace kernel name)",
+		subsys		=> "tty",
+		devpath		=> "/class/tty/ttyUSB0",
+		exp_name	=> "visor" ,
+		conf		=> <<EOF
+
+#
+\\
+
+\\\\
+
+#\\
+
+KERNEL="ttyUSB0", \\
+NAME="visor"
+
+EOF
+	},
+	{
 		desc		=> "subdirectory handling",
 		subsys		=> "tty",
 		devpath		=> "/class/tty/ttyUSB0",
diff -Nru a/udev.h b/udev.h
--- a/udev.h	2004-12-19 20:52:01 +01:00
+++ b/udev.h	2004-12-19 20:52:01 +01:00
@@ -37,7 +37,7 @@
 #define SUBSYSTEM_SIZE			32
 #define SEQNUM_SIZE			32
 
-#define LINE_SIZE			256
+#define LINE_SIZE			512
 
 #define DEVD_DIR			"/etc/dev.d"
 #define DEVD_SUFFIX			".dev"
@@ -74,7 +74,6 @@
 extern int udev_remove_device(struct udevice *udev);
 extern void udev_init_config(void);
 extern int udev_start(void);
-extern int parse_get_pair(char **orig_string, char **left, char **right);
 extern void udev_multiplex_directory(struct udevice *udev, const char *basedir, const char *suffix);
 
 extern char sysfs_path[SYSFS_PATH_MAX];
diff -Nru a/udev_config.c b/udev_config.c
--- a/udev_config.c	2004-12-19 20:52:01 +01:00
+++ b/udev_config.c	2004-12-19 20:52:01 +01:00
@@ -91,41 +91,6 @@
 		udev_hotplug_d = 0;
 }
 
-int parse_get_pair(char **orig_string, char **left, char **right)
-{
-	char *temp;
-	char *string = *orig_string;
-
-	if (!string)
-		return -ENODEV;
-
-	/* eat any whitespace */
-	while (isspace(*string) || *string == ',')
-		++string;
-
-	/* split based on '=' */
-	temp = strsep(&string, "=");
-	*left = temp;
-	if (!string)
-		return -ENODEV;
-
-	/* take the right side and strip off the '"' */
-	while (isspace(*string))
-		++string;
-	if (*string == '"')
-		++string;
-	else
-		return -ENODEV;
-
-	temp = strsep(&string, "\"");
-	if (!string || *temp == '\0')
-		return -ENODEV;
-	*right = temp;
-	*orig_string = string;
-	
-	return 0;
-}
-
 static int parse_config_file(void)
 {
 	char line[LINE_SIZE];
@@ -254,20 +219,13 @@
 			strfieldcpy(udev_config_filename, temp);
 	}
 
-	dbg("sysfs_path='%s'", sysfs_path);
-	dbg_parse("udev_root = %s", udev_root);
-	dbg_parse("udev_config_filename = %s", udev_config_filename);
-	dbg_parse("udev_db_path = %s", udev_db_path);
-	dbg_parse("udev_rules_filename = %s", udev_rules_filename);
-	dbg_parse("udev_log = %d", udev_log);
-
 	parse_config_file();
-
-	dbg("udev_root = %s", udev_root);
-	dbg("udev_config_filename = %s", udev_config_filename);
-	dbg("udev_db_path = %s", udev_db_path);
-	dbg("udev_rules_filename = %s", udev_rules_filename);
-	dbg("udev_log = %d", udev_log);
+	dbg("sysfs_path='%s'", sysfs_path);
+	dbg("udev_root='%s'", udev_root);
+	dbg("udev_config_filename='%s'", udev_config_filename);
+	dbg("udev_db_path='%s'", udev_db_path);
+	dbg("udev_rules_filename='%s'", udev_rules_filename);
+	dbg("udev_log=%d", udev_log);
 }
 
 void udev_init_config(void)
diff -Nru a/udev_utils.c b/udev_utils.c
--- a/udev_utils.c	2004-12-19 20:52:01 +01:00
+++ b/udev_utils.c	2004-12-19 20:52:01 +01:00
@@ -25,6 +25,7 @@
 #include <unistd.h>
 #include <fcntl.h>
 #include <errno.h>
+#include <ctype.h>
 #include <dirent.h>
 #include <sys/stat.h>
 #include <sys/mman.h>
@@ -111,6 +112,41 @@
 	return mkdir(p, 0755);
 }
 
+int parse_get_pair(char **orig_string, char **left, char **right)
+{
+	char *temp;
+	char *string = *orig_string;
+
+	if (!string)
+		return -ENODEV;
+
+	/* eat any whitespace */
+	while (isspace(*string) || *string == ',')
+		++string;
+
+	/* split based on '=' */
+	temp = strsep(&string, "=");
+	*left = temp;
+	if (!string)
+		return -ENODEV;
+
+	/* take the right side and strip off the '"' */
+	while (isspace(*string))
+		++string;
+	if (*string == '"')
+		++string;
+	else
+		return -ENODEV;
+
+	temp = strsep(&string, "\"");
+	if (!string || *temp == '\0')
+		return -ENODEV;
+	*right = temp;
+	*orig_string = string;
+	
+	return 0;
+}
+
 int file_map(const char *filename, char **buf, size_t *bufsize)
 {
 	struct stat stats;
@@ -143,11 +179,21 @@
 	munmap(buf, bufsize);
 }
 
-size_t buf_get_line(char *buf, size_t buflen, size_t cur)
+/* return number of chars until the next newline, skip escaped newline */
+size_t buf_get_line(const char *buf, size_t buflen, size_t cur)
 {
-	size_t count = 0;
+	int escape = 0;
+	size_t count;
 
-	for (count = cur; count < buflen && buf[count] != '\n'; count++);
+	for (count = cur; count < buflen; count++) {
+		if (!escape && buf[count] == '\n')
+			break;
+
+		if (buf[count] == '\\')
+			escape = 1;
+		else
+			escape = 0;
+	}
 
 	return count - cur;
 }
diff -Nru a/udev_utils.h b/udev_utils.h
--- a/udev_utils.h	2004-12-19 20:52:01 +01:00
+++ b/udev_utils.h	2004-12-19 20:52:01 +01:00
@@ -79,9 +79,10 @@
 extern void udev_init_device(struct udevice *udev, const char* devpath, const char *subsystem);
 extern int kernel_release_satisfactory(int version, int patchlevel, int sublevel);
 extern int create_path(const char *path);
+extern int parse_get_pair(char **orig_string, char **left, char **right);
 extern int file_map(const char *filename, char **buf, size_t *bufsize);
 extern void file_unmap(char *buf, size_t bufsize);
-extern size_t buf_get_line(char *buf, size_t buflen, size_t cur);
+extern size_t buf_get_line(const char *buf, size_t buflen, size_t cur);
 extern void no_trailing_slash(char *path);
 typedef int (*file_fnct_t)(const char *filename, void *data);
 extern int  call_foreach_file(file_fnct_t fnct, const char *dirname,

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: udev: remove permissions file from udev
  2004-12-19 17:10 udev: remove permissions file from udev Kay Sievers
                   ` (4 preceding siblings ...)
  2004-12-19 19:57 ` Kay Sievers
@ 2004-12-20  0:59 ` Marco d'Itri
  2004-12-20  1:17 ` Kay Sievers
                   ` (14 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: Marco d'Itri @ 2004-12-20  0:59 UTC (permalink / raw)
  To: linux-hotplug

[-- Attachment #1: Type: text/plain, Size: 491 bytes --]

On Dec 19, Kay Sievers <kay.sievers@vrfy.org> wrote:

> How about the usual backslash at the end of the line. Here is a simple
> patch, that just replaces backslashes/newlines with spaces. So it will
> obviously not work if key values continue at the next line. How does
> that sound?
I think that continuation on leading blanks is more practical, but since
you are the one writing the code I suppose that this will work as
well... :-)

-- 
ciao, |
Marco | [9930 co3JWpx.tkg..]

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: udev: remove permissions file from udev
  2004-12-19 17:10 udev: remove permissions file from udev Kay Sievers
                   ` (5 preceding siblings ...)
  2004-12-20  0:59 ` Marco d'Itri
@ 2004-12-20  1:17 ` Kay Sievers
  2004-12-20 13:36 ` Kay Sievers
                   ` (13 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: Kay Sievers @ 2004-12-20  1:17 UTC (permalink / raw)
  To: linux-hotplug

On Mon, 2004-12-20 at 01:59 +0100, Marco d'Itri wrote:
> On Dec 19, Kay Sievers <kay.sievers@vrfy.org> wrote:
> 
> > How about the usual backslash at the end of the line. Here is a simple
> > patch, that just replaces backslashes/newlines with spaces. So it will
> > obviously not work if key values continue at the next line. How does
> > that sound?
> I think that continuation on leading blanks is more practical, but since
> you are the one writing the code I suppose that this will work as
> well... :-)

Hmm, I'm just thought that it's still interpreted as one line and the
backslash syntax is more intuitive here, cause it doesn't look like a
block of separate instructions.

I've pushed a new version out into my tree. If you want a tarball, let
me know.

Kay



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/
_______________________________________________
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] 22+ messages in thread

* Re: udev: remove permissions file from udev
  2004-12-19 17:10 udev: remove permissions file from udev Kay Sievers
                   ` (6 preceding siblings ...)
  2004-12-20  1:17 ` Kay Sievers
@ 2004-12-20 13:36 ` Kay Sievers
  2004-12-20 14:03 ` Marco d'Itri
                   ` (12 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: Kay Sievers @ 2004-12-20 13:36 UTC (permalink / raw)
  To: linux-hotplug

On Sun, 2004-12-19 at 18:10 +0100, Kay Sievers wrote:
> As discussed this week, here we remove the explicit permissions file
> from udev. All permissions should be specified along with the rule now,
> to have only one source of policy.
> 
> This simplifies the whole udev process and removes the need to parse a
> second file in a different format. The rule file will grow a bit to
> apply some permissions, but its an overall win.
> 
> You may look at the changes at:
>   http://vrfy.bkbits.net:8080/udev/ChangeSet@-8d?nav=index.html
> 
> or pull it from:
>   bk://vrfy.bkbits.net/udev

> To get this working, the current rules file needs to be updated. I
> started to convert the gentoo and the Fedora file available in the tree.
> Any help here is appreciated, cause we need to be sure, that it will
> work before we make a new release.

Just an example how nice the permissions application can work now. The
following line applies the "disk" group ownership to all block devices
not catched by an earlier explicit rule.
There is no longer the need to catch all the different node names of a
device class.

--- a/etc/udev/gentoo/udev.rules        2004-12-20 14:24:22 +01:00
+++ b/etc/udev/gentoo/udev.rules        2004-12-20 14:24:22 +01:00
@@ -207,6 +207,9 @@
 # rem_ide devices
 KERNEL="microdrive*",	NAME="%k", GROUP="disk"
 
+# all block devices
+SUBSYSTEM="block",	NAME="%k", GROUP="disk"
+
 # kbd devices
 KERNEL="kbd",		NAME="%k", MODE="0664"
 

Thanks,
Kay




-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/
_______________________________________________
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] 22+ messages in thread

* Re: udev: remove permissions file from udev
  2004-12-19 17:10 udev: remove permissions file from udev Kay Sievers
                   ` (7 preceding siblings ...)
  2004-12-20 13:36 ` Kay Sievers
@ 2004-12-20 14:03 ` Marco d'Itri
  2004-12-20 14:54 ` Kay Sievers
                   ` (11 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: Marco d'Itri @ 2004-12-20 14:03 UTC (permalink / raw)
  To: linux-hotplug

[-- Attachment #1: Type: text/plain, Size: 316 bytes --]

On Dec 20, Kay Sievers <kay.sievers@vrfy.org> wrote:

> +# all block devices
> +SUBSYSTEM="block",	NAME="%k", GROUP="disk"
> +
NAME="%k" here and in similar rules does not add any new information,
what about making it optional, like it is for SYMLINK-only rules?

-- 
ciao, |
Marco | [9945 afTk4TWqM7keE]

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: udev: remove permissions file from udev
  2004-12-19 17:10 udev: remove permissions file from udev Kay Sievers
                   ` (8 preceding siblings ...)
  2004-12-20 14:03 ` Marco d'Itri
@ 2004-12-20 14:54 ` Kay Sievers
  2004-12-20 17:13 ` Lindsay Haisley
                   ` (10 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: Kay Sievers @ 2004-12-20 14:54 UTC (permalink / raw)
  To: linux-hotplug

On Mon, 2004-12-20 at 15:03 +0100, Marco d'Itri wrote:
> On Dec 20, Kay Sievers <kay.sievers@vrfy.org> wrote:
> 
> > +# all block devices
> > +SUBSYSTEM="block",	NAME="%k", GROUP="disk"
> > +
> NAME="%k" here and in similar rules does not add any new information,
> what about making it optional, like it is for SYMLINK-only rules?

Yeah, I was already working on this. :) You may get the tarball:
  http://vrfy.org/projects/udev/udev-050-plus2.tar.gz

Or look here:
  http://vrfy.bkbits.net:8080/udev/ChangeSet@-2d?nav=index.html

Thanks,
Kay



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/
_______________________________________________
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] 22+ messages in thread

* Re: udev: remove permissions file from udev
  2004-12-19 17:10 udev: remove permissions file from udev Kay Sievers
                   ` (9 preceding siblings ...)
  2004-12-20 14:54 ` Kay Sievers
@ 2004-12-20 17:13 ` Lindsay Haisley
  2004-12-20 20:30 ` Kay Sievers
                   ` (9 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: Lindsay Haisley @ 2004-12-20 17:13 UTC (permalink / raw)
  To: linux-hotplug

Thus spake Kay Sievers on Mon, Dec 20, 2004 at 07:36:51AM CST
> Just an example how nice the permissions application can work now. The
> following line applies the "disk" group ownership to all block devices
> not catched by an earlier explicit rule.
> There is no longer the need to catch all the different node names of a
> device class.
> 
> --- a/etc/udev/gentoo/udev.rules        2004-12-20 14:24:22 +01:00
> +++ b/etc/udev/gentoo/udev.rules        2004-12-20 14:24:22 +01:00
> @@ -207,6 +207,9 @@
>  # rem_ide devices
>  KERNEL="microdrive*",	NAME="%k", GROUP="disk"
>  
> +# all block devices
> +SUBSYSTEM="block",	NAME="%k", GROUP="disk"
> +
>  # kbd devices
>  KERNEL="kbd",		NAME="%k", MODE="0664"

If it hasn't been done, I'm going to lobby once again for the inclusion in
udev of a utility which will will parse the sysfs tree for acceptable values
for KERNEL and spit out copy 'n paste lines which are acceptable in a rules
file, much the way udevinfo does for SYSFS{*} terms.  I corresponded with
Greg KH on this a while back and he suggested a simple shell script for
this, which I tweaked a bit and reposted.  Such as script could also show
acceptable values for SUBSYSTEM.  If it hasn't been done, and I get a moment
after the 1st of the year, I'll work on something and post it.

Thanks!

-- 
Lindsay Haisley       | "Fighting against human |     PGP public key
FMP Computer Services |    creativity is like   |      available at
512-259-1190          |    trying to eradicate  | <http://pubkeys.fmp.com>
http://www.fmp.com    |        dandelions"      |
                      |      (Pamela Jones)     |


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/
_______________________________________________
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] 22+ messages in thread

* Re: udev: remove permissions file from udev
  2004-12-19 17:10 udev: remove permissions file from udev Kay Sievers
                   ` (10 preceding siblings ...)
  2004-12-20 17:13 ` Lindsay Haisley
@ 2004-12-20 20:30 ` Kay Sievers
  2004-12-20 20:49 ` Kay Sievers
                   ` (8 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: Kay Sievers @ 2004-12-20 20:30 UTC (permalink / raw)
  To: linux-hotplug

On Mon, 2004-12-20 at 11:13 -0600, Lindsay Haisley wrote:
> Thus spake Kay Sievers on Mon, Dec 20, 2004 at 07:36:51AM CST
> > Just an example how nice the permissions application can work now. The
> > following line applies the "disk" group ownership to all block devices
> > not catched by an earlier explicit rule.
> > There is no longer the need to catch all the different node names of a
> > device class.
> > 
> > --- a/etc/udev/gentoo/udev.rules        2004-12-20 14:24:22 +01:00
> > +++ b/etc/udev/gentoo/udev.rules        2004-12-20 14:24:22 +01:00
> > @@ -207,6 +207,9 @@
> >  # rem_ide devices
> >  KERNEL="microdrive*",	NAME="%k", GROUP="disk"
> >  
> > +# all block devices
> > +SUBSYSTEM="block",	NAME="%k", GROUP="disk"
> > +
> >  # kbd devices
> >  KERNEL="kbd",		NAME="%k", MODE="0664"
> 
> If it hasn't been done, I'm going to lobby once again for the inclusion in
> udev of a utility which will will parse the sysfs tree for acceptable values
> for KERNEL and spit out copy 'n paste lines which are acceptable in a rules
> file, much the way udevinfo does for SYSFS{*} terms.  I corresponded with
> Greg KH on this a while back and he suggested a simple shell script for
> this, which I tweaked a bit and reposted.  Such as script could also show
> acceptable values for SUBSYSTEM.  If it hasn't been done, and I get a moment
> after the 1st of the year, I'll work on something and post it.

Hmm, I don't know if this is really useful, as sysfs has well defined
filenames you can list that with just "ls -1 /sys/class /sys/bus", which
will print all possible subsystems (besides block).

It's different from the sysfs _values_ which may be vendor defined and
contain odd whitespaces and similar. That's why we have the udevinfo
print.

udevinfo already prints BUS= and ID= so you may add the KERNEL=,
DRIVER=, SUBSYSTEM= keys there if you think that is useful.

Thanks,
Kay




-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/
_______________________________________________
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] 22+ messages in thread

* Re: udev: remove permissions file from udev
  2004-12-19 17:10 udev: remove permissions file from udev Kay Sievers
                   ` (11 preceding siblings ...)
  2004-12-20 20:30 ` Kay Sievers
@ 2004-12-20 20:49 ` Kay Sievers
  2004-12-20 20:51 ` Marco d'Itri
                   ` (7 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: Kay Sievers @ 2004-12-20 20:49 UTC (permalink / raw)
  To: linux-hotplug

On Mon, 2004-12-20 at 15:54 +0100, Kay Sievers wrote:
> On Mon, 2004-12-20 at 15:03 +0100, Marco d'Itri wrote:
> > On Dec 20, Kay Sievers <kay.sievers@vrfy.org> wrote:
> > 
> > > +# all block devices
> > > +SUBSYSTEM="block",	NAME="%k", GROUP="disk"
> > > +
> > NAME="%k" here and in similar rules does not add any new information,
> > what about making it optional, like it is for SYMLINK-only rules?
> 
> Yeah, I was already working on this. :) You may get the tarball:
>   http://vrfy.org/projects/udev/udev-050-plus2.tar.gz
> 
> Or look here:
>   http://vrfy.bkbits.net:8080/udev/ChangeSet@-2d?nav=index.html

We may even remove the definition of the default values from the
udev.conf file now, as with the "permissions only rules" we can just
place:

  MODE="0660", OWNER="root", GROUP="root"

at the beginning of the rules file and get exactly the same behavior.
How does that sound?

Thanks,
Kay



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/
_______________________________________________
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] 22+ messages in thread

* Re: udev: remove permissions file from udev
  2004-12-19 17:10 udev: remove permissions file from udev Kay Sievers
                   ` (12 preceding siblings ...)
  2004-12-20 20:49 ` Kay Sievers
@ 2004-12-20 20:51 ` Marco d'Itri
  2004-12-20 20:55 ` Kay Sievers
                   ` (6 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: Marco d'Itri @ 2004-12-20 20:51 UTC (permalink / raw)
  To: linux-hotplug

[-- Attachment #1: Type: text/plain, Size: 582 bytes --]

On Dec 20, Kay Sievers <kay.sievers@vrfy.org> wrote:

> We may even remove the definition of the default values from the
> udev.conf file now, as with the "permissions only rules" we can just
> place:
> 
>   MODE="0660", OWNER="root", GROUP="root"
> 
> at the beginning of the rules file and get exactly the same behavior.
> How does that sound?
This looks like a very good idea.
But now I think it's needed to clearly document which statements cause
end of processing of the rules file. Only NAME or are there any others?

-- 
ciao, |
Marco | [9954 slSVeAV9ThM2o]

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: udev: remove permissions file from udev
  2004-12-19 17:10 udev: remove permissions file from udev Kay Sievers
                   ` (13 preceding siblings ...)
  2004-12-20 20:51 ` Marco d'Itri
@ 2004-12-20 20:55 ` Kay Sievers
  2004-12-20 20:58 ` Tobias Klauser
                   ` (5 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: Kay Sievers @ 2004-12-20 20:55 UTC (permalink / raw)
  To: linux-hotplug

On Mon, 2004-12-20 at 21:51 +0100, Marco d'Itri wrote:
> On Dec 20, Kay Sievers <kay.sievers@vrfy.org> wrote:
> 
> > We may even remove the definition of the default values from the
> > udev.conf file now, as with the "permissions only rules" we can just
> > place:
> > 
> >   MODE="0660", OWNER="root", GROUP="root"
> > 
> > at the beginning of the rules file and get exactly the same behavior.
> > How does that sound?
> This looks like a very good idea.
> But now I think it's needed to clearly document which statements cause
> end of processing of the rules file. Only NAME or are there any others?

Right, only NAME stops the processing. The default kernel name will be
used possibly along with the permissions and SYMLINKS from the "only
rules".

Kay



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/
_______________________________________________
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] 22+ messages in thread

* Re: udev: remove permissions file from udev
  2004-12-19 17:10 udev: remove permissions file from udev Kay Sievers
                   ` (14 preceding siblings ...)
  2004-12-20 20:55 ` Kay Sievers
@ 2004-12-20 20:58 ` Tobias Klauser
  2004-12-20 23:36 ` Lindsay Haisley
                   ` (4 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: Tobias Klauser @ 2004-12-20 20:58 UTC (permalink / raw)
  To: linux-hotplug

On Monday 20 December 2004 21:49, Kay Sievers wrote:
> We may even remove the definition of the default values from the
> udev.conf file now, as with the "permissions only rules" we can just
> place:
>
>   MODE="0660", OWNER="root", GROUP="root"
>
> at the beginning of the rules file and get exactly the same behavior.
> How does that sound?

That would be great. It really doesn't make sense to keep the directives in 
udev.conf now with the new rules file.

Cheers, Tobias


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/
_______________________________________________
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] 22+ messages in thread

* Re: udev: remove permissions file from udev
  2004-12-19 17:10 udev: remove permissions file from udev Kay Sievers
                   ` (15 preceding siblings ...)
  2004-12-20 20:58 ` Tobias Klauser
@ 2004-12-20 23:36 ` Lindsay Haisley
  2004-12-21  3:04 ` Kay Sievers
                   ` (3 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: Lindsay Haisley @ 2004-12-20 23:36 UTC (permalink / raw)
  To: linux-hotplug

Thus spake Kay Sievers on Mon, Dec 20, 2004 at 02:30:22PM CST
> > If it hasn't been done, I'm going to lobby once again for the inclusion in
> > udev of a utility which will will parse the sysfs tree for acceptable values
> > for KERNEL and spit out copy 'n paste lines which are acceptable in a rules
> > file, much the way udevinfo does for SYSFS{*} terms.  I corresponded with
> > Greg KH on this a while back and he suggested a simple shell script for
> > this, which I tweaked a bit and reposted.  Such as script could also show
> > acceptable values for SUBSYSTEM.  If it hasn't been done, and I get a moment
> > after the 1st of the year, I'll work on something and post it.
> 
> Hmm, I don't know if this is really useful, as sysfs has well defined
> filenames you can list that with just "ls -1 /sys/class /sys/bus", which
> will print all possible subsystems (besides block).

I figured this out, but had to go exploring in /sys to get a clue.  Even a
better doc on this would help.

> It's different from the sysfs _values_ which may be vendor defined and
> contain odd whitespaces and similar. That's why we have the udevinfo
> print.

Yeah, this is really needed for sure for SYSFS terms in a rules file, and
you're quite right about getting this information from /sys being relatively
trivial, assuming one understands something about the structure of the sysfs
file system.

> udevinfo already prints BUS= and ID= so you may add the KERNEL=,
> DRIVER=, SUBSYSTEM= keys there if you think that is useful.

It's simply a matter of convenience.  It wasn't very long ago that I started
using devfs and had to learn devfs rules files.  Now we've moved on to
udev/sysfs, and it's new tech - different data structurs, different config
files.  Being able to get everything one needs to compose working udev rules
from a single utility, without having to learn the structure of and explore
/sys, is majorly convenient.  It's just polish, but people do wax and polish
their cars ;-)

-- 
Lindsay Haisley       | "Fighting against human |     PGP public key
FMP Computer Services |    creativity is like   |      available at
512-259-1190          |    trying to eradicate  | <http://pubkeys.fmp.com>
http://www.fmp.com    |        dandelions"      |
                      |      (Pamela Jones)     |


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/
_______________________________________________
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] 22+ messages in thread

* Re: udev: remove permissions file from udev
  2004-12-19 17:10 udev: remove permissions file from udev Kay Sievers
                   ` (16 preceding siblings ...)
  2004-12-20 23:36 ` Lindsay Haisley
@ 2004-12-21  3:04 ` Kay Sievers
  2004-12-22  3:41 ` Willem Riede
                   ` (2 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: Kay Sievers @ 2004-12-21  3:04 UTC (permalink / raw)
  To: linux-hotplug

On Mon, 2004-12-20 at 17:36 -0600, Lindsay Haisley wrote:
> Thus spake Kay Sievers on Mon, Dec 20, 2004 at 02:30:22PM CST
> > > If it hasn't been done, I'm going to lobby once again for the inclusion in
> > > udev of a utility which will will parse the sysfs tree for acceptable values
> > > for KERNEL and spit out copy 'n paste lines which are acceptable in a rules
> > > file, much the way udevinfo does for SYSFS{*} terms.

> > udevinfo already prints BUS= and ID= so you may add the KERNEL=,
> > DRIVER=, SUBSYSTEM= keys there if you think that is useful.

> Being able to get everything one needs to compose working udev rules
> from a single utility, without having to learn the structure of and explore
> /sys, is majorly convenient.  It's just polish, but people do wax and polish
> their cars ;-)

That's what udevinfo is for. You may look at the output of:
  udevinfo -a -p <DEVPATH>

and
  udevinfo -s

to get an idea. I've added the -s option while I was working on
wait_for_sysfs. It's not generally useful and it may be nice to move
some of that functionality into the -a option to provide the user with
the full list of possible keys to paste into a rule.

Thanks,
Kay



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/
_______________________________________________
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] 22+ messages in thread

* Re: udev: remove permissions file from udev
  2004-12-19 17:10 udev: remove permissions file from udev Kay Sievers
                   ` (17 preceding siblings ...)
  2004-12-21  3:04 ` Kay Sievers
@ 2004-12-22  3:41 ` Willem Riede
  2004-12-22  6:18 ` Greg KH
  2004-12-22 14:25 ` Willem Riede
  20 siblings, 0 replies; 22+ messages in thread
From: Willem Riede @ 2004-12-22  3:41 UTC (permalink / raw)
  To: linux-hotplug

On 12/19/2004 01:12:34 PM, Kay Sievers wrote:
> On Sun, 2004-12-19 at 17:36 +0000, Willem Riede wrote:
> > On 12/19/2004 12:10:09 PM, Kay Sievers wrote:
> > >
> > > # tape devices
> > > KERNEL="ht*",		NAME="%k", GROUP="tape", MODE="0660"
> > > KERNEL="nht*",		NAME="%k", GROUP="tape", MODE="0660"
> > > KERNEL="pt*",		NAME="%k", GROUP="tape", MODE="0660"
> > > KERNEL="npt*",		NAME="%k", GROUP="tape", MODE="0660"
> > > KERNEL="st*",		NAME="%k", GROUP="tape", MODE="0660"
> > > KERNEL="nst*",		NAME="%k", GROUP="tape", MODE="0660"
> >
> > Would you mind adding OnStream tape drives?
> >
> > KERNEL="osst*",		NAME="%k", GROUP="tape", MODE="0660"
> > KERNEL="nosst*",	NAME="%k", GROUP="tape", MODE="0660"
> 
> I've added it to the gentoo rules.

What about the redhat rules?

Thanks, Willem Riede.



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/
_______________________________________________
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] 22+ messages in thread

* Re: udev: remove permissions file from udev
  2004-12-19 17:10 udev: remove permissions file from udev Kay Sievers
                   ` (18 preceding siblings ...)
  2004-12-22  3:41 ` Willem Riede
@ 2004-12-22  6:18 ` Greg KH
  2004-12-22 14:25 ` Willem Riede
  20 siblings, 0 replies; 22+ messages in thread
From: Greg KH @ 2004-12-22  6:18 UTC (permalink / raw)
  To: linux-hotplug

On Wed, Dec 22, 2004 at 03:41:44AM +0000, Willem Riede wrote:
> On 12/19/2004 01:12:34 PM, Kay Sievers wrote:
> >On Sun, 2004-12-19 at 17:36 +0000, Willem Riede wrote:
> >> On 12/19/2004 12:10:09 PM, Kay Sievers wrote:
> >> >
> >> > # tape devices
> >> > KERNEL="ht*",		NAME="%k", GROUP="tape", MODE="0660"
> >> > KERNEL="nht*",		NAME="%k", GROUP="tape", MODE="0660"
> >> > KERNEL="pt*",		NAME="%k", GROUP="tape", MODE="0660"
> >> > KERNEL="npt*",		NAME="%k", GROUP="tape", MODE="0660"
> >> > KERNEL="st*",		NAME="%k", GROUP="tape", MODE="0660"
> >> > KERNEL="nst*",		NAME="%k", GROUP="tape", MODE="0660"
> >>
> >> Would you mind adding OnStream tape drives?
> >>
> >> KERNEL="osst*",		NAME="%k", GROUP="tape", MODE="0660"
> >> KERNEL="nosst*",	NAME="%k", GROUP="tape", MODE="0660"
> >
> >I've added it to the gentoo rules.
> 
> What about the redhat rules?

Red Hat's rules are in their rpm package, and we every once in a while,
sync up the udev tarball with it.  Gentoo's rules, on the other hand,
live in the udev tarball, as it's easier for me to maintain them over
time that way :)

So in short, we can guess as to what Red Hat's rule files should look
like, but Red Hat doesn't pull them from us, it's the other way around.

Hope this helps,

greg k-h


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/
_______________________________________________
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] 22+ messages in thread

* Re: udev: remove permissions file from udev
  2004-12-19 17:10 udev: remove permissions file from udev Kay Sievers
                   ` (19 preceding siblings ...)
  2004-12-22  6:18 ` Greg KH
@ 2004-12-22 14:25 ` Willem Riede
  20 siblings, 0 replies; 22+ messages in thread
From: Willem Riede @ 2004-12-22 14:25 UTC (permalink / raw)
  To: linux-hotplug

On 12/22/2004 01:18:37 AM, Greg KH wrote:
> On Wed, Dec 22, 2004 at 03:41:44AM +0000, Willem Riede wrote:
> > On 12/19/2004 01:12:34 PM, Kay Sievers wrote:
> > >On Sun, 2004-12-19 at 17:36 +0000, Willem Riede wrote:
> > >>
> > >> Would you mind adding OnStream tape drives?
> > >>
> > >> KERNEL="osst*",		NAME="%k", GROUP="tape", MODE="0660"
> > >> KERNEL="nosst*",	NAME="%k", GROUP="tape", MODE="0660"
> > >
> > >I've added it to the gentoo rules.
> >
> > What about the redhat rules?
> 
> Red Hat's rules are in their rpm package, and we every once in a while,
> sync up the udev tarball with it.  Gentoo's rules, on the other hand,
> live in the udev tarball, as it's easier for me to maintain them over
> time that way :)
> 
> So in short, we can guess as to what Red Hat's rule files should look
> like, but Red Hat doesn't pull them from us, it's the other way around.
> 
> Hope this helps,

Yes, it does. Thanks. Redhat-Fedora now gained
https://bugzilla.redhat.com/beta/show_bug.cgi?id\x143568

Not that that's the only thing needed, there's this hotplug patch I sent to  
this list a while ago - who owns making that change?

--- /etc/hotplug/scsi.agent	2004-11-04 16:05:13.000000000 -0500
+++ scsi.agent	2004-12-20 13:15:54.498854871 -0500
@@ -41,8 +41,16 @@
     case "$TYPE" in
     # 2.5.51 style attributes; <scsi/scsi.h> TYPE_* constants
     0)		TYPE=disk ; MODULE=sd_mod ;;
-    # FIXME some tapes use 'osst' not 'st'
-    1)		TYPE=tape ; MODULE=st ;;
+    # Some tapes use 'osst' not 'st'
+    1)		TYPE=tape ;
+		VENDOR=$(cat /sys/$DEVPATH/vendor) ;
+		MODEL=$(cat /sys/$DEVPATH/model) ;
+		if [ $VENDOR = "OnStream" -a ${MODEL:0:3} != "ADR" ]
+		then
+			MODULE=osst ;
+		else
+			MODULE=st ;
+		fi ;;
     2)		TYPE=printer ; MODULE=sg ;;
     3)		TYPE=processor ; MODULE=sg ;;
     4)		TYPE=worm ; MODULE=sr_mod ;;



Thanks, Willem Riede.



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/
_______________________________________________
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] 22+ messages in thread

end of thread, other threads:[~2004-12-22 14:25 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-12-19 17:10 udev: remove permissions file from udev Kay Sievers
2004-12-19 17:31 ` Marco d'Itri
2004-12-19 17:36 ` Willem Riede
2004-12-19 17:49 ` Kay Sievers
2004-12-19 18:12 ` Kay Sievers
2004-12-19 19:57 ` Kay Sievers
2004-12-20  0:59 ` Marco d'Itri
2004-12-20  1:17 ` Kay Sievers
2004-12-20 13:36 ` Kay Sievers
2004-12-20 14:03 ` Marco d'Itri
2004-12-20 14:54 ` Kay Sievers
2004-12-20 17:13 ` Lindsay Haisley
2004-12-20 20:30 ` Kay Sievers
2004-12-20 20:49 ` Kay Sievers
2004-12-20 20:51 ` Marco d'Itri
2004-12-20 20:55 ` Kay Sievers
2004-12-20 20:58 ` Tobias Klauser
2004-12-20 23:36 ` Lindsay Haisley
2004-12-21  3:04 ` Kay Sievers
2004-12-22  3:41 ` Willem Riede
2004-12-22  6:18 ` Greg KH
2004-12-22 14:25 ` Willem Riede

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