1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-01 09:21:26 +03:00
Commit Graph

74 Commits

Author SHA1 Message Date
greg@kroah.com
480763324d [PATCH] add pci to the bus_files list. 2005-04-26 21:13:10 -07:00
greg@kroah.com
07562d6ecf [PATCH] fix long delay for all devices in namedev
Now we only sleep if we can't find the device file, and we have
a hack to sleep for 1 second if we are on a partition.  This will be
removed when the libsysfs change gets made...
2005-04-26 21:13:10 -07:00
greg@kroah.com
ca593541e6 [PATCH] fix complier warning in namedev.c 2005-04-26 21:13:10 -07:00
greg@kroah.com
a8b01705c6 [PATCH] add ability to have up to 5 SYSFS_ file/value pairs for the LABEL rule. 2005-04-26 21:13:10 -07:00
kay.sievers@vrfy.org
958479a0de [PATCH] add any valid device 2005-04-26 21:13:09 -07:00
kay.sievers@vrfy.org
3e54036862 [PATCH] introduce format char 'k' for kernel-name
Attached is a patch that introduces the format char 'k' to be replaced with
the kernel name. I like to have it in a callout script.

I've moved the build_kernel_name() back to namedev_name_device() since
we don't expect it growing cause of 'sdaj' :)
2005-04-26 21:13:09 -07:00
greg@kroah.com
1edbb8d350 [PATCH] Just live with a sleep(1) in namedev for now until libsysfs is fixed up. 2005-04-26 21:13:09 -07:00
greg@kroah.com
dac056aa30 [PATCH] try to wait until the proper device file shows up in sysfs.
this still isn't working correctly for partitions, so don't
think this is the final version...
2005-04-26 21:13:09 -07:00
greg@kroah.com
7ecb8d23f3 [PATCH] remove unneeded TODO and FIXME entry
Thanks to Kay for pointing it out to me.
2005-04-26 21:13:09 -07:00
kay.sievers@vrfy.org
b1c5e3339d [PATCH] get part of callout return string
Try this patch if you like, to get special parts of the callout output.
This beast works now:
CALLOUT, BUS="scsi", PROGRAM="/bin/echo -n node link1 link2", ID="node *", NAME="%1c", SYMLINK="%2c %3c"

The callout returned string is separated by spaces and is
addressed by the "len" value of the 'c' format char.
Since we support symlinks, this my be useful for other uses of callout too.

  introduce 'len number' for format chars
  the first use is 'c'-the callout return to select a part of the output string like:
  CALLOUT, BUS="scsi", PROGRAM="/bin/echo -n node link1 link2", ID="node *", NAME="%1c", SYMLINK="%2c %3c"
  (note: first part is requested by len=1, len=0 will return the whole string)
  add a test to udev-test.pl
2005-04-26 21:13:07 -07:00
kay.sievers@vrfy.org
2052464275 [PATCH] remove '\n' from end of callout return
remove possible newline at end of callout output,
  for easier matching with ID=
2005-04-26 21:13:07 -07:00
dsteklof@us.ibm.com
5d4754f195 [PATCH] pre-libsysfs-0.4.0 patch
I am sending you a pre-release patch. It's everything that's in our
current CVS tree. It adds the functionality you've been looking for. Please
play with this before checking it into your tree, I'd like to know if
it's ok with you or if you find problems. I have tested this out with
test.all and the perl regression test. Let me know what you think.

Still need to do more testing for our work and add some more functions
related to the changes.

I've gone into namedev.c and udev-add.c to make the necessary changes
in line with the library. I have not gone and edited any of the "extras".


Changes:

1) Libsysfs object structures work more as handles now, their included
directories or devices are labeled private. If you need attributes
from a sysfs_class_device, call the available function and don't access
the directory directly. Same holds true for a sysfs_class_device
sysfs_device. Do not access the link directly but call the function
sysfs_get_classdev_device() instead. We only populate entries upon
request, makes things faster and uses less memory.

2) Added sysfs_get_classdev_parent() as requested.

3) Changed getpagesize to sysconf.

4) Added sysfs_refresh_attributes function for refreshing views of
attribute lists. We still need to add refresh for links and subdirs. All
udev needs to do is keep calling sysfs_get_classdev_attr() and that will
internally call the refresh routine.
2005-04-26 21:13:07 -07:00
greg@kroah.com
525d07e78e [PATCH] change devfs disk name rule from 'disk' to 'disc' 2005-04-26 21:13:07 -07:00
kay.sievers@vrfy.org
3d150dfb28 [PATCH] experimental (very simple) SYMLINK creation
> > here is a experimental symlink creation patch - for discussion,
> > in which direction we should go.
> > It is possible now to define SYMLINK= after the NAME= in udev.rules.
> > The link is relative to the node, but the path is not optimized now
> > if the node and the link are in the same nested directory.
> > Only one link is supported, cause i need to sleep now :)
> >
> > 06-simple-symlink-creation.diff
> >   simple symlink creation
> >   reorganized udev-remove to have access to the symlink field
> >   subdir creation/removal are functions now
> >   udev-test.pl tests for link creation/removal

