1
0
forked from pool/virtualbox

- Fix the changes for kernel 4.20 API differences. The previous version compiled but had an error in logic.

OBS-URL: https://build.opensuse.org/package/show/Virtualization/virtualbox?expand=0&rev=457
This commit is contained in:
Larry Finger 2018-11-27 01:05:54 +00:00 committed by Git OBS Bridge
parent b2ba724881
commit 19f1afc1f5
2 changed files with 28 additions and 70 deletions

View File

@ -1,7 +1,7 @@
Index: VirtualBox-5.2.20/src/VBox/HostDrivers/VBoxNetAdp/linux/VBoxNetAdp-linux.c
Index: VirtualBox-5.2.22/src/VBox/HostDrivers/VBoxNetAdp/linux/VBoxNetAdp-linux.c
===================================================================
--- VirtualBox-5.2.20.orig/src/VBox/HostDrivers/VBoxNetAdp/linux/VBoxNetAdp-linux.c
+++ VirtualBox-5.2.20/src/VBox/HostDrivers/VBoxNetAdp/linux/VBoxNetAdp-linux.c
--- VirtualBox-5.2.22.orig/src/VBox/HostDrivers/VBoxNetAdp/linux/VBoxNetAdp-linux.c
+++ VirtualBox-5.2.22/src/VBox/HostDrivers/VBoxNetAdp/linux/VBoxNetAdp-linux.c
@@ -84,8 +84,11 @@ static long VBoxNetAdpLinuxIOCtlUnlocked
#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36) */
@ -27,85 +27,38 @@ Index: VirtualBox-5.2.20/src/VBox/HostDrivers/VBoxNetAdp/linux/VBoxNetAdp-linux.
.get_link = ethtool_op_get_link,
};
@@ -200,10 +207,64 @@ static void vboxNetAdpEthGetDrvinfo(stru
@@ -200,8 +207,18 @@ static void vboxNetAdpEthGetDrvinfo(stru
"N/A");
}
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0)
+static bool
+convert_link_ksettings_to_legacy_settings(
+ struct ethtool_cmd *legacy_settings,
+ const struct ethtool_link_ksettings *link_ksettings)
+{
+ bool retval = true;
+
+ memset(legacy_settings, 0, sizeof(*legacy_settings));
+ /* this also clears the deprecated fields in legacy structure:
+ * __u8 transceiver;
+ * __u32 maxtxpkt;
+ * __u32 maxrxpkt;
+ */
+
+ retval &= ethtool_convert_link_mode_to_legacy_u32(
+ &legacy_settings->supported,
+ link_ksettings->link_modes.supported);
+ retval &= ethtool_convert_link_mode_to_legacy_u32(
+ &legacy_settings->advertising,
+ link_ksettings->link_modes.advertising);
+ retval &= ethtool_convert_link_mode_to_legacy_u32(
+ &legacy_settings->lp_advertising,
+ link_ksettings->link_modes.lp_advertising);
+ ethtool_cmd_speed_set(legacy_settings, link_ksettings->base.speed);
+ legacy_settings->duplex
+ = link_ksettings->base.duplex;
+ legacy_settings->port
+ = link_ksettings->base.port;
+ legacy_settings->phy_address
+ = link_ksettings->base.phy_address;
+ legacy_settings->autoneg
+ = link_ksettings->base.autoneg;
+ legacy_settings->mdio_support
+ = link_ksettings->base.mdio_support;
+ legacy_settings->eth_tp_mdix
+ = link_ksettings->base.eth_tp_mdix;
+ legacy_settings->eth_tp_mdix_ctrl
+ = link_ksettings->base.eth_tp_mdix_ctrl;
+ legacy_settings->transceiver
+ = link_ksettings->base.transceiver;
+ return retval;
+}
+#endif
-
/* ethtool_ops::get_settings */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0)
+static int vboxNetAdpEthGetSettings(struct net_device *pNetDev, struct ethtool_link_ksettings *link_ksettings)
+{
+ link_ksettings->link_modes.supported[0] = 0;
+ ethtool_link_ksettings_zero_link_mode(link_ksettings, advertising);
+ link_ksettings->base.speed = SPEED_10;
+ link_ksettings->base.duplex = DUPLEX_FULL;
+ link_ksettings->base.port = PORT_TP;
+ link_ksettings->base.phy_address = 0;
+ link_ksettings->base.autoneg = AUTONEG_DISABLE;
+#else
static int vboxNetAdpEthGetSettings(struct net_device *pNetDev, struct ethtool_cmd *cmd)
+#endif
{
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0)
+ struct ethtool_cmd *cmd = kzalloc(sizeof(struct ethtool_cmd), GFP_KERNEL);
+ if (!cmd)
+ return 1;
+ convert_link_ksettings_to_legacy_settings(cmd, link_ksettings);
+#endif
cmd->supported = 0;
cmd->advertising = 0;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)
@@ -218,6 +279,9 @@ static int vboxNetAdpEthGetSettings(stru
@@ -218,6 +235,7 @@ static int vboxNetAdpEthGetSettings(stru
cmd->autoneg = AUTONEG_DISABLE;
cmd->maxtxpkt = 0;
cmd->maxrxpkt = 0;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0)
+ kfree(cmd);
+#endif
return 0;
}
Index: VirtualBox-5.2.20/src/VBox/Runtime/r0drv/linux/time-r0drv-linux.c
Index: VirtualBox-5.2.22/src/VBox/Runtime/r0drv/linux/time-r0drv-linux.c
===================================================================
--- VirtualBox-5.2.20.orig/src/VBox/Runtime/r0drv/linux/time-r0drv-linux.c
+++ VirtualBox-5.2.20/src/VBox/Runtime/r0drv/linux/time-r0drv-linux.c
--- VirtualBox-5.2.22.orig/src/VBox/Runtime/r0drv/linux/time-r0drv-linux.c
+++ VirtualBox-5.2.22/src/VBox/Runtime/r0drv/linux/time-r0drv-linux.c
@@ -171,11 +171,19 @@ RTDECL(PRTTIMESPEC) RTTimeNow(PRTTIMESPE
{
IPRT_LINUX_SAVE_EFL_AC();
@ -127,10 +80,10 @@ Index: VirtualBox-5.2.20/src/VBox/Runtime/r0drv/linux/time-r0drv-linux.c
#else /* < 2.6.16 */
struct timeval Tv;
do_gettimeofday(&Tv);
Index: VirtualBox-5.2.20/include/iprt/time.h
Index: VirtualBox-5.2.22/include/iprt/time.h
===================================================================
--- VirtualBox-5.2.20.orig/include/iprt/time.h
+++ VirtualBox-5.2.20/include/iprt/time.h
--- VirtualBox-5.2.22.orig/include/iprt/time.h
+++ VirtualBox-5.2.22/include/iprt/time.h
@@ -54,7 +54,6 @@ typedef struct RTTIMESPEC
int64_t i64NanosecondsRelativeToUnixEpoch;
} RTTIMESPEC;
@ -173,10 +126,10 @@ Index: VirtualBox-5.2.20/include/iprt/time.h
#endif /* various ways of detecting struct timespec */
Index: VirtualBox-5.2.20/src/VBox/Additions/linux/drm/vbox_fb.c
Index: VirtualBox-5.2.22/src/VBox/Additions/linux/drm/vbox_fb.c
===================================================================
--- VirtualBox-5.2.20.orig/src/VBox/Additions/linux/drm/vbox_fb.c
+++ VirtualBox-5.2.20/src/VBox/Additions/linux/drm/vbox_fb.c
--- VirtualBox-5.2.22.orig/src/VBox/Additions/linux/drm/vbox_fb.c
+++ VirtualBox-5.2.22/src/VBox/Additions/linux/drm/vbox_fb.c
@@ -297,8 +297,12 @@ static int vboxfb_create(struct drm_fb_h
* The last flag forces a mode set on VT switches even if the kernel
* does not think it is needed.

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Tue Nov 27 01:04:06 UTC 2018 - Larry Finger <Larry.Finger@gmail.com>
- Fix the changes for kernel 4.20 API differences. The previous version compiled but had an error in logic.
-------------------------------------------------------------------
Fri Nov 9 19:30:20 UTC 2018 - Larry Finger <Larry.Finger@gmail.com>