linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* +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

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