Here is a new version with relative link target path optimization
an better tests in udev-test.pl:

LABEL, BUS="scsi", vendor="IBM-ESXS", NAME="1/2/a/b/node", SYMLINK="1/2/c/d/symlink"

  Dec  7 06:48:34 pim udev[13789]: create_node: symlink 'udev-root/1/2/c/d/symlink' to node '1/2/a/b/node' requested
  Dec  7 06:48:34 pim udev[13789]: create_path: created 'udev-root/1/2/c'
  Dec  7 06:48:34 pim udev[13789]: create_path: created 'udev-root/1/2/c/d'
  Dec  7 06:48:34 pim udev[13789]: create_node: symlink(../../a/b/node, udev-root/1/2/c/d/symlink)
2005-04-26 21:13:06 -07:00
kay.sievers@vrfy.org
83be97ba21 [PATCH] pattern match for label method
switch LABEL search to pattern match
  add a test for pattern match in LABEL
  remove useless rule from udev.rules
2005-04-26 21:13:06 -07:00
kay.sievers@vrfy.org
28d6536a0f [PATCH] a bug in linefeed removal
While I was adding pattern match to the LABEL method i hit a bug.
We modify a string returned from libsysfs, so with every iteration is is
truncated by one char:

Dec  4 02:27:16 pim udev[23307]: do_label: dev->bus='scsi' sysfs_device->bus='scsi'
Dec  4 02:27:16 pim udev[23307]: do_label: look for device attribute 'vendor'
Dec  4 02:27:16 pim udev[23307]: do_label: xxx 'IBM-ESXS '
Dec  4 02:27:16 pim udev[23307]: do_label: compare attribute 'vendor' value 'IBM-ESX' with '?IBM-ESXS'
Dec  4 02:27:16 pim udev[23307]: do_label: dev->bus='scsi' sysfs_device->bus='scsi'
Dec  4 02:27:16 pim udev[23307]: do_label: look for device attribute 'vendor'
Dec  4 02:27:16 pim udev[23307]: do_label: xxx 'IBM-ESX'
Dec  4 02:27:16 pim udev[23307]: do_label: compare attribute 'vendor' value 'IBM-ES' with 'IBM-ESXS?'
Dec  4 02:27:16 pim udev[23307]: do_label: dev->bus='scsi' sysfs_device->bus='scsi'
Dec  4 02:27:16 pim udev[23307]: do_label: look for device attribute 'vendor'
Dec  4 02:27:16 pim udev[23307]: do_label: xxx 'IBM-ES'
Dec  4 02:27:16 pim udev[23307]: do_label: compare attribute 'vendor' value 'IBM-E' with 'IBM-ES??'
Dec  4 02:27:16 pim udev[23307]: do_label: dev->bus='scsi' sysfs_device->bus='scsi'
Dec  4 02:27:16 pim udev[23307]: do_label: look for device attribute 'vendor'
Dec  4 02:27:16 pim udev[23307]: do_label: xxx 'IBM-E'
Dec  4 02:27:16 pim udev[23307]: do_label: compare attribute 'vendor' value 'IBM-' with 'IBM-ESXSS'

I changed the behavior to remove only the line feed.

03-bug-in-linefeed-removal.diff
  remove only the line feed from string not every last char
2005-04-26 21:13:06 -07:00
greg@kroah.com
61219c756a [PATCH] fix permission handling logic
Now we can handle wildcards properly within the permission file.
2005-04-26 21:13:05 -07:00
greg@kroah.com
8957102244 [PATCH] add support for the default_mode variable, as it is documented... 2005-04-26 21:13:05 -07:00
kay.sievers@vrfy.org
9f1da36138 [PATCH] pattern matching for namedev
As promised yesterday, here is a patch to implement a more advanced
pattern matching instead of the simple '*'.

We can remove the "tty"="tty" line from udev.rules now and
replace "tty*" by "tty[0-9]*" to catch only the vc's.


  implement pattern matching in namedev
  '*'  - to match zero or more chars
  '?'  - to match exactly one char
  '[]' - character classes with ranges '[0-9]'and negation [!A]
