From patchwork Fri Oct 30 18:28:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 11870529 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8E37461C for ; Fri, 30 Oct 2020 18:28:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 76EB820731 for ; Fri, 30 Oct 2020 18:28:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727074AbgJ3S2v (ORCPT ); Fri, 30 Oct 2020 14:28:51 -0400 Received: from mga04.intel.com ([192.55.52.120]:60186 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726077AbgJ3S2v (ORCPT ); Fri, 30 Oct 2020 14:28:51 -0400 IronPort-SDR: 3C5s4ucPbo9rYTQyapsV33TABdQ1TUEkSXgmJ4c+VE0iey1OrZJYWDFhe0332OTBCMvWZQMrvK lEBBuZs3O/PA== X-IronPort-AV: E=McAfee;i="6000,8403,9790"; a="166063596" X-IronPort-AV: E=Sophos;i="5.77,434,1596524400"; d="scan'208";a="166063596" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Oct 2020 11:28:51 -0700 IronPort-SDR: 0k1LPe5KZs0yH1e/dXW1UfC6qY52RWLdNHrnk6rW3n4LNY36BznAZF0Ob2Z+Vzfl/hvwTggbNh 0gzqk+0qzxbA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,434,1596524400"; d="scan'208";a="324163323" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga006.jf.intel.com with ESMTP; 30 Oct 2020 11:28:49 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 4EC8F2A0; Fri, 30 Oct 2020 20:28:48 +0200 (EET) From: Andy Shevchenko To: Christoph Hellwig , linux-kernel@vger.kernel.org, Masahiro Yamada , Michal Marek , linux-kbuild@vger.kernel.org Cc: Andy Shevchenko Subject: [PATCH v1 1/2] modpost: Mark uuid_le type only for MEI Date: Fri, 30 Oct 2020 20:28:46 +0200 Message-Id: <20201030182847.78753-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org The uuid_le type is used only for MEI ABI, do not advertise it for others. Due to above, bury add_uuid() in its only user. Signed-off-by: Andy Shevchenko --- scripts/mod/file2alias.c | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c index 8a438c94dcd9..fefff92b33ef 100644 --- a/scripts/mod/file2alias.c +++ b/scripts/mod/file2alias.c @@ -34,19 +34,22 @@ typedef Elf64_Addr kernel_ulong_t; typedef uint32_t __u32; typedef uint16_t __u16; typedef unsigned char __u8; + typedef struct { __u8 b[16]; } guid_t; -/* backwards compatibility, don't use in new code */ -typedef struct { - __u8 b[16]; -} uuid_le; typedef struct { __u8 b[16]; } uuid_t; + #define UUID_STRING_LEN 36 +/* MEI UUID type, don't use anywhere else */ +typedef struct { + __u8 b[16]; +} uuid_le; + /* Big exception to the "don't include kernel headers into userspace, which * even potentially has different endianness and word sizes, since * we handle those differences explicitly below */ @@ -104,17 +107,6 @@ static inline void add_wildcard(char *str) strcat(str + len, "*"); } -static inline void add_uuid(char *str, uuid_le uuid) -{ - int len = strlen(str); - - sprintf(str + len, "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x", - uuid.b[3], uuid.b[2], uuid.b[1], uuid.b[0], - uuid.b[5], uuid.b[4], uuid.b[7], uuid.b[6], - uuid.b[8], uuid.b[9], uuid.b[10], uuid.b[11], - uuid.b[12], uuid.b[13], uuid.b[14], uuid.b[15]); -} - /** * Check that sizeof(device_id type) are consistent with size of section * in .o file. If in-consistent then userspace and kernel does not agree @@ -1198,12 +1190,16 @@ static int do_mei_entry(const char *filename, void *symval, char *alias) { DEF_FIELD_ADDR(symval, mei_cl_device_id, name); - DEF_FIELD_ADDR(symval, mei_cl_device_id, uuid); + DEF_FIELD(symval, mei_cl_device_id, uuid); DEF_FIELD(symval, mei_cl_device_id, version); sprintf(alias, MEI_CL_MODULE_PREFIX); sprintf(alias + strlen(alias), "%s:", (*name)[0] ? *name : "*"); - add_uuid(alias, *uuid); + sprintf(alias + strlen(alias), "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x", + uuid.b[3], uuid.b[2], uuid.b[1], uuid.b[0], + uuid.b[5], uuid.b[4], uuid.b[7], uuid.b[6], + uuid.b[8], uuid.b[9], uuid.b[10], uuid.b[11], + uuid.b[12], uuid.b[13], uuid.b[14], uuid.b[15]); ADD(alias, ":", version != MEI_CL_VERSION_ANY, version); strcat(alias, ":*"); From patchwork Fri Oct 30 18:28:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 11870531 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 698C961C for ; Fri, 30 Oct 2020 18:28:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 51C0F20702 for ; Fri, 30 Oct 2020 18:28:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726077AbgJ3S2y (ORCPT ); Fri, 30 Oct 2020 14:28:54 -0400 Received: from mga02.intel.com ([134.134.136.20]:3920 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727055AbgJ3S2v (ORCPT ); Fri, 30 Oct 2020 14:28:51 -0400 IronPort-SDR: ko+5B3D7zEyrR66axEgY8r8MYoxUBbrNaEl2M2x0QSY7bYC3wyICOv8snYyRyW6+QBjJ19u3Rl zRniMNjAMRJA== X-IronPort-AV: E=McAfee;i="6000,8403,9790"; a="155624555" X-IronPort-AV: E=Sophos;i="5.77,434,1596524400"; d="scan'208";a="155624555" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Oct 2020 11:28:51 -0700 IronPort-SDR: c/tuQDjhSxkSNtt/lxIsliLDe2icssU4CBvniw+CtjTkx7Eghuu5FbQqF5zrOnbbRdBcxEOg6+ z59tUjMOMGZg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,434,1596524400"; d="scan'208";a="425416652" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 30 Oct 2020 11:28:49 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 5ACDF5B; Fri, 30 Oct 2020 20:28:48 +0200 (EET) From: Andy Shevchenko To: Christoph Hellwig , linux-kernel@vger.kernel.org, Masahiro Yamada , Michal Marek , linux-kbuild@vger.kernel.org Cc: Andy Shevchenko Subject: [PATCH v1 2/2] uuid: Make guid_t completely internal type to the kernel Date: Fri, 30 Oct 2020 20:28:47 +0200 Message-Id: <20201030182847.78753-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201030182847.78753-1-andriy.shevchenko@linux.intel.com> References: <20201030182847.78753-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org The guid_t type was defined in UAPI by mistake. Keep it an internal type and leave uuid_le UAPI for it's only user, i.e. MEI. Signed-off-by: Andy Shevchenko Reported-by: kernel test robot --- include/linux/uuid.h | 16 ++++++++++++++-- include/uapi/linux/uuid.h | 14 +++++--------- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/include/linux/uuid.h b/include/linux/uuid.h index 8cdc0d3567cd..a106d51de2f7 100644 --- a/include/linux/uuid.h +++ b/include/linux/uuid.h @@ -8,15 +8,25 @@ #ifndef _LINUX_UUID_H_ #define _LINUX_UUID_H_ -#include #include #define UUID_SIZE 16 +typedef struct { + __u8 b[UUID_SIZE]; +} guid_t; + typedef struct { __u8 b[UUID_SIZE]; } uuid_t; +#define GUID_INIT(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7) \ +((guid_t) \ +{{ (a) & 0xff, ((a) >> 8) & 0xff, ((a) >> 16) & 0xff, ((a) >> 24) & 0xff, \ + (b) & 0xff, ((b) >> 8) & 0xff, \ + (c) & 0xff, ((c) >> 8) & 0xff, \ + (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) }}) + #define UUID_INIT(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7) \ ((uuid_t) \ {{ ((a) >> 24) & 0xff, ((a) >> 16) & 0xff, ((a) >> 8) & 0xff, (a) & 0xff, \ @@ -97,7 +107,9 @@ extern const u8 uuid_index[16]; int guid_parse(const char *uuid, guid_t *u); int uuid_parse(const char *uuid, uuid_t *u); -/* backwards compatibility, don't use in new code */ +/* MEI UUID type, don't use anywhere else */ +#include + static inline int uuid_le_cmp(const guid_t u1, const guid_t u2) { return memcmp(&u1, &u2, sizeof(guid_t)); diff --git a/include/uapi/linux/uuid.h b/include/uapi/linux/uuid.h index e5a7eecef7c3..c3e175f686f4 100644 --- a/include/uapi/linux/uuid.h +++ b/include/uapi/linux/uuid.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* - * UUID/GUID definition + * MEI UUID definition * * Copyright (C) 2010, Intel Corp. * Huang Ying @@ -22,21 +22,17 @@ typedef struct { __u8 b[16]; -} guid_t; +} uuid_le; -#define GUID_INIT(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7) \ -((guid_t) \ +#define UUID_LE(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7) \ +((uuid_le) \ {{ (a) & 0xff, ((a) >> 8) & 0xff, ((a) >> 16) & 0xff, ((a) >> 24) & 0xff, \ (b) & 0xff, ((b) >> 8) & 0xff, \ (c) & 0xff, ((c) >> 8) & 0xff, \ (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) }}) -/* backwards compatibility, don't use in new code */ -typedef guid_t uuid_le; -#define UUID_LE(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7) \ - GUID_INIT(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7) #define NULL_UUID_LE \ UUID_LE(0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, \ - 0x00, 0x00, 0x00, 0x00) + 0x00, 0x00, 0x00, 0x00) #endif /* _UAPI_LINUX_UUID_H_ */