* +rule: query device inode by Major and Minor - am i inventing brand
@ 2005-08-15 6:09 Arioch
2005-08-15 13:40 ` +rule: query device inode by Major and Minor - am i inventing brand new bycicle ? Kay Sievers
` (9 more replies)
0 siblings, 10 replies; 11+ messages in thread
From: Arioch @ 2005-08-15 6:09 UTC (permalink / raw)
To: linux-hotplug
[-- Attachment #1: Type: text/plain, Size: 1927 bytes --]
Hello!
I made (and attached) a tiny rule, and hope it will be interesting to
some of you.
See attach.
Rule is very simple ( i think someone already did that, but i'm just
offline and cannot check it )
I made it with two thought in background:
1) Some drivers with incomplete SYSFS support (namely, wbsd on my box)
publiches major and minor, but not the device inode name :-(
If i wantr to find it from script - how ? ls -lR | grep ? BRR! :-) Hate
RegExp's :-)
2) On my box pktsetup (packet-mode CD-RW burning helper, part of
udfhelper) creates two block device per drive! I wanted to catch this.
After all it seems that it creates second inode by mknod, not kernel
call and UDEV. But surprisingly i saw a number of other duplicate inodes
with the identical major-minor
So, as i want to be famous, would You, please, considering including
this rule into UDEV examples ? :-)
Ouugh, almost forgot to state a wish:
Can there be on more key for rules ?
Similar to RETURN, but matching not string form stdout, but the return
code of program ( $? ) ?
Why - cause i wanted to do if/else/then.
I run a program to check if a symlink already exists - then i run
another program to check if it does not exists !
And i cannot use /bin/ls or /bin/readlink and then use RESULT - it puts
its output onto stderr if file not found, which seems to make UDEV
ignore that rule inn the future (i could not find this in man, but i
guess it is said somewhere on some wiki - but i'm still offline) . As
well, stderr is not intercepted and user sees that unpretty sign of my
sillyness :)
And i didn't want to create a separate file (bash script) for such a
simple task.
To end this mindflow, if i mentioned man's, i'd like to say that i saw a
typo in the "man udev".
When describing "=" operation, there is word "iNplicit" instead of
"iMplicit". If it is not my English - it is is a typo :-)
Good luck and thank you all !
[-- Attachment #2: 99-reverse_lookup.rules --]
[-- Type: text/plain, Size: 1130 bytes --]
# mailto:the_Arioch@nm.ru, xmpp:arioch@jabber.ru
#
# I want to be able to easily look for dev name by major and minor numbers
# for example - from scripts
# So i think of having dedicated folder for symlinks to devices
#
# I should check that symlinks are not overwitten - i saw udftools' pktsetup
# created 2 block dev-inodes per drive !
# After all, pktsetup creates its fantom by direct mknod w/o udev interaction,
# but i found a number of other dups
# PROGRAM="/bin/sh -c ' [ -e %r/.lookup_by_numbers/major%M@minor%m ] ' ", SYMLINK+=".lookup_by_numbers/DUP/major%M@minor%m_DUP%e"
# this rule makes easy check if any duplicate exist - dups are stored in separate dir
# enter with Midnight Commander / Nautilu / Konqueror etc - and if You can see DUP folder...
PROGRAM="/bin/sh -c ' [ -e %r/.lookup_by_numbers/major%M@minor%m ] ' ", SYMLINK+=".lookup_by_numbers/DUP/major%M@minor%m_DUP%e"
# this rule makes easy matching - scroll through symlinks - and all DUPs and 1st link are together
PROGRAM="/bin/sh -c ' [ ! -e %r/.lookup_by_numbers/major%M@minor%m ] ' ", SYMLINK+=".lookup_by_numbers/major%M@minor%m"
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: +rule: query device inode by Major and Minor - am i inventing brand new bycicle ?
2005-08-15 6:09 +rule: query device inode by Major and Minor - am i inventing brand Arioch
@ 2005-08-15 13:40 ` Kay Sievers
2005-08-16 10:52 ` +rule: query device inode by Major and Minor - am i inventing Arioch
` (8 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Kay Sievers @ 2005-08-15 13:40 UTC (permalink / raw)
To: linux-hotplug
On Mon, Aug 15, 2005 at 10:09:15AM +0400, Arioch wrote:
> I made (and attached) a tiny rule, and hope it will be interesting to
> some of you.
> See attach.
> I made it with two thought in background:
>
> 1) Some drivers with incomplete SYSFS support (namely, wbsd on my box)
> publiches major and minor, but not the device inode name :-(
> If i wantr to find it from script - how ? ls -lR | grep ? BRR! :-) Hate
> RegExp's :-)
You mean the device 'node', the file in /dev, right?
What does publish major/minor mean? That the driver does not create an
entry in /sys/block/*?
> 2) On my box pktsetup (packet-mode CD-RW burning helper, part of
> udfhelper) creates two block device per drive! I wanted to catch this.
> After all it seems that it creates second inode by mknod, not kernel
> call and UDEV. But surprisingly i saw a number of other duplicate inodes
> with the identical major-minor
What nodes exactly have the same major/minor? That setup may need to be
fixed.
> So, as i want to be famous, would You, please, considering including
> this rule into UDEV examples ? :-)
We don't provide a dead example file anymore. Nobody cared about that file,
it was outdated and some people expected this as "the default" udev file
and complained about the entries, so I just deleted it. Instead we carry
a lot of distro rules as examples now. So you need to convince a distro to
ship your rule to get it included. Good luck! :)
> Ouugh, almost forgot to state a wish:
> Can there be on more key for rules ?
> Similar to RETURN, but matching not string form stdout, but the return
> code of program ( $? ) ?
You mean similar to "RESULT"?
> Why - cause i wanted to do if/else/then.
> I run a program to check if a symlink already exists - then i run
> another program to check if it does not exists !
PROGRAM!="..." should catch non-zero exit's. You also can jump with GOTO="..."
to a LABEL="..." line (see the persistent disk rules examples).
> And i cannot use /bin/ls or /bin/readlink and then use RESULT - it puts
> its output onto stderr if file not found, which seems to make UDEV
> ignore that rule inn the future (i could not find this in man, but i
> guess it is said somewhere on some wiki - but i'm still offline) . As
> well, stderr is not intercepted and user sees that unpretty sign of my
> sillyness :)
> And i didn't want to create a separate file (bash script) for such a
> simple task.
Yes stderr is ignored. You will need to fork a shell for that to catch.
> To end this mindflow, if i mentioned man's, i'd like to say that i saw a
> typo in the "man udev".
> When describing "=" operation, there is word "iNplicit" instead of
> "iMplicit". If it is not my English - it is is a typo :-)
Will fix that. Thanks!
Thanks,
Kay
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
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] 11+ messages in thread
* Re: +rule: query device inode by Major and Minor - am i inventing
2005-08-15 6:09 +rule: query device inode by Major and Minor - am i inventing brand Arioch
2005-08-15 13:40 ` +rule: query device inode by Major and Minor - am i inventing brand new bycicle ? Kay Sievers
@ 2005-08-16 10:52 ` Arioch
2005-08-16 17:13 ` Arioch
` (7 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Arioch @ 2005-08-16 10:52 UTC (permalink / raw)
To: linux-hotplug
Kay Sievers пишет:
> On Mon, Aug 15, 2005 at 10:09:15AM +0400, Arioch wrote:
>
>>I made (and attached) a tiny rule, and hope it will be interesting to
>>some of you.
>>See attach.
>
>
>>I made it with two thought in background:
>>
>>1) Some drivers with incomplete SYSFS support (namely, wbsd on my box)
>>publiches major and minor, but not the device inode name :-(
>>If i wantr to find it from script - how ? ls -lR | grep ? BRR! :-) Hate
>>RegExp's :-)
>
>
> You mean the device 'node', the file in /dev, right?
exactly.
> What does publish major/minor mean?
That mean by crawling through /sys i can learn what is major and minor
for some dev-file. Yet the very name of the file is not the thing i can
find in /SYS - since SYSFS is not the layer that creates such devices,
and there seems to be no method, UDEV will tell device file name, and
SYSFS would hear it and represent under /sys.
>That the driver does not create an
> entry in /sys/block/*?
>
AS: eraly drivers is only one example, where i want to find file under
/dev, knowing only its major and minor. There can be more situations.
wbsd is driver for SD/MMC flash cards reader.
When i insert MMC card, it (or mmc-core.ko, or mmc-block.ko ) creates
block devices /dev/mmcblk0 and /dev/mmcblk0p1 - for 1st (and only)
partition. The very controller is not block device yet. There are SDIO
cards, which, like CardBus ones, are devices, rather than disks.
zsh 4 % ls /sys/module/wbsd
parameters refcnt sections
zsh 5 % ls /sys/bus/pnp/drivers/wbsd -l
@00:07 -> ../../../../devices/pnp0/00:07
zsh 6 % ls /sys/bus/pnp/drivers/wbsd/00:07
bus driver id options power resources
This is without MMC card. With card there is added folder mmc0:0001
Yahoo! yesterday i updated kernel to 2.6.12 and driver seems to got
updated too.
But ...
zsh/2 17 % pwd
/sys/bus/pnp/drivers/wbsd/00:07/mmc0:0001/block
zsh/2 18 % ls
dev device mmcblk0p1 queue range removable size stat
zsh/2 20 % cat removable
0 # - WOW !!!!
zsh/2 19 % cat dev
253:0
That's all.
Since UDEV can move and rename device inodes wherever and however it is
configured - how should i find it ?
At my box, for example, those devices are /dev/mmcblk0* - they are not
moved into /dev/disks subfoolder to my HDD, nor to /dev/cdroms.
I have not ZIP drive now and cannot check which device node it would be
mapped to.
IMHO old FDD, ZIP and alike devices, memory cards (CF, MMC, USB flash
drives) and even CD-RW in packet burning mode - they are same kind of
devices: block and removable. I wonder where they are to be grouped :-)
>>2) On my box pktsetup (packet-mode CD-RW burning helper, part of
>>udfhelper) creates two block device per drive! I wanted to catch this.
>>After all it seems that it creates second inode by mknod, not kernel
>>call and UDEV. But surprisingly i saw a number of other duplicate inodes
>>with the identical major-minor
>
> What nodes exactly have the same major/minor? That setup may need to be
> fixed.
For now i put this in my distro bugzilla and hope it will get some
attention in proper time.
This design might be affecting only my distro.
Out of my head - i saw a number of logs, sharing numbers with ram disks.
Did You tested those rules ? You can see, they are harmless and only add
a couple of symlinks. Next time You'd boot Your box (or if it is no
danger to You - service udevd restart) - You would know about Your
system :-)
>>So, as i want to be famous, would You, please, considering including
>>this rule into UDEV examples ? :-)
>
> We don't provide a dead example file anymore. Nobody cared about that file,
> it was outdated and some people expected this as "the default" udev file
> and complained about the entries, so I just deleted it. Instead we carry
> a lot of distro rules as examples now. So you need to convince a distro to
> ship your rule to get it included. Good luck! :)
...and it would be distro-local ?
Guess, there i s to be some wiki or something of a kind.
In such a place, different distro's could publish their rules and
compare the benefits.
Or perhaps LSB is to care of those rules ?
>>Ouugh, almost forgot to state a wish:
>>Can there be on more key for rules ?
>>Similar to RETURN, but matching not string form stdout, but the return
>>code of program ( $? ) ?
>
>
> You mean similar to "RESULT"?
>
Sure, i was typing RESULT, but was thinking of RETURN CODE :-)
>>Why - cause i wanted to do if/else/then.
>>I run a program to check if a symlink already exists - then i run
>>another program to check if it does not exists !
>
>
> PROGRAM!="..." should catch non-zero exit's. You also can jump with GOTO="..."
> to a LABEL="..." line (see the persistent disk rules examples).
Where can i find such rules, if You do not ship Your own rulesets ?
Article of righting UDEV rule is ether too basic or too outdated - there
even no word about "+=" (Hmmm, how about -= ? :D )
PROGRAM != - is not solution.
Please, look at my rules. There're just two rules in the file.
And they represent if-then-else choice.
If i would negate if-condition - i just swap then and else - but do not
get rid of them. I still have to run the program twice, since in later
rule i cannot refer to retcode of PROGRAM in prior rule.
I just do not want to run the program twice, nor to make quite dumb and
auxillary script.
> Yes stderr is ignored. You will need to fork a shell for that to catch.
But since i cannot escape \" in PROGRAM argument (and i already used
single quotes) - that makes pain :-)
To my experience, stderr output is
1) sent to user's tty
2) signals to UDEV to not try this rule any more (at list i saw that
output once, while otherwise i should see it for every device)
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
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] 11+ messages in thread
* Re: +rule: query device inode by Major and Minor - am i inventing
2005-08-15 6:09 +rule: query device inode by Major and Minor - am i inventing brand Arioch
2005-08-15 13:40 ` +rule: query device inode by Major and Minor - am i inventing brand new bycicle ? Kay Sievers
2005-08-16 10:52 ` +rule: query device inode by Major and Minor - am i inventing Arioch
@ 2005-08-16 17:13 ` Arioch
2005-08-16 18:18 ` Arioch
` (6 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Arioch @ 2005-08-16 17:13 UTC (permalink / raw)
To: linux-hotplug
Kay Sievers пишет:
> What nodes exactly have the same major/minor? That setup may need to be
> fixed.
Now i think that %M and %m macros are expanded somehow strangely:
$ pwd
/dev/.lookup_by_numbers
$for i in DUP/* ; do j=${i#*/}; h=${j%_*}; ls -l $h $i ; echo; done
[... list skipped - there is longer and more detailed one below ...]
I was intrigued by duplicating of /dev/null.
Was this device created twice ???
$ls -l ../ram3 ../nu*
crw-rw-rw- 1 root root 1, 3 Авг 16 19:47 ../null
brw-rw---- 1 root disk 1, 3 Авг 16 19:47 ../ram3
You see, it seems character and block devices with same major|minor can
easily co-exist!
$for i in {1,2,3,4,5}; do ls ../hda$i ../pty/s$i -l ; done
brw-rw---- 1 root root 3, 1 Авг 16 19:47 ../hda1
crw-rw---- 1 root tty 3, 161 Авг 16 19:47 ../pty/s1
brw-rw---- 1 root root 3, 2 Авг 16 19:47 ../hda2
crw-rw---- 1 root tty 3, 162 Авг 16 19:47 ../pty/s2
brw-rw---- 1 root root 3, 3 Авг 16 19:47 ../hda3
crw-rw---- 1 root tty 3, 163 Авг 16 19:47 ../pty/s3
brw-rw---- 1 root root 3, 4 Авг 16 19:47 ../hda4
crw-rw---- 1 root tty 3, 164 Авг 16 19:47 ../pty/s4
brw-rw---- 1 root root 3, 5 Авг 16 19:47 ../hda5
You see, on one hand we again see mixing block and char devices.
On the othe hands, it seems that when %m was expanded - it subtrcted 160
from it's value. 160=32*5 - so was minor masked with 2:00011111 ?
Or can major|minor be silently changed later, after symlink already
created ?
To be more generic, and more longer
$for i in DUP/* ; do j=${i#*/}; h=${j%_*}; ls -l $i ;ls -l
`readlink -e $i`; ls -l $h; ls -l `readlink -e $h`; echo; done
lrwxrwxrwx 1 root root 10 Авг 16 19:47 DUP/major1@minor11_DUP -> ../../kmsg
crw-rw---- 1 root root 1, 11 Авг 16 19:47 /dev/kmsg
lrwxrwxrwx 1 root root 8 Авг 16 19:47 major1@minor11 -> ../ram11
brw-rw---- 1 root disk 1, 11 Авг 16 19:47 /dev/ram11
lrwxrwxrwx 1 root root 9 Авг 16 19:47 DUP/major1@minor1_DUP -> ../../mem
crw-r----- 1 root root 1, 1 Авг 16 19:47 /dev/mem
lrwxrwxrwx 1 root root 7 Авг 16 19:47 major1@minor1 -> ../ram1
brw-rw---- 1 root disk 1, 1 Авг 16 19:47 /dev/ram1
lrwxrwxrwx 1 root root 10 Авг 16 19:47 DUP/major1@minor2_DUP -> ../../kmem
crw-r----- 1 root root 1, 2 Авг 16 19:47 /dev/kmem
lrwxrwxrwx 1 root root 7 Авг 16 19:47 major1@minor2 -> ../ram2
brw-rw---- 1 root disk 1, 2 Авг 16 19:47 /dev/ram2
lrwxrwxrwx 1 root root 10 Авг 16 19:47 DUP/major1@minor3_DUP -> ../../ram3
brw-rw---- 1 root disk 1, 3 Авг 16 19:47 /dev/ram3
lrwxrwxrwx 1 root root 7 Авг 16 19:47 major1@minor3 -> ../null
crw-rw-rw- 1 root root 1, 3 Авг 16 19:47 /dev/null
lrwxrwxrwx 1 root root 10 Авг 16 19:47 DUP/major1@minor3_DUP1 -> ../../null
crw-rw-rw- 1 root root 1, 3 Авг 16 19:47 /dev/null
lrwxrwxrwx 1 root root 7 Авг 16 19:47 major1@minor3 -> ../null
crw-rw-rw- 1 root root 1, 3 Авг 16 19:47 /dev/null
lrwxrwxrwx 1 root root 10 Авг 16 19:47 DUP/major1@minor4_DUP -> ../../port
crw-r----- 1 root root 1, 4 Авг 16 19:47 /dev/port
lrwxrwxrwx 1 root root 7 Авг 16 19:47 major1@minor4 -> ../ram4
brw-rw---- 1 root disk 1, 4 Авг 16 19:47 /dev/ram4
lrwxrwxrwx 1 root root 10 Авг 16 19:47 DUP/major1@minor5_DUP -> ../../zero
crw-rw-rw- 1 root root 1, 5 Авг 16 19:47 /dev/zero
lrwxrwxrwx 1 root root 7 Авг 16 19:47 major1@minor5 -> ../ram5
brw-rw---- 1 root disk 1, 5 Авг 16 19:47 /dev/ram5
lrwxrwxrwx 1 root root 10 Авг 16 19:47 DUP/major1@minor7_DUP -> ../../full
crw-rw-rw- 1 root root 1, 7 Авг 16 19:47 /dev/full
lrwxrwxrwx 1 root root 7 Авг 16 19:47 major1@minor7 -> ../ram7
brw-rw---- 1 root disk 1, 7 Авг 16 19:47 /dev/ram7
lrwxrwxrwx 1 root root 12 Авг 16 19:47 DUP/major1@minor8_DUP ->
../../random
crw-rw-rw- 1 root root 1, 8 Авг 16 19:47 /dev/random
lrwxrwxrwx 1 root root 7 Авг 16 19:47 major1@minor8 -> ../ram8
brw-rw---- 1 root disk 1, 8 Авг 16 19:47 /dev/ram8
lrwxrwxrwx 1 root root 13 Авг 16 19:47 DUP/major1@minor9_DUP ->
../../urandom
cr--r--r-- 1 root root 1, 9 Авг 16 19:47 /dev/urandom
lrwxrwxrwx 1 root root 7 Авг 16 19:47 major1@minor9 -> ../ram9
brw-rw---- 1 root disk 1, 9 Авг 16 19:47 /dev/ram9
lrwxrwxrwx 1 root root 12 Авг 16 19:47 DUP/major3@minor0_DUP ->
../../pty/s0
crw-rw---- 1 root tty 3, 160 Авг 16 19:47 /dev/pty/s0
lrwxrwxrwx 1 root root 6 Авг 16 19:47 major3@minor0 -> ../hda
brw-rw---- 1 root root 3, 0 Авг 16 19:47 /dev/hda
lrwxrwxrwx 1 root root 12 Авг 16 19:47 DUP/major3@minor1_DUP ->
../../pty/s1
crw-rw---- 1 root tty 3, 161 Авг 16 19:47 /dev/pty/s1
lrwxrwxrwx 1 root root 7 Авг 16 19:47 major3@minor1 -> ../hda1
brw-rw---- 1 root root 3, 1 Авг 16 19:47 /dev/hda1
lrwxrwxrwx 1 root root 12 Авг 16 19:47 DUP/major3@minor2_DUP ->
../../pty/s2
crw-rw---- 1 root tty 3, 162 Авг 16 19:47 /dev/pty/s2
lrwxrwxrwx 1 root root 7 Авг 16 19:47 major3@minor2 -> ../hda2
brw-rw---- 1 root root 3, 2 Авг 16 19:47 /dev/hda2
lrwxrwxrwx 1 root root 12 Авг 16 19:47 DUP/major3@minor3_DUP ->
../../pty/s3
crw-rw---- 1 root tty 3, 163 Авг 16 19:47 /dev/pty/s3
lrwxrwxrwx 1 root root 7 Авг 16 19:47 major3@minor3 -> ../hda3
brw-rw---- 1 root root 3, 3 Авг 16 19:47 /dev/hda3
lrwxrwxrwx 1 root root 12 Авг 16 19:47 DUP/major3@minor4_DUP ->
../../pty/s4
crw-rw---- 1 root tty 3, 164 Авг 16 19:47 /dev/pty/s4
lrwxrwxrwx 1 root root 7 Авг 16 19:47 major3@minor4 -> ../hda4
brw-rw---- 1 root root 3, 4 Авг 16 19:47 /dev/hda4
lrwxrwxrwx 1 root root 12 Авг 16 19:47 DUP/major3@minor5_DUP ->
../../pty/s5
crw-rw---- 1 root tty 3, 165 Авг 16 19:47 /dev/pty/s5
lrwxrwxrwx 1 root root 7 Авг 16 19:47 major3@minor5 -> ../hda5
brw-rw---- 1 root root 3, 5 Авг 16 19:47 /dev/hda5
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
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] 11+ messages in thread
* Re: +rule: query device inode by Major and Minor - am i inventing
2005-08-15 6:09 +rule: query device inode by Major and Minor - am i inventing brand Arioch
` (2 preceding siblings ...)
2005-08-16 17:13 ` Arioch
@ 2005-08-16 18:18 ` Arioch
2005-08-16 18:29 ` +rule: query device inode by Major and Minor - am i inventing brand new bycicle ? Kay Sievers
` (5 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Arioch @ 2005-08-16 18:18 UTC (permalink / raw)
To: linux-hotplug
So, it seems that there are two misfeatures:
UDEV does not provide block/char %-macro, like it does with %M and %m
And something strange happened to /dev/pty/* - minors like 16? were
truncated to last number in %m :-(
BTW, since udevtest needs to be tolf of block/character device type,
does it mean, that sysfs does not export this info ?
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
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] 11+ messages in thread
* Re: +rule: query device inode by Major and Minor - am i inventing brand new bycicle ?
2005-08-15 6:09 +rule: query device inode by Major and Minor - am i inventing brand Arioch
` (3 preceding siblings ...)
2005-08-16 18:18 ` Arioch
@ 2005-08-16 18:29 ` Kay Sievers
2005-08-16 18:50 ` +rule: query device inode by Major and Minor - am i inventing Arioch
` (4 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Kay Sievers @ 2005-08-16 18:29 UTC (permalink / raw)
To: linux-hotplug
On Tue, Aug 16, 2005 at 10:18:48PM +0400, Arioch wrote:
> So, it seems that there are two misfeatures:
> UDEV does not provide block/char %-macro, like it does with %M and %m
No, it doesn't. But you can use a script or make different rules that
match against SUBSYSTEM="block" or DEVPATH="/block/*" ...
> And something strange happened to /dev/pty/* - minors like 16? were
> truncated to last number in %m :-(
No idea! Better get rid of the dead devfs scheme. :)
> BTW, since udevtest needs to be tolf of block/character device type,
> does it mean, that sysfs does not export this info ?
DEVPATH=/block/* are block nodes, DEVPATH=/class/* are char nodes.
That information is only in the path of the device not in the "dev" file.
Kay
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
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] 11+ messages in thread
* Re: +rule: query device inode by Major and Minor - am i inventing
2005-08-15 6:09 +rule: query device inode by Major and Minor - am i inventing brand Arioch
` (4 preceding siblings ...)
2005-08-16 18:29 ` +rule: query device inode by Major and Minor - am i inventing brand new bycicle ? Kay Sievers
@ 2005-08-16 18:50 ` Arioch
2005-08-16 21:28 ` +rule: query device inode by Major and Minor - am i inventing brand new bycicle ? Greg KH
` (3 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Arioch @ 2005-08-16 18:50 UTC (permalink / raw)
To: linux-hotplug
Kay Sievers пишет:
>>And something strange happened to /dev/pty/* - minors like 16? were
>>truncated to last number in %m :-(
>
> No idea! Better get rid of the dead devfs scheme. :)
>
That scheme has its advantages.
For example, kppp doesn't know my modem and i need to make symlink
/dev/modem -> /dev/ttySLM0 after each boot.
If all modems could be found in /dev/dialup, then there was no this
trouble ;)
And at least that should not affect %m value :-P
>
>>BTW, since udevtest needs to be tolf of block/character device type,
>>does it mean, that sysfs does not export this info ?
>
>
> DEVPATH=/block/* are block nodes, DEVPATH=/class/* are char nodes.
> That information is only in the path of the device not in the "dev" file.
If that is so simple, i wonder why udevtest requests subsystem as a
parameter? I'm looking at article "How to write udev rules" v.0.6 - and
there udevtest is runned with the only param.
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
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] 11+ messages in thread
* Re: +rule: query device inode by Major and Minor - am i inventing brand new bycicle ?
2005-08-15 6:09 +rule: query device inode by Major and Minor - am i inventing brand Arioch
` (5 preceding siblings ...)
2005-08-16 18:50 ` +rule: query device inode by Major and Minor - am i inventing Arioch
@ 2005-08-16 21:28 ` Greg KH
2005-08-17 8:07 ` +rule: query device inode by Major and Minor - am i inventing Arioch
` (2 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Greg KH @ 2005-08-16 21:28 UTC (permalink / raw)
To: linux-hotplug
On Tue, Aug 16, 2005 at 09:13:42PM +0400, Arioch wrote:
> Kay Sievers ??????????:
>
> >What nodes exactly have the same major/minor? That setup may need to be
> >fixed.
>
> Now i think that %M and %m macros are expanded somehow strangely:
>
> $ pwd
> /dev/.lookup_by_numbers
>
> $for i in DUP/* ; do j=${i#*/}; h=${j%_*}; ls -l $h $i ; echo; done
>
> [... list skipped - there is longer and more detailed one below ...]
>
>
> I was intrigued by duplicating of /dev/null.
> Was this device created twice ???
>
>
> $ls -l ../ram3 ../nu*
> crw-rw-rw- 1 root root 1, 3 ?????? 16 19:47 ../null
> brw-rw---- 1 root disk 1, 3 ?????? 16 19:47 ../ram3
>
> You see, it seems character and block devices with same major|minor can
> easily co-exist!
Of course they can. For further examples, see Documentation/devices.txt
for all of the reserved major/minor numbers for character and block
devices. Remember, character and block devices are totally separate
"namespaces". The major/minor number is only unique within a character,
or a block "namespace".
thanks,
greg k-h
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
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] 11+ messages in thread
* Re: +rule: query device inode by Major and Minor - am i inventing
2005-08-15 6:09 +rule: query device inode by Major and Minor - am i inventing brand Arioch
` (6 preceding siblings ...)
2005-08-16 21:28 ` +rule: query device inode by Major and Minor - am i inventing brand new bycicle ? Greg KH
@ 2005-08-17 8:07 ` Arioch
2005-08-18 17:59 ` +rule: query device inode by Major and Minor - am i inventing brand new bycicle ? Greg KH
2005-08-18 21:04 ` +rule: query device inode by Major and Minor - am i inventing Arioch
9 siblings, 0 replies; 11+ messages in thread
From: Arioch @ 2005-08-17 8:07 UTC (permalink / raw)
To: linux-hotplug
Greg KH пишет:
>>You see, it seems character and block devices with same major|minor can
>>easily co-exist!
>
>
> Of course they can. For further examples, see Documentation/devices.txt
Thanks. I was already pointed too.
> for all of the reserved major/minor numbers for character and block
> devices. Remember, character and block devices are totally separate
> "namespaces". The major/minor number is only unique within a character,
> or a block "namespace".
But now, when UDEV seems toconfigure network devices as well, how can i
distinguish them ?
SUBSYSTEM=="block" - that is to tell block devices.
But what should tell character devices from, say, network interfaces ?
eth0 should have no major and minor, but trying to catch it makes rule
more and more complex.
Alas, i don't know where to et list of subsystems :-(
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
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] 11+ messages in thread
* Re: +rule: query device inode by Major and Minor - am i inventing brand new bycicle ?
2005-08-15 6:09 +rule: query device inode by Major and Minor - am i inventing brand Arioch
` (7 preceding siblings ...)
2005-08-17 8:07 ` +rule: query device inode by Major and Minor - am i inventing Arioch
@ 2005-08-18 17:59 ` Greg KH
2005-08-18 21:04 ` +rule: query device inode by Major and Minor - am i inventing Arioch
9 siblings, 0 replies; 11+ messages in thread
From: Greg KH @ 2005-08-18 17:59 UTC (permalink / raw)
To: linux-hotplug
On Wed, Aug 17, 2005 at 12:07:18PM +0400, Arioch wrote:
> But now, when UDEV seems toconfigure network devices as well, how can i
> distinguish them ?
> SUBSYSTEM="block" - that is to tell block devices.
> But what should tell character devices from, say, network interfaces ?
Perhaps SUBSYSTEM="net"? :)
> eth0 should have no major and minor, but trying to catch it makes rule
> more and more complex.
> Alas, i don't know where to et list of subsystems :-(
'ls /sys/class/' is a good place to start (becides the block subsystem,
which is still in /sys/block/ due to a whole bunch of kernel coding
reasons...)
Hope this helps.
greg k-h
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
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] 11+ messages in thread
* Re: +rule: query device inode by Major and Minor - am i inventing
2005-08-15 6:09 +rule: query device inode by Major and Minor - am i inventing brand Arioch
` (8 preceding siblings ...)
2005-08-18 17:59 ` +rule: query device inode by Major and Minor - am i inventing brand new bycicle ? Greg KH
@ 2005-08-18 21:04 ` Arioch
9 siblings, 0 replies; 11+ messages in thread
From: Arioch @ 2005-08-18 21:04 UTC (permalink / raw)
To: linux-hotplug
Greg KH пишет:
>>But what should tell character devices from, say, network interfaces ?
> Perhaps SUBSYSTEM=="net"? :)
way to fragile rules.
SUBSYSTEM!="block", SUBSYSTEM!="net", ....
...and tomorrow this script would be run on another platform, that has
subsystem i did not have. Or just new subsystem was invented. And the
rule immediately fails.
Those matches, they do not tell character devices from subsystem, but
they tell knon (to me) subsystems from the unknown rest (which i believe
to be character devices and nothing else).
Guess i also can dp something like PROGRAM="/bin/file %P",
Result=="*character*" but...
...then i again can stumble upon stderr
...and i cannot call another program
Oh, i guess i can determine something, then ENV{tmp_xxx}:='flag', then
use it later. (i remember i heard that ENV can be LValue now)
Or again i can use scripts.
but that seems that rather simple task needs rather complex actions to
implement :-)
>>Alas, i don't know where to et list of subsystems :-(
>
> 'ls /sys/class/' is a good place to start (becides the block subsystem,
> which is still in /sys/block/ due to a whole bunch of kernel coding
> reasons...)
...assuming my kernel has all of them.
kernel docs sysfs.txt and kobject.txt are written for oldschool
kernel hacker introducing him to new concepts. I wish to see someday
SYSFS in 30 days for users ;)
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
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] 11+ messages in thread
end of thread, other threads:[~2005-08-18 21:04 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-08-15 6:09 +rule: query device inode by Major and Minor - am i inventing brand Arioch
2005-08-15 13:40 ` +rule: query device inode by Major and Minor - am i inventing brand new bycicle ? Kay Sievers
2005-08-16 10:52 ` +rule: query device inode by Major and Minor - am i inventing Arioch
2005-08-16 17:13 ` Arioch
2005-08-16 18:18 ` Arioch
2005-08-16 18:29 ` +rule: query device inode by Major and Minor - am i inventing brand new bycicle ? Kay Sievers
2005-08-16 18:50 ` +rule: query device inode by Major and Minor - am i inventing Arioch
2005-08-16 21:28 ` +rule: query device inode by Major and Minor - am i inventing brand new bycicle ? Greg KH
2005-08-17 8:07 ` +rule: query device inode by Major and Minor - am i inventing Arioch
2005-08-18 17:59 ` +rule: query device inode by Major and Minor - am i inventing brand new bycicle ? Greg KH
2005-08-18 21:04 ` +rule: query device inode by Major and Minor - am i inventing Arioch
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).