2005-04-26 21:13:05 -07:00
greg@kroah.com
e8bacccab2 [PATCH] add support for a main udev config file, udev.conf.
the older udev.config file is now called udev.rules.
This allows us to better control configuration values, and move away from 
the environment variables.
2005-04-26 21:13:05 -07:00
greg@kroah.com
19feb35100 [PATCH] split out the namedev config parsing logic to namedev_parse.c 2005-04-26 21:13:05 -07:00
greg@kroah.com
5c6f0fb0dc [PATCH] rename namedev's get_attr() to be main namedev_name_device() as that's what it really is. 2005-04-26 21:13:05 -07:00
kay.sievers@vrfy.org
0db6d4cc61 [PATCH] catch replace device by wildcard
catch device name by wildcard to support a whole class of devices
  by just one config line like:
  REPLACE, KERNEL="tty*", NAME="vc/%n"
2005-04-26 21:13:05 -07:00
greg@kroah.com
8cf7ebe8cd [PATCH] operate on the rules in the order they are in the config file (within the rule type) 2005-04-26 21:13:04 -07:00
greg@kroah.com
137af0cc47 [PATCH] fix problem where we were not looking at the BUS value. 2005-04-26 21:13:04 -07:00
arnd@arndb.de
5c6f0f141d [PATCH] Add format modifier for devfs like naming
On Monday 24 November 2003 01:29, Greg KH wrote:
> I think with the ability to capture the output of the CALLOUT rule,
> combined with the ability to put format modifiers in the CALLOUT program
> string, we now have everything in place to emulate the existing devfs
> naming scheme.  Anyone want to verify this or not?

I would prefer to have the ability of creating partition nodes in devfs
style built-in to udev. Devfs used to call the whole disk e.g.
"/dev/dasd/0123/disk" and the partitions "/dev/dasd/0123/part[1-3]".
This can obviously be done with a CALLOUT rule, but its common enough
to make it a format modifier. AFAIK, this scheme has been used for
ide, scsi and dasd disks, which is about 99% of all disks ever connected
to Linux.
2005-04-26 21:13:04 -07:00
azarah@nosferatu.za.org
befd83cc4e [PATCH] more config file parsing robustness
udev kept on segfaulting when it was in use, and not having the time
(and building it with DEBUG=true showing nothing), I have not tracked it
until tonight.  Seems like I made a type-o, and forgotten the ':'
between one line's group and permission parameters.  Attached patch
should stop the segfault, and warn at that at least.
2005-04-26 21:13:04 -07:00
kay.sievers@vrfy.org
6968d494d7 [PATCH] namedev.c strcat tweak
02-namedev.c-strcat-tweak.diff
  o cat the substitution to the already known end of the string instead of searching it another time
2005-04-26 21:13:04 -07:00
kay.sievers@vrfy.org
f7b4eca455 [PATCH] overall whitespace + debug text conditioning
01-overall-whitespace+debug-text-conditioning.diff
  o cleanup whitespace
  o clarify a few comments
  o enclose all printed debug string values in ''
2005-04-26 21:13:03 -07:00
greg@kroah.com
f3b04a2e0a [PATCH] added ability to put format specifiers in the CALLOUT program string. 2005-04-26 21:13:02 -07:00
kay.sievers@vrfy.org
c124eafa23 [PATCH] - format char for CALLOUT output
here is a patch for inserting the callout output into NAME=.
ID= supports the usual wildcard to compare with the output.

I've moved all wildcard matching to a function cause this was the third occurrence.
Also attached is the last whitespace cleanup and debug text corrections.
The callout patch depends on the whitespace patch.


CALLOUT, BUS="usb", PROGRAM="/bin/echo -n return", ID="ret*", NAME="webcam-%c-"

results in:

Nov 21 17:33:51 pim udev[20399]: get_major_minor: found major = 81, minor = 0
Nov 21 17:33:51 pim udev[20399]: exec_callout: callout to '/bin/echo -n return'
Nov 21 17:33:51 pim udev[20399]: exec_callout: callout returned 'return'
Nov 21 17:33:51 pim udev[20399]: get_attr: substitute callout output 'return'
Nov 21 17:33:51 pim udev[20399]: udev_add_device: name = webcam-return-
Nov 21 17:33:51 pim udev[20399]: create_node: mknod(/udev/webcam-return-, 020660, 81, 0)
2005-04-26 21:13:02 -07:00
kay.sievers@vrfy.org
53dc383ee9 [PATCH] more namedev whitespace cleanups
attached is the last whitespace cleanup and debug text corrections.
2005-04-26 21:13:02 -07:00
greg@kroah.com
2023350eec [PATCH] add getgrnam and getpwnam to klibc_fixups files.
Hopefully the klibc_fixups code will not be needed eventually.
2005-04-26 21:13:02 -07:00
md@Linux.IT
04a81cac0a [PATCH] fix segfault in parsing bad udev.permissions file 2005-04-26 21:13:02 -07:00
kay.sievers@vrfy.org
bc43451131 [PATCH] support arguments in callout exec
here is argument support for CALLOUT exec:

