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=-2.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no 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 07A52C433DF for ; Thu, 14 May 2020 11:58:53 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D2A652065D for ; Thu, 14 May 2020 11:58:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D2A652065D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jZCVc-0002UT-92; Thu, 14 May 2020 11:58:40 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jZCVb-0002UO-9R for xen-devel@lists.xenproject.org; Thu, 14 May 2020 11:58:39 +0000 X-Inumbo-ID: 3f102bc4-95da-11ea-ae69-bc764e2007e4 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 3f102bc4-95da-11ea-ae69-bc764e2007e4; Thu, 14 May 2020 11:58:38 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 8C5E5ABC7; Thu, 14 May 2020 11:58:39 +0000 (UTC) Subject: Re: [PATCH v8 04/12] xen: add basic hypervisor filesystem support To: =?UTF-8?B?SsO8cmdlbiBHcm/Dnw==?= References: <20200508153421.24525-1-jgross@suse.com> <20200508153421.24525-5-jgross@suse.com> <23938228-e947-fe36-8b19-0e89886db9ac@suse.com> From: Jan Beulich Message-ID: Date: Thu, 14 May 2020 13:58:30 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: <23938228-e947-fe36-8b19-0e89886db9ac@suse.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Stefano Stabellini , Julien Grall , Wei Liu , Andrew Cooper , Ian Jackson , George Dunlap , xen-devel@lists.xenproject.org, Daniel De Graaf , Volodymyr Babchuk , =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" On 14.05.2020 11:50, Jürgen Groß wrote: > On 14.05.20 09:59, Jan Beulich wrote: >> On 08.05.2020 17:34, Juergen Gross wrote: >>> +#define HYPFS_FIXEDSIZE_INIT(var, typ, nam, contvar, wr) \ >>> +    struct hypfs_entry_leaf __read_mostly var = {        \ >>> +        .e.type = typ,                                   \ >>> +        .e.encoding = XEN_HYPFS_ENC_PLAIN,               \ >>> +        .e.name = nam,                                   \ >>> +        .e.size = sizeof(contvar),                       \ >>> +        .e.max_size = wr ? sizeof(contvar) : 0,          \ >>> +        .e.read = hypfs_read_leaf,                       \ >>> +        .e.write = wr,                                   \ >>> +        .content = &contvar,                             \ >>> +    } >> >> At the example of this, some of the macros look like they want >> parentheses added around uses of some of their parameters. > > Hmm, which ones? As I've understood from previous patch reviews by you > you only want those parameters with parantheses where they are really > needed. > > - var is a plain variable, so no parantheses > - typ _should_ be a XEN_HYPFS_TYPE_* define, so probably no parantheses >   (its usage in the macro doesn't call for using parantheses anyway) > - nam might be a candidate, but I can't come up with a reason to put it >   in parantheses here > - contvar has to be a variable (otherwise sizeof(contvar) wouldn't >   work), so no parantheses > - wr is a function pointer or NULL, so no parantheses You have a point for uses as initializers, as there's no lower precedence operator than the assignment ones except comma, which would need parenthesizing in the macro invocation already. However, I disagree on what you say about contvar and wr - contvar is expected, but not required to be just an identifier. And wr in turn is expected but not required to by an identifier or NULL. I.e. the respective two lines where I think parentheses can't be avoided are .e.max_size = (wr) ? sizeof(contvar) : 0, and .content = &(contvar), . Jan