Age | Commit message (Collapse) | Author |
|
|
|
I want to make udevinfo the standard query interface, so all the user
features of the main udev are copied in here. It is now capable to:
o query the database for a given value
o dump the whole database
o extract all possible device attributes for a sysfs_device
In addition to the known options of udev it supports the query for the
mode of the device node, and it includes the mode in the database dump:
udevinfo -d
P: /class/video4linux/video0
N: video/webcam0
M: 0666
S: camera0 kamera0
O: 500
G: 500
It is also a bit more friendly with the pathnames specified for devices or nodes.
We remove the absolute path or add it if neccessary:
udevinfo -q mode -n video/webcam0
udevinfo -q mode -n /udev/video/webcam0
0666
udevinfo -q mode -p /sys/class/video4linux/video0
udevinfo -q mode -p /class/video4linux/video0
udevinfo -q mode -p class/video4linux/video0
0666
|
|
udevinfo is now capable to print "all" attributes along the device chain
of a sysfs device. Just like udev itself it walks the chain upwards and
prints all usable attributes in the udev key format.
So it should be easy to find unique attributes to compose a rule.
All multiline attribute values and values containing non printable
characters are skipped now. I hope nothing useful gets lost with this :)
NOTE:
The BUS value corresponding with the attributes is printed for every
device. Don't specify BUS= in a rule and mix SYSFS_attributes from
different busses, the rule can't match.
./udevinfo /sys/block/sda/sda1
device '/sys/block/sda/sda1' has major:minor 8:1
looking at class device '/sys/block/sda/sda1':
SYSFS_dev="8:1"
SYSFS_start="32"
SYSFS_size="160"
SYSFS_stat=" 0 0 0 0"
follow the class device's "device"
looking at the device chain at '/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-1/1-1.3/1-1.3:1.0/host32/32:0:0:0':
BUS="scsi"
ID="32:0:0:0"
SYSFS_detach_state="0"
SYSFS_type="0"
SYSFS_model="USB 2 HS-CF"
SYSFS_vendor="SMSC "
SYSFS_max_sectors="240"
SYSFS_device_blocked="0"
SYSFS_queue_depth="1"
SYSFS_scsi_level="3"
SYSFS_rev="1.25"
SYSFS_online="1"
looking at the device chain at '/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-1/1-1.3/1-1.3:1.0/host32':
BUS=""
ID="host32"
SYSFS_detach_state="0"
looking at the device chain at '/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-1/1-1.3/1-1.3:1.0':
BUS="usb"
ID="1-1.3:1.0"
SYSFS_detach_state="0"
SYSFS_bInterfaceNumber="00"
SYSFS_bAlternateSetting=" 0"
SYSFS_bNumEndpoints="02"
SYSFS_bInterfaceClass="08"
SYSFS_bInterfaceSubClass="06"
SYSFS_bInterfaceProtocol="50"
SYSFS_iInterface="00"
looking at the device chain at '/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-1/1-1.3':
BUS="usb"
ID="1-1.3"
SYSFS_detach_state="0"
SYSFS_bNumConfigurations="1"
SYSFS_bNumInterfaces=" 1"
SYSFS_bConfigurationValue="1"
SYSFS_bmAttributes="80"
SYSFS_bMaxPower=" 96mA"
SYSFS_idVendor="0424"
SYSFS_idProduct="20fc"
SYSFS_bcdDevice="0125"
SYSFS_bDeviceClass="00"
SYSFS_bDeviceSubClass="00"
SYSFS_bDeviceProtocol="00"
SYSFS_speed="12"
SYSFS_manufacturer="SMSC"
SYSFS_product="USB 2 Flash Media Device"
SYSFS_serial="0305037000C2"
looking at the device chain at '/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-1':
BUS="usb"
ID="1-1"
SYSFS_detach_state="0"
SYSFS_bNumConfigurations="1"
SYSFS_bNumInterfaces=" 1"
SYSFS_bConfigurationValue="1"
SYSFS_bmAttributes="e0"
SYSFS_bMaxPower=" 64mA"
SYSFS_idVendor="03eb"
SYSFS_idProduct="3301"
SYSFS_bcdDevice="0300"
SYSFS_bDeviceClass="09"
SYSFS_bDeviceSubClass="00"
SYSFS_bDeviceProtocol="00"
SYSFS_speed="12"
SYSFS_product="Standard USB Hub"
looking at the device chain at '/sys/devices/pci0000:00/0000:00:1d.0/usb1':
BUS="usb"
ID="usb1"
SYSFS_detach_state="0"
SYSFS_bNumConfigurations="1"
SYSFS_bNumInterfaces=" 1"
SYSFS_bConfigurationValue="1"
SYSFS_bmAttributes="40"
SYSFS_bMaxPower=" 0mA"
SYSFS_idVendor="0000"
SYSFS_idProduct="0000"
SYSFS_bcdDevice="0206"
SYSFS_bDeviceClass="09"
SYSFS_bDeviceSubClass="00"
SYSFS_bDeviceProtocol="00"
SYSFS_speed="12"
SYSFS_manufacturer="Linux 2.6.2-rc1-p4 uhci_hcd"
SYSFS_product="UHCI Host Controller"
SYSFS_serial="0000:00:1d.0"
looking at the device chain at '/sys/devices/pci0000:00/0000:00:1d.0':
BUS="pci"
ID="0000:00:1d.0"
SYSFS_detach_state="0"
SYSFS_vendor="0x8086"
SYSFS_device="0x2482"
SYSFS_subsystem_vendor="0x1014"
SYSFS_subsystem_device="0x0220"
SYSFS_class="0x0c0300"
SYSFS_irq="9"
looking at the device chain at '/sys/devices/pci0000:00':
BUS=""
ID="pci0000:00"
SYSFS_detach_state="0"
|
|
incremental to 0.0.13,
* update the DM target synthax to the 2.6.0-udm5 style
* update the changelog and the doc to reflect minimal requirements
|
|
On Sun, Jan 18, 2004 at 07:30:50AM +0100, Kay Sievers wrote:
> Hi,
> here is a small program to query all attributes of a device and
> print these in the udev key format. It may help to get the keys to
> define a rule.
Fixed a typo - the sysfs_device is right now.
USB FLash Reader:
kay@pim:~/src/udev.kay$ extras/udevinfo/udevinfo /sys/block/sda/sda1
device '/sys/block/sda/sda1' has major:minor 8:1
looking at class device '/sys/block/sda/sda1':
SYSFS_dev="8:1"
SYSFS_start="32"
SYSFS_size="160"
SYSFS_stat=" 0 0 0 0"
follow class device's "device" link '/sys/block/sda':
BUS="scsi"
ID="57:0:0:0"
SYSFS_detach_state="0"
SYSFS_type="0"
SYSFS_device_blocked="0"
SYSFS_queue_depth="1"
SYSFS_scsi_level="3"
SYSFS_vendor="SMSC "
SYSFS_model="USB 2 HS-CF"
SYSFS_rev="1.25"
SYSFS_online="1"
|
|
|
|
Optimize the scripts reflecting the now more powerful rule logic,
cause we can combine all known fields now in any order:
The ide-devfs.sh is only executed if the kernel name matches with 'hd*':
BUS="ide", KERNEL="hd*", PROGRAM="/etc/udev/ide-devfs.sh %k %b %n", NAME="%k", SYMLINK="%1c %2c"
The name_cdrom.pl is only executed for ide and scsi devices, but not for a partition.
It exits with nonzero to skip the rule if the CD is not found:
KERNEL="[hs]d[a-z]", PROGRAM="name_cdrom.pl %M %m", NAME="%1c", SYMLINK="cdrom"
|
|
replace CALLOUT by PROGRAM and fix old rule format
|
|
I had too much time during the holidays, so I played a bit with udev. The
changes are like last time mostly on the init stuff. I'm sending you this as
a great diff which is just for comments.
What it does:
-fix a typo in Makefile
-use only one "grep -v" instead of many
-don't include BK-Files into release (shrinks the stuff to 30%!)
-add a new init script which is LSB compliant
-add some flags to choose which one to use
-use /etc/udev/udev.conf in Redhat init script as the source for the udev
directory. If this is not done then the init script may create a directory
which udev itself isn't using (I changed /udev to /Udev to avoid collisions
with /usr and ran into this)
-first check for sysfs_dir before creating udev_root (maybe someone else has
already fixed this, I saw this discussion on lkml)
|
|
Hey, this is funny.
I couldn't resist to give it a try and we need a few changes:
- it's %2c otherwise nearly all my CD's are "good", but sure I also have bad ones :)
- remove the node first, cause get_cddb() dies and leaves the old one there
- remove spaces in name, cause this is our separator
/udev/
|-- The_Cure-The_Peel_Sessions
|-- cdrom -> ./The_Cure-The_Peel_Sessions
|-- hda
|-- hda1
|-- hda2
|-- hda4
|
|
|
|
incremental to 0.0.12-1,
* check hotplug event refers to a block device; if not exit early
|
|
2003-12-29 multipath-012
* refresh doc
* add the uninstall target in Makefile
* /sbin/multipath, not /root/multipath in hotplug agent
|
|
Attached is a patch for ide-devfs.sh,
The script is merged with the one from Martin Schlemmer, and cleaned up
by him, to create both types of symlinks with one single rule:
CALLOUT, BUS="ide", PROGRAM="/etc/udev/ide-devfs.sh %k %b %n", ID="hd*", NAME="%1c", SYMLINK="%2c %3c"
/udev/
|-- cdroms
| `-- cdrom0 -> ../hdc
|-- discs
| |-- disc0
| | |-- disc -> ../../hda
| | |-- part1 -> ../../hda1
| | |-- part2 -> ../../hda2
| | `-- part4 -> ../../hda4
| |-- disc1
| | |-- disc -> ../../hdb
| | `-- part1 -> ../../hdb1
| `-- disc2
| |-- disc -> ../../hde
| `-- part1 -> ../../hde1
|-- hda
|-- hda1
|-- hda2
|-- hda4
|-- hdb
|-- hdb1
|-- hdc
|-- hde
|-- hde1
`-- ide
|-- host0
| |-- bus0
| | |-- target0
| | | `-- lun0
| | | |-- disc -> ../../../../../hda
| | | |-- part1 -> ../../../../../hda1
| | | |-- part2 -> ../../../../../hda2
| | | `-- part4 -> ../../../../../hda4
| | `-- target1
| | `-- lun0
| | |-- disc -> ../../../../../hdb
| | `-- part1 -> ../../../../../hdb1
| `-- bus1
| `-- target0
| `-- lun0
| `-- cd -> ../../../../../hdc
`-- host2
`-- bus0
`-- target0
`-- lun0
|-- disc -> ../../../../../hde
`-- part1 -> ../../../../../hde1
|
|
incremental to 20031222-2,
2003-12-22 multipath-010
* tweak the install target in Makefile
* stop passing fds as argument : this change enable a strict
segregation of ugly 2.4 code
* sysfs version of get_lun_strings()
* be careful about the return of get_unique_id() since errors
formerly caught up by if(open()) in the caller fn are now returned
by get_unique_id()
* send get_serial() in unused.c
|
|
incremental to 20031222,
2003-12-22 multipath-010
* introduce dm-simplecmd for RESUME & SUSPEND requests
* split add_map() in setup_map() & dm-addmap()
* setup_map() correctly submits "SUSPEND-RELOAD-RESUME or CREATE"
sequences instead of the bogus "RELOAD or CREATE"
|
|
incremental to 20031220,
2003-12-22 multipath-010
* don't print .sg_dev if equal to .dev (2.6) in print_path()
* since the kernel code handles defective paths, remove all
code to cope with them :
* move do_tur() to unused.c
* remove .state from path struct
* remove .state settings & conditionals
* add a cmdline switch to force maps to failover mode,
ie 1 path per priority group
* add default policies to the whitelist array (spread io ==
MULTIBUS / io forced to 1 path == FAILOVER)
* move get_disk_size() call out of add_map() to coalesce()
* comment tricky coalesce() fn
* bogus unsused.c file renamed to unused.c
|
|
An important one, against stock udev-009 :
2003-12-20 multipath-010
* big ChangeLog update
* start to give a little control over target params :
introduce cmdline arg -i to control polling interval
* cope with hotplug-style calling convention :
ie "multipath scsi $DEVPATH" ... to avoid messing with
online maps not concerned by an event
* example hotplug agent to drop in /etc/hotplug.d/scsi
* revert the run & resched patch : unless someone proves me
wrong, this was overdesigned
* move commented out functions in unused.c
* update multipath target params to "udm[23] style"
* mp target now supports nr_path == 1, so do we
* add gratuitous free()
* push version forward
|
|
disc, part
Here is a experimental CALLOUT script for udev to create devfs nodes
for IDE-devices. Not that I need these, I just wanted to see if it works :)
The script is really stupid, no error handling, nothing more than
absolutely needed. The rule uses the 'k' format char of the previous
patch. The %D is not used, so the user can have disc or disk :)
this single line:
CALLOUT, BUS="ide", PROGRAM="/etc/udev/ide-devfs.sh %k %b %n", ID="hd*", NAME="%1c", SYMLINK="%2c"
creates the following on my machine with two hard disks, one DVD and a PCMCIA-compact-flash inserted:
/udev
|-- hda
|-- hda1
|-- hda2
|-- hda4
|-- hdb
|-- hdb1
|-- hdc
|-- hde
|-- hde1
`-- ide
|-- host0
| |-- bus0
| | |-- target0
| | | `-- lun0
| | | |-- disc -> ../../../../../hda
| | | |-- part1 -> ../../../../../hda1
| | | |-- part2 -> ../../../../../hda2
| | | `-- part4 -> ../../../../../hda4
| | `-- target1
| | `-- lun0
| | |-- disc -> ../../../../../hdb
| | `-- part1 -> ../../../../../hdb1
| `-- bus1
| `-- target0
| `-- lun0
| `-- cd -> ../../../../../hdc
`-- host2
`-- bus0
`-- target0
`-- lun0
|-- disc -> ../../../../../hde
`-- part1 -> ../../../../../hde1
|
|
Ananth released sysfsutils 0.4.0 last night, I'm sure you saw the email.
Here's a patch with the latest changes from the pre-patch I already
gave you. It includes sysfs_get_device_parent(), which you said you
needed. I've run your test scripts and I've built scsi_id. Please
play around with this and check it out.
There are quite a few changes. Please do not access
structure pointers, like sysfs_device's parent, directly like
dev->parent. Please use the "get" function to retrieve. The functions
load things on demand and refresh views under the covers.
|
|
Scsi_id hasn't been changed to use the latest libsysfs changes. The
"directory" in the sysfs_class_device is now considered "private" and only
should be accessed using functions. Treating the structures as handles lets
us only load information when it's needed, reducing caching or stale
information and also helping performance.
Here's the problem.
static inline char *sysfs_get_attr(struct sysfs_class_device *dev,
const char *attr)
{
return sysfs_get_value_from_attributes(dev->directory->attributes,
attr);
}
Please try this quick fix:
|
|
* Make the HW-specific get_unique_id switch pretty
* Prepare to field-test by whitelisting all known fibre array, try to
fetch WWID from the standard EVPD 0x83 off 8 for everyone ... we will
learn from feedback :)
Could you drop a note with the udev-009 release-notes asking for testing
this WWID fetching thing ?
|
|
* configure the multipath target with round-robin path selector and
conservative default for a start : yes it makes this release the first
really useful one.
* temporarily disable map creation for single path device due to current
restrictive defaults in the kernel target. Sistina should work it out.
* correct the strncmp logic in blacklist function.
Tested on StorageWorks with 2.6.0-test10-udm1 :
xa-s03:~# ./multipath -v
60001fe1000bdad0000903507109004b (1 0 1 1) /dev/sda op:1 /dev/sda
[HSG80 ]
60001fe1000bdad000090371312100bf (1 0 1 2) /dev/sdb op:1 /dev/sdb
[HSG80 ]
60001fe1000bdad000090371312100c2 (1 0 1 3) /dev/sdc op:1 /dev/sdc
[HSG80 ]
60001fe1000bdad00009037131210067 (1 0 2 1) /dev/sdd op:1 /dev/sdd
[HSG80 ]
60001fe1000bdad000090371312100b3 (1 0 2 2) /dev/sde op:1 /dev/sde
[HSG80 ]
60001fe1000bdad00009035071090024 (1 0 2 3) /dev/sdf op:1 /dev/sdf
[HSG80 ]
600508b4000156d700012000000b0000 (1 0 3 1) /dev/sdg op:1 /dev/sdg
[HSV110 (C)COMPAQ]
600508b4000156c30001200000210000 (1 0 3 2) /dev/sdh op:1 /dev/sdh
[HSV110 (C)COMPAQ]
600508b4000156d700012000000b0000 (1 0 6 1) /dev/sdi op:1 /dev/sdi
[HSV110 (C)COMPAQ]
600508b4000156c30001200000210000 (1 0 6 2) /dev/sdj op:1 /dev/sdj
[HSV110 (C)COMPAQ]
60001fe1000bdad0000903507109004b
\_(1 0 1 1) /dev/sda op:1 /dev/sda [HSG80 ]
60001fe1000bdad000090371312100bf
\_(1 0 1 2) /dev/sdb op:1 /dev/sdb [HSG80 ]
60001fe1000bdad000090371312100c2
\_(1 0 1 3) /dev/sdc op:1 /dev/sdc [HSG80 ]
60001fe1000bdad00009037131210067
\_(1 0 2 1) /dev/sdd op:1 /dev/sdd [HSG80 ]
60001fe1000bdad000090371312100b3
\_(1 0 2 2) /dev/sde op:1 /dev/sde [HSG80 ]
60001fe1000bdad00009035071090024
\_(1 0 2 3) /dev/sdf op:1 /dev/sdf [HSG80 ]
600508b4000156d700012000000b0000
\_(1 0 3 1) /dev/sdg op:1 /dev/sdg [HSV110 (C)COMPAQ]
\_(1 0 6 1) /dev/sdi op:1 /dev/sdi [HSV110 (C)COMPAQ]
600508b4000156c30001200000210000
\_(1 0 3 2) /dev/sdh op:1 /dev/sdh [HSV110 (C)COMPAQ]
\_(1 0 6 2) /dev/sdj op:1 /dev/sdj [HSV110 (C)COMPAQ]
N|600508b4000156d700012000000b0000 : 0 4194304 multipath 2 2 10
round-robin 2 /dev/sdg 10 2 1 2 /dev/sdi 10 2 1 2
N|600508b4000156c30001200000210000 : 0 20971520 multipath 2 2 10
round-robin 2 /dev/sdh 10 2 1 2 /dev/sdj 10 2 1 2
xa-s03:~# dmsetup ls
600508b4000156c30001200000210000 (254, 1)
600508b4000156d700012000000b0000 (254, 0)
xa-s03:~# ll /dev/mapper/
total 0
brw------- 1 root root 254, 1 Dec 9 22:57
600508b4000156c30001200000210000
brw------- 1 root root 254, 0 Dec 9 22:57
600508b4000156d700012000000b0000
crw------- 1 root root 10, 63 Jul 25 22:48 control
xa-s03:~# dd if=/dev/mapper/600508b4000156c30001200000210000
of=/dev/null bs=1M count=500
500+0 records in
500+0 records out
524288000 bytes transferred in 5.662530 seconds (92589003 bytes/sec)
gee, that pretty fast :)
|
|
* update the Makefiles to autodetect libgcc.a & gcc includes
"ulibc-style". Factorisation of udevdirs & others niceties
* drop a hint about absent /dev/sd? on failed open() for poor Debian
users who don't imagine their favorite distro with only 16 preconfigured
SCSI device nodes :)
|
|
This patch updates scsi_id under udev from version 0.1 to version 0.2.
|
|
* implement a reschedule flag in /var/run. Last thing the prog do before
exit is check if a call to multipath was done (but canceled by
/var/run/multipath.run check) during its execution. If so restart the
main loop.
* implement a blacklist of sysfs bdev to not bother with for now (hd,
md, dm, sr, scd, ram, raw). This avoid sending SG_IO to unappropiate
devices.
Compiles & survive "while true;do (./multipath -v &);done"
|
|
* Adds a /var/run/multipath.run handling to avoid simultaneous runs.
* Remove a commented-out "printf"
|
|
here is the next update which brings this multipath to the state i'm not
ashamed of it being in udev :)
* drop a libdevmapper copy in extras/multipath; maybe discussions w/
Sistina folks will bring a better solution in the future.
* drop a putchar usage in libdevmapper to compile cleanly with klibc
* drop another such usage of my own in main.c
* massage the Makefile to compile libdevmapper against klibc
* use "ld" to produce the binary rather than "gcc -static"
* stop being stupid w/ uneeded major, minor & dev in main.c:dm_mk_node()
* reverse to creating striped target for now because the multipath
target is more hairy than expected initialy
* push the version code to 009 to be in synch w/ udev
builds & run here.
binary size is 43ko, which is fairly gratifying after all the efforts
I've put to compiling it with klibc :)
|
|
here is a clean-up patch :
* removes sg_err.[ch] deps
* makes sure the core code play nice with klibc
* port the sysfs calls to dlist helpers
* links against udev's sysfs (need libsysfs.a & dlist.a)
* finally define DM_TARGET as "multipath" as Joe posted the code today
(not tested yet)
* push version forward (do you want it in sync with udev version?)
libdevmapper doesn't play well with klibc, so I wasn't able to produce a
static binary yet. Help needed here ... as I don't want to fall back to
merge libdevmapper code in the core.
It compiles here and doesn't segfault.
|
|
|
|
<christophe.varoqui@free.fr>
|