Author: araujo
Date: Tue Dec 17 01:33:26 2019
New Revision: 355838
URL: https://svnweb.freebsd.org/changeset/base/355838

Log:
  Attempt to load vmm(4) module before creating a guest using vm_create()
  wrapper in libvmmapi.
  
  Submitted by: Rob Fairbanks <rob.fx907_gmail.com>
  Reviewed by:  jhb
  MFC after:    1 month
  Differential Revision:        https://reviews.freebsd.org/D19400

Modified:
  head/lib/libvmmapi/vmmapi.c

Modified: head/lib/libvmmapi/vmmapi.c
==============================================================================
--- head/lib/libvmmapi/vmmapi.c Tue Dec 17 00:13:45 2019        (r355837)
+++ head/lib/libvmmapi/vmmapi.c Tue Dec 17 01:33:26 2019        (r355838)
@@ -34,7 +34,9 @@ __FBSDID("$FreeBSD$");
 #include <sys/param.h>
 #include <sys/sysctl.h>
 #include <sys/ioctl.h>
+#include <sys/linker.h>
 #include <sys/mman.h>
+#include <sys/module.h>
 #include <sys/_iovec.h>
 #include <sys/cpuset.h>
 
@@ -103,7 +105,11 @@ vm_device_open(const char *name)
 int
 vm_create(const char *name)
 {
-
+       /* Try to load vmm(4) module before creating a guest. */
+       if (modfind("vmm") < 0) {
+               if (modfind("vmm") < 0)
+                       kldload("vmm");
+       }
        return (CREATE((char *)name));
 }
 
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to