1
0
mirror of https://github.com/systemd/systemd.git synced 2024-10-28 20:25:38 +03:00
Commit Graph

57 Commits

Author SHA1 Message Date
Thierry Vignaud
a1ea706a1e fix udevinfo output 2005-08-10 17:06:01 +02:00
Kay Sievers
e8d569b414 move code to its own files
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-07-22 12:35:58 -04:00
Kay Sievers
b8476286d6 store the imported device information in the udevdb
Any program can query with udevinfo for persistent device
attributes evaluated on device discovery now.

Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-06-26 18:55:24 +02:00
Greg KH
e2bd03ff63 Fix udevinfo for empty sysfs directories
udevinfo would die if it ran into a sysfs directory with no attributes.
This is valid for a lot of scsi devices, so now we just continue on
up the chain.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-06-06 13:46:19 -07:00
kay.sievers@vrfy.org
fb39f0566e [PATCH] move execute_program to utils + add action to init_device 2005-04-26 23:55:00 -07:00
kay.sievers@vrfy.org
6276fdd2ab [PATCH] udevinfo: print SYSFS attribute the same way we match it 2005-04-26 23:54:59 -07:00
kay.sievers@vrfy.org
61b1b7069f [PATCH] udevinfo: print errors to stderr instead of stdout
On Wed, 2005-03-23 at 13:55 +0100, Dieter Stueken <stueken@conterra.de> wrote:
> I noticed a few funny synlinks within /dev:
  
> lrwxrwxrwx  1 root root 4 2005-03-21 15:33:54.196950896 +0100 device2 -> hda2
> lrwxrwxrwx  1 root root 4 2005-03-21 15:33:54.196950896 +0100 not2 -> hda2
> lrwxrwxrwx  1 root root 4 2005-03-21 15:33:54.196950896 +0100 found2 -> hda2
> lrwxrwxrwx  1 root root 4 2005-03-21 15:33:54.196950896 +0100 in2 -> hda2
> lrwxrwxrwx  1 root root 4 2005-03-21 15:33:54.196950896 +0100 database2 -> hda2
  
> I don't know exactly, what caused this in depth. But I found udevinfo
> prints all error messages to stdout instead of using stderr.
2005-04-26 23:54:59 -07:00
kay.sievers@vrfy.org
6b493a20e1 [PATCH] support log-priority levels in udev.conf 2005-04-26 23:54:59 -07:00
kay.sievers@vrfy.org
911847864f [PATCH] remove unneeded include 2005-04-26 23:53:17 -07:00
kay.sievers@vrfy.org
3810823b44 [PATCH] udevinfo -d: use '=' as separator, cause ':' may be a part of the devpath 2005-04-26 23:53:17 -07:00
kay.sievers@vrfy.org
63f61c5cf6 [PATCH] replace strncpy()/strncat() by strlcpy()/strlcat() 2005-04-26 23:51:00 -07:00
kay.sievers@vrfy.org
6c18b1fb87 [PATCH] rename LOG to USE_LOG in all places 2005-04-26 23:48:48 -07:00
kay.sievers@vrfy.org
599e17a3e6 [PATCH] udevinfo -d: speed-up device dump 2005-04-26 23:48:48 -07:00
kay.sievers@vrfy.org
e48fc108d9 [PATCH] allow unlimitied count of symlinks 2005-04-26 23:48:48 -07:00
kay.sievers@vrfy.org
9fe1a96d88 [PATCH] udevinfo: print devpath -> node relationship for all devices 2005-04-26 23:39:48 -07:00
kay.sievers@vrfy.org
f8a178a35b [PATCH] trivial rename of some variables 2005-04-26 23:36:14 -07:00
kay.sievers@vrfy.org
f385ff6512 [PATCH] big libsysfs diet (pre 2.0 version) 2005-04-26 23:36:13 -07:00
kay.sievers@vrfy.org
8f2f6e426f [PATCH] cleanup db functions 2005-04-26 23:36:13 -07:00
kay.sievers@vrfy.org
f51d8ec661 [PATCH] udevinfo: print SUBSYSTEM and DRIVER 2005-04-26 23:35:15 -07:00
roland@digitalvampire.org
adf3af8c35 [PATCH] This fixes a silly mistake in how udevinfo prints the major and minor 2005-04-26 23:21:57 -07:00
kay.sievers@vrfy.org
82ca88904d [PATCH] klibc supports LOG_PID now, so remove our own implementation 2005-04-26 23:17:47 -07:00
Greg KH
18ebc43050 bleah, more merge fixes... 2005-04-26 23:15:56 -07:00
azarah@nosferatu.za.org
9af175553d [PATCH] remove leftover from udevinfo's -d option 2005-04-26 23:13:48 -07:00
kay.sievers@vrfy.org
a0294b7625 [PATCH] update the man pages and correct Usage: hints
Add UDEV_LOG to the man udev man page. Remove mention of specific
variables from the udevd/udevsend man page as we changed to pass
the whole environment.

