From patchwork Tue Jun 27 08:15:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oliver O'Halloran X-Patchwork-Id: 9811039 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1BE0F60329 for ; Tue, 27 Jun 2017 08:15:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0E4B82846F for ; Tue, 27 Jun 2017 08:15:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 02E7628515; Tue, 27 Jun 2017 08:15:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, T_DKIM_INVALID autolearn=no version=3.3.1 Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A57C128469 for ; Tue, 27 Jun 2017 08:15:55 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id C8F0421BBC430; Tue, 27 Jun 2017 01:14:24 -0700 (PDT) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received: from mail-pf0-x242.google.com (mail-pf0-x242.google.com [IPv6:2607:f8b0:400e:c00::242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 72ACA21A00AC1 for ; Tue, 27 Jun 2017 01:14:24 -0700 (PDT) Received: by mail-pf0-x242.google.com with SMTP id e199so3763618pfh.0 for ; Tue, 27 Jun 2017 01:15:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=+Mw27nmD+f2ZDemWIi2nOVvTYnE8DfwVnbGiJRBSLs0=; b=liJCqLqsqEwBjNpHJqb26gbsQEdxusSOLWWsP/EoMW323rpUUaHYf5QCWAaeeERTZj 7fuKj/MUKdTHKVvOeiGs7869roSk3m6gd1MfbYR5crowA0CSyA0DxNVaYvdqUvoXhOuW oR8v+a3gNYqPnFIOzDMW+o+VLiTbwigkAPVSGrW19aVDO8MmTqVJE+UX5pP8rsmEqFYb JBx4PG4JCWyZP2bk7YMIUP0I1msmap+5Suw9JoN2q9FUF90cJNsiG+4yol5JX3Wzg69l UgObFbPDfRuAlgueHiCU3BJc/TAAIVOXDTMnWNNGisRfz6zPZaOTGyXO6HiWW3LXXMTm P2xA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=+Mw27nmD+f2ZDemWIi2nOVvTYnE8DfwVnbGiJRBSLs0=; b=HR6K38bDz9UdBlJEOVck36mPndQIQVIA4egvv+Q8k3b/1gC6s6TeOOpcxc6rgUAFp0 Ubf15PWCwpdTmjEvkDDqqsT3fVeOCRGl/CuP+osDEbW6zO+LblWEunXC1I44PFbji83O YenN3fu68dA4AthoGeBuYVTM9O+i/l4S/NcbBQLJIFEuhTciMhNrRGZ/4WHK1dyK5eEH di+WTfJ2GqqCE4JnYhGjjuAkls7sYh7NsCbLf2Aok6sidMh6N9+HuFH5grdtE/oVN1Km /ap+G83RZX7Ct4wYNwnAPsi8LX0dD6p33rvZfCZ9h+LZJLLbRGPJb6hxEcaZMcKIeuKg Pu1A== X-Gm-Message-State: AKS2vOzz8+j3acqGvIauXtgwfOEoLiF1qvHvE0NF2aJwTA50ytCjCGRt ZrJ62sRJfCpWdtN5 X-Received: by 10.99.44.209 with SMTP id s200mr2311973pgs.101.1498551354356; Tue, 27 Jun 2017 01:15:54 -0700 (PDT) Received: from flat-canetoad.ozlabs.ibm.com ([122.99.82.10]) by smtp.gmail.com with ESMTPSA id k129sm4875850pfc.87.2017.06.27.01.15.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 27 Jun 2017 01:15:53 -0700 (PDT) From: Oliver O'Halloran To: linux-nvdimm@lists.01.org Subject: [PATCH 1/4] libndctl: rename parse_lbasize to parse_sizes Date: Tue, 27 Jun 2017 18:15:28 +1000 Message-Id: <20170627081531.7389-1-oohall@gmail.com> X-Mailer: git-send-email 2.9.4 X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Virus-Scanned: ClamAV using ClamSMTP We want to re-use this code to parse the list of supported alignments for dax and PFN devices so rename the function to reflect the more generic usage. Signed-off-by: Oliver O'Halloran --- ndctl/lib/libndctl.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/ndctl/lib/libndctl.c b/ndctl/lib/libndctl.c index 4acebc05d6db..aa262f03303e 100644 --- a/ndctl/lib/libndctl.c +++ b/ndctl/lib/libndctl.c @@ -234,12 +234,12 @@ struct ndctl_region { }; /** - * struct ndctl_lbasize - lbasize info for btt and blk-namespace devices + * struct ndctl_sizes - list of supported sector or alignments * @select: currently selected sector_size * @supported: possible sector_size options * @num: number of entries in @supported */ -struct ndctl_lbasize { +struct ndctl_sizes { int select; unsigned int *supported; int num; @@ -270,7 +270,7 @@ struct ndctl_namespace { unsigned long long resource, size; char *alt_name; uuid_t uuid; - struct ndctl_lbasize lbasize; + struct ndctl_sizes lbasize; int numa_node; }; @@ -291,7 +291,7 @@ struct ndctl_btt { struct ndctl_region *region; struct ndctl_namespace *ndns; struct list_node list; - struct ndctl_lbasize lbasize; + struct ndctl_sizes lbasize; unsigned long long size; char *btt_path; char *btt_buf; @@ -2855,8 +2855,8 @@ static char *get_block_device(struct ndctl_ctx *ctx, const char *block_path) return bdev_name; } -static int parse_lbasize_supported(struct ndctl_ctx *ctx, const char *devname, - const char *buf, struct ndctl_lbasize *lba); +static int parse_sizes(struct ndctl_ctx *ctx, const char *devname, + const char *buf, struct ndctl_sizes *lba); static void *add_namespace(void *parent, int id, const char *ndns_base) { @@ -2908,7 +2908,7 @@ static void *add_namespace(void *parent, int id, const char *ndns_base) sprintf(path, "%s/sector_size", ndns_base); if (sysfs_read_attr(ctx, path, buf) < 0) goto err_read; - if (parse_lbasize_supported(ctx, devname, buf, &ndns->lbasize) < 0) + if (parse_sizes(ctx, devname, buf, &ndns->lbasize) < 0) goto err_read; /* fall through */ case ND_DEVICE_NAMESPACE_PMEM: @@ -3738,8 +3738,8 @@ NDCTL_EXPORT int ndctl_namespace_delete(struct ndctl_namespace *ndns) return 0; } -static int parse_lbasize_supported(struct ndctl_ctx *ctx, const char *devname, - const char *buf, struct ndctl_lbasize *lba) +static int parse_sizes(struct ndctl_ctx *ctx, const char *devname, + const char *buf, struct ndctl_sizes *lba) { char *s = strdup(buf), *end, *field; void *temp; @@ -3830,7 +3830,7 @@ static void *add_btt(void *parent, int id, const char *btt_base) sprintf(path, "%s/sector_size", btt_base); if (sysfs_read_attr(ctx, path, buf) < 0) goto err_read; - if (parse_lbasize_supported(ctx, devname, buf, &btt->lbasize) < 0) + if (parse_sizes(ctx, devname, buf, &btt->lbasize) < 0) goto err_read; sprintf(path, "%s/size", btt_base);