Don't instantiate variables in for loops; we don't assume C99
compilers. This commit was SVN r24330.
Этот коммит содержится в:
родитель
ddcbfa6af0
Коммит
c8badb79df
@ -1974,10 +1974,11 @@ static int
|
|||||||
look_powerpc_device_tree_discover_cache(device_tree_cpus_t *cpus,
|
look_powerpc_device_tree_discover_cache(device_tree_cpus_t *cpus,
|
||||||
uint32_t ibm_phandle, unsigned int *level, hwloc_bitmap_t cpuset)
|
uint32_t ibm_phandle, unsigned int *level, hwloc_bitmap_t cpuset)
|
||||||
{
|
{
|
||||||
|
unsigned int i;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
if ((NULL == level) || (NULL == cpuset))
|
if ((NULL == level) || (NULL == cpuset))
|
||||||
return ret;
|
return ret;
|
||||||
for (unsigned int i = 0; i < cpus->n; ++i) {
|
for (i = 0; i < cpus->n; ++i) {
|
||||||
if (ibm_phandle != cpus->p[i].l2_cache)
|
if (ibm_phandle != cpus->p[i].l2_cache)
|
||||||
continue;
|
continue;
|
||||||
if (NULL != cpus->p[i].cpuset) {
|
if (NULL != cpus->p[i].cpuset) {
|
||||||
@ -2033,6 +2034,7 @@ look_powerpc_device_tree(struct hwloc_topology *topology)
|
|||||||
{
|
{
|
||||||
device_tree_cpus_t cpus = { .n = 0, .p = NULL, .allocated = 0 };
|
device_tree_cpus_t cpus = { .n = 0, .p = NULL, .allocated = 0 };
|
||||||
const char ofroot[] = "/proc/device-tree/cpus";
|
const char ofroot[] = "/proc/device-tree/cpus";
|
||||||
|
unsigned int i;
|
||||||
|
|
||||||
int root_fd = topology->backend_params.sysfs.root_fd;
|
int root_fd = topology->backend_params.sysfs.root_fd;
|
||||||
DIR *dt = hwloc_opendir(ofroot, root_fd);
|
DIR *dt = hwloc_opendir(ofroot, root_fd);
|
||||||
@ -2074,8 +2076,9 @@ look_powerpc_device_tree(struct hwloc_topology *topology)
|
|||||||
uint32_t nthreads = cb / sizeof(threads[0]);
|
uint32_t nthreads = cb / sizeof(threads[0]);
|
||||||
|
|
||||||
if (NULL != threads) {
|
if (NULL != threads) {
|
||||||
|
unsigned int i;
|
||||||
cpuset = hwloc_bitmap_alloc();
|
cpuset = hwloc_bitmap_alloc();
|
||||||
for (unsigned int i = 0; i < nthreads; ++i) {
|
for (i = 0; i < nthreads; ++i) {
|
||||||
hwloc_bitmap_set(cpuset, ntohl(threads[i]));
|
hwloc_bitmap_set(cpuset, ntohl(threads[i]));
|
||||||
}
|
}
|
||||||
free(threads);
|
free(threads);
|
||||||
@ -2111,7 +2114,7 @@ look_powerpc_device_tree(struct hwloc_topology *topology)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HWLOC_DEBUG
|
#ifdef HWLOC_DEBUG
|
||||||
for (unsigned int i = 0; i < cpus.n; ++i) {
|
for (i = 0; i < cpus.n; ++i) {
|
||||||
hwloc_debug("%i: %s ibm,phandle=%08X l2_cache=%08X ",
|
hwloc_debug("%i: %s ibm,phandle=%08X l2_cache=%08X ",
|
||||||
i, cpus.p[i].name, cpus.p[i].ibm_phandle, cpus.p[i].l2_cache);
|
i, cpus.p[i].name, cpus.p[i].ibm_phandle, cpus.p[i].l2_cache);
|
||||||
if (NULL == cpus.p[i].cpuset) {
|
if (NULL == cpus.p[i].cpuset) {
|
||||||
@ -2123,7 +2126,7 @@ look_powerpc_device_tree(struct hwloc_topology *topology)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Scan L2/L3/... caches */
|
/* Scan L2/L3/... caches */
|
||||||
for (unsigned int i = 0; i < cpus.n; ++i) {
|
for (i = 0; i < cpus.n; ++i) {
|
||||||
/* Skip real CPUs */
|
/* Skip real CPUs */
|
||||||
if (NULL != cpus.p[i].cpuset)
|
if (NULL != cpus.p[i].cpuset)
|
||||||
continue;
|
continue;
|
||||||
@ -2143,7 +2146,7 @@ look_powerpc_device_tree(struct hwloc_topology *topology)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Do cleanup */
|
/* Do cleanup */
|
||||||
for (unsigned int i = 0; i < cpus.n; ++i) {
|
for (i = 0; i < cpus.n; ++i) {
|
||||||
hwloc_bitmap_free(cpus.p[i].cpuset);
|
hwloc_bitmap_free(cpus.p[i].cpuset);
|
||||||
free(cpus.p[i].name);
|
free(cpus.p[i].name);
|
||||||
}
|
}
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user