From nobody Mon Jun 26 12:08:55 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 4QqRTN38mxz4k6wn; Mon, 26 Jun 2023 12:08:56 +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 4QqRTM6lgkz3jrj; Mon, 26 Jun 2023 12:08:55 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1687781336; 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=JztP+vtUHSTKuC4H0cRpSm8LBGoIwznQPO7ORgAINJI=; b=wzH7LVUAl2/IPh0Xn+4WukUprUK/jrfAfwWyNUwr7NnxRKajlsrVqb6LkZZqKVzNYmUOEc i2RfiitpcCAnHPPGFt2lux6pjvFI6Mo61PL+3OveBC/+uqw7/p0VNZPny4l4M3bsemYoTX EemAfhJikEUbBdswnvbuABISTeMw+Qt9sa+XR0rkhz+nZImaTsilTXMQ5fT6xohA1Ss0W2 7Ntd3v8WnlPqronTnu84aF5HBQUdmdNmXdpCA7OYlOwamjHG4OgO8dx9SlISPuFYceliSq NKP6CssgyK97Bpcu8Iiy2kd3WIc3roCx3C1xunEuF72ujiqz9Qa6hYFUT22Dug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1687781336; 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=JztP+vtUHSTKuC4H0cRpSm8LBGoIwznQPO7ORgAINJI=; b=Hm1Bb9V65U7071vDhWAEwEYmnpl1cMvz715Sa+xOczEmyN2vt+npgUDF/SCWfne2N28Mb1 UDtF4hNbUmy1f0Fy5yCyBoAUFggKegWSgdiQf3iJ00vD/jWTVJNHGnvhbXLJAKS6QepqkV uN+/eBwO1e5Z2PfjsP6KzxptpxK0H8H9nmJT8zcQw+QTazB4/OTTFHmg6HI7IumyGba2tT 83UvQL6/Qt76aXFQ9+fV2jrzBuX6Bs2OGrK2xYHg8grxjhy/i+0tOLpOCV+JcNzv667uXi LoXicty6lu+sxv9mCUvp3vfMZMRHO9McBp2qxELoTSH5/zttjBq2KYbPWomhlQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1687781336; a=rsa-sha256; cv=none; b=s3ceRUNf2ykAIaO+0c/sRxy48i73Lw1V0O4tYwaC4yLDRLN5JPY9kCESikGvadWiCJtK1c 49S5edlOBICRnwUcKOpLen6Sr03nI0w+1gdhqj6W52rGNr47fyhVPwuqNK0dbWsySdvjyb j/nv4qvqrNOP3NEN73UC7nWpYAlR2h4FjepCS1w/zvJy/iutgyUBMWPf4sn0pXi9V2FpqZ w98uhnZfAMO8KoEMcWTSz+NCCwYn0+qj4ONFgDDkApak2qIeP1nZFiqTTCFhnodCyWaLsF k0GjgquyMkO8bzk1+n236Gm/+34p2UNcdGsVSRaBmefmvO2tc0CcAH+BkW1YbQ== 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 4QqRTM5qs5z17dd; Mon, 26 Jun 2023 12:08:55 +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 35QC8tgh083453; Mon, 26 Jun 2023 12:08:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 35QC8tjI083452; Mon, 26 Jun 2023 12:08:55 GMT (envelope-from git) Date: Mon, 26 Jun 2023 12:08:55 GMT Message-Id: <202306261208.35QC8tjI083452@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: 523d17b26290 - stable/13 - LinuxKPI: add utsname for init_utsname() with release 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: 523d17b262905c8dab686025edc337d91c0f3a86 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=523d17b262905c8dab686025edc337d91c0f3a86 commit 523d17b262905c8dab686025edc337d91c0f3a86 Author: Bjoern A. Zeeb AuthorDate: 2023-05-23 23:12:47 +0000 Commit: Bjoern A. Zeeb CommitDate: 2023-06-26 09:20:21 +0000 LinuxKPI: add utsname for init_utsname() with release A wireless dirver is requesting release from the result of init_utsname(). Populate the field on startup. Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D40248 (cherry picked from commit ad513b4dba3e330b6f2714bdde4d864898c4222e) --- sys/compat/linuxkpi/common/include/linux/utsname.h | 51 ++++++++++++++++++++++ sys/compat/linuxkpi/common/src/linux_compat.c | 4 ++ 2 files changed, 55 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/utsname.h b/sys/compat/linuxkpi/common/include/linux/utsname.h new file mode 100644 index 000000000000..1f7f4b7f4289 --- /dev/null +++ b/sys/compat/linuxkpi/common/include/linux/utsname.h @@ -0,0 +1,51 @@ +/*- + * Copyright (c) 2023 Bjoern A. Zeeb + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _LINUXKPI_LINUX_UTSNAME_H +#define _LINUXKPI_LINUX_UTSNAME_H + +#include +#include + +struct _utsname { + char release[OSRELEASELEN]; +}; + +struct uts_namespace { + struct _utsname name; +}; + +extern struct uts_namespace init_uts_ns; + +static inline struct _utsname * +init_utsname(void) +{ + + return &init_uts_ns.name; +} + +#endif /* _LINUXKPI_LINUX_UTSNAME_H */ diff --git a/sys/compat/linuxkpi/common/src/linux_compat.c b/sys/compat/linuxkpi/common/src/linux_compat.c index 4ceb33c348f6..dce3cdcc2de3 100644 --- a/sys/compat/linuxkpi/common/src/linux_compat.c +++ b/sys/compat/linuxkpi/common/src/linux_compat.c @@ -83,6 +83,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -139,6 +140,7 @@ struct class linux_class_misc; struct list_head pci_drivers; struct list_head pci_devices; spinlock_t pci_lock; +struct uts_namespace init_uts_ns; unsigned long linux_timer_hz_mask; @@ -2815,6 +2817,8 @@ linux_compat_init(void *arg) */ for (i = 0; i < MAXCPU; i++) CPU_SET(i, &static_single_cpu_mask[i]); + + strlcpy(init_uts_ns.name.release, osrelease, sizeof(init_uts_ns.name.release)); } SYSINIT(linux_compat, SI_SUB_DRIVERS, SI_ORDER_SECOND, linux_compat_init, NULL);