From: md@Linux.IT (Marco d'Itri)
To: linux-hotplug@vger.kernel.org
Subject: Re: write_cd_rules: identity-based persistence
Date: Sun, 26 Nov 2006 14:31:35 +0000 [thread overview]
Message-ID: <20061126143135.GA24098@bongo.bofh.it> (raw)
In-Reply-To: <456740BD.3050501@kadzban.is-a-geek.net>
[-- Attachment #1.1.1: Type: text/plain, Size: 324 bytes --]
On Nov 24, Bryan Kadzban <bryan@kadzban.is-a-geek.net> 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.
--
ciao,
Marco
[-- Attachment #1.1.2: write_cd_rules.diff --]
[-- Type: text/plain, Size: 1127 bytes --]
--- 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
+if [ "$1" ]; then
+ METHOD="$1"
+else
+ METHOD='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="ENV{ID_PATH}==\"$ID_PATH\""
+ ;;
+
+ by-id)
+ if [ "$ID_SERIAL" ]; then
+ RULE="ENV{ID_SERIAL}==\"$ID_SERIAL\""
+ elif [ "$ID_MODEL" -a "$ID_REVISION" ]; then
+ RULE="ENV{ID_MODEL}==\"$ID_MODEL\", ENV{ID_REVISION}==\"$ID_REVISION\""
+ 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
@@ -58,7 +90,7 @@
link_num=$(find_next_available 'cdrom[0-9]*')
-match="ENV{ID_CDROM}==\"?*\", ENV{ID_PATH}==\"$ID_PATH\""
+match="ENV{ID_CDROM}==\"?*\", $RULE"
comment="$ID_MODEL ($ID_PATH)"
[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
[-- Attachment #2: Type: text/plain, Size: 347 bytes --]
-------------------------------------------------------------------------
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
[-- Attachment #3: Type: text/plain, Size: 226 bytes --]
_______________________________________________
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
next prev parent reply other threads:[~2006-11-26 14:31 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-24 18:58 write_cd_rules: identity-based persistence Bryan Kadzban
2006-11-26 14:31 ` Marco d'Itri [this message]
2006-11-26 19:13 ` Bryan Kadzban
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20061126143135.GA24098@bongo.bofh.it \
--to=md@linux.it \
--cc=linux-hotplug@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).