From patchwork Fri Jun 28 23:26:14 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Marzinski X-Patchwork-Id: 2802831 Return-Path: X-Original-To: patchwork-dm-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 579EDBF4A1 for ; Fri, 28 Jun 2013 23:30:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 91473201E4 for ; Fri, 28 Jun 2013 23:30:47 +0000 (UTC) Received: from mx3-phx2.redhat.com (mx3-phx2.redhat.com [209.132.183.24]) by mail.kernel.org (Postfix) with ESMTP id B9DE320140 for ; Fri, 28 Jun 2013 23:30:46 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx3-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r5SNReYu010582; Fri, 28 Jun 2013 19:27:40 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r5SNQRJI022948 for ; Fri, 28 Jun 2013 19:26:27 -0400 Received: from ether.msp.redhat.com (ether.msp.redhat.com [10.15.80.119]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r5SNQRJw020236 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 28 Jun 2013 19:26:27 -0400 Received: from ether.msp.redhat.com (localhost.localdomain [127.0.0.1]) by ether.msp.redhat.com (8.14.1/8.14.1) with ESMTP id r5SNQPt6006353; Fri, 28 Jun 2013 18:26:26 -0500 Received: (from bmarzins@localhost) by ether.msp.redhat.com (8.14.1/8.14.1/Submit) id r5SNQPIf006352; Fri, 28 Jun 2013 18:26:25 -0500 From: Benjamin Marzinski To: device-mapper development Date: Fri, 28 Jun 2013 18:26:14 -0500 Message-Id: <1372461981-6333-2-git-send-email-bmarzins@redhat.com> In-Reply-To: <1372461981-6333-1-git-send-email-bmarzins@redhat.com> References: <1372461981-6333-1-git-send-email-bmarzins@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-loop: dm-devel@redhat.com Cc: Christophe Varoqui Subject: [dm-devel] [PATCH 1/8] Add multipath path format wildcard X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk Reply-To: device-mapper development List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Spam-Status: No, score=-8.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This adds a new format wildcard, 'm', to be used with multipathd show paths format It prints the multipath device associated with the path. Signed-off-by: Benjamin Marzinski --- libmultipath/print.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/libmultipath/print.c b/libmultipath/print.c index 274f5e7..c00f5d7 100644 --- a/libmultipath/print.c +++ b/libmultipath/print.c @@ -422,6 +422,16 @@ snprint_path_serial (char * buff, size_t len, struct path * pp) } static int +snprint_path_mpp (char * buff, size_t len, struct path * pp) +{ + if (!pp->mpp) + return snprintf(buff, len, "[orphan]"); + if (!pp->mpp->alias) + return snprintf(buff, len, "[unknown]"); + return snprint_str(buff, len, pp->mpp->alias); +} + +static int snprint_path_checker (char * buff, size_t len, struct path * pp) { struct checker * c = &pp->checker; @@ -464,6 +474,7 @@ struct path_data pd[] = { {'p', "pri", 0, snprint_pri}, {'S', "size", 0, snprint_path_size}, {'z', "serial", 0, snprint_path_serial}, + {'m', "multipath", 0, snprint_path_mpp}, {0, NULL, 0 , NULL} };