Changeset View
Changeset View
Standalone View
Standalone View
lib/libvmmapi/vmmapi.c
Show First 20 Lines • Show All 100 Lines • ▼ Show 20 Lines | vm_device_open(const char *name) | |||||||||||
/* Open the device file */ | /* Open the device file */ | |||||||||||
fd = open(vmfile, O_RDWR, 0); | fd = open(vmfile, O_RDWR, 0); | |||||||||||
free(vmfile); | free(vmfile); | |||||||||||
return (fd); | return (fd); | |||||||||||
} | } | |||||||||||
int | int | |||||||||||
vmmctl_open(void) | ||||||||||||
markjUnsubmitted Not Done Inline Actions
markj: | ||||||||||||
{ | ||||||||||||
/* Try to load vmm(4) */ | ||||||||||||
if (modfind("vmm") < 0) | ||||||||||||
kldload("vmm"); | ||||||||||||
return (open("/dev/vmmctl", O_RDWR)); | ||||||||||||
Not Done Inline Actionsthe last 0 is not necessary if you are not creating a file. khng: the last 0 is not necessary if you are not creating a file. | ||||||||||||
} | ||||||||||||
int | ||||||||||||
vm_fcreate(int fd, const char *name) | ||||||||||||
{ | ||||||||||||
struct vmmctl_op op; | ||||||||||||
if (strlen(name) > VM_MAX_NAMELEN) { | ||||||||||||
Not Done Inline ActionsWe allows vmname with the length of VM_MAX_NAMELEN. khng: We allows vmname with the length of VM_MAX_NAMELEN. | ||||||||||||
errno = ENAMETOOLONG; | ||||||||||||
return (-1); | ||||||||||||
} | ||||||||||||
strcpy(op.name, name); | ||||||||||||
return (ioctl(fd, VMMCTL_CREATE, &op)); | ||||||||||||
} | ||||||||||||
int | ||||||||||||
vm_fdestroy(int fd, const char *name) | ||||||||||||
{ | ||||||||||||
struct vmmctl_op op; | ||||||||||||
if (strlen(name) > VM_MAX_NAMELEN) { | ||||||||||||
Not Done Inline ActionsWe allows vmname with the length of VM_MAX_NAMELEN. khng: We allows vmname with the length of VM_MAX_NAMELEN. | ||||||||||||
errno = ENAMETOOLONG; | ||||||||||||
return (-1); | ||||||||||||
} | ||||||||||||
strcpy(op.name, name); | ||||||||||||
return (ioctl(fd, VMMCTL_DESTROY, &op)); | ||||||||||||
} | ||||||||||||
int | ||||||||||||
vm_create(const char *name) | vm_create(const char *name) | |||||||||||
{ | { | |||||||||||
/* Try to load vmm(4) module before creating a guest. */ | /* Try to load vmm(4) module before creating a guest. */ | |||||||||||
if (modfind("vmm") < 0) | if (modfind("vmm") < 0) | |||||||||||
kldload("vmm"); | kldload("vmm"); | |||||||||||
return (CREATE(name)); | return (CREATE(name)); | |||||||||||
} | } | |||||||||||
▲ Show 20 Lines • Show All 1,593 Lines • Show Last 20 Lines |