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. * Check if a branch is likely to be taken.
*/ */
#ifndef likely #ifndef likely
#if __GNUC__ < 3
#define likely(x) x
#else
#define likely(x) __builtin_expect((x),1) #define likely(x) __builtin_expect((x),1)
#endif
#endif /* likely */ #endif /* likely */
/* /*
* Check if a branch is unlikely to be taken. * Check if a branch is unlikely to be taken.
*/ */
#ifndef unlikely #ifndef unlikely
#if __GNUC__ < 3
#define unlikely(x) x
#else
#define unlikely(x) __builtin_expect((x),0) #define unlikely(x) __builtin_expect((x),0)
#endif
#endif /* unlikely */ #endif /* unlikely */
#ifndef typeof #ifndef typeof
@@ -162,19 +162,17 @@ nvme_disk_init_device(void* _info, void** _cookie)
// construct the libnvme pci_device struct // construct the libnvme pci_device struct
pci_device* device = new pci_device; pci_device* device = new pci_device;
*device = { device->vendor_id = info->info.vendor_id;
.vendor_id = info->info.vendor_id, device->device_id = info->info.device_id;
.device_id = info->info.device_id, device->subvendor_id = 0;
.subvendor_id = 0, device->subdevice_id = 0;
.subdevice_id = 0,
.domain = 0, device->domain = 0;
.bus = info->info.bus, device->bus = info->info.bus;
.dev = info->info.device, device->dev = info->info.device;
.func = info->info.function, device->func = info->info.function;
.pci_info = &info->info, device->pci_info = &info->info;
};
// open the controller // open the controller
info->ctrlr = nvme_ctrlr_open(device, NULL); info->ctrlr = nvme_ctrlr_open(device, NULL);