From mboxrd@z Thu Jan 1 00:00:00 1970 From: md@Linux.IT (Marco d'Itri) Date: Sun, 26 Nov 2006 14:31:35 +0000 Subject: Re: write_cd_rules: identity-based persistence Message-Id: <20061126143135.GA24098@bongo.bofh.it> MIME-Version: 1 Content-Type: multipart/mixed; boundary="===============1118965348==" List-Id: References: <456740BD.3050501@kadzban.is-a-geek.net> In-Reply-To: <456740BD.3050501@kadzban.is-a-geek.net> To: linux-hotplug@vger.kernel.org --===============1118965348== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="oC1+HKm2/end4ao3" Content-Disposition: inline --oC1+HKm2/end4ao3 Content-Type: multipart/mixed; boundary="TB36FDmn/VVEgNH/" Content-Disposition: inline --TB36FDmn/VVEgNH/ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Nov 24, Bryan Kadzban wrote: > This is a sort of follow-up of my path-based persistence patch for net > devices; it's the opposite type of addition for CD symlinks. Passing Looks good. I am attaching a slightly reformatted version, I think it should be applied. --=20 ciao, Marco --TB36FDmn/VVEgNH/ Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="write_cd_rules.diff" Content-Transfer-Encoding: quoted-printable --- write_cd_rules.orig 2006-11-26 15:27:11.000000000 +0100 +++ write_cd_rules 2006-11-26 15:30:21.000000000 +0100 @@ -50,6 +50,38 @@ exit 1 fi =20 +if [ "$1" ]; then + METHOD=3D"$1" +else + METHOD=3D'by-path' +fi + +case "$METHOD" in + by-path) + if [ -z "$ID_PATH" ]; then + echo "$DEVPATH not supported by path_id. by-id may work." >&2 + exit 1 + fi + RULE=3D"ENV{ID_PATH}=3D=3D\"$ID_PATH\"" + ;; + + by-id) + if [ "$ID_SERIAL" ]; then + RULE=3D"ENV{ID_SERIAL}=3D=3D\"$ID_SERIAL\"" + elif [ "$ID_MODEL" -a "$ID_REVISION" ]; then + RULE=3D"ENV{ID_MODEL}=3D=3D\"$ID_MODEL\", ENV{ID_REVISION}=3D=3D\"$ID_RE= VISION\"" + else + echo "$DEVPATH not supported by ata_id. by-path may work." >&2 + exit 1 + fi + ;; + + *) + echo "Invalid argument (must be either by-path or by-id)." >&2 + exit 1 + ;; +esac + # Prevent concurrent processes from modifying the file at the same time. lock_rules_file =20 @@ -58,7 +90,7 @@ =20 link_num=3D$(find_next_available 'cdrom[0-9]*') =20 -match=3D"ENV{ID_CDROM}=3D=3D\"?*\", ENV{ID_PATH}=3D=3D\"$ID_PATH\"" +match=3D"ENV{ID_CDROM}=3D=3D\"?*\", $RULE" =20 comment=3D"$ID_MODEL ($ID_PATH)" =20 --TB36FDmn/VVEgNH/-- --oC1+HKm2/end4ao3 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (GNU/Linux) iD8DBQFFaaVHFGfw2OHuP7ERAlDUAJ9s0laDYVt+KxhQlcobBrdCVi3arACgpHTF pjSlELZTO6x9u7DRFQpZHxU= =d6OF -----END PGP SIGNATURE----- --oC1+HKm2/end4ao3-- --===============1118965348== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV --===============1118965348== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ 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 --===============1118965348==--