nvme: Fix the build with GCC2.

This commit is contained in:
Augustin Cavalier
2019-04-14 15:48:07 -04:00
parent 2338299bcb
commit 26657c395d
2 changed files with 17 additions and 11 deletions
@@ -68,14 +68,22 @@
* Check if a branch is likely to be taken.
*/
#ifndef likely
#if __GNUC__ < 3
#define likely(x) x
#else
#define likely(x) __builtin_expect((x),1)
#endif
#endif /* likely */
/*
* Check if a branch is unlikely to be taken.
*/
#ifndef unlikely
#if __GNUC__ < 3
#define unlikely(x) x
#else
#define unlikely(x) __builtin_expect((x),0)
#endif
#endif /* unlikely */
#ifndef typeof
@@ -162,19 +162,17 @@ nvme_disk_init_device(void* _info, void** _cookie)
// construct the libnvme pci_device struct
pci_device* device = new pci_device;
*device = {
.vendor_id = info->info.vendor_id,
.device_id = info->info.device_id,
.subvendor_id = 0,
.subdevice_id = 0,
device->vendor_id = info->info.vendor_id;
device->device_id = info->info.device_id;
device->subvendor_id = 0;
device->subdevice_id = 0;
.domain = 0,
.bus = info->info.bus,
.dev = info->info.device,
.func = info->info.function,
device->domain = 0;
device->bus = info->info.bus;
device->dev = info->info.device;
device->func = info->info.function;
.pci_info = &info->info,
};
device->pci_info = &info->info;
// open the controller
info->ctrlr = nvme_ctrlr_open(device, NULL);