From patchwork Fri Jun 25 13:59:22 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan Harper X-Patchwork-Id: 56971 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 9FAC1B6F01 for ; Sat, 26 Jun 2010 05:23:22 +1000 (EST) Received: from localhost ([127.0.0.1]:48472 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OSDvv-0000gk-BE for incoming@patchwork.ozlabs.org; Fri, 25 Jun 2010 14:47:23 -0400 Received: from [140.186.70.92] (port=45934 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OSCzG-0003iE-Np for qemu-devel@nongnu.org; Fri, 25 Jun 2010 13:46:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OS9Rg-0006qg-ES for qemu-devel@nongnu.org; Fri, 25 Jun 2010 09:59:54 -0400 Received: from e32.co.us.ibm.com ([32.97.110.150]:35527) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OS9Rg-0006lK-88 for qemu-devel@nongnu.org; Fri, 25 Jun 2010 09:59:52 -0400 Received: from d03relay05.boulder.ibm.com (d03relay05.boulder.ibm.com [9.17.195.107]) by e32.co.us.ibm.com (8.14.4/8.13.1) with ESMTP id o5PDqAOi015878 for ; Fri, 25 Jun 2010 07:52:10 -0600 Received: from d03av03.boulder.ibm.com (d03av03.boulder.ibm.com [9.17.195.169]) by d03relay05.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id o5PDxVk8076892 for ; Fri, 25 Jun 2010 07:59:32 -0600 Received: from d03av03.boulder.ibm.com (loopback [127.0.0.1]) by d03av03.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id o5PDxUVw014334 for ; Fri, 25 Jun 2010 07:59:30 -0600 Received: from localhost.localdomain (sig-9-76-74-41.mts.ibm.com [9.76.74.41]) by d03av03.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id o5PDxQvM014192; Fri, 25 Jun 2010 07:59:29 -0600 From: Ryan Harper To: linux-hotplug@vger.kernel.org Date: Fri, 25 Jun 2010 08:59:22 -0500 Message-Id: <1277474363-6534-2-git-send-email-ryanh@us.ibm.com> X-Mailer: git-send-email 1.6.3.3 In-Reply-To: <1277474363-6534-1-git-send-email-ryanh@us.ibm.com> References: <1277474363-6534-1-git-send-email-ryanh@us.ibm.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) Cc: john cooper , Rusty Russell , qemu-devel@nongnu.org, Ryan Harper Subject: [Qemu-devel] [PATCH 1/2] Add virtio-blk support to path_id X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org This patch adds a case handling path_id invoked on a virtio-blk device. Currently path_id walks the parent path to virtio-pci but doesn't know that it's the end of the path and exits without building the path (providing no output resulting in no disk/by-path symlinks to virtio-blk devices). This patch handles the virtio-pci path and updates the path accordingly. /lib/udev/path_id --debug /block/vda udev_device_new_from_syspath: device 0x2300120 has devpath '/devices/virtio-pci/virtio1/block/vda' udev_device_new_from_syspath: device 0x2300380 has devpath '/devices/virtio-pci/virtio1' udev_device_new_from_syspath: device 0x2300670 has devpath '/devices/virtio-pci' ID_PATH=virtio-pci-virtio1 And with the current persistent-storage rules generates: % ls -al /dev/disk/by-path | grep vda lrwxrwxrwx. 1 root root 9 Jun 1 22:09 virtio-pci-virtio1 -> ../../vda Signed-off-by: Ryan Harper --- extras/path_id/path_id.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/extras/path_id/path_id.c b/extras/path_id/path_id.c index dcee378..c19bfd0 100644 --- a/extras/path_id/path_id.c +++ b/extras/path_id/path_id.c @@ -448,6 +448,9 @@ int main(int argc, char **argv) } else if (strcmp(subsys, "xen") == 0) { path_prepend(&path, "xen-%s", udev_device_get_sysname(parent)); parent = skip_subsystem(parent, "xen"); + } else if (strcmp(subsys, "virtio") == 0) { + path_prepend(&path, "virtio-pci-%s", udev_device_get_sysname(parent)); + parent = skip_subsystem(parent, "virtio"); } parent = udev_device_get_parent(parent);