Correct printed Usage: of udevtest and udevinfo.

Init the config in udevtest earlier to accept input with and without
the sysfs mount point.
2005-04-26 23:00:29 -07:00
Greg KH
b1e95455d2 fixups to get back to proper patch order
Damm, it's hard to merge a multi-line tree into one flat line at times...
2005-04-26 22:52:57 -07:00
kay.sievers@vrfy.org
9af5bb2f8f [PATCH] rename udev_lib to udev_utils and dev_d to udev_multiplex 2005-04-26 22:44:02 -07:00
greg@kroah.com
0d1ecb44a0 [PATCH] fix udevinfo '-q path' option as it was not working 2005-04-26 22:38:22 -07:00
kay.sievers@vrfy.org
c02ae2fe33 [PATCH] Don't try to print major/minor for devices without a dev file. 2005-04-26 22:30:27 -07:00
kay.sievers@vrfy.org
fc2aa29613 [PATCH] remove get_device_type and merge that into udev_set_values() 2005-04-26 22:30:27 -07:00
kay.sievers@vrfy.org
e4ad54a302 [PATCH] change key names in udevinfo sysfs walk to match the kernel 2005-04-26 22:27:34 -07:00
kay.sievers@vrfy.org
02fa9ae589 [PATCH] rename udevdb* to udev_db* 2005-04-26 22:25:14 -07:00
kay.sievers@vrfy.org
af4b05d491 [PATCH] make the udev object available to more processing stages
Remove the overwriting of main_argv[] hack and use the values
from the udev object.
  
Pass the udev object to call_foreach_file().
  
In the udevstart case, export SUBSYSTEM and UDEVSTART to the
environment.
2005-04-26 22:24:38 -07:00
kay.sievers@vrfy.org
31fd340352 [PATCH] make udevinfo's -r option also workimg for symlink queries
[kay@pim udev.kay]$ ./udevinfo -r -q symlink -p /class/video4linux/video0
/dev/camera0 /dev/kamera0 /dev/videocam0 /dev/webcam0 

[kay@pim udev.kay]$ ./udevinfo -q symlink -p /class/video4linux/video0
camera0 kamera0 videocam0 webcam0
2005-04-26 22:21:20 -07:00
kay.sievers@vrfy.org
3bdef3939d [PATCH] improve udevinfo sysfs info walk 2005-04-26 22:21:20 -07:00
kay.sievers@vrfy.org
f156b6d203 [PATCH] add sysfs info walk to udevinfo
The option "-s" will get information about the major/minor,
the physical device, the bus value and the driver from sysfs for
all class and block devices:

kay@pim udev.kay]$ ./udevinfo -s

DEVPATH        '/sys/block/sda'
SUBSYSTEM      'block'
NAME           'sda'
MAJORMINOR     '8:0'
PHYSDEVPATH    '/sys/devices/pci0000:00/0000:00:1d.7/usb1/1-3/1-3:1.0/host2/target2:0:0/2:0:0:0'
PHYSDEVPATHBUS 'scsi'
DRIVER         'sd'

DEVPATH        '/sys/class/input/mice'
SUBSYSTEM      'input'
NAME           'mice'
MAJORMINOR     '13:63'

DEVPATH        '/sys/class/input/mouse0'
SUBSYSTEM      'input'
NAME           'mouse0'
MAJORMINOR     '13:32'

