From patchwork Sat Feb 4 23:21:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 9555789 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 8CB92602B5 for ; Sat, 4 Feb 2017 23:25:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 81AA726785 for ; Sat, 4 Feb 2017 23:25:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 74A4626BE9; Sat, 4 Feb 2017 23:25:59 +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.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE autolearn=ham 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 7B6AB26785 for ; Sat, 4 Feb 2017 23:25:55 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 18088820AB; Sat, 4 Feb 2017 15:25:55 -0800 (PST) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 6D7CA820A8 for ; Sat, 4 Feb 2017 15:25:53 -0800 (PST) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga101.jf.intel.com with ESMTP; 04 Feb 2017 15:25:53 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,336,1477983600"; d="scan'208";a="221404902" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.14]) by fmsmga004.fm.intel.com with ESMTP; 04 Feb 2017 15:25:53 -0800 Subject: [ndctl PATCH 1/2] util: add a common ALIGN macro From: Dan Williams To: linux-nvdimm@lists.01.org Date: Sat, 04 Feb 2017 15:21:47 -0800 Message-ID: <148625050793.27070.3913104369267731411.stgit@dwillia2-desk3.amr.corp.intel.com> User-Agent: StGit/0.17.1-9-g687f MIME-Version: 1.0 X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Virus-Scanned: ClamAV using ClamSMTP There are a couple locations where we locally define ALIGN(), add a global definition before adding another local one. Signed-off-by: Dan Williams --- ndctl/builtin-dimm.c | 3 +-- test/dax-pmd.c | 3 +-- util/size.h | 4 ++++ 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/ndctl/builtin-dimm.c b/ndctl/builtin-dimm.c index 8a041cee8cab..637b10b47abf 100644 --- a/ndctl/builtin-dimm.c +++ b/ndctl/builtin-dimm.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -605,8 +606,6 @@ static struct namespace_label *label_base(struct nvdimm_data *ndd) return (struct namespace_label *) base; } -#define ALIGN(x, a) ((((unsigned long long) x) + (a - 1)) & ~(a - 1)) -#define BITS_PER_LONG (sizeof(unsigned long) * 8) static int label_write_index(struct nvdimm_data *ndd, int index, u32 seq) { struct namespace_index *nsindex; diff --git a/test/dax-pmd.c b/test/dax-pmd.c index 47f254e398b2..831b1f0a6572 100644 --- a/test/dax-pmd.c +++ b/test/dax-pmd.c @@ -11,11 +11,10 @@ #include #include #include +#include #include #define NUM_EXTENTS 5 -#define HPAGE_SIZE (2 << 20) -#define ALIGN(x, a) ((((unsigned long long) x) + (a - 1)) & ~(a - 1)) #define fail() fprintf(stderr, "%s: failed at: %d\n", __func__, __LINE__) #define faili(i) fprintf(stderr, "%s: failed at: %d: %d\n", __func__, __LINE__, i) #define TEST_FILE "test_dax_data" diff --git a/util/size.h b/util/size.h index 776363fd19e9..4af14eb7d150 100644 --- a/util/size.h +++ b/util/size.h @@ -14,4 +14,8 @@ unsigned long long parse_size64(const char *str); unsigned long long __parse_size64(const char *str, unsigned long long *units); +#define ALIGN(x, a) ((((unsigned long long) x) + (a - 1)) & ~(a - 1)) +#define BITS_PER_LONG (sizeof(unsigned long) * 8) +#define HPAGE_SIZE (2 << 20) + #endif /* _NDCTL_SIZE_H_ */