From nobody Mon Jun 26 12:08:56 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4QqRTP1p4nz4k6wt; Mon, 26 Jun 2023 12:08:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4QqRTP0gjNz3jtr; Mon, 26 Jun 2023 12:08:57 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1687781337; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=lcXP22bKmEfJp+suO8GJ0/HYEbHAxhCCYCk0EF55tXk=; b=C/uLCDB7SgorQHjN+LXdOHUgUt24/Q0kClbUXIw2H/pvGh9hSQYpImbGu7mj2oZelWsSg+ n1XLeTxOdXnkSPJtp70bMhaAQNnK5CF35uJWXrjoPC3DoG8K8ctWXyuZhjzYfCd0PmWi1o aMtYDY5pYECS42VIXOOMIHJ/9TdAfdXuwi6bYTG4CmHrxEAxzbH1zSPp2S/NMryx15vp9x 0qHqepYYMpX/6OW4zfcq+KcRXUt3mUPr0Vyep8kLuwho2LUn4ZfvbCfTS3G6n06wXoH/vF /ii7z0B3aMW4aqJsL4FiWbF4KPTrMRJ6ku6x7joqGpMmjX1kv8Q9z5aCFN0cgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1687781337; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=lcXP22bKmEfJp+suO8GJ0/HYEbHAxhCCYCk0EF55tXk=; b=m0t4fl8f9B1HnOWRyMKANFKoLkD6AUc/ij2b9iQfarl4tjgGRvRqInJnQ/+RT9Qf2nQBSy vdYBWzbVDoQnR7LIS2EWhrZTyW/+HLG/EVcvOeQHPikryMY1SkRbO4s3m99U0XfqthfdPp HtJS82dsL/5m1a2hpayGrS+RVg6qt27Tkda7gpomFhwEcYDsB3FKj8fRY16le4iUT6k6yj 9blznrNW79FMRxXDsz/6Ce8WNC76Z6hYAXGhwX2LmOQI2OZIecE30KMitXGtSYjH35vXwO +ptUD6eGH5FY+QDjIZIFHtaB84tvceZNyETvazMMgO2EdRdgjWfuDHIMXZ1W3A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1687781337; a=rsa-sha256; cv=none; b=iwavu3m+IEs9ODcRbuEHJkEGOvBoXMwLkx94kKJ3m42rIe9VFOiG8NnPEPyZLj3FudQA+z PuZDsOrFtiNYD8OSH+PLpAbRoFlauPHG6E8VeUE+MeERtIeSLE9c9ohD+0Sya3MRQe8ixM l6n2HC/dKNe0z6rdtjLQVGiyDMtPic1HQEuI8xdUmvNyNQBvPiy52SN9dxvCe9Smj69fiR OLgDZihvBOwXNGbcL3/fYARwI+3WwaTsVnhtOqQYaX58YFGysoMgRENKDhyC5S3rBHp8s6 h1tRYP8NPP51pau/keOaq9MikDMWf/CWEL2NCEIW2mz0r8T60hTm32a6RQ17gQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4QqRTN6tmGz18X2; Mon, 26 Jun 2023 12:08:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 35QC8uYu083478; Mon, 26 Jun 2023 12:08:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 35QC8unc083477; Mon, 26 Jun 2023 12:08:56 GMT (envelope-from git) Date: Mon, 26 Jun 2023 12:08:56 GMT Message-Id: <202306261208.35QC8unc083477@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: bd0b4de28d6b - stable/13 - LinuxKPI: uuid: add guid_gen() and guid_copy() List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: bd0b4de28d6b1fb598b0e2bd5f3713ac427cbda7 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=bd0b4de28d6b1fb598b0e2bd5f3713ac427cbda7 commit bd0b4de28d6b1fb598b0e2bd5f3713ac427cbda7 Author: Bjoern A. Zeeb AuthorDate: 2023-05-23 23:15:12 +0000 Commit: Bjoern A. Zeeb CommitDate: 2023-06-26 09:20:27 +0000 LinuxKPI: uuid: add guid_gen() and guid_copy() Add function used by a wireless driver. Sponsored by: The FreeBSD Foundation Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D40249 (cherry picked from commit c1b6e9121e889608b86530d1a37047797dfeb460) --- sys/compat/linuxkpi/common/include/linux/uuid.h | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/sys/compat/linuxkpi/common/include/linux/uuid.h b/sys/compat/linuxkpi/common/include/linux/uuid.h index 31a018497f78..63b77dd7d0bc 100644 --- a/sys/compat/linuxkpi/common/include/linux/uuid.h +++ b/sys/compat/linuxkpi/common/include/linux/uuid.h @@ -1,7 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (c) 2021 The FreeBSD Foundation + * Copyright (c) 2021,2023 The FreeBSD Foundation * * This software was developed by Björn Zeeb under sponsorship from * the FreeBSD Foundation. @@ -33,6 +33,8 @@ #ifndef _LINUXKPI_LINUX_UUID_H #define _LINUXKPI_LINUX_UUID_H +#include + #define UUID_STRING_LEN 36 #define GUID_INIT(x0_3, x4_5, x6_7, x8, x9, x10, x11, x12, x13, x14, x15) \ @@ -59,4 +61,19 @@ typedef struct { char x[16]; } guid_t; +static inline void +guid_gen(guid_t *g) +{ + + get_random_bytes(g, 16); + g->x[7] = (g->x[7] & 0x0f) | 0x40; + g->x[8] = (g->x[8] & 0x3f) | 0x80; +} + +static inline void +guid_copy(guid_t *dst, const guid_t *src) +{ + memcpy(dst, src, sizeof(*dst)); +} + #endif /* _LINUXKPI_LINUX_UUID_H */