From patchwork Thu Apr 27 09:14:51 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: 9702615 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 52BDC6032C for ; Thu, 27 Apr 2017 09:15:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 281622860F for ; Thu, 27 Apr 2017 09:15:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1A8DF28623; Thu, 27 Apr 2017 09:15:09 +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 300EA2860F for ; Thu, 27 Apr 2017 09:15:07 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 6DBD821951C96; Thu, 27 Apr 2017 02:15:07 -0700 (PDT) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received: from mail-pf0-x244.google.com (mail-pf0-x244.google.com [IPv6:2607:f8b0:400e:c00::244]) (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 399D721951C96 for ; Thu, 27 Apr 2017 02:15:06 -0700 (PDT) Received: by mail-pf0-x244.google.com with SMTP id c198so8070563pfc.0 for ; Thu, 27 Apr 2017 02:15:06 -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=jlH6daDB0lgMepi3ZFdV9++omrVFLbRNTB9XBATY1MU=; b=JKPaDIAEBS21ixOUJQgg2XJ0fRcwmC9I3rQMOczlz8VoJzjp3wpDU0bHsxzl4GRy6h 6Ey/+eh6FAYWpuiwjaJT8VoWiuxOk/B7gbqbGySaWZgOjn8cNnyUuA5YSMA+6iJrN3zp 4M6NbITBIc67T66IX+aTgrzcAcGeIB3KbySZvl4kGtSFbw55o6g5cX9durUpvGGj7EqS PZxsoxwV2sEWmazoNs143XH//1FlzwBqT0UY9mhubPLn9t3Jjrse4NrV1VAS9ZCw+Qyr iG7RTJBFITNJQ09Cl3dZVtDkT+/mnDGdOd2rYZ92wYMD8i6dW/fN90U8qVhess+oDZVu 0mAw== 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=jlH6daDB0lgMepi3ZFdV9++omrVFLbRNTB9XBATY1MU=; b=HY93IwtoiXG1ISC2CZfCo+bZFzVlSl0wMIEG6lLGrqSQZypEZ49KRJfszzrkYM5480 KPxaEEMEHa5ChJmsFNNLSaRnB6PibSWx6UidZAcmHqxGsRoORalR85293gnc3Cy12e2K JKUKmsQ1u7QtPGR5f2AqwUcEPI/Q+NK3Nyz84loww6AwCk6EQ6j83OLfP+YY5jnH/bPb 7C2/a2uCGAtdm7I0yjPiXqaujiDWzeChObjHKr0ATP2rfFoZgTXTj3BFZlBpvxFZit7G Sfe9kn+9RURNTALkJKaH4hXyMSiMNVFyxWSOSQC+S/n8tPOpVutTcwcazYWlpLdQu6gp 8psA== X-Gm-Message-State: AN3rC/4mk/b43dLT74RkAMmif/le9cpDEz6jqmrK5XQBDDEBDDrvkK6h 1Ule07JVqbWoIA== X-Received: by 10.99.108.74 with SMTP id h71mr4675638pgc.18.1493284505916; Thu, 27 Apr 2017 02:15:05 -0700 (PDT) Received: from flat-canetoad.ozlabs.ibm.com ([122.99.82.10]) by smtp.gmail.com with ESMTPSA id 3sm2954210pfe.20.2017.04.27.02.15.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 27 Apr 2017 02:15:05 -0700 (PDT) From: Oliver O'Halloran To: linux-nvdimm@lists.01.org Subject: [PATCH 1/4] ndctl: rename parse_lbasize to parse_sizes Date: Thu, 27 Apr 2017 19:14:51 +1000 Message-Id: <20170427091454.17412-1-oohall@gmail.com> X-Mailer: git-send-email 2.9.3 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 565c969170ce..25a1e6d20d10 100644 --- a/ndctl/lib/libndctl.c +++ b/ndctl/lib/libndctl.c @@ -230,12 +230,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; @@ -266,7 +266,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; }; @@ -287,7 +287,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; @@ -2735,8 +2735,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) { @@ -2788,7 +2788,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: @@ -3559,8 +3559,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; @@ -3651,7 +3651,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);