From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_2 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 95741C4338F for ; Wed, 11 Aug 2021 17:27:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 792E96101D for ; Wed, 11 Aug 2021 17:27:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229918AbhHKR2D (ORCPT ); Wed, 11 Aug 2021 13:28:03 -0400 Received: from frasgout.his.huawei.com ([185.176.79.56]:3629 "EHLO frasgout.his.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229535AbhHKR2C (ORCPT ); Wed, 11 Aug 2021 13:28:02 -0400 Received: from fraeml712-chm.china.huawei.com (unknown [172.18.147.200]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4GlGw55Hr3z6GBj4; Thu, 12 Aug 2021 01:27:01 +0800 (CST) Received: from lhreml710-chm.china.huawei.com (10.201.108.61) by fraeml712-chm.china.huawei.com (10.206.15.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.8; Wed, 11 Aug 2021 19:27:37 +0200 Received: from localhost (10.52.123.85) by lhreml710-chm.china.huawei.com (10.201.108.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Wed, 11 Aug 2021 18:27:36 +0100 Date: Wed, 11 Aug 2021 18:27:06 +0100 From: Jonathan Cameron To: Dan Williams CC: , , , , , Subject: Re: [PATCH 03/23] libnvdimm/labels: Introduce label setter helpers Message-ID: <20210811182706.00003bee@Huawei.com> In-Reply-To: <162854808363.1980150.11628345983283480967.stgit@dwillia2-desk3.amr.corp.intel.com> References: <162854806653.1980150.3354618413963083778.stgit@dwillia2-desk3.amr.corp.intel.com> <162854808363.1980150.11628345983283480967.stgit@dwillia2-desk3.amr.corp.intel.com> Organization: Huawei Technologies Research and Development (UK) Ltd. X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; i686-w64-mingw32) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.52.123.85] X-ClientProxiedBy: lhreml716-chm.china.huawei.com (10.201.108.67) To lhreml710-chm.china.huawei.com (10.201.108.61) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-cxl@vger.kernel.org On Mon, 9 Aug 2021 15:28:03 -0700 Dan Williams wrote: > In preparation for LIBNVDIMM to manage labels on CXL devices deploy > helpers that abstract the label type from the implementation. The CXL > label format is mostly similar to the EFI label format with concepts / > fields added, like dynamic region creation and label type guids, and > other concepts removed like BLK-mode and interleave-set-cookie ids. > > Signed-off-by: Dan Williams Hi Dan, Only thing on this patch is whether it might be better to put get /set pairs together rather than all the get functions, then all the set functions? If looking at this code in future it would make it a little easier to quickly see they are match pairs. Your code though, so if you prefer it like this, I don't really care! Fine either way with me. Reviewed-by: Jonathan Cameron > --- > drivers/nvdimm/label.c | 61 +++++++++++++++++------------------ > drivers/nvdimm/namespace_devs.c | 2 + > drivers/nvdimm/nd.h | 68 +++++++++++++++++++++++++++++++++++++++ > 3 files changed, 98 insertions(+), 33 deletions(-) > ... > diff --git a/drivers/nvdimm/nd.h b/drivers/nvdimm/nd.h > index b3feaf3699f7..416846fe7818 100644 > --- a/drivers/nvdimm/nd.h > +++ b/drivers/nvdimm/nd.h > @@ -47,6 +47,14 @@ static inline u8 *nsl_get_name(struct nvdimm_drvdata *ndd, > return memcpy(name, nd_label->name, NSLABEL_NAME_LEN); > } > > +static inline u8 *nsl_set_name(struct nvdimm_drvdata *ndd, > + struct nd_namespace_label *nd_label, u8 *name) > +{ > + if (!name) > + return name; Nitpick: Obviously same thing, but my eyes parse return NULL; more easily as a clear "error" return. > + return memcpy(nd_label->name, name, NSLABEL_NAME_LEN); > +} > + ...