Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 14 Feb 2023 14:47:19 GMT
From:      Dmitry Chagin <dchagin@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 32fdc75fe727 - main - linux(4): Move use_real_names knob to the linux.c
Message-ID:  <202302141447.31EElJkP072434@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by dchagin:

URL: https://cgit.FreeBSD.org/src/commit/?id=32fdc75fe7276083d446964055b0de0e29970b7c

commit 32fdc75fe7276083d446964055b0de0e29970b7c
Author:     Dmitry Chagin <dchagin@FreeBSD.org>
AuthorDate: 2023-02-14 14:46:32 +0000
Commit:     Dmitry Chagin <dchagin@FreeBSD.org>
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 <sys/systm.h>
 #include <sys/vnode.h>
 
-#include <net/if.h>
-#include <net/if_var.h>
-#include <net/if_types.h>
-
 #include <machine/stdarg.h>
 
 #include <compat/linux/linux_dtrace.h>
@@ -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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202302141447.31EElJkP072434>