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

* Re: RFC: cleaner version of test.block
  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
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Robert Love @ 2003-10-21  6:13 UTC (permalink / raw)
  To: linux-hotplug

On Tue, 2003-10-21 at 01:35, 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.
> 
> Also, running the call to udev backgrounded makes the whole scan take 1
> second, rather than 1 second for each entry.

I did not test it, but if it works as advertised I think it is an
improvement.

	Robert Love




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

* Re: RFC: cleaner version of test.block
  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
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Greg KH @ 2003-10-21 16:54 UTC (permalink / raw)
  To: linux-hotplug

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?

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

The 004 release fixes that problem, so you don't have to run udev in the
background.

On some basic tests (test.tty) with debugging turned off (comment out
the DEBUG=true in the Makefile) all tty device nodes are created in less
than .5 seconds.  So I think we are ok as far as time goes now :)

thanks,

greg k-h


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

* Re: RFC: cleaner version of test.block
  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
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Chris Larson @ 2003-10-21 16:55 UTC (permalink / raw)
  To: linux-hotplug

* Chris Friesen (chris_friesen@sympatico.ca) 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.
> 
> Also, running the call to udev backgrounded makes the whole scan take 1
> second, rather than 1 second for each entry.
[snip]

One thing to take note of here, is that adding additional bash
dependencies makes it harder to use on embedded devices, which generally
use dash, busybox ash, or similar.  (hotplug is another project that
suffers from this, but that can be remedied by using diethotplug)
--
Chris Larson - kergoth at handhelds dot org
Embedded Linux Developer - clarson at ti dot com
OpenZaurus Project Maintainer - http://openzaurus.org/


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

* Re: RFC: cleaner version of test.block
  2003-10-21  5:35 RFC: cleaner version of test.block Chris Friesen
                   ` (2 preceding siblings ...)
  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
  5 siblings, 0 replies; 7+ messages in thread
From: Greg KH @ 2003-10-21 17:42 UTC (permalink / raw)
  To: linux-hotplug

On Tue, Oct 21, 2003 at 11:55:43AM -0500, Chris Larson wrote:
> * Chris Friesen (chris_friesen@sympatico.ca) 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.
> > 
> > Also, running the call to udev backgrounded makes the whole scan take 1
> > second, rather than 1 second for each entry.
> [snip]
> 
> One thing to take note of here, is that adding additional bash
> dependencies makes it harder to use on embedded devices, which generally
> use dash, busybox ash, or similar.  (hotplug is another project that
> suffers from this, but that can be remedied by using diethotplug)

Yes, but this is just a test script.  And this is also one reason why
udev is linked statically...

thanks,

greg k-h



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

* Re: RFC: cleaner version of test.block
  2003-10-21  5:35 RFC: cleaner version of test.block Chris Friesen
                   ` (3 preceding siblings ...)
  2003-10-21 17:42 ` Greg KH
@ 2003-10-23  4:30 ` Chris Friesen
  2003-11-20 16:55 ` Greg KH
  5 siblings, 0 replies; 7+ messages in thread
From: Chris Friesen @ 2003-10-23  4:30 UTC (permalink / raw)
  To: linux-hotplug

[-- Attachment #1: Type: text/plain, Size: 490 bytes --]

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

[-- Attachment #2: udev.patch --]
[-- Type: text/plain, Size: 1706 bytes --]

# 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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: RFC: cleaner version of test.block
  2003-10-21  5:35 RFC: cleaner version of test.block Chris Friesen
                   ` (4 preceding siblings ...)
  2003-10-23  4:30 ` Chris Friesen
@ 2003-11-20 16:55 ` Greg KH
  5 siblings, 0 replies; 7+ messages in thread
From: Greg KH @ 2003-11-20 16:55 UTC (permalink / raw)
  To: linux-hotplug

On Thu, Oct 23, 2003 at 12:30:52AM -0400, Chris Friesen wrote:
> 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.

Sorry for the delay, but I've included your patch in the 006 release.

thanks,

greg k-h


-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  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

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