#include <sys/stat.h>
#include <limits.h>
-
static int devpath_to_ll(const char *dev_path, const char *entry,
unsigned long long *val);
static __u16 devpath_to_vendor(const char *dev_path);
-void free_sys_dev(struct sys_dev **list)
+static void free_sys_dev(struct sys_dev **list)
{
while (*list) {
struct sys_dev *next = (*list)->next;
list->dev_id = (__u16) dev_id;
list->type = type;
- list->path = canonicalize_file_name(path);
+ list->path = realpath(path, NULL);
list->next = NULL;
if ((list->pci_id = strrchr(list->path, '/')) != NULL)
list->pci_id++;
return head;
}
-
static struct sys_dev *intel_devices=NULL;
+static time_t valid_time = 0;
static enum sys_dev_type device_type_by_id(__u16 device_id)
{
return n;
}
-
static __u16 devpath_to_vendor(const char *dev_path)
{
char path[strlen(dev_path) + strlen("/vendor") + 1];
{
struct sys_dev *ahci, *isci;
+ if (valid_time > time(0) - 10)
+ return intel_devices;
+
+ if (intel_devices)
+ free_sys_dev(&intel_devices);
+
isci = find_driver_devices("pci", "isci");
ahci = find_driver_devices("pci", "ahci");
elem = elem->next;
elem->next = isci;
}
- return ahci;
+ intel_devices = ahci;
+ valid_time = time(0);
+ return intel_devices;
}
/*
return 0;
}
-
const struct imsm_orom *imsm_platform_test(enum sys_dev_type hba_id, int *populated,
struct imsm_orom *imsm_orom)
{
return imsm_orom;
}
-
-
static const struct imsm_orom *find_imsm_hba_orom(enum sys_dev_type hba_id)
{
unsigned long align;
check_env("IMSM_TEST_SCU_EFI"))
return NULL;
-
- if (intel_devices != NULL)
- free_sys_dev(&intel_devices);
-
- intel_devices = find_intel_devices();
+ find_intel_devices();
if (intel_devices == NULL)
return NULL;
scan_adapter_roms(scan);
probe_roms_exit();
- if (intel_devices != NULL)
- free_sys_dev(&intel_devices);
- intel_devices = NULL;
-
if (populated_orom[hba_id])
return &imsm_orom[hba_id];
return NULL;
(c) & 0xff, ((c) >> 8) & 0xff, \
(d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) }})
-
#define SYS_EFI_VAR_PATH "/sys/firmware/efi/vars"
#define SCU_PROP "RstScuV"
#define AHCI_PROP "RstSataV"
{
const struct imsm_orom *cap=NULL;
-
if ((cap = find_imsm_efi(hba_id)) != NULL)
return cap;
if ((cap = find_imsm_hba_orom(hba_id)) != NULL)
char device[46];
sprintf(device, "/sys/dev/block/%d:%d/device", major(dev), minor(dev));
- return canonicalize_file_name(device);
+ return realpath(device, NULL);
}
char *diskfd_to_devpath(int fd)