CALLOUT, PROGRAM="/bin/echo -n xxx", BUS="usb", ID="xxx", NAME="webcam%n"

results in:

Nov 20 02:35:20 pim udev[30422]: get_major_minor: found major = 81, minor = 0
Nov 20 02:35:20 pim udev[30422]: exec_callout: callout to /bin/echo -n xxx
Nov 20 02:35:20 pim udev[30422]: exec_callout: callout returned 'xxx'
Nov 20 02:35:20 pim udev[30422]: get_attr: kernel number appended: 0

The feature is really nice, but the maximum argument count is hard coded to 8.
2005-04-26 21:06:25 -07:00
kay.sievers@vrfy.org
cb08e0f253 [PATCH] namedev.c - change order of fields in CALLOUT
I want to bring the CALLOUT field ordering in line with the other
methods, cause the current parsing relies on the ordering it's good
to have it like the others. The BUS= is now the first expected field.

Also made the last two remaining field names to uppercase and the man page
callout example is updated.
2005-04-26 21:06:25 -07:00
kay.sievers@vrfy.org
8f43a65e4f [PATCH] namedev.c whitespace + debug text cleanup
here is mainly a whitespace cleanup for namedev.c. I changed the
dbg_parse() output a bit for better readability:


current:

Nov 19 19:00:59 pim udev[25582]: do_number: NUMBER path='/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-1/2-1.1'
Nov 19 19:00:59 pim udev[25582]: do_number: NUMBER temp='/2-1.1' id='00:07.1'
Nov 19 19:00:59 pim udev[25582]: do_number: NUMBER temp='/2-1' id='00:07.1'
Nov 19 19:00:59 pim udev[25582]: do_number: NUMBER path='/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-1/2-1.1'
Nov 19 19:00:59 pim udev[25582]: do_number: NUMBER temp='/2-1.1' id='00:0b.0'
Nov 19 19:00:59 pim udev[25582]: do_number: NUMBER temp='/2-1' id='00:0b.0'
Nov 19 19:00:59 pim udev[25582]: do_number: NUMBER path='/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-1/2-1.1'
Nov 19 19:00:59 pim udev[25582]: do_number: NUMBER temp='/2-1.1' id='2-1.1'
Nov 19 19:00:59 pim udev[25582]: do_number: device id '2-1.1' becomes 'webcam%n' - owner='', group ='', mode=0


becomes:

Nov 19 19:23:40 pim udev[26091]: do_number: search '00:07.1' in '/2-1.1', path='/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-1/2-1.1'
Nov 19 19:23:40 pim udev[26091]: do_number: search '00:07.1' in '/2-1', path='/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-1'
Nov 19 19:23:40 pim udev[26091]: do_number: search '00:0b.0' in '/2-1.1', path='/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-1/2-1.1'
Nov 19 19:23:40 pim udev[26091]: do_number: search '00:0b.0' in '/2-1', path='/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-1'
Nov 19 19:23:40 pim udev[26091]: do_number: search '2-1.1' in '/2-1.1', path='/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-1/2-1.1'
Nov 19 19:23:40 pim udev[26091]: do_number: found id '2-1.1', 'video0' becomes 'webcam%n' - owner='', group ='', mode=0
2005-04-26 21:06:25 -07:00
greg@kroah.com
a1b8786ae6 [PATCH] fix namedev.c to build with older version of gcc. 2005-04-26 21:06:25 -07:00
kay.sievers@vrfy.org
09e52d5126 [PATCH] apply permissions.conf support for wildcard and default name
Permissions given in udev.permissions are not applied if no METHOD from
udev.config is found. I've added do_kernelname() to scan for known
permissions if we only use the default method.

Simple support for wildcards is also added:

#name:user:group:mode
hdb*:2702:2702:0660

results in:

