From patchwork Tue Oct 10 19:05:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Volodymyr Babchuk X-Patchwork-Id: 9997103 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 0A458603B5 for ; Tue, 10 Oct 2017 19:09:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EE0F428722 for ; Tue, 10 Oct 2017 19:09:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E2B4828743; Tue, 10 Oct 2017 19:09:03 +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 CACFD28722 for ; Tue, 10 Oct 2017 19:09:02 +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 1e1zr1-0005Rl-7J; Tue, 10 Oct 2017 19:06:11 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e1zr0-0005Rf-78 for xen-devel@lists.xen.org; Tue, 10 Oct 2017 19:06:10 +0000 Received: from [85.158.139.211] by server-9.bemta-5.messagelabs.com id F1/20-26618-12A1DD95; Tue, 10 Oct 2017 19:06:09 +0000 X-Br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ref: server-10.tower-206.messagelabs.com!1507662368!77948816!1 X-Originating-IP: [40.107.4.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 20994 invoked from network); 10 Oct 2017 19:06:08 -0000 Received: from mail-eopbgr40062.outbound.protection.outlook.com (HELO EUR03-DB5-obe.outbound.protection.outlook.com) (40.107.4.62) by server-10.tower-206.messagelabs.com with AES256-SHA256 encrypted SMTP; 10 Oct 2017 19:06: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=wID5FT8MtOf5Dz11P4SwFxDnHfYo99bpWQ1b4McGMpI=; b=WltbbdhZnZOcNv8v3/YZ8KORD4cs73m+n0glAjHrqpialoB579jmwIvDkzYwd9LKLZqBZu8LAPc2U6iBAoDFoidaXh3yRx3eLzViptJhTY3lItJvZSUn5824x0W3t2Pp41wm6Pc+ZgzyzsHScGWKoT42HPffvpHgjtfsuOMIKKo= Received: from EPUAKYIW2556.kyiv.epam.com (85.223.209.58) by AM4PR0301MB2131.eurprd03.prod.outlook.com (2603:10a6:200:4d::16) 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 19:06:04 +0000 Received: by EPUAKYIW2556.kyiv.epam.com (sSMTP sendmail emulation); Tue, 10 Oct 2017 22:06:00 +0300 From: Volodymyr Babchuk To: xen-devel@lists.xen.org Date: Tue, 10 Oct 2017 22:05:48 +0300 Message-Id: <1507662348-12963-1-git-send-email-volodymyr_babchuk@epam.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <59DD0D820200007800184742@prv-mh.provo.novell.com> References: <59DD0D820200007800184742@prv-mh.provo.novell.com> MIME-Version: 1.0 X-Originating-IP: [85.223.209.58] X-ClientProxiedBy: DB3PR0202CA0017.eurprd02.prod.outlook.com (2603:10a6:8:1::30) To AM4PR0301MB2131.eurprd03.prod.outlook.com (2603:10a6:200:4d::16) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: dd5a184c-74d6-4dd4-b362-08d51011f543 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017030254152)(2017052603199)(201703131423075)(201703031133081)(201702281549075); SRVR:AM4PR0301MB2131; X-Microsoft-Exchange-Diagnostics: 1; AM4PR0301MB2131; 3:Q4U1uJ3RgC9kU4sXpK5VAuSE6T7TPLV2vMnhfEBXn3/02TR0tmTDxpmRQ+CTjMdkcEpSbwo1VqnsooT4qu+4dTFKXcTCzL8XMH67wcqa1kLvNnPR1724A425wWkVNJxvdcPrpmO9wEv2I4q7/o6ZnneV/XHFhv7J09ZhwNYxXHlMk5el1U4vUtvtcbcWBOxY7d+W7cNY2j0yryL1x04zJ3w+zpOYIV/BNkTjcKMcR3KfKO3Gg2Fcc/nGwfISeRnE; 25:m3WWtmKV1SahLMrt6a+QZY2zuLbmvwE2p+9ctMqGR82FrTO9aUDCHwgQoNTsAzbWvaItWtmQcXydPerI3aj4HkMG7pWRTLhf+64vsco9FJW42BIfZXHoa8Qc2AmZnpWXlQMA6YiYero3yfQgeaYYk7TR0V+IWTGF3/si+ZM8H/daFL6f1HAtHJZ1R03b57ragm/AwgBTJ4mpgNhC9FJw/AbbepTiWJObQTABLlGCht8lvQJSKmLuk4CV5WdDws2/fN6JXP4HzKF3/VhshnlVloc4fxM5uh10A8kn0Y3N8uTMIFtoIxs3pQhdKHJZ2YsQoXe5TZ2y+tVAaBD3lMXo0g==; 31:bjQtzkmqYL1c8ls815j68N4uJpLoSh6hfGme/MUyT5h6BYNUJNhulkl7JbMJLz3e3vR3BeDnRWmqGsg+rJ4iNeU15EwsOBiw+5DapF1+cdgJN4s8e+EWx1Aq5YbvWpOgobUNWIVo2iRB3vm3nrZEQnvQeJRw1MCK6fJY7dpMMO4nVV9bELWTRPGa7bUCDKu/Ga62gses3lCkIvOy8OI3ax64djUmKaawjA4CUN5mDUs= X-MS-TrafficTypeDiagnostic: AM4PR0301MB2131: X-Microsoft-Exchange-Diagnostics: 1; AM4PR0301MB2131; 20:utVabXRnkg/iNc3bu4SIfZ0VpRMuvpWzWzv4dSf/76ntMLop4SfXPYrvRz2eMEVGABwk/xqkQaH2LHcE6AgC9Y2pt0W3G7WibzTxaw0uFAwWhRSnGNsdaNDCmusWDlBjbA4vqoFqxHU/aw7vrS1mU5uLkBO9tJvcyYIbzaRC1pQ+cGAJrSccfRQVCqyYfYrhmMAR+n2op2shzq1Djb4e+MwjmbwiC4Cwh7BOfwxVZSaCgNrOGnlW4dhAMnRiITVBTgcluD5McLPdndrvztR9PQV2rQ7w/92JdxkDoGqld5NHhMoNYg7gj3DVmxr+0qadO0SCYAKpeGHdLqjCFvUTzrlDWQirT5Mg+9yDqHmNfvjv9+qAuU8bC32BEF3B9t1BWDHwDpeCWbLOXqkJ0/VcYxEn5/qxhbdm93wRKyK5eTlV9naFUrRC6hiB5IEj4ajxfUL1Cz7DSC6iNyrN3XXvYvjyjNA1PuXzh/4Bt/SHaT6FZGvR63SltvEgFvmiyd2x; 4:CfzliUSPKS3AXXBTqibMu1YBeMTRkMFx3ND9vC57ARwaumFzkH3hS4oinKETgcFDHDhqafLGH+ze4m0Iili+zJi/Ia60WTd1/VsBUhaC+caTkd4cAlx4W693mI3yrh7d/T1CidnuZlnHuNp4p3Om53q5in+8VpoU+wAum1X3iQfTlDlDciJZ/qdl9Z1gi/VYV6jsVxmJYgK8NJrKL/LvbFRbOkBG3bd+KhWLS3Il2xBiJ22r5Toc2I/U9trCSQvEgRBJLg9a3dTH6XEUcWrKRp30oJ+XU0B5UcaekuR1yfk= 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)(8121501046)(5005006)(10201501046)(3002001)(100000703101)(100105400095)(93006095)(93001095)(6041248)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123564025)(20161123562025)(20161123560025)(20161123558100)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:AM4PR0301MB2131; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:AM4PR0301MB2131; X-Forefront-PRVS: 04569283F9 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(376002)(346002)(189002)(199003)(8656003)(7416002)(80792005)(76176999)(122856001)(50986999)(97736004)(8676002)(3846002)(6116002)(66066001)(2351001)(53936002)(6916009)(105586002)(50226002)(33646002)(2950100002)(2361001)(305945005)(47776003)(106356001)(8936002)(81166006)(189998001)(7736002)(8666007)(36756003)(6666003)(68736007)(101416001)(86362001)(81156014)(4326008)(16586007)(54906003)(5003940100001)(478600001)(5660300001)(48376002)(50466002)(316002)(45080400002)(72206003)(42186006)(2906002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM4PR0301MB2131; 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; AM4PR0301MB2131; 23:28VzoYOo1jF0EMQoqIO5wD6nFQpecKlWuA5WYff?= =?us-ascii?Q?7uV/cK/gSIF9Mend0hSOkqx/aRsCrF1LRiRWuEW5g/N1Nsr/k25EM6l9bqx1?= =?us-ascii?Q?qdXkSZ8r8BpUJ42rhMDp2WKlbwOXo7sfSahtEa/uEVISi0jocBfCSJE1vKqS?= =?us-ascii?Q?fGdQyBzBh4Nlj/u4miPFkwm1VfielANXBq/1CD0CKi+o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orOrg: epam.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Oct 2017 19:06:04.6416 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: b41b72d0-4e9f-4c26-8a69-f949f367c91d X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR0301MB2131 Cc: "Edgar E . Iglesias" , Stefano Stabellini , Wei Liu , Konrad Rzeszutek Wilk , George Dunlap , Andrew Cooper , Ian Jackson , Tim Deegan , Julien Grall , Jan Beulich , Volodymyr Babchuk Subject: [Xen-devel] [PATCH v9 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 --- * Fixed code formatting * Added parenthess around (xen_uuid_t)XEN_DEFINE_UUID_(..) --- 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..3d5edc6 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. */