Le 09/10/2012 22:12, Brice Goglin a écrit : > The attached patch should help (and fix minor bugs nearby). > > Brice >
Patch attached for real.
Index: src/topology-linux.c =================================================================== --- src/topology-linux.c (révision 4884) +++ src/topology-linux.c (copie de travail) @@ -3565,6 +3565,7 @@ strcpy(&path[pathlen+1], portdirent->d_name); pathlen += 1+strlen(portdirent->d_name); hwloc_linux_lookup_host_block_class(topology, pcidev, path, pathlen); + /* restore parent path */ pathlen -= 1+strlen(portdirent->d_name); path[pathlen] = '\0'; } @@ -3641,6 +3642,9 @@ path[pathlen] = '\0'; } } + /* restore parent path */ + pathlen -= 1+strlen(devicedirent->d_name); + path[pathlen] = '\0'; } else if (sscanf(devicedirent->d_name, "host%d", &dummy) == 1) { /* found host%d */ path[pathlen] = '/'; @@ -3650,6 +3654,30 @@ /* restore parent path */ pathlen -= 1+strlen(devicedirent->d_name); path[pathlen] = '\0'; + } else if (sscanf(devicedirent->d_name, "ata%d", &dummy) == 1) { + /* found ata%d */ + path[pathlen] = '/'; + strcpy(&path[pathlen+1], devicedirent->d_name); + pathlen += 1+strlen(devicedirent->d_name); + hostdir = opendir(path); + if (!hostdir) + continue; + while ((hostdirent = readdir(hostdir)) != NULL) { + if (sscanf(hostdirent->d_name, "host%d", &dummy) == 1) { + /* found ata%d/host%d */ + path[pathlen] = '/'; + strcpy(&path[pathlen+1], hostdirent->d_name); + pathlen += 1+strlen(hostdirent->d_name); + /* lookup block class for real */ + hwloc_linux_lookup_host_block_class(topology, pcidev, path, pathlen); + /* restore parent path */ + pathlen -= 1+strlen(hostdirent->d_name); + path[pathlen] = '\0'; + } + } + /* restore parent path */ + pathlen -= 1+strlen(devicedirent->d_name); + path[pathlen] = '\0'; } } closedir(devicedir);