Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/smbios/smbios_subr.c
| Show First 20 Lines • Show All 55 Lines • ▼ Show 20 Lines | static const struct { | ||||
| int vm_guest; | int vm_guest; | ||||
| } vm_pnames[] = { | } vm_pnames[] = { | ||||
| { "VMware Virtual Platform", VM_GUEST_VMWARE }, | { "VMware Virtual Platform", VM_GUEST_VMWARE }, | ||||
| { "Virtual Machine", VM_GUEST_VM }, /* Microsoft VirtualPC */ | { "Virtual Machine", VM_GUEST_VM }, /* Microsoft VirtualPC */ | ||||
| { "QEMU Virtual Machine", VM_GUEST_VM }, | { "QEMU Virtual Machine", VM_GUEST_VM }, | ||||
| { "VirtualBox", VM_GUEST_VBOX }, | { "VirtualBox", VM_GUEST_VBOX }, | ||||
| { "Parallels Virtual Platform", VM_GUEST_PARALLELS }, | { "Parallels Virtual Platform", VM_GUEST_PARALLELS }, | ||||
| { "KVM", VM_GUEST_KVM }, | { "KVM", VM_GUEST_KVM }, | ||||
| { "Google Compute Engine", VM_GUEST_KVM }, | |||||
ziaee: Seems to be missing a space before the "}". Please consider uploading diffs with -u 9999 so we… | |||||
| }; | }; | ||||
| void | void | ||||
| identify_hypervisor_smbios(void) | identify_hypervisor_smbios(void) | ||||
| { | { | ||||
| char *p; | char *p; | ||||
| int i; | int i; | ||||
| Show All 24 Lines | for (i = 0; i < nitems(vm_bnames); i++) | ||||
| * a more specific match in the pnames | * a more specific match in the pnames | ||||
| */ | */ | ||||
| break; | break; | ||||
| } | } | ||||
| freeenv(p); | freeenv(p); | ||||
| } | } | ||||
| p = kern_getenv("smbios.system.product"); | p = kern_getenv("smbios.system.product"); | ||||
| if (p != NULL) { | if (p != NULL) { | ||||
| for (i = 0; i < nitems(vm_pnames); i++) | for (i = 0; i < nitems(vm_pnames); i++) { | ||||
| if (strcmp(p, vm_pnames[i].vm_pname) == 0) { | if (strcmp(p, vm_pnames[i].vm_pname) == 0) { | ||||
| vm_guest = vm_pnames[i].vm_guest; | vm_guest = vm_pnames[i].vm_guest; | ||||
| /* | |||||
| * Google Compute Engine's bare metal instances | |||||
| * have a serial number that starts with | |||||
| * "GoogleCloud-BM-". | |||||
| */ | |||||
| if (strcmp(p, "Google Compute Engine") == 0) { | |||||
| char *s; | |||||
| s = kern_getenv("smbios.system.serial"); | |||||
| if (s != NULL) { | |||||
| if (strncmp(s, | |||||
| "GoogleCloud-BM-", | |||||
| 15) == 0) | |||||
| vm_guest = VM_GUEST_NO; | |||||
| freeenv(s); | |||||
| } | |||||
| } | |||||
| freeenv(p); | freeenv(p); | ||||
| return; | return; | ||||
| } | |||||
| } | } | ||||
| freeenv(p); | freeenv(p); | ||||
| } | } | ||||
| } | } | ||||
Seems to be missing a space before the "}". Please consider uploading diffs with -u 9999 so we can see more context.