From: Arioch <the_Arioch@nm.ru>
To: linux-hotplug@vger.kernel.org
Subject: +rule: query device inode by Major and Minor - am i inventing brand
Date: Mon, 15 Aug 2005 06:09:15 +0000 [thread overview]
Message-ID: <4300318B.8040505@nm.ru> (raw)
[-- 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"
next reply other threads:[~2005-08-15 6:09 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-08-15 6:09 Arioch [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4300318B.8040505@nm.ru \
--to=the_arioch@nm.ru \
--cc=linux-hotplug@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.