diff options
Diffstat (limited to 'vmnet.patch')
-rw-r--r-- | vmnet.patch | 139 |
1 files changed, 133 insertions, 6 deletions
diff --git a/vmnet.patch b/vmnet.patch index cfec7bad9d5b..6095bd3ea237 100644 --- a/vmnet.patch +++ b/vmnet.patch @@ -1,6 +1,6 @@ --- a/vmnet/Makefile +++ b/vmnet/Makefile -@@ -43,7 +43,11 @@ INCLUDE += -I$(SRCROOT)/shared +@@ -43,7 +43,11 @@ endif @@ -140,7 +140,7 @@ #endif /* __COMPAT_NETDEVICE_H__ */ --- a/vmnet/driver.c +++ b/vmnet/driver.c -@@ -279,7 +279,7 @@ VNetRemovePortFromList(const VNetPort *port) // IN: port to remove from list +@@ -279,7 +279,7 @@ /* *---------------------------------------------------------------------- * @@ -149,7 +149,7 @@ * * linux module entry point. Called by /sbin/insmod command. * Initializes module and Registers this driver for a -@@ -296,7 +296,7 @@ VNetRemovePortFromList(const VNetPort *port) // IN: port to remove from list +@@ -296,7 +296,7 @@ */ int @@ -158,7 +158,7 @@ { int retval; -@@ -358,7 +358,7 @@ init_module(void) +@@ -358,7 +358,7 @@ /* *---------------------------------------------------------------------- * @@ -167,7 +167,7 @@ * * Called by /sbin/rmmod. Unregisters this driver for a * vnet major #, and deinitializes the modules. The 64-bit -@@ -375,7 +375,7 @@ init_module(void) +@@ -375,7 +375,7 @@ */ void @@ -176,7 +176,7 @@ { unregister_chrdev(VNET_MAJOR_NUMBER, "vmnet"); VNetProtoUnregister(); -@@ -1705,3 +1705,5 @@ MODULE_LICENSE("GPL v2"); +@@ -1705,3 +1705,5 @@ * by default (i.e., neither mkinitrd nor modprobe will accept it). */ MODULE_INFO(supported, "external"); @@ -594,3 +594,130 @@ Fixing VMWare Player on Linux when using DHCP addresses: https://www.nikhef.nl/~ if (count < n) { n = count; } +From add7a6d8b99565fdfa79098315b0a69fd244eda3 Mon Sep 17 00:00:00 2001 +From: Michal Kubecek <mkubecek@suse.cz> +Date: Fri, 12 Jan 2024 08:30:33 +0100 +Subject: [PATCH] modules: fix build with -Wmissing-prototypes + +Mainline commit 0fcb70851fbf ("Makefile.extrawarn: turn on +missing-prototypes globally") in 6.8-rc1 enables -Wmissing-prototypes +globally, revealing a lot of unclean code and also some actual problems. +This is also the case in vmmon and vmnet modules. + +Most of them are addressed by making functions used only within one file +static. A special case are Vmx86_MapPage() and Vmx86_UnmapPage() which were +defined since Workstation 14.0.0 but they are not actually used anywhere +until 15.0.0 so that dropping them seems to be the best option. + +The missing prototype of random_get_entropy_fallback() is handled by +including <linux/timex.h> rather than <asm/timex.h>. + +Finally, there are four functions in vmnet module which are actually used +in multiple files but instead of proper declarations, their prototype is +duplicated in vmnet-only/driver.c, risking that the two copies won't match +(which actually happened in one case). The cleanest solution would be +creating separate header files for them (bridge.h, netif.h, userif.h and +vnetUserListener.h) and including them in the respective source file and +driver.c. As the developers already handle similar cases by simply putting +the declarations into vnetInt.h, let us do the same to keep things simple. +--- + vmmon-only/bootstrap/monLoaderVmmon.c | 1 + + vmmon-only/common/vmx86.c | 50 +-------------------------- + vmmon-only/linux/driver.c | 4 +-- + vmmon-only/linux/hostif.c | 6 ++-- + vmnet-only/bridge.c | 2 +- + vmnet-only/driver.c | 16 ++------- + vmnet-only/vnetInt.h | 7 ++++ + 7 files changed, 17 insertions(+), 69 deletions(-) + +diff --git a/vmnet-only/bridge.c b/vmnet-only/bridge.c +index b144adab..b46df795 100644 +--- a/vmnet-only/bridge.c ++++ b/vmnet-only/bridge.c +@@ -1576,7 +1576,7 @@ VNetBridgeComputeHeaderPos(struct sk_buff *skb) // IN: buffer to examine + *---------------------------------------------------------------------- + */ + +-void ++static void + VNetBridgeSendLargePacket(struct sk_buff *skb, // IN: packet to split + VNetBridge *bridge) // IN: bridge + { +diff --git a/vmnet-only/driver.c b/vmnet-only/driver.c +index 602bbfa1..a6f6a7d9 100644 +--- a/vmnet-only/driver.c ++++ b/vmnet-only/driver.c +@@ -50,18 +50,6 @@ + + #include "vmnetInt.h" + +-/* +- * Initialization and creation routines from other files. +- * Putting them here reduces the need for so many header files. +- */ +- +-extern int VNetUserIf_Create(VNetPort **ret); +-extern int VNetNetIf_Create(char *devName, VNetPort **ret, int hubNum); +-extern int VNetBridge_Create(char *devName, uint32 flags, VNetJack *hubJack, +- VNetPort **ret); +-extern int VNetUserListener_Create(uint32 classMask, VNetJack *hubJack, VNetPort **ret); +- +- + /* + * Structure for cycle detection of host interfaces. This + * struct is only used by VNetCycleDetectIf(). +@@ -295,7 +283,7 @@ VNetRemovePortFromList(const VNetPort *port) // IN: port to remove from list + *---------------------------------------------------------------------- + */ + +-int ++static int + LinuxDriverInit(void) + { + int retval; +@@ -374,7 +362,7 @@ vmnet_init_module(void) + *---------------------------------------------------------------------- + */ + +-void ++static void + LinuxDriverExit(void) + { + unregister_chrdev(VNET_MAJOR_NUMBER, "vmnet"); +diff --git a/vmnet-only/vnetInt.h b/vmnet-only/vnetInt.h +index 5f41269d..cb25e3b8 100644 +--- a/vmnet-only/vnetInt.h ++++ b/vmnet-only/vnetInt.h +@@ -225,6 +225,13 @@ extern int VNetProc_Init(void); + + extern void VNetProc_Cleanup(void); + ++int VNetNetIf_Create(char *devName, VNetPort **ret, int hubNum); ++int VNetUserIf_Create(VNetPort **ret); ++int VNetBridge_Create(const char *devName, uint32 flags, VNetJack *hubJack, ++ VNetPort **ret); ++int VNetUserListener_Create(uint32 classMask, VNetJack *hubJack, ++ VNetPort **port); ++ + + /* + *---------------------------------------------------------------------- +Patch for Linux 6.9 from https://github.com/mkubecek/vmware-host-modules/issues/239 +--- a/vmnet-only/vmnetInt.h ++++ b/vmnet-only/vmnetInt.h +@@ -62,8 +62,13 @@ + compat_skb_set_network_header(skb, sizeof (struct ethhdr)), \ + dev_queue_xmit(skb) \ + ) +-#define dev_lock_list() read_lock(&dev_base_lock) +-#define dev_unlock_list() read_unlock(&dev_base_lock) ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 9, 0) ++# define dev_lock_list() rcu_read_lock() ++# define dev_unlock_list() rcu_read_unlock() ++#else ++# define dev_lock_list() read_lock(&dev_base_lock) ++# define dev_unlock_list() read_unlock(&dev_base_lock) ++#endif + #ifdef VMW_NETDEV_HAS_NET + # define DEV_GET(x) __dev_get_by_name(&init_net, (x)->name) + # ifdef VMW_NETDEV_HAS_DEV_NET |