From patchwork Wed Jan 16 12:14:16 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hannes Reinecke X-Patchwork-Id: 1987631 Return-Path: X-Original-To: patchwork-dm-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from mx3-phx2.redhat.com (mx3-phx2.redhat.com [209.132.183.24]) by patchwork2.kernel.org (Postfix) with ESMTP id E1551DF2A2 for ; Wed, 16 Jan 2013 12:18:54 +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 r0GCFfEv018429; Wed, 16 Jan 2013 07:15:41 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r0GCEOb0032139 for ; Wed, 16 Jan 2013 07:14:24 -0500 Received: from mx1.redhat.com (ext-mx14.extmail.prod.ext.phx2.redhat.com [10.5.110.19]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r0GCEOu0015922 for ; Wed, 16 Jan 2013 07:14:24 -0500 Received: from mx2.suse.de (cantor2.suse.de [195.135.220.15]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r0GCENHq030475 for ; Wed, 16 Jan 2013 07:14:23 -0500 Received: from relay2.suse.de (unknown [195.135.220.254]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id 05825A50E4; Wed, 16 Jan 2013 13:14:22 +0100 (CET) From: Hannes Reinecke To: Christophe Varoqui Date: Wed, 16 Jan 2013 13:14:16 +0100 Message-Id: <1358338456-1234-14-git-send-email-hare@suse.de> In-Reply-To: <1358338456-1234-1-git-send-email-hare@suse.de> References: <1358338456-1234-1-git-send-email-hare@suse.de> X-RedHat-Spam-Score: -7.301 (BAYES_00, DCC_REPUT_00_12, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD) X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-Scanned-By: MIMEDefang 2.68 on 10.5.110.19 X-loop: dm-devel@redhat.com Cc: dm-devel@redhat.com Subject: [dm-devel] [PATCH 13/13] Rename variables in sysfs_get_tgt_nodename 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 For consistency. Signed-off-by: Hannes Reinecke --- libmultipath/discovery.c | 54 +++++++++++++++++++++++----------------------- 1 files changed, 27 insertions(+), 27 deletions(-) diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c index 65f9c57..3fbc181 100644 --- a/libmultipath/discovery.c +++ b/libmultipath/discovery.c @@ -205,9 +205,9 @@ sysfs_get_timeout(struct path *pp, unsigned int *timeout) int sysfs_get_tgt_nodename (struct path *pp, char * node) { - const char *targetid, *value; + const char *tgtname, *value; struct udev_device *parent, *tgtdev; - int host, channel, rport_id = -1, ata_id = -1; + int host, channel, tgtid = -1; parent = udev_device_get_parent_with_subsystem_devtype(pp->udev, "scsi", "scsi_device"); if (!parent) @@ -217,16 +217,16 @@ sysfs_get_tgt_nodename (struct path *pp, char * node) if (value) { tgtdev = udev_device_get_parent(parent); while (tgtdev) { - targetid = udev_device_get_sysname(tgtdev); - if (sscanf(targetid, "end_device-%d:%d", - &host, &rport_id) == 2) + tgtname = udev_device_get_sysname(tgtdev); + if (sscanf(tgtname, "end_device-%d:%d", + &host, &tgtid) == 2) break; tgtdev = udev_device_get_parent(tgtdev); - rport_id = -1; + tgtid = -1; } - if (rport_id >= 0) { + if (tgtid >= 0) { pp->sg_id.proto_id = SCSI_PROTOCOL_SAS; - pp->sg_id.transport_id = rport_id; + pp->sg_id.transport_id = tgtid; strncpy(node, value, NODE_NAME_SIZE); return 0; } @@ -239,7 +239,7 @@ sysfs_get_tgt_nodename (struct path *pp, char * node) tgtdev = udev_device_get_parent(parent); value = udev_device_get_sysname(tgtdev); if (sscanf(value, "rport-%d:%d-%d", - &host, &channel, &rport_id) == 3) { + &host, &channel, &tgtid) == 3) { tgtdev = udev_device_new_from_subsystem_sysname(conf->udev, "fc_remote_ports", value); if (tgtdev) { @@ -247,12 +247,12 @@ sysfs_get_tgt_nodename (struct path *pp, char * node) "FC rport %d:%d-%d", pp->sg_id.host_no, pp->sg_id.channel, pp->sg_id.scsi_id, host, channel, - rport_id); + tgtid); value = udev_device_get_sysattr_value(tgtdev, "node_name"); if (value) { pp->sg_id.proto_id = SCSI_PROTOCOL_FCP; - pp->sg_id.transport_id = rport_id; + pp->sg_id.transport_id = tgtid; strncpy(node, value, NODE_NAME_SIZE); udev_device_unref(tgtdev); return 0; @@ -263,25 +263,25 @@ sysfs_get_tgt_nodename (struct path *pp, char * node) /* Check for iSCSI */ parent = pp->udev; - targetid = NULL; + tgtname = NULL; while (parent) { - targetid = udev_device_get_sysname(parent); - if (targetid && sscanf(targetid , "session%d", &rport_id) == 1) + tgtname = udev_device_get_sysname(parent); + if (tgtname && sscanf(tgtname , "session%d", &tgtid) == 1) break; parent = udev_device_get_parent(parent); - targetid = NULL; - rport_id = -1; + tgtname = NULL; + tgtid = -1; } - if (parent && targetid) { + if (parent && tgtname) { tgtdev = udev_device_new_from_subsystem_sysname(conf->udev, - "iscsi_session", targetid); + "iscsi_session", tgtname); if (tgtdev) { const char *value; - value = udev_device_get_sysattr_value(tgtdev, "targetname"); + value = udev_device_get_sysattr_value(tgtdev, "tgtname"); if (value) { pp->sg_id.proto_id = SCSI_PROTOCOL_ISCSI; - pp->sg_id.transport_id = rport_id; + pp->sg_id.transport_id = tgtid; strncpy(node, value, NODE_NAME_SIZE); udev_device_unref(tgtdev); return 0; @@ -292,18 +292,18 @@ sysfs_get_tgt_nodename (struct path *pp, char * node) } /* Check for libata */ parent = pp->udev; - targetid = NULL; + tgtname = NULL; while (parent) { - targetid = udev_device_get_sysname(parent); - if (targetid && sscanf(targetid, "ata%d", &ata_id) == 1) + tgtname = udev_device_get_sysname(parent); + if (tgtname && sscanf(tgtname, "ata%d", &tgtid) == 1) break; parent = udev_device_get_parent(parent); - targetid = NULL; + tgtname = NULL; } - if (targetid) { + if (tgtname) { pp->sg_id.proto_id = SCSI_PROTOCOL_ATA; - pp->sg_id.transport_id = ata_id; - snprintf(node, NODE_NAME_SIZE, "ata-%d.00", ata_id); + pp->sg_id.transport_id = tgtid; + snprintf(node, NODE_NAME_SIZE, "ata-%d.00", tgtid); return 0; } pp->sg_id.proto_id = SCSI_PROTOCOL_UNSPEC;