From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kay Sievers Date: Sat, 20 Dec 2003 04:36:08 +0000 Subject: [udev] experimental CALLOUT script for devfs ide node creation with cd, disc, part MIME-Version: 1 Content-Type: multipart/mixed; boundary="jI8keyz6grp/JLjh" Message-Id: List-Id: To: linux-hotplug@vger.kernel.org --jI8keyz6grp/JLjh Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Here is a experimental CALLOUT script for udev to create devfs nodes for IDE-devices. Not that I need these, I just wanted to see if it works :) The script is really stupid, no error handling, nothing more than absolutely needed. The rule uses the 'k' format char of the previous patch. The %D is not used, so the user can have disc or disk :) this single line: CALLOUT, BUS="ide", PROGRAM="/etc/udev/ide-devfs.sh %k %b %n", ID="hd*", NAME="%1c", SYMLINK="%2c" creates the following on my machine with two hard disks, one DVD and a PCMCIA-compact-flash inserted: /udev |-- hda |-- hda1 |-- hda2 |-- hda4 |-- hdb |-- hdb1 |-- hdc |-- hde |-- hde1 `-- ide |-- host0 | |-- bus0 | | |-- target0 | | | `-- lun0 | | | |-- disc -> ../../../../../hda | | | |-- part1 -> ../../../../../hda1 | | | |-- part2 -> ../../../../../hda2 | | | `-- part4 -> ../../../../../hda4 | | `-- target1 | | `-- lun0 | | |-- disc -> ../../../../../hdb | | `-- part1 -> ../../../../../hdb1 | `-- bus1 | `-- target0 | `-- lun0 | `-- cd -> ../../../../../hdc `-- host2 `-- bus0 `-- target0 `-- lun0 |-- disc -> ../../../../../hde `-- part1 -> ../../../../../hde1 have fun, Kay --jI8keyz6grp/JLjh Content-Type: application/x-sh Content-Disposition: inline; filename="ide-devfs.sh" Content-Transfer-Encoding: quoted-printable #!/bin/sh=0A=0A# udev CALLOUT script=0A# return devfs-names for ide-devices= =0A# CALLOUT, BUS=3D"ide", PROGRAM=3D"/etc/udev/ide-devfs.sh %k %b %n", ID= =3D"hd*", NAME=3D"%1c", SYMLINK=3D"%2c"=0A=0AHOST=3D${2%\.[0-9]}=0ATARGET= =3D${2#[0-9]\.}=0A=0Aif [ -z ${HOST#[13579]} ]; then=0A HOST=3D`expr $HOST = - 1`=0A BUS=3D"1"=0Aelse=0A BUS=3D"0"=0Afi=0A=0Aif [ -z "$3" ]; then=0A MED= IA=3D`cat /proc/ide/$1/media`=0A if [ "$MEDIA" =3D "cdrom" ]; then=0A echo= $1 ide/host$HOST/bus$BUS/target$TARGET/lun0/cd=0A elif [ "$MEDIA" =3D "dis= k" ]; then=0A echo $1 ide/host$HOST/bus$BUS/target$TARGET/lun0/disc=0A fi= =0Aelse=0A echo $1 ide/host$HOST/bus$BUS/target$TARGET/lun0/part$3=0Afi=0A= =0A --jI8keyz6grp/JLjh-- ------------------------------------------------------- This SF.net email is sponsored by: IBM Linux Tutorials. Become an expert in LINUX or just sharpen your skills. Sign up for IBM's Free Linux Tutorials. Learn everything from the bash shell to sys admin. Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click _______________________________________________ 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