Skip to contentSkip to conversation

udev: cool test scripts

PATCH Greg KH 2 participants 3 messages Oct 17, 2003 – Oct 18, 2003

lore
Share & tools
lore

Greg KH

author
#0 lore raw
Quoted 9 lines · Robert Love

Hi, Greg.

I dunno if these are desired, but they are pretty useful to me.

This patch changes test.tty and test.block to add/remove each tty and block device, respectively, on the system. Great way to populate/unpopulate udev rapidly.

Its just a simple for loop over the sysfs entries.

Nice, thanks for the patch, I've applied it.

But the test.block script doesn't catch any partitions on the block devices :)

thanks,

greg k-h

-------------------------------------------------------
This SF.net email sponsored by: Enterprise Linux Forum Conference & Expo The Event For Linux Datacenter Solutions & Strategies in The Enterprise Linux in the Boardroom; in the Front Office; & in the Server Room
http://www.enterpriselinuxforum.com
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#1 lore raw
Quoted 1 line · Greg KH

Nice, thanks for the patch, I've applied it.

Thanks.

Quoted 2 lines

But the test.block script doesn't catch any partitions on the block devices :)

Never happy! But for a fellow Gator...

        [19:07:52]root@phantasy:~/src/udev/udev# ./test.block
        [19:13:37]root@phantasy:~/src/udev/udev# ls /udev/hd*
        ls: /udev/hd*: No such file or directory
        [19:13:42]root@phantasy:~/src/udev/udev# ./test.block
        [19:13:53]root@phantasy:~/src/udev/udev# ls /udev/hd*
        /udev/hda   /udev/hda2  /udev/hda4  /udev/hda6  /udev/hdd
        /udev/hda1  /udev/hda3  /udev/hda5  /udev/hdc

test.block now recurses /sys/block, looking for partitions. Should add all drives and all partitions.

Patch is against 003 plus last patch.

Robert Love

 test.block |   10 ++++++++++
 1 files changed, 10 insertions(+)
test.block +10 -0
diff -urN udev-cvs/test.block udev/test.block
@@ -7,6 +7,16 @@
 export ACTION­d	# 'add' or 'remove'
 
 for i in ${SYSFSDIR}/block/*; do
+	# add each drive
 	export DEVPATH="/"`echo $i | cut --delimiter='/' --fields=3-`
 	$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-`
+			$BIN block
+		fi
+	done
 done

-------------------------------------------------------
This SF.net email sponsored by: Enterprise Linux Forum Conference & Expo The Event For Linux Datacenter Solutions & Strategies in The Enterprise Linux in the Boardroom; in the Front Office; & in the Server Room
http://www.enterpriselinuxforum.com
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

author
#2 lore raw
In reply to Greg KH
Quoted 8 lines · Robert Love
        [19:07:52]root@phantasy:~/src/udev/udev# ./test.block
        [19:13:37]root@phantasy:~/src/udev/udev# ls /udev/hd*
        ls: /udev/hd*: No such file or directory
        [19:13:42]root@phantasy:~/src/udev/udev# ./test.block
        [19:13:53]root@phantasy:~/src/udev/udev# ls /udev/hd*
        /udev/hda   /udev/hda2  /udev/hda4  /udev/hda6  /udev/hdd
        /udev/hda1  /udev/hda3  /udev/hda5  /udev/hdc
Quoted 4 lines

test.block now recurses /sys/block, looking for partitions. Should add all drives and all partitions.

Patch is against 003 plus last patch.

Very nice. Applied, thanks.

greg k-h

-------------------------------------------------------
This SF.net email sponsored by: Enterprise Linux Forum Conference & Expo The Event For Linux Datacenter Solutions & Strategies in The Enterprise Linux in the Boardroom; in the Front Office; & in the Server Room
http://www.enterpriselinuxforum.com
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel