From nobody Tue Feb 14 14:47:19 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 4PGPF34jppz3s2fS; Tue, 14 Feb 2023 14:47:19 +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 4PGPF329RXz46VW; Tue, 14 Feb 2023 14:47:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676386039; 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=QzWarjUAqZIr/Hj3LVVbbwbhUB+izzcq4+zbAgYf7eg=; b=GQNFzzNKqcGse137vRe4U6p/kpRPMFniiF7ix1S8N58+fZxTCJarzRqr1wLScR+8LvL97+ Nx/RjmcHnCgStMlPLTN53NP2mehzHEpYT27qZ+b8yzSJRIu5jniFseFGh6Bt/vv0tT2N5R EOIOWgY2gThwDkE0qIDkaY85pfNnV32Ghhqfl5+Xv9aI3HQ3ZHuNIvyfL8GW5AaXyUK3vj ssW7b8Sdh6J0TiG7mEBDII6yX5d62nVru0AQD3ypMlPxyzdoBKPv1iEKxbe9aVxt9Zg2u8 XKztKg2cte1k0p3aGed6+ciSGFp8k95PkkzQ7FmZBOQwMdyolyOaoLjrIZ+bZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676386039; 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=QzWarjUAqZIr/Hj3LVVbbwbhUB+izzcq4+zbAgYf7eg=; b=Ck06AJjXCYArilsmwojvnesnQVZgQWeAogWPn9dhfiuVKCoUTkqKqvAauUR5fGZWM04QME +Boqsdr+ieDJaXos9qmzcZEoaeC9d2wpJ+n9V0e9ZI/RNkzet1EgYYBJU3z13xtmWtOLDn KKiyDfASBPJnui5O07Z6Og2ZbltK0b7dvsmf5e8i1iMpYP0o25nx8bFy1hVfgZW5D4jYxL 4gdD0vGusHcYNfjICfQHFfuC2qkawHpqdLd2MkKvrFjnJ4BwJOS9Yp1xIggGbGTJhN2TMm OL2Sq8Kk+Dg8WlsMr6mTv1/Op3fxZACzcLucP8aujISgDc8jdsveEOIdKv2kHg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676386039; a=rsa-sha256; cv=none; b=IE5DtlyXDm5lkcqmNWj9V7BDIAcWdbHhW8LNFqHhqUl/73Uq3cfOKtuleZSRzsQyt3HbyE tChTe7jW8XYHkVG3n7UgHqYgT7cqt5CAUJ2iHPZoIQkq9QecwT0cLn1fZppmrj7C/7l7oi 0d7IYYVfw2AG8Tg6yXq/+JRXbtycA6XPSq5vdvsFpF2VoWTOVHUi/s/j0q9EO+PmltsbOS 2MXJb1HUPdSDRcbr72e77pbPSzKJZ7ecE+b2R1aubwJSeD5/dDqnZ6pu7NigcY/5VpLPbO /AG0tc2ePFCgWPpwh9a2zGcRrEc2bSEIXkQBsSeRdJ7yt2sQAPQVORV3Lg7y4Q== 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 4PGPF31Gytz12mh; Tue, 14 Feb 2023 14:47:19 +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 31EElJ52072435; Tue, 14 Feb 2023 14:47:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31EElJkP072434; Tue, 14 Feb 2023 14:47:19 GMT (envelope-from git) Date: Tue, 14 Feb 2023 14:47:19 GMT Message-Id: <202302141447.31EElJkP072434@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dmitry Chagin Subject: git: 32fdc75fe727 - main - 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/main X-Git-Reftype: branch X-Git-Commit: 32fdc75fe7276083d446964055b0de0e29970b7c Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=32fdc75fe7276083d446964055b0de0e29970b7c commit 32fdc75fe7276083d446964055b0de0e29970b7c Author: Dmitry Chagin AuthorDate: 2023-02-14 14:46:32 +0000 Commit: Dmitry Chagin CommitDate: 2023-02-14 14:46:32 +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. MFC after: 2 weeks --- 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 1a0459fd3f7b..2208d6cb1b6d 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 */ @@ -723,3 +728,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 cd7e8cd6b3e0..055d8e3b9cf6 100644 --- a/sys/compat/linux/linux.h +++ b/sys/compat/linux/linux.h @@ -284,6 +284,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 4fa460078597..2656bab92171 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 b00a9036d367..37445ad0af27 100644 --- a/sys/compat/linux/linux_util.h +++ b/sys/compat/linux/linux_util.h @@ -113,15 +113,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