Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F148377830
D48797.1786530036.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
994 B
Referenced Files
None
Subscribers
None
D48797.1786530036.diff
View Options
diff --git a/lib/libvmmapi/vmmapi.c b/lib/libvmmapi/vmmapi.c
--- a/lib/libvmmapi/vmmapi.c
+++ b/lib/libvmmapi/vmmapi.c
@@ -90,6 +90,14 @@
return (open(devpath, O_RDWR));
}
+static int
+vm_ctl_open(void)
+{
+ if (modfind("vmm") < 0)
+ (void)kldload("vmm");
+ return (open("/dev/vmmctl", O_RDWR, 0));
+}
+
static int
vm_ctl_create(const char *name, int ctlfd)
{
@@ -108,16 +116,10 @@
{
int error, fd;
- /* Try to load vmm(4) module before creating a guest. */
- if (modfind("vmm") < 0) {
- error = kldload("vmm");
- if (error != 0)
- return (-1);
- }
-
- fd = open("/dev/vmmctl", O_RDWR, 0);
+ fd = vm_ctl_open();
if (fd < 0)
- return (fd);
+ return (-1);
+
error = vm_ctl_create(name, fd);
if (error != 0) {
error = errno;
@@ -153,7 +155,7 @@
strcpy(vm->name, name);
memset(vm->memsegs, 0, sizeof(vm->memsegs));
- if ((vm->ctlfd = open("/dev/vmmctl", O_RDWR, 0)) < 0)
+ if ((vm->ctlfd = vm_ctl_open()) < 0)
goto err;
vm->fd = vm_device_open(vm->name);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Aug 12, 10:20 AM (9 h, 30 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29399128
Default Alt Text
D48797.1786530036.diff (994 B)
Attached To
Mode
D48797: libvmmapi: Fix auto-loading of vmm.ko
Attached
Detach File
Event Timeline
Log In to Comment