]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
FreeBSD kernel API changes with FreeBSD 13.0 (development)
authorOliver Kurth <okurth@vmware.com>
Thu, 13 Feb 2020 00:49:09 +0000 (16:49 -0800)
committerOliver Kurth <okurth@vmware.com>
Thu, 13 Feb 2020 00:49:09 +0000 (16:49 -0800)
VOP_UNLOCK(): second argument "flags" has been dropped when the kernel
version is >= 1300074.

The timeout(9) interface has been deprecated and must be replaced with
callout(9) (v2) when the kernel version >= 1300067.

https://github.com/vmware/open-vm-tools/pull/398

open-vm-tools/AUTHORS
open-vm-tools/modules/freebsd/shared/compat_vop.h
open-vm-tools/modules/freebsd/vmblock/vnops.c
open-vm-tools/modules/freebsd/vmmemctl/os.c

index 026de07e6f7f65bfcca95a62285caceb3ecc4c1e..814797509849a75fa04ef3fefa0d7ac5790b7c30 100644 (file)
@@ -53,3 +53,6 @@ Haruki Tsurumoto        Fix Asianux identification
 MilhouseVH      stop systemd-243 udev complaints
                 - https://github.com/vmware/open-vm-tools/pull/371
 
+Josh Paetzel    Changes to vmmemctl.ko and vmblock.ko for FreeBSD 13.0 API changes.
+                - https://github.com/vmware/open-vm-tools/pull/398
+
index f76bba50746ecae77c9adf0902f9e7b5b05b6db2..60ef863f3f7d621073f4255936a94f6ae283e9b5 100644 (file)
@@ -1,5 +1,5 @@
 /*********************************************************
- * Copyright (C) 2008 VMware, Inc. All rights reserved.
+ * Copyright (C) 2008, 2020 VMware, Inc. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License as published by the
 #if __FreeBSD_version >= 800011
 #define COMPAT_THREAD_VAR(varname, varval)
 #define COMPAT_VOP_LOCK(vop, flags, threadvar) VOP_LOCK((vop), (flags))
+#if __FreeBSD_version >= 1300074
+#define COMPAT_VOP_UNLOCK(vop, flags, threadvar) VOP_UNLOCK((vop))
+#else
 #define COMPAT_VOP_UNLOCK(vop, flags, threadvar) VOP_UNLOCK((vop), (flags))
+#endif
 #define compat_lockstatus(lock, threadvar) lockstatus((lock))
 #define compat_lockmgr(lock, flags, randompointerparam, threadval) lockmgr((lock), (flags), (randompointerparam))
 #define compat_vn_lock(vp, flags, threadval) vn_lock((vp), (flags))
index b49925c8e5adad18f7371eb9a05679b86855a00c..6fbef7d1671172083ba108b8e6d407c32b33560b 100644 (file)
@@ -1,5 +1,5 @@
 /* **********************************************************
- * Copyright 2007-2014 VMware, Inc.  All rights reserved. -- VMware Confidential
+ * Copyright 2007-2014, 2020 VMware, Inc.  All rights reserved. -- VMware Confidential
  * **********************************************************/
 
 /*
@@ -1262,12 +1262,15 @@ struct vop_unlock_args {
 */
 {
    struct vnode *vp = ap->a_vp;
+#if __FreeBSD_version < 1300074
    int flags = ap->a_flags;
+#endif
    COMPAT_THREAD_VAR(td, ap->a_td);
    struct VMBlockNode *nn;
    struct vnode *lvp;
    int error;
 
+#if __FreeBSD_version < 1300074
    /*
     * If caller already holds interlock, drop it.  (Per VOP_UNLOCK() API.)
     * Also strip LK_INTERLOCK from flags passed to lower layer.
@@ -1276,9 +1279,14 @@ struct vop_unlock_args {
       VI_UNLOCK(vp);
       ap->a_flags = flags &= ~LK_INTERLOCK;
    }
+#endif
    nn = VPTOVMB(vp);
    if (nn != NULL && (lvp = VMBVPTOLOWERVP(vp)) != NULL) {
+#if __FreeBSD_version < 1300074
       error = COMPAT_VOP_UNLOCK(lvp, flags, td);
+#else
+      error = COMPAT_VOP_UNLOCK(lvp, 0, td);
+#endif
    } else {
       error = vop_stdunlock(ap);
    }
index 55cb52b6f85c09354f445f21c11de73988e429c3..20ec9d005dea8805a8470dd60c4b12553909419a 100644 (file)
@@ -1,5 +1,5 @@
 /*********************************************************
- * Copyright (C) 2000,2014,2018-2019 VMware, Inc. All rights reserved.
+ * Copyright (C) 2000,2014,2018-2020 VMware, Inc. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License as published by the
 
 typedef struct {
    /* system structures */
+#if __FreeBSD_version >= 1300067
+   struct callout callout_handle;
+#else
    struct callout_handle callout_handle;
+#endif
 
    /* termination flag */
    volatile int stop;
@@ -678,7 +682,12 @@ vmmemctl_poll(void *data) // IN
    if (!t->stop) {
       /* invoke registered handler, rearm timer */
       Balloon_QueryAndExecute();
+#if __FreeBSD_version >= 1300067
+      callout_reset(&t->callout_handle, BALLOON_POLL_PERIOD * hz, vmmemctl_poll,
+          t);
+#else
       t->callout_handle = timeout(vmmemctl_poll, t, BALLOON_POLL_PERIOD * hz);
+#endif
    }
 }
 
@@ -712,15 +721,23 @@ vmmemctl_init(void)
    }
 
    /* initialize timer state */
+#if __FreeBSD_version >= 1300067
+   callout_init(&state->timer.callout_handle, 0);
+#else
    callout_handle_init(&state->timer.callout_handle);
+#endif
 
    os_pmap_init(pmap);
    os_balloonobject_create();
 
    /* Set up and start polling */
-   callout_handle_init(&t->callout_handle);
    t->stop = FALSE;
+#if __FreeBSD_version >= 1300067
+   callout_reset(&t->callout_handle, BALLOON_POLL_PERIOD * hz, vmmemctl_poll,
+       t);
+#else
    t->callout_handle = timeout(vmmemctl_poll, t, BALLOON_POLL_PERIOD * hz);
+#endif
 
    vmmemctl_init_sysctl();
 
@@ -759,7 +776,11 @@ vmmemctl_cleanup(void)
 
    /* Stop polling */
    t->stop = TRUE;
+#if __FreeBSD_version >= 1300067
+   callout_drain(&t->callout_handle);
+#else
    untimeout(vmmemctl_poll, t, t->callout_handle);
+#endif
 
    os_balloonobject_delete();
    os_pmap_free(pmap);