drwxr-xr-x    2 root     root          240 Nov 19 03:45 .
drwxr-xr-x   23 root     root          528 Nov 17 03:36 ..
brw-r--r--    1 root     root       3,   0 Nov 19 03:45 hda
brw-r--r--    1 root     root       3,   1 Nov 19 03:45 hda1
brw-r--r--    1 root     root       3,   2 Nov 19 03:45 hda2
brw-r--r--    1 root     root       3,   4 Nov 19 03:45 hda4
brw-r-----    1 kay      kay        3,  64 Nov 19 03:45 hdb
brw-r-----    1 kay      kay        3,  65 Nov 19 03:45 hdb1
brw-r--r--    1 root     root      22,   0 Nov 19 03:45 hdc
crw-r--r--    1 root     root      81,   0 Nov 19 03:34 webcam0
2005-04-26 21:06:25 -07:00
greg@kroah.com
a43180955a [PATCH] turn DEBUG_PARSER off by default. 2005-04-26 21:06:24 -07:00
arnd@arndb.de
70033702cd [PATCH] more robust config file parsing in namedev.c
After getting a number of different crashes for udev reading broken
udev.config files, I decided to try to make the parser a little
more robust.

The behaviour is changed to stop reading the configuration file
and logging the broken entry instead of silently ignoring it (is
that good? It's easy to just print and continue).
All strcpy()'s to a fixed length string are now implicitly limited
to the bounds of the target string.

I kept the -ENODEV return code for now, not sure if there should be
different ones.
2005-04-26 21:06:24 -07:00
arnd@arndb.de
ae2859df40 [PATCH] add bus id modifier
On Tuesday 18 November 2003 02:14, Greg KH wrote:
> On Mon, Nov 17, 2003 at 06:33:32PM +0100, Arnd Bergmann wrote:
> > That would at least be part of the solution I'm looking for. How about
> > extra format characters for bus_id and for the result of a callout
> > program?
>
> Sure, I can see the use for that.  Want to send a patch?  :)

> Take a look at the current bk tree (which has moved to
> bk://linuxusb.bkbits.net/udev/ )  I've made finding that device a lot
> easier now, and it works for all rule types.

Great, just what I was missing. I didn't see the any link to the bk
repository. Here's the patch for the bus_id. I'll need to think about
the handling of callout results a bit more.
2005-04-26 21:06:24 -07:00
greg@kroah.com
5e6e29fd35 [PATCH] change debug level on printf values for now. 2005-04-26 21:06:24 -07:00
greg@kroah.com
7408a7fbb5 [PATCH] fix up printf-like functionality due to previous changes. 2005-04-26 21:06:24 -07:00
kay.sievers@vrfy.org
98b88dbf70 [PATCH] implement printf-like placeholder support for NAME
> Problem is, if you use the LABEL rule to match a device, like a SCSI
> vendor, then all of the partitions, as well as the main block device,
> will end up with the same name.  That's why I added the "add the number"
> hack to the LABEL rule.
>
> So yes, your patch is correct in that we shouldn't always be adding the
> number to any match for LABEL (like for char devices), but if we do
> that, then we break partitions.  Your '%' patch fixes this, but I'd just
> like to extend it a bit.  Let me see what I can come up with...

Oh, I see. Do you mean something like this:

LABEL, BUS="usb", model="Creative Labs WebCam 3", NAME="webcam%n-%M:%m-test"

results in: "webcam0-81:0-test"

Nov 15 16:51:53 pim udev[16193]: get_class_dev: looking at /sys/class/video4linux/video0
Nov 15 16:51:53 pim udev[16193]: get_class_dev: class_dev->name = video0
Nov 15 16:51:53 pim udev[16193]: get_major_minor: dev = 81:0
Nov 15 16:51:53 pim udev[16193]: get_major_minor: found major = 81, minor = 0
Nov 15 16:51:53 pim udev[16193]: udev_add_device: name = webcam0-81:0-test
Nov 15 16:51:53 pim udev[16193]: create_node: mknod(/udev/webcam0-81:0-test, 020666, 81, 0)



  implement printf-like placeholder support for NAME
  %n-kernel number, %M-major number, %m-minor number
2005-04-26 21:06:24 -07:00
greg@kroah.com
20ff86bd71 [PATCH] trailing whitespace cleanups. 2005-04-26 21:06:24 -07:00
greg@kroah.com
ca1cc0fe74 [PATCH] splig LABEL and NUMBER into separate functions.
Now items are processed in priority order, fixing that bug.
2005-04-26 21:06:24 -07:00
greg@kroah.com
8c51bbfe5f [PATCH] move TOPOLOGY rule to it's own function. 2005-04-26 21:06:23 -07:00
greg@kroah.com
8a0c11d360 [PATCH] fix bug where NUMBER and TOPOLOGY would not work for partitions. 2005-04-26 21:06:23 -07:00
greg@kroah.com
7bd22a78a1 [PATCH] clean up the way we find the sysdevice for a block device for namedev. 2005-04-26 21:06:23 -07:00