...
2005-04-26 22:21:19 -07:00
kay.sievers@vrfy.org
2b41e68a08 [PATCH] replace tdb database by simple lockless file database
This makes the udev operation completely lockless by storing a
file for every node in /dev/.udevdb/* This solved the problem
with deadlocking concurrent udev processes waiting for each other
to release the file lock under heavy load.
2005-04-26 22:16:40 -07:00
kay.sievers@vrfy.org
7a947ce515 [PATCH] big cleanup of internal udev api
Here is the first patch to cleanup the internal processing of the
various stages of an udev event. It should not change any behavior,
but if your system depends on udev, please always test it before reboot :)

We pass only one generic structure around between add, remove,
namedev, db and dev_d handling and make all relevant data available
to all internal stages. All udev structures are renamed to "udev".

We replace the fake parameter by a flag in the udev structure.

We open the class device in the main binaries and not in udev_add, to
make it possible to use libsysfs for udevstart directory crawling.

The last sleep parameters are removed.
2005-04-26 22:02:46 -07:00
kay.sievers@vrfy.org
7257cb1845 [PATCH] close the syslog
Seems that we never closed the opened syslog.
Here is a patch to do this in all our binaries.
2005-04-26 22:02:45 -07:00
kay.sievers@vrfy.org
bbbe503ec1 [PATCH] netdev - udevdb+dev.d changes
Here is a patch to change the netdev handling in the database and for
the dev.d/ calls. I applies on top of the udevd.patch, cause klibc has
no sysinfo().

 o netdev's are also put into our database now. I want this for the
   udevruler gui to get a list of all handled devices.
   All devices in the db are stamped with the system uptime value at
   the creation time. 'udevinfo -d' prints it.

 o the DEVPATH value is the key for udevdb, but if we rename
   a netdev, the name is replaced in the kernel, so we add
   the changed name to the db to match with the remove event.

   NOTE: The dev.d/ scripts still get the original name from the
   hotplug call. Should we replace DEVPATH with the new name too?

 o We now only add a device to the db, if we have successfully created
   the main node or successfully renamed a netdev. This is the main part
   of the patch, cause I needed to clean the retval passing trough all
   the functions used for node creation.

 o DEVNODE sounds a bit ugly for netdev's so I exported DEVNAME too.
   Can we change the name?

 o I've added a UDEV_NO_DEVD to possibly skip the script execution
   and used it in udev-test.pl.
   udevstart is the same horror now, if you have scripts with logging
   statements in dev.d/ it takes minutes to finish, can we skip the
   scripts here too?

 o The get_device_type() function is changed to be more strict, cause
   'udevinfo -a -p /block/' gets a class device for it and tries to
   print the major/minor values.

 o bugfix, the RESULT value has now a working newline removal and a test
   for this case.
2005-04-26 21:35:13 -07:00
kay.sievers@vrfy.org
f61d732a02 [PATCH] hmm, handle net devices with udev?
Hmm, Arndt Bergmann sent a patch like this one a few weeks ago and
I want to bring the question back, if we want to handle net device
naming with udev.

With this patch it is actually possible to specify something like this
in udev.rules:

  KERNEL="dummy*", SYSFS{address}="00:00:00:00:00:00", SYSFS{features}="0x0", NAME="blind%n"
  KERNEL="eth*", SYSFS{address}="00:0d:60:77:30:91", NAME="private"

and you will get:

  [root@pim udev.kay]# cat /proc/net/dev
  Inter-|   Receive                                                | Transmit
   face |bytes    packets errs drop fifo frame compressed multicast|bytes   packets errs drop fifo colls carrier compressed
       lo:    1500     30    0    0    0     0          0         0    1500      30    0    0    0     0       0          0
  private:  278393   1114    0    0    0     0          0         0  153204    1468    0    0    0     0       0          0
     sit0:       0      0    0    0    0     0          0         0       0       0    0    0    0     0       0          0
   blind0:       0      0    0    0    0     0          0         0       0       0    0    0    0     0       0          0


The udevinfo program is also working:

  [root@pim udev.kay]# ./udevinfo -a -p /sys/class/net/private
    looking at class device '/sys/class/net/private':
      SYSFS{addr_len}="6"
      SYSFS{address}="00:0d:60:77:30:91"
      SYSFS{broadcast}="ff:ff:ff:ff:ff:ff"
      SYSFS{features}="0x3a9"
      SYSFS{flags}="0x1003"
      SYSFS{ifindex}="2"
      SYSFS{iflink}="2"
      SYSFS{mtu}="1500"
      SYSFS{tx_queue_len}="1000"
      SYSFS{type}="1"

  follow the class device's "device"
    looking at the device chain at '/sys/devices/pci0000:00/0000:00:1e.0/0000:02:01.0':
      BUS="pci"
      ID="0000:02:01.0"
      SYSFS{class}="0x020000"
      SYSFS{detach_state}="0"
      SYSFS{device}="0x101e"
      SYSFS{irq}="11"
      SYSFS{subsystem_device}="0x0549"
      SYSFS{subsystem_vendor}="0x1014"
      SYSFS{vendor}="0x8086"


The matching device will be renamed to the given name. The device name
will not be put into the udev database, cause the kernel renames the
device and the sysfs name disappears.

I like it, cause it plugs in nicely. We have all the naming features
and sysfs queries and walks inside of  udev. The sysfs timing races
are already solved and the management tools are working for net devices
too. nameif can only match the MAC address now. udev can match any sysfs
value of the device tree the net device is connected to.
But right, net devices do not have device nodes :)
2005-04-26 21:35:12 -07:00
dsteklof@us.ibm.com
a291a14b90 [PATCH] udevinfo patch
I think this is what you want for udevinfo. Patched against the latest BK
tree. I tested it and it seemed to work.

One other question, shouldn't udevinfo.c:print_all_attributes() check to
make sure attr->method is SYSFS_METHOD_SHOW along with checking to see
if attr->value != NULL or doesn't that matter?

Here's the libsysfs fix for print_device_chain():
2005-04-26 21:35:10 -07:00
kay.sievers@vrfy.org
b608ade8e4 [PATCH] first stupid try for a rule compose gui
On Mon, Mar 15, 2004 at 09:28:17PM +0100, Kay Sievers wrote:
> Here is a first simple and pretty stupid try to make a simple tool for
> composing of a udev rule.
>
> It reads the udevdb to get all currently handled devices and presents a
> list, where you can choose the device to compose the rule for.
>
> The composed rule is just printed out in a window, nothing else by now.
>
> Do we want something like this?
> Nevermind, I always wanted to know, how this newt thing works :)

Here is the next step, I still can't sleep and there are to many patches
pending to make something useful :)
Cause nobody wanted to play with me, I've made a screenshot.
The device list is sorted in alphabetical order now and if there are only
a few recently discovered devices, they are placed on top of the list.

For those who want to have a look:

  http://vrfy.org/projects/udev/udevruler.png

The patch applies on top of today's mmap() patch. The db format is
changed to have the file and line number of the applied rule. So it
should be easy to edit the matching rule with this beast. It compiles
with "make all udevruler".
2005-04-26 21:35:10 -07:00
kay.sievers@vrfy.org
c81b35c08b [PATCH] replace fgets() with mmap() and introduce udev_lib.[hc]
Here we replace the various fgets() with a mmap() call for the config
file reading, due to the reported performance problems with klibc.

Thanks to Patrick's testing, it makes a very small, close to nothing
speed gain for libc users, but a 6 times speed increase for klibc users
with a 1000 line config file.

I've created a udev_lib.[hc] for this and also moved all the generic
stuff from udev.h in there and uninlined the functions.
2005-04-26 21:35:10 -07:00
kay.sievers@vrfy.org
ebc39fefd5 [PATCH] clarify udevinfo text
Make udevinfo attribute printing note so clear,
that's nearly impossible to misunderstand it in the future.
2005-04-26 21:35:08 -07:00
kay.sievers@vrfy.org
d00bd1724b [PATCH] overall trivial trivial cleanup
Here I try to make the style a bit more consistant in the different
files, so that new patches just copy the 'right' one :)

Some "magic" numbers are replaced and udevtest.c is catched up with udev.
2005-04-26 21:35:08 -07:00
kay.sievers@vrfy.org
dba8c18b8b [PATCH] clarify udevinfo device walk
It seems that the long attribute list can confuse the user.
Se here we print a few words on top the attributes.
2005-04-26 21:35:06 -07:00
kay.sievers@vrfy.org
8ea84a8a78 [PATCH] udevinfo symlink reverse query
Thanks to Olaf Hering <olh@suse.de> for this patch. It's possible now to
feed the -n option of udevinfo with a symlink.

I've also added a 'all' attribute, but no more text, it's all in the
included man page :)
2005-04-26 21:35:06 -07:00
kay.sievers@vrfy.org
c472e3c89b [PATCH] udev - safer string handling all over the place
On Tue, Feb 24, 2004 at 11:50:52PM +0100, Kay Sievers wrote:
> Here is the first step towards a safer string handling.
> More will follow, but for now only the easy ones :)
>
> Thanks to all who pointed this out. strncat() isn't a nice function. We
> all should remember that the destination string is not terminated if the
> given lenght is shorter than the strlen of the source string.
>
> And shame on the various implementers of strfieldcat() I found in the
> unapplied patches on this list, it's not really better than strncpy()
> and hides the real problem.

Hmm, bk didn't checked in one file, maybe I edited it again as root.
Nevermind, here is the more complete version.
2005-04-26 21:32:30 -07:00
greg@kroah.com
c80da5085f [PATCH] force udev to include the internal version of libsysfs and never the external one.
Should fix some more build bugs...
2005-04-26 21:32:29 -07:00
patmans@us.ibm.com
0bad3406c1 [PATCH] udev use new libsysfs header file location
Use the new location of libsysfs header files.
2005-04-26 21:32:29 -07:00