From nobody Mon Feb 27 18:15:49 2023 X-Original-To: dev-commits-src-all@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 4PQTFd6ZGXz3vRPh; Mon, 27 Feb 2023 18:15:49 +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 4PQTFd4s0Pz3wpp; Mon, 27 Feb 2023 18:15:49 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677521749; 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=y3MHPFegr4odxvIeb+e6a7YKH0XsiOjdfpsYNGdxa7c=; b=JcTFW+WrcQEZw7IlSNXsjqFOdOJUA82Zp63aiiLOBhDkgAplRmM0HSD/TzrJk9DNgVGUCx Ts61BICW1yH6JGR+YgM1HuNa916dpW2q7Lerqnrw/mf3hedvognhDoHeQIXXDCpsx6Vn5x i2rIg9dRdp3nkqQo6VQerimrwVm/JIesIEF6oQTY5FQmaw3dJIyXm+fR4RL081Jsdu5jNu nvNHC8KZWD0EZQdrOnMRmZrHGfYg+8dJrKXS0UW8NzzTWlrib51v3GzBBFdMzAZwbQk5yM 0B+D6ok2ROOVa0vXBkYucgwhOajVgvy4yFSgLclVZjy63AOaTWofaxSALu1HCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677521749; 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=y3MHPFegr4odxvIeb+e6a7YKH0XsiOjdfpsYNGdxa7c=; b=K5lWZUZRzpvsmqtyXoHQO6VmX5zYXaRtAscA2dS8ZBzJhUfGBqa9ZkaBhKiEkdjMx/2T9h MBLv/9wnMtlgD64Rm0eqiBFVLuH6Zhc0OXVXf52nmktwnvSv2iLIGi9ULDV8nzBbwqxr19 xDyKknZBCsnP8Wxspva6C0EvokTXB/dh985nOAb49UjTdJfRxv43WbLCRcpuejxjBxEZNb tcdB+KRBsYPn5zf7vnk2ZmJUTdNT4rakfN/sdP/J7qHyrllhNABTF+nxicr2fQlDKSLpp1 LPlrMu6foPAoEBgSyGYTO1ZyH22/2TC5qZ5qK6u332kmAohBFVD6EJ6aqJBamQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1677521749; a=rsa-sha256; cv=none; b=d/7JjoMDm4iOXI4MxA8kXcGG2A3RKUuBY1I5E1nv1O8sLHa3dd+yys7Qdyyczpkta+EaBb /CSGr29JWtkRf1rPIaNDTOkZT8LxHj0fWzBtUtRoebWtMFu6SkYFd9ba6YBqKcotWP00sh 8gWJa7DlKiWEb4ulG5JaP6EgIlIgngu04S+l9CZpArKtsZ6kW77s5N3pKfemNfwPe+hsU1 N+sdwIEFRdu1Hmaxp6AeXT8HiKS2nGpz9pOVXvuGgZ+/SxYi4KlcWtCs4Tb0SHCWzHb//h 8h5pWFQesVkj75PMXEiWo9CG7Y1fYqDfswf9P2YvQ8TJHHTiiYehiC17NKG3eA== 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 4PQTFd3yhSzbby; Mon, 27 Feb 2023 18:15:49 +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 31RIFnRK033738; Mon, 27 Feb 2023 18:15:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31RIFnL2033737; Mon, 27 Feb 2023 18:15:49 GMT (envelope-from git) Date: Mon, 27 Feb 2023 18:15:49 GMT Message-Id: <202302271815.31RIFnL2033737@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dmitry Chagin Subject: git: 8fd0f86abdfa - releng/13.2 - linux(4): Move use_real_names knob to the linux.c List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.2 X-Git-Reftype: branch X-Git-Commit: 8fd0f86abdfa8b98facb22649cb03545d0cf0df6 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch releng/13.2 has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=8fd0f86abdfa8b98facb22649cb03545d0cf0df6 commit 8fd0f86abdfa8b98facb22649cb03545d0cf0df6 Author: Dmitry Chagin AuthorDate: 2023-02-14 14:46:32 +0000 Commit: Dmitry Chagin CommitDate: 2023-02-27 18:15:25 +0000 linux(4): Move use_real_names knob to the linux.c MI linux.[c|h] are the module independent in terms of the Linux emulation layer (ie, intended for both ISA - 32 & 64 bit), analogue of MD linux.h. There must be a code here that cannot be placed into the corresponding by common sense MI source and header files, i.e., code is machine independent, but ISA dependent. For the use_real_names knob, the code must be placed into the linux_socket.[c|h], however linux_socket is ISA dependent. Approved by: re (cperciva) MFC after: 2 weeks (cherry picked from commit 32fdc75fe7276083d446964055b0de0e29970b7c) (cherry picked from commit 884ea80d4ebbd2d8ff03d56eddc1dc64d49be908) --- sys/compat/linux/linux.c | 12 ++++++++++++ sys/compat/linux/linux.h | 10 ++++++++++ sys/compat/linux/linux_util.c | 15 --------------- sys/compat/linux/linux_util.h | 9 --------- 4 files changed, 22 insertions(+), 24 deletions(-) diff --git a/sys/compat/linux/linux.c b/sys/compat/linux/linux.c index 5351575ed6e1..bf0479b89588 100644 --- a/sys/compat/linux/linux.c +++ b/sys/compat/linux/linux.c @@ -59,6 +59,11 @@ __FBSDID("$FreeBSD$"); CTASSERT(LINUX_IFNAMSIZ == IFNAMSIZ); +static bool use_real_ifnames = false; +SYSCTL_BOOL(_compat_linux, OID_AUTO, use_real_ifnames, CTLFLAG_RWTUN, + &use_real_ifnames, 0, + "Use FreeBSD interface names instead of generating ethN aliases"); + static int bsd_to_linux_sigtbl[LINUX_SIGTBLSZ] = { LINUX_SIGHUP, /* SIGHUP */ LINUX_SIGINT, /* SIGINT */ @@ -726,3 +731,10 @@ bsd_to_linux_poll_events(short bev, short *lev) *lev = bits; } + +bool +linux_use_real_ifname(const struct ifnet *ifp) +{ + + return (use_real_ifnames || !IFP_IS_ETH(ifp)); +} diff --git a/sys/compat/linux/linux.h b/sys/compat/linux/linux.h index 40e563014fde..a8cdab07a70b 100644 --- a/sys/compat/linux/linux.h +++ b/sys/compat/linux/linux.h @@ -286,6 +286,16 @@ struct l_statx { ktrstruct("l_sigset_t", (s), l) #endif +/* + * Criteria for interface name translation + */ +#define IFP_IS_ETH(ifp) ((ifp)->if_type == IFT_ETHER) +#define IFP_IS_LOOP(ifp) ((ifp)->if_type == IFT_LOOP) + +struct ifnet; + +bool linux_use_real_ifname(const struct ifnet *); + void linux_netlink_register(void); void linux_netlink_deregister(void); diff --git a/sys/compat/linux/linux_util.c b/sys/compat/linux/linux_util.c index e41c505425ee..ad6ad8f26261 100644 --- a/sys/compat/linux/linux_util.c +++ b/sys/compat/linux/linux_util.c @@ -50,10 +50,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include -#include -#include - #include #include @@ -86,11 +82,6 @@ SYSCTL_STRING(_compat_linux, OID_AUTO, emul_path, CTLFLAG_RWTUN, linux_emul_path, sizeof(linux_emul_path), "Linux runtime environment path"); -static bool use_real_ifnames = false; -SYSCTL_BOOL(_compat_linux, OID_AUTO, use_real_ifnames, CTLFLAG_RWTUN, - &use_real_ifnames, 0, - "Use FreeBSD interface names instead of generating ethN aliases"); - /* * Search an alternate path before passing pathname arguments on to * system calls. Useful for keeping a separate 'emulation tree'. @@ -324,9 +315,3 @@ linux_device_unregister_handler(struct linux_device_handler *d) return (EINVAL); } - -bool -linux_use_real_ifname(const struct ifnet *ifp) -{ - return (use_real_ifnames || !IFP_IS_ETH(ifp)); -} diff --git a/sys/compat/linux/linux_util.h b/sys/compat/linux/linux_util.h index 6f7b55be8123..d751267e6d54 100644 --- a/sys/compat/linux/linux_util.h +++ b/sys/compat/linux/linux_util.h @@ -120,15 +120,6 @@ int linux_vn_get_major_minor(const struct vnode *vn, int *major, int *minor); char *linux_get_char_devices(void); void linux_free_get_char_devices(char *string); -/* - * Criteria for interface name translation - */ -#define IFP_IS_ETH(ifp) ((ifp)->if_type == IFT_ETHER) -#define IFP_IS_LOOP(ifp) ((ifp)->if_type == IFT_LOOP) - -struct ifnet; -bool linux_use_real_ifname(const struct ifnet *ifp); - #if defined(KTR) #define KTR_LINUX KTR_SUBSYS