linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* RFC: cleaner version of test.block
@ 2003-10-21  5:35 Chris Friesen
  2003-10-21  6:13 ` Robert Love
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Chris Friesen @ 2003-10-21  5:35 UTC (permalink / raw)
  To: linux-hotplug


I propose the following version of test.block.  I think the code's
easier to read than the one using "cut", and it removes the dependency
on stuff outside of bash.

Also, running the call to udev backgrounded makes the whole scan take 1
second, rather than 1 second for each entry.

Chris





#!/bin/sh
#
# test.block - run udev(8) on each block device in /sys/block

SYSFSDIR=/sys           # change this for a nonstand sysfs mount point
BIN=./udev              # location of your udev binary
export ACTION­d       # 'add' or 'remove'


for i in ${SYSFSDIR}/block/*; do
         # add each drive
         export DEVPATH=${i#${SYSFSDIR}}
         $BIN block &

         # add each partition, on each device
         for j in $i/*; do
                 if [ -f $j/dev ]; then
                         export DEVPATH=${j#${SYSFSDIR}}
                         $BIN block &
                 fi
         done
done



-------------------------------------------------------
This SF.net email is sponsored by OSDN developer relations
Here's your chance to show off your extensive product knowledge
We want to know what you know. Tell us and you have a chance to win $100
http://www.zoomerang.com/survey.zgi?HRPT1X3RYQNC5V4MLNSV3E54
_______________________________________________
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] 7+ messages in thread

end of thread, other threads:[~2003-11-20 16:55 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-10-21  5:35 RFC: cleaner version of test.block Chris Friesen
2003-10-21  6:13 ` Robert Love
2003-10-21 16:54 ` Greg KH
2003-10-21 16:55 ` Chris Larson
2003-10-21 17:42 ` Greg KH
2003-10-23  4:30 ` Chris Friesen
2003-11-20 16:55 ` Greg KH

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