From mboxrd@z Thu Jan 1 00:00:00 1970 From: Chris Friesen Date: Thu, 23 Oct 2003 04:30:52 +0000 Subject: Re: RFC: cleaner version of test.block MIME-Version: 1 Content-Type: multipart/mixed; boundary="------------080007000303030803030007" Message-Id: List-Id: References: In-Reply-To: To: linux-hotplug@vger.kernel.org This is a multi-part message in MIME format. --------------080007000303030803030007 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Greg KH wrote: > On Tue, Oct 21, 2003 at 01:35:04AM -0400, Chris Friesen wrote: > >> 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. > Looks good, care to make a patch against the 004 release? I've attached a patch against 005 for both the block and tty scripts. I didn't bother running udev backgrounded, since as you say, the new code runs a lot faster. Chris --------------080007000303030803030007 Content-Type: text/plain; name="udev.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="udev.patch" # This is a BitKeeper generated patch for the following project: # Project Name: udev # This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas: # ChangeSet 1.133 -> 1.135 # test.block 1.11 -> 1.12 # test.tty 1.3 -> 1.4 # # The following is the BitKeeper ChangeSet Log # -------------------------------------------- # 03/10/22 chris@doug.mackenzie.net 1.84.1.1 # cleaning up the test script # -------------------------------------------- # 03/10/22 chris@doug.mackenzie.net 1.134 # Merge bk://kernel.bkbits.net/gregkh/udev/ # into doug.mackenzie.net:/home/chris/hacking/udev # -------------------------------------------- # 03/10/23 chris@doug.mackenzie.net 1.135 # cleaning up test script # -------------------------------------------- # diff -Nru a/test.block b/test.block --- a/test.block Thu Oct 23 00:25:14 2003 +++ b/test.block Thu Oct 23 00:25:14 2003 @@ -16,14 +16,13 @@ for i in ${SYSFSDIR}/block/*; do # add each drive - export DEVPATH="/"`echo $i | cut --delimiter='/' --fields=3-` + export DEVPATH=${i#${SYSFSDIR}} $BIN block # add each partition, on each device for j in $i/*; do if [ -f $j/dev ]; then - export DEVPATH="/"`echo $j | \ - cut --delimiter='/' --fields=3-` + export DEVPATH=${j#${SYSFSDIR}} $BIN block fi done diff -Nru a/test.tty b/test.tty --- a/test.tty Thu Oct 23 00:25:14 2003 +++ b/test.tty Thu Oct 23 00:25:14 2003 @@ -15,6 +15,6 @@ export ACTION=$1 # 'add' or 'remove' for i in ${SYSFSDIR}/class/tty/*; do - export DEVPATH="/"`echo $i | cut --delimiter='/' --fields=3-` + export DEVPATH=${i#${SYSFSDIR}} $BIN tty done --------------080007000303030803030007-- ------------------------------------------------------- This SF.net email is sponsored by: The SF.net Donation Program. Do you like what SourceForge.net is doing for the Open Source Community? Make a contribution, and help us add new features and functionality. Click here: http://sourceforge.net/donate/ _______________________________________________ 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