linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chris Friesen <chris_friesen@sympatico.ca>
To: linux-hotplug@vger.kernel.org
Subject: RFC: cleaner version of test.block
Date: Tue, 21 Oct 2003 05:35:04 +0000	[thread overview]
Message-ID: <marc-linux-hotplug-106671517825612@msgid-missing> (raw)


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

             reply	other threads:[~2003-10-21  5:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-21  5:35 Chris Friesen [this message]
2003-10-21  6:13 ` RFC: cleaner version of test.block 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

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=marc-linux-hotplug-106671517825612@msgid-missing \
    --to=chris_friesen@sympatico.ca \
    --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 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).