All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrey Borzenkov <arvidjaar@mail.ru>
To: linux-hotplug@vger.kernel.org
Subject: [PATCH] Make saved environment available for remove event rules
Date: Wed, 05 Apr 2006 17:51:06 +0000	[thread overview]
Message-ID: <200604052151.09087.arvidjaar@mail.ru> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 477 bytes --]

The patch assures that saved environment is available when processing
rules for 'remove' event. It enables mathing on previously set variables.
Among others it makes REMOVE_CMD really works (Debian bug 360855).

This is slightly modified version of patch from this thread:
http://marc.theaimsgroup.com/?l=linux-hotplug-devel&m=114416867706787&w=2

Signed-off-by: Andrey Borzenkov <arvidjaar@mail.ru>

---
Patch attached due to kmail customarily mangling long lines :(

-andrey

[-- Attachment #1.2: make_save_environment_avaialble_for_remove_rules.diff --]
[-- Type: text/x-diff, Size: 1989 bytes --]

Subject: [PATCH] Make saved environment available for remove event rules

From: Andrey Borzenkov <arvidjaar@mail.ru>

The patch assures that saved environment is available when processing
rules for 'remove' event. It enables mathing on previously set variables.
Among others it makes REMOVE_CMD really works (Debian bug 360855).

This is slightly modified version of patch from this thread:
http://marc.theaimsgroup.com/?l=linux-hotplug-devel&m=114416867706787&w=2

Signed-off-by: Andrey Borzenkov <arvidjaar@mail.ru>

---

 udev_device.c |    7 ++++---
 udev_remove.c |    2 +-
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/udev_device.c b/udev_device.c
index 5db2709..6ee6b13 100644
--- a/udev_device.c
+++ b/udev_device.c
@@ -101,6 +101,10 @@ int udev_device_event(struct udev_rules 
 	if (major(udev->devt) != 0 && strcmp(udev->action, "remove") == 0) {
 		struct name_entry *name_loop;
 
+		udev_db_get_device(udev, udev->dev->devpath);
+		/* restore stored persistent data */
+		list_for_each_entry(name_loop, &udev->env_list, node)
+			putenv(name_loop->name);
 		udev_rules_get_run(rules, udev);
 		if (udev->ignore_device) {
 			info("device event will be ignored");
@@ -109,9 +113,6 @@ int udev_device_event(struct udev_rules 
 		/* get data from db, remove db-entry, delete node */
 		retval = udev_remove_device(udev);
 
-		/* restore stored persistent data */
-		list_for_each_entry(name_loop, &udev->env_list, node)
-			putenv(name_loop->name);
 		return retval;
 	}
 
diff --git a/udev_remove.c b/udev_remove.c
index 6de6cf5..f4c9ab6 100644
--- a/udev_remove.c
+++ b/udev_remove.c
@@ -119,7 +119,7 @@ int udev_remove_device(struct udevice *u
 	if (major(udev->devt) == 0)
 		return 0;
 
-	if (udev_db_get_device(udev, udev->dev->devpath) == 0) {
+	if (udev->name[0] != '\0') {
 		if (udev->ignore_remove) {
 			dbg("remove event for '%s' requested to be ignored by rule", udev->name);
 			return 0;

[-- Attachment #2: Type: application/pgp-signature, Size: 191 bytes --]

             reply	other threads:[~2006-04-05 17:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-05 17:51 Andrey Borzenkov [this message]
2006-04-05 20:46 ` [PATCH] Make saved environment available for remove event rules Kay Sievers

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=200604052151.09087.arvidjaar@mail.ru \
    --to=arvidjaar@mail.ru \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.