diff options
author | Labun Marcin <Marcin.Labun@intel.com> | 2011-01-25 07:44:12 +0100 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2011-01-26 02:22:34 +0100 |
commit | 96234762a6dd8fb5be96650273c62d97da68d1ed (patch) | |
tree | 715542241baf9de610f9f24a1cbe4ad146c1ae72 /super-intel.c | |
parent | imsm: detail_platform_imsm supports Intel SAS controller (isci driver) (diff) | |
download | mdadm-96234762a6dd8fb5be96650273c62d97da68d1ed.tar.xz mdadm-96234762a6dd8fb5be96650273c62d97da68d1ed.zip |
imsm: support for Intel SAS controller in get_disk_controller_domain handler
get_disk_controller_domain recognizes Intel (R) SAS controller (isci).
The function returns three different strings that differentiate disk attached
to AHCI, ISCI or unknown controller types to create separate domains
for each case.
Signed-off-by: Marcin Labun <marcin.labun@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'super-intel.c')
-rw-r--r-- | super-intel.c | 49 |
1 files changed, 24 insertions, 25 deletions
diff --git a/super-intel.c b/super-intel.c index 1fb4c049..8d1f0ada 100644 --- a/super-intel.c +++ b/super-intel.c @@ -6622,34 +6622,33 @@ static char disk_by_path[] = "/dev/disk/by-path/"; static const char *imsm_get_disk_controller_domain(const char *path) { - struct sys_dev *list, *hba = NULL; char disk_path[PATH_MAX]; - int ahci = 0; - char *dpath = NULL; - - list = find_driver_devices("pci", "ahci"); - for (hba = list; hba; hba = hba->next) - if (devpath_to_vendor(hba->path) == 0x8086) - break; - - if (hba) { - struct stat st; + char *drv=NULL; + struct stat st; - strncpy(disk_path, disk_by_path, PATH_MAX - 1); - strncat(disk_path, path, PATH_MAX - strlen(disk_path) - 1); - if (stat(disk_path, &st) == 0) { - dpath = devt_to_devpath(st.st_rdev); - if (dpath) - ahci = path_attached_to_hba(dpath, hba->path); - } + strncpy(disk_path, disk_by_path, PATH_MAX - 1); + strncat(disk_path, path, PATH_MAX - strlen(disk_path) - 1); + if (stat(disk_path, &st) == 0) { + struct sys_dev* hba; + char *path=NULL; + + path = devt_to_devpath(st.st_rdev); + if (path == NULL) + return "unknown"; + hba = find_disk_attached_hba(-1, path); + if (hba && hba->type == SYS_DEV_SAS) + drv = "isci"; + else if (hba && hba->type == SYS_DEV_SATA) + drv = "ahci"; + else + drv = "unknown"; + dprintf("path: %s hba: %s attached: %s\n", + path, (hba) ? hba->path : "NULL", drv); + free(path); + if (hba) + free_sys_dev(&hba); } - dprintf("path: %s(%s) hba: %s attached: %d\n", - path, dpath, (hba) ? hba->path : "NULL", ahci); - free_sys_dev(&list); - if (ahci) - return "ahci"; - else - return NULL; + return drv; } static int imsm_find_array_minor_by_subdev(int subdev, int container, int *minor) |