Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F149802858
D24289.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D24289.diff
View Options
Index: head/lib/libvmmapi/vmmapi.c
===================================================================
--- head/lib/libvmmapi/vmmapi.c
+++ head/lib/libvmmapi/vmmapi.c
@@ -816,16 +816,13 @@
return (ioctl(ctx->fd, VM_INJECT_NMI, &vmnmi));
}
-static struct {
- const char *name;
- int type;
-} capstrmap[] = {
- { "hlt_exit", VM_CAP_HALT_EXIT },
- { "mtrap_exit", VM_CAP_MTRAP_EXIT },
- { "pause_exit", VM_CAP_PAUSE_EXIT },
- { "unrestricted_guest", VM_CAP_UNRESTRICTED_GUEST },
- { "enable_invpcid", VM_CAP_ENABLE_INVPCID },
- { 0 }
+static const char *capstrmap[] = {
+ [VM_CAP_HALT_EXIT] = "hlt_exit",
+ [VM_CAP_MTRAP_EXIT] = "mtrap_exit",
+ [VM_CAP_PAUSE_EXIT] = "pause_exit",
+ [VM_CAP_UNRESTRICTED_GUEST] = "unrestricted_guest",
+ [VM_CAP_ENABLE_INVPCID] = "enable_invpcid",
+ [VM_CAP_BPT_EXIT] = "bpt_exit",
};
int
@@ -833,9 +830,9 @@
{
int i;
- for (i = 0; capstrmap[i].name != NULL && capname != NULL; i++) {
- if (strcmp(capstrmap[i].name, capname) == 0)
- return (capstrmap[i].type);
+ for (i = 0; i < nitems(capstrmap); i++) {
+ if (strcmp(capstrmap[i], capname) == 0)
+ return (i);
}
return (-1);
@@ -844,12 +841,8 @@
const char *
vm_capability_type2name(int type)
{
- int i;
-
- for (i = 0; capstrmap[i].name != NULL; i++) {
- if (capstrmap[i].type == type)
- return (capstrmap[i].name);
- }
+ if (type < nitems(capstrmap))
+ return (capstrmap[type]);
return (NULL);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Mar 28, 5:33 AM (1 h, 29 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
30400856
Default Alt Text
D24289.diff (1 KB)
Attached To
Mode
D24289: map capability string for VM_CAP_BPT_EXIT
Attached
Detach File
Event Timeline
Log In to Comment