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

Re: [PATCH 1/2] xen/kernel.h: Import __struct_group from Linux


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Luca Fancellu <Luca.Fancellu@xxxxxxx>
  • Date: Wed, 1 May 2024 06:54:12 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=arm.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com])
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
  • Arc-message-signature: i=2; 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=G6wnQxmYQEs6x1K3g2n0Y17L5Gq9s/LAONIJZAEUtJE=; b=VYPMZX3t6nDxK+16m/v+OtKtJ0s80tQYDRSnL5pukHah8HacDGsKHdqLuFyQWMmiTt3146QA7tW2rqwJJQAscWpL8An7JwE7n1e1t2OwV2qewKeaIguHYmBQE+MsqVTwNZ410m17olXVs1mNfbJ8b3n5RhBOoS7U+aPlN6UeWppbKTrfMXNV0Qimw/rLuciPewiqCkYRk23ubkQ1OlULcnU3XRlKroOjfd165FMvISC5X+lYJNXPrjqdKC0RsVDT/fsMuvWDwuIoB8RVwjmZj0R7Z8rb2YmYtKp9vYSVgnIlLD99mHKFxo0aYQBjCIwbfETcmxQbh+M4HJCSbjjzBQ==
  • 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=G6wnQxmYQEs6x1K3g2n0Y17L5Gq9s/LAONIJZAEUtJE=; b=AA4vTXtAL5sbIt5axdYnlf3YohyZWfLrKd+aqt+wvJ5xyhTLDdaESAZk6C06upvj9RBWpoxLYeA1J5rsIFdzpeBsuS1KKxYXm8bNCKDjRbZMjiC7bQNL050ywRh/XdeIkZl0iL3Ho+RCHFRdB5ed6alW+eJltHTb/20LUiLNe+mcMhwpS2bSnUp8xDMSi3g4nTCsvsdZPhXorZyEljVdBSCFOPn3EUbbzOq1q4ZSZR8h8QjBCMhfam/uTR/o6T0DnpvDb4rtRqRiOe0Js5udAgbW7W2AsH002/frR/8ly3ytrcoI3uGP4WLsAfZxzTSKzesbY8HweI6ACm9I//weYw==
  • Arc-seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=NKW6VNwYg3nJs7JnHe5TrE0sqaE4r2/D1UlM0wQM+Nla4K05JyGYuSm5Uqc/520pVHCo+wVWhr8V0YSOYUljA/Pm07k6yak9bdljKRyVqhQlGw3JG3cRt5cBZJiP6PcQ5x+dXyNqisfvP3HxH57fYXcX1tU3rVgiFLiyp/dD3wHCDZe3Jt/m8qy2iIzPZG7cMXa9JNJe8qd1uRVaeTX4Mr60X0/qJ8s/CgLdyE8dnhpC5RxoQR8zF33DtJYUUGerpkYX3h+n825a3uIXU7tqP1LgovfAC5+oHoedJpflBZvHgSqEwEkVGj4HBVaITJNZOS8w3GkRonbW/Ix0y2sc8w==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kxJZH8gapmQ0MCh6OVhFu7ZXlNn1Jm0/SozpvRNxeeYegg/DWVbKUumsoeT8hshgFYJCPyIymZ0u4qcNsNG1itbIJSD2ehTMMrX1wZ8oXhH+apwkycxk3bQihHgpi6qqlDWXl4+ol+Q3mNuuqKFe2yBWS/pAUi1EaV3ll2M+bmu97N9qraAhDmwMjMLz80U922tFxBAK9iSHe3VIh5a/qxaINPbw9u1cw5vIyq/l7xBuktQQC12jyG4Hwnh64RRvhXGyLUtZwcvCR3mkuV6C+es/YP+39RonaVl31rJllHrWtgnPvH+jCU95HxiQLjet6Qvj6Be2OKaFjOlNqlXDwg==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: "consulting @ bugseng . com" <consulting@xxxxxxxxxxx>, Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Wed, 01 May 2024 06:54:50 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHamu7vn3o+gufgI0eDMZNP6vgeorGAsTwAgAFBl4A=
  • Thread-topic: [PATCH 1/2] xen/kernel.h: Import __struct_group from Linux

Hi Jan,

> On 30 Apr 2024, at 12:43, Jan Beulich <jbeulich@xxxxxxxx> wrote:
> 
> On 30.04.2024 13:09, Luca Fancellu wrote:
>> --- a/xen/include/xen/kernel.h
>> +++ b/xen/include/xen/kernel.h
>> @@ -54,6 +54,27 @@
>>         typeof_field(type, member) *__mptr = (ptr);             \
>>         (type *)( (char *)__mptr - offsetof(type,member) );})
>> 
>> +/**
>> + * __struct_group() - Create a mirrored named and anonyomous struct
>> + *
>> + * @TAG: The tag name for the named sub-struct (usually empty)
>> + * @NAME: The identifier name of the mirrored sub-struct
>> + * @ATTRS: Any struct attributes (usually empty)
>> + * @MEMBERS: The member declarations for the mirrored structs
>> + *
>> + * Used to create an anonymous union of two structs with identical layout
>> + * and size: one anonymous and one named. The former's members can be used
>> + * normally without sub-struct naming, and the latter can be used to
>> + * reason about the start, end, and size of the group of struct members.
>> + * The named struct can also be explicitly tagged for layer reuse, as well
>> + * as both having struct attributes appended.
>> + */
>> +#define __struct_group(TAG, NAME, ATTRS, MEMBERS...) \
>> +    union { \
>> +        struct { MEMBERS } ATTRS; \
>> +        struct TAG { MEMBERS } ATTRS NAME; \
>> +    } ATTRS
> 
> Besides my hesitance towards having this construct, can you explain why
> ATTR needs using 3 times, i.e. also on the wrapping union?

The original commit didn’t have the third ATTRS, but afterwards it was 
introduced due to
this:

https://patchwork.kernel.org/project/linux-wireless/patch/20231120110607.98956-1-dmantipov@xxxxxxxxx/#25610045

Now, I have to say that for the Origin tag I used the SHA of the commit 
introducing the macro
and the SHA doing this modification is different, how are these cases handled?

Cheers,
Luca



 


Rackspace

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