From patchwork Tue Oct 10 15:52:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Volodymyr Babchuk X-Patchwork-Id: 9996659 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 8214A60216 for ; Tue, 10 Oct 2017 15:59:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 74051204FB for ; Tue, 10 Oct 2017 15:59:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 68AD224B5B; Tue, 10 Oct 2017 15:59:25 +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=-4.1 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id CD9E022638 for ; Tue, 10 Oct 2017 15:59:23 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e1wu7-0003LG-UA; Tue, 10 Oct 2017 15:57:11 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e1wu6-0003Kr-NL for xen-devel@lists.xen.org; Tue, 10 Oct 2017 15:57:10 +0000 Received: from [85.158.137.68] by server-4.bemta-3.messagelabs.com id 15/BA-20448-5DDECD95; Tue, 10 Oct 2017 15:57:09 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA1VSa0gUYRT1m9ndGWVXxlXztmnURir5SLNATUS iH2UIFhQZQs7auLOwD51ZQ4PCqEAlUVSsLFDTH2FatD7DBB9YpqWWSyJqiSylppJKpK1QM85q 9v063z3n3nMuXBJX31ZoSCbHynBm2qhVeMjYw1h8mH1xMiWi901sdN1yrSwBnerrcGLJ6JLcY NZZctLkbNXPGSJzeldOXduiIg91eRUid1JG3cTh3nR6IfIg1VQRBl8bBjGRUFPp0LoyJhexgj oKz6qGCRH7UHvg0+ooEhtwagGDxUmnQiS8qURoKHcImBSmHoSVMqVYVgnlxoknmxKg9sL4UAE uYnfqDAw+niEkr0SoWV7FJL0XvH3gkIkYpwC6Z2dxqXc/THePbPoCVYbAXuVwNQdBp3PBJQqA vvePZBJOAltji0JqqEZQOPYDlz63CBizd7g6QmHd0bKJEZUKtuYCl8U3BQx/WXeJYmB5bc21Q yZMdvW4Jo3I4eXzViQR/rBUk+/yq5BDU/8HJAVMg6U/Tkwi2pTwYmCOkD4FBDTZ+ogSFFS5Y/ XKHatXI6weBfMMd5XhwiKPhes4g561mmiDMSwyIircxPA8rWeMtI4PT7eYbEi4BTfhtaOGttM 9aDeJaX1VxXOTKWpPneVKLkvz7GUu28jwPcifJLWgmlkQOC+O0TM5GQajcFBbNJBKrY+KE05K reIzaRNv0EvUAIoiS2vtGxiZPz61gallZouZ0fipYkQpJUrZbPP2oK3j/IgCNN4qJERTKzMZz mSw/s/PIz8Sab1VlWIepcFs3fabF6JgQhTfjM0oVvofpclDsQWhRsfJs0n+zuuaqOh4/+qEZO 1v7Z2i1N5f3RdTYtiukn3Fd0NflyJLV3/9VFDguZKwClOCx9Pvx181B0/nh1yzVwyUV2dZa3z 5wHD9Ecv9xBsPYw987h/tjlxqn5gY8pxRdOZm6LIuVLFpleYTIecJuhR7l4VjcUFucePDhFbG s3TkIZzj6b+0qnzjlwMAAA== X-Env-Sender: Volodymyr_Babchuk@epam.com X-Msg-Ref: server-8.tower-31.messagelabs.com!1507651028!109704504!1 X-Originating-IP: [104.47.2.62] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 51775 invoked from network); 10 Oct 2017 15:57:08 -0000 Received: from mail-db5eur01on0062.outbound.protection.outlook.com (HELO EUR01-DB5-obe.outbound.protection.outlook.com) (104.47.2.62) by server-8.tower-31.messagelabs.com with AES256-SHA256 encrypted SMTP; 10 Oct 2017 15:57:08 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=EPAM.onmicrosoft.com; s=selector1-epam-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=7LCIGWhrHcFJgF9UGL0iNAYQEfaSyEeWg4y8ixgRx0c=; b=MDMF0AaUa/6nd3VVTcMxuo/oz5K6J4x2I13cPWWmx6NZD5V/1Pp2z96ijU6y8mpqU4UVmKMW1rxqjWabhk8M8aoFIogi8D6Ld9nvK6EouUGznfPmUl7NhITCXQJm0MR2TviJSdfzQyBQ5eYX6+6BinhUNeTG8yFu7jgjkQA+HsA= Received: from EPUAKYIW2556.kyiv.epam.com (85.223.209.56) by DB6PR0301MB2133.eurprd03.prod.outlook.com (2603:10a6:4:46::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.77.7; Tue, 10 Oct 2017 15:57:05 +0000 Received: by EPUAKYIW2556.kyiv.epam.com (sSMTP sendmail emulation); Tue, 10 Oct 2017 18:57:00 +0300 From: Volodymyr Babchuk To: xen-devel@lists.xen.org Date: Tue, 10 Oct 2017 18:52:44 +0300 Message-Id: <1507650771-16631-5-git-send-email-volodymyr_babchuk@epam.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1507650771-16631-1-git-send-email-volodymyr_babchuk@epam.com> References: <1507650771-16631-1-git-send-email-volodymyr_babchuk@epam.com> MIME-Version: 1.0 X-Originating-IP: [85.223.209.56] X-ClientProxiedBy: HE1PR07CA0020.eurprd07.prod.outlook.com (2603:10a6:7:67::30) To DB6PR0301MB2133.eurprd03.prod.outlook.com (2603:10a6:4:46::15) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e7b2acf2-74b3-448a-7847-08d50ff78e80 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017030254152)(2017052603199)(201703131423075)(201703031133081)(201702281549075); SRVR:DB6PR0301MB2133; X-Microsoft-Exchange-Diagnostics: 1; DB6PR0301MB2133; 3:H59i90f5xrbJkWMKmN3rBlG8nvpa0o/qYzeYzVHrP6khV3FPDeEwJYjD3ec9e1eGgUtg6IELJnfBtqnqZSqBYkimbD68O4vCVt9iovCbdHDqBYS5nEU8Lfl+L+8hgCPQCNK4KDsptIgVN9UdkepTF+cIxCb3VsNggInDfzypmMizW4Paz7//tf2FlS98QQiGLmWNmS7mJfsY2WIVcYOEghokzu0yGo7TA5NeZlM2l1QdqWHNxkPjvcKGl5gLY1Pn; 25:GmgweDcBy5nFfNFlL6CnYQKXLvDwg4lnljv+TIyqIXmaHPq693eCl09Uqr2Nl52bUX47DfakEQ8xrzB31Dq3rF4uYRnAB19n3zFqa7eH4OtYfOElxSvWMfkiL11RRa9i+cHe0Y+GRglf0pOpGRw6QvGQLm0HsQXQ/WRXSFtZW+SMcfH4xixNum4sCGWSdnFykWovrl34PMeEa7pNPbNKW+3rCJpEKzm+7baTJuGT8cy88Q4kqaSg/rxLrZ27MV+TBGdczXD9ONUsup9dEMEiXb9xPoEgY0LfFOTNYx+v7Yhnhkn2HPrYs33NeGIgPB5+xHdQP4QVREEoempTc5xNzQ==; 31:m08ZVNSp1aME8o8S70qn19axR8LaW+pt2dfhRAmVwmG2G9uL10Mhq1AQBN6CNOF0weSbXJGZSsEFRaichy6mRQlMSj4pRPdl/Y9hDGGainJCfoGObL63KoR6eeb8hPu0AkmC0CiLjLwIboaiyeAd5K/B4/HfH8WCK3C/JU1UUEo2r+yikurkTIrb5RAfPrfaaZvxezRD1OCK3Has0BKRzDLp2tBQOi5pzcRW/RI0pBc= X-MS-TrafficTypeDiagnostic: DB6PR0301MB2133: X-Microsoft-Exchange-Diagnostics: 1; DB6PR0301MB2133; 20:B2nsbEuHyC/ms0M7tc74v4FuYuKPS6j7d41Ylws8IEAxRirhagxwmmZZlWkuIWtBwBgnxi0JeZKf/SPOJQpOa46mAq9ZAZ/ka3PopgcZ2aqIKoOiLBLBYWNN8bOl9uawJoLE6gcVzGMb1C/8EvGasup5Oar5ikwGXAZoDCeoMYw5Vie9y1qhkLjCRD6INkW9Acci7OY8O2MIg6HX8MHMnnr1ao6fDa8avBxU2h3yvPv5xEtf310gHZwTTzLp8gQZMvWqntIzH1cxfg8AcLwhnMkjKLr9fQ3UVFpW4zwynADAstbvMg5jUmDlpgHJVl0LLjciyUEYoGFdUMiXvkinERVFFFTF4b6wRmfoQ5UL/ZJ02azHWKsH9FGX0+WzsHoAbGMX7OgY1S6qL17DSD736v5zpSVky9LmiB47Yv56BYnIv52bemTUoaveTouK3SdwZlxPiowtra3vOrhbqjcIU3QJD2NzSqg0hokJJQmSVW9m/dzcggI4tFLQeReiXdol; 4:yCS8vzDK9UQDxiWwrK8wafWapC/An/nkkjjS2P+IcyvzV/1UyGph8RRwfIz3e4sGOaRZ4IntC6OPssfw8hY2tbOK6Czw+vjn0UHXojmXwwz9uduzSAnbiHKLgJzJanXdrXcBPjxDHOfNNZiMW8nUqAnXZ4CyMiBIh9xBqwPNzTKQkRO1lnnzHrs6KI2zK3TLfGfAbSBpoHvGqfTWP2cAItfwWKoqyxoZEcRcbx+0lEft1FcrmPyWtELJhmmVoV/ZaHjwYtRxC6EISYR1251NdSeBOwB1u9YT27v1GJnolRo= X-Exchange-Antispam-Report-Test: UriScan:(4114951738403); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(5005006)(8121501046)(10201501046)(100000703101)(100105400095)(3002001)(93006095)(93001095)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123558100)(20161123555025)(20161123560025)(20161123564025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:DB6PR0301MB2133; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:DB6PR0301MB2133; X-Forefront-PRVS: 04569283F9 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(346002)(376002)(189002)(199003)(6916009)(50986999)(66066001)(2950100002)(76176999)(106356001)(5003940100001)(47776003)(305945005)(105586002)(8676002)(33646002)(7736002)(4326008)(101416001)(2351001)(81166006)(189998001)(2906002)(8936002)(72206003)(86362001)(36756003)(81156014)(97736004)(80792005)(68736007)(6116002)(3846002)(2361001)(54906003)(478600001)(5660300001)(42186006)(50466002)(316002)(48376002)(16586007)(45080400002)(6666003)(122856001)(53936002)(8666007)(50226002); DIR:OUT; SFP:1101; SCL:1; SRVR:DB6PR0301MB2133; H:EPUAKYIW2556.kyiv.epam.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: epam.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DB6PR0301MB2133; 23:7ukNs99WoVtx7JStSBN7IXF9a8dwAVhKJwS6qfe?= =?us-ascii?Q?HGvbDN17eWGB70HX2T5mQI5ZaxuFWjEeTjEr9Kzq6i1wzSl5QBni0nMx5u/Z?= =?us-ascii?Q?x0GgPEn5JTqvRz27KO8BWYjz/vgyt5C+DFsh/J17QhUTjik4iEhg1oH0rINc?= =?us-ascii?Q?3cXCRiaWxGqC8O8RlnmU0IXTQ0t+XF5e6HZfsxg7eBtjShaKn0s+ThQXrnQn?= =?us-ascii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qjs+PIKf0d82JLignLvOp?= =?us-ascii?Q?8YBebxV8X0MmwHpFrbmYkHi8HN73TI7gpev4b3IGksN+Bln2VIzSxuQ=3D?= =?us-ascii?Q?=3D?= X-Microsoft-Exchange-Diagnostics: 1; DB6PR0301MB2133; 6:poBy9dXrXKWj5rZJw3diNFyAMC2ZrxrlI/OjcqagKCtKMf+5RFfze/xWVf7wKTLpTfw5yM62B4gc95NqM7ooaPK68c0w/5quVDZkhc0VjDhHWm0DVMOzUuyMptUWY4h8N4iimvWOENvuoC3sqImWq3CcGW+16fJMxbUOsOFmXuabOU2+3eP4LS0rzdzFDBCTSTbynXN7z3PL1ZJYQK5mV8Gbr2cSs33rvwBspGdW17jvXSChWsxbQ5ah9a4DY6nt20Us2tRnbtEDOID2RaiFUaw8wXW/1ZiPH1ykjjys5zOEy3OrtF1yJ68XpOU0qr4IQUh9WyyKBEI0E+OFOtr1sA==; 5:G8obv3aG/6+c+7odDPjxzr+Om5UPPlRq/DwhnHCacU3dH04Sejt16cy4j15A0rarImYY3VEESA17zZ1g3z19muqj0+ednxQUBa4pz+Q8irzB1XVFpbYc2k/pbsFh6E1vwbIVS36BmI+JEuSY73rbDQ==; 24:CyovoIk7pqKsxPO+tTRLur4/KoAYoBVDfUvkLyq2ltd0IHpmvBS8Ho8L5qDOWVOp7v1o0yNaCZsU9Bn/z1kr3/8aOSmQhqa0zKydfC5NpeU=; 7:7ns99eTXW0kBMHmNghfsMexEsaMO6w69qBj2VWaSZ8DXMjRo13/GdqFcI1kH4sbjzs4We6OK9dYriQEuEewgZh45Nxe1SsqgfdVuAIiynqYmDJx5P5TxYcckrCzHBFheE+Quag1whGsp1rFhRedeOaGEZx8U8OyM9oYffgzNx5lKycap9ReeHa562PEVL2eO5T+J4s9B2s3iwBxIIqrrRlmbl16CzgkjCIM1kniM6qo= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: epam.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Oct 2017 15:57:05.1790 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: b41b72d0-4e9f-4c26-8a69-f949f367c91d X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0301MB2133 Cc: Stefano Stabellini , Wei Liu , Konrad Rzeszutek Wilk , George Dunlap , Tim Deegan , Ian Jackson , Julien Grall , Jan Beulich , Volodymyr Babchuk Subject: [Xen-devel] [PATCH v8 04/11] public: xen.h: add definitions for UUID handling X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Added type xen_uuid_t. This type represents UUID as an array of 16 bytes in big endian format. Added macro XEN_DEFINE_UUID that constructs UUID in the usual way: XEN_DEFINE_UUID(0x00112233, 0x4455, 0x6677, 0x8899, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff) will construct UUID 00112233-4455-6677-8899-aabbccddeeff presented as {0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff} NB: We define a new structure here rather than re-using EFI_GUID. EFI_GUID uses a Microsoft-style encoding which, among other things, mixes little-endian and big-endian. The structure defined in this patch, unlike EFI_GUID, is compatible with the Linux kernel and libuuid. Signed-off-by: Volodymyr Babchuk --- * Changed commit message ("NB:" part). Thanks to George Dunlap for suggestion. --- xen/include/public/xen.h | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/xen/include/public/xen.h b/xen/include/public/xen.h index 2ac6b1e..1a6255f 100644 --- a/xen/include/public/xen.h +++ b/xen/include/public/xen.h @@ -930,6 +930,39 @@ __DEFINE_XEN_GUEST_HANDLE(uint16, uint16_t); __DEFINE_XEN_GUEST_HANDLE(uint32, uint32_t); __DEFINE_XEN_GUEST_HANDLE(uint64, uint64_t); +typedef struct +{ + uint8_t a[16]; +} xen_uuid_t; + +/* + * XEN_DEFINE_UUID(0x00112233, 0x4455, 0x6677, 0x8899, + * 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff) + * will construct UUID 00112233-4455-6677-8899-aabbccddeeff presented as + * {0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, + * 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff}; + * + * NB: This is compatible with Linux kernel and with libuuid, but it is not + * compatible with Microsoft, as they use mixed-endian encoding (some + * components are little-endian, some are big-endian). + */ +#define XEN_DEFINE_UUID_(a, b, c, d, e1, e2, e3, e4, e5, e6) \ + {{((a) >> 24) & 0xFF, ((a) >> 16) & 0xFF, \ + ((a) >> 8) & 0xFF, ((a) >> 0) & 0xFF, \ + ((b) >> 8) & 0xFF, ((b) >> 0) & 0xFF, \ + ((c) >> 8) & 0xFF, ((c) >> 0) & 0xFF, \ + ((d) >> 8) & 0xFF, ((d) >> 0) & 0xFF, \ + e1, e2, e3, e4, e5, e6}} + +/* Compound literals are supported in C99 and later. */ +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L +#define XEN_DEFINE_UUID(a, b, c, d, e1, e2, e3, e4, e5, e6) \ + (xen_uuid_t)XEN_DEFINE_UUID_(a, b, c, d, e1, e2, e3, e4, e5, e6) +#else +#define XEN_DEFINE_UUID(a, b, c, d, e1, e2, e3, e4, e5, e6) \ + XEN_DEFINE_UUID_(a, b, c, d, e1, e2, e3, e4, e5, e6) +#endif /* defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L */ + #endif /* !__ASSEMBLY__ */ /* Default definitions for macros used by domctl/sysctl. */