[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 1/2] rangeset: add RANGESETF_no_print flag


  • To: Oleksandr Andrushchenko <Oleksandr_Andrushchenko@xxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 23 Nov 2021 09:01:11 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=qRwQ/ROP8pRe31KYLn9qVfE+jOFtGVV/Pp7Sku6bczM=; b=fKAUtSwShMQeNasPabOZXEawWwyZG03ra1D5gKLZw9nrzxoj0KOfjXmYBoPUBwxGfND2yDZz+ljgOceGc8f3Yu97OwCxE30tzkdwS0TLRZd63Fg1Uvm1Mb8UeoHtLxBk1JPhshAqIFP8f3c47q2R1r8qDnQ05+5er1F2A9Rcr2isQE/ZGpmCtevdqyjyuqa9Hod8i9/zpO08WmFnyxJ0ahOHWH5dY4QDdZNm4rfgYbDf14gZRKw0LuU6wz3CqEBmctXIu/0DdFRuDqBO2CTc10Xl+ZitSntri7x32KtT8mTpGRHK3qqksSNOUOh3xFN8f05zs1Sj2h+1TYODaZ6v6w==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hmbu0M3MEEJad6KWQW55Obwimjh30tUNbF3AMHKtNMdl+l3DvXat77Cv1dIZ4/3udpFJ4xRLXTG/GoDvNcej0rSidnX+41Ax5JhENKR7Aj1YaDT8matBbRNYoZnzW2v8g9BxVjjlpZPGWa067uCzoDmnNv+Y1QG9gar3k2Y/n+0nrPVHi4/Dq6XhokDZ2DW+vpiwNlhFCVN6zFAt+8mWPkyEobgW3KO+ZUR9gm2lWKs1hTWJuxDUl/MUDK5Mm/xVs5RNFrABBE82jQILuMn4HlJ4qCtF1qeyigG7EJqrNEtdNaNszfeLMSe2/8VZ+Tn4zl4DVh/u/TxS7p2mqnObjQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: "roger.pau@xxxxxxxxxx" <roger.pau@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Tue, 23 Nov 2021 08:01:36 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 23.11.2021 08:49, Oleksandr Andrushchenko wrote:
> 
> 
> On 23.11.21 09:38, Jan Beulich wrote:
>> On 22.11.2021 10:28, Oleksandr Andrushchenko wrote:
>>> --- a/xen/include/xen/rangeset.h
>>> +++ b/xen/include/xen/rangeset.h
>>> @@ -51,6 +51,9 @@ void rangeset_limit(
>>>    /* Pretty-print range limits in hexadecimal. */
>>>   #define _RANGESETF_prettyprint_hex 0
>>>   #define RANGESETF_prettyprint_hex  (1U << _RANGESETF_prettyprint_hex)
>>> +/* Do not print entries marked with this flag. */
>>> +#define _RANGESETF_no_print 1
>> There's no need for this, so I'd like to ask that you add ...
>>
>>> +#define RANGESETF_no_print  (1U << _RANGESETF_no_print)
>> ... just this. In due course we should do away with
>> _RANGESETF_prettyprint_hex as well (unless you want to do so right
>> at this occasion).
> Ok, I can remove "#define _RANGESETF_prettyprint_hex 0" as well
> and have both flags defined as
>   /* Pretty-print range limits in hexadecimal. */
> #define RANGESETF_prettyprint_hex  (1U << 0)
> /* Do not print entries marked with this flag. */
> #define RANGESETF_no_print         (1U << 1)
> 
> Or we can use BIT macro here:
> 
> /* Pretty-print range limits in hexadecimal. */
> #define RANGESETF_prettyprint_hex  BIT(0, U)
> /* Do not print entries marked with this flag. */
> #define RANGESETF_no_print         BIT(1, U)
> 
> What's your preference here?

Clearly the former. But this may not be everybody's view. I'm hesitant
towards further uses at least as long as its generalization, GENMASK(),
isn't ready for easy use. It was some time ago that we had a discussion
about that one, supporting my reservations voiced back at the time when
it was introduced into our code base. Iirc there was more than one
issue with it; the immediately obvious one is that it silently does the
wrong thing when the arguments get specified the wrong way round, when
it really would be relatively easy to support either ordering.

Jan




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.