All of lore.kernel.org
 help / color / mirror / Atom feed
From: Benjamin Marzinski <bmarzins@redhat.com>
To: christophe varoqui <christophe.varoqui@free.fr>
Cc: device-mapper development <dm-devel@redhat.com>
Subject: [PATCH 1/6] Fix for uevent devpath handling
Date: Thu, 11 Dec 2008 16:03:28 -0600	[thread overview]
Message-ID: <20081211220328.GI1585@ether.msp.redhat.com> (raw)

This is necessary to make uevents work on fedora, since devpath appears as
something like:
'/devices/pci0000:00/0000:00:0a.0/0000:06:00.0/host11/rport-11:0-1/target11:0:1/11:0:1:0/block/sdi'

It simply strips off the everything up to the /block.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
 multipathd/main.c |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

Index: multipath-tools-081203/multipathd/main.c
===================================================================
--- multipath-tools-081203.orig/multipathd/main.c
+++ multipath-tools-081203/multipathd/main.c
@@ -603,14 +603,20 @@ uxsock_trigger (char * str, char ** repl
 static int
 uev_discard(char * devpath)
 {
+	char *tmp;
 	char a[10], b[10];
 
 	/*
 	 * keep only block devices, discard partitions
 	 */
-	if (sscanf(devpath, "/block/%10s", a) != 1 ||
-	    sscanf(devpath, "/block/%10[^/]/%10s", a, b) == 2) {
-		condlog(4, "discard event on %s", devpath);
+	tmp = strstr(devpath, "/block/");
+	if (tmp == NULL){
+		condlog(0, "no /block/ in '%s'", devpath);
+		return 1;
+	}
+	if (sscanf(tmp, "/block/%10s", a) != 1 ||
+	    sscanf(tmp, "/block/%10[^/]/%10s", a, b) == 2) {
+		condlog(0, "discard event on %s", devpath);
 		return 1;
 	}
 	return 0;

                 reply	other threads:[~2008-12-11 22:03 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20081211220328.GI1585@ether.msp.redhat.com \
    --to=bmarzins@redhat.com \
    --cc=christophe.varoqui@free.fr \
    --cc=dm-devel@redhat.com \
    /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.