--- src/libplpa/plpa_map.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --quilt old/src/libplpa/plpa_map.c new/src/libplpa/plpa_map.c --- old/src/libplpa/plpa_map.c +++ new/src/libplpa/plpa_map.c @@ -130,11 +130,11 @@ typedef struct tuple_t_ { int processor_id, socket, core; } tuple_t; static int supported = 0; static int num_processors = -1; -static int max_processor_num = -1; +static int max_processor_id = -1; static int num_sockets = -1; static int max_socket_id = -1; static int *max_core_id = NULL; static int *num_cores = NULL; static int max_core_id_overall = -1; @@ -162,11 +162,11 @@ static void clear_cache(void) } free(map_tuple_to_processor_id); map_tuple_to_processor_id = NULL; } - num_processors = max_processor_num = -1; + num_processors = max_processor_id = -1; num_sockets = max_socket_id = -1; max_core_id_overall = -1; } static void load_cache(const char *sysfs_mount) @@ -181,15 +181,15 @@ static void load_cache(const char *sysfs if (access(path, R_OK|X_OK)) { return; } /* Go through and find the max processor ID */ - for (num_processors = max_processor_num = i = 0; + for (num_processors = max_processor_id = i = 0; i < PLPA_BITMASK_CPU_MAX; ++i) { sprintf(path, "%s/devices/system/cpu/cpu%d", sysfs_mount, i); if (0 != access(path, (R_OK | X_OK))) { - max_processor_num = i - 1; + max_processor_id = i - 1; break; } ++num_processors; } @@ -200,16 +200,16 @@ static void load_cache(const char *sysfs } /* Malloc space for the first map (processor ID -> tuple). Include enough space for one invalid entry. */ map_processor_id_to_tuple = malloc(sizeof(tuple_t) * - (max_processor_num + 2)); + (max_processor_id + 2)); if (NULL == map_processor_id_to_tuple) { clear_cache(); return; } - for (i = 0; i <= max_processor_num; ++i) { + for (i = 0; i <= max_processor_id; ++i) { map_processor_id_to_tuple[i].processor_id = i; map_processor_id_to_tuple[i].socket = -1; map_processor_id_to_tuple[i].core = -1; } /* Set the invalid entry */ @@ -217,11 +217,11 @@ static void load_cache(const char *sysfs map_processor_id_to_tuple[invalid_entry].processor_id = -1; map_processor_id_to_tuple[invalid_entry].socket = -1; map_processor_id_to_tuple[invalid_entry].core = -1; /* Build a cached map of (socket,core) tuples */ - for (found = 0, i = 0; i <= max_processor_num; ++i) { + for (found = 0, i = 0; i <= max_processor_id; ++i) { sprintf(path, "%s/devices/system/cpu/cpu%d/topology/core_id", sysfs_mount, i); fd = open(path, O_RDONLY); if ( fd < 0 ) { continue; @@ -268,11 +268,11 @@ static void load_cache(const char *sysfs num_cores[i] = -1; max_core_id[i] = -1; } /* Find the max core number on each socket */ - for (i = 0; i <= max_processor_num; ++i) { + for (i = 0; i <= max_processor_id; ++i) { if (map_processor_id_to_tuple[i].core > max_core_id[map_processor_id_to_tuple[i].socket]) { max_core_id[map_processor_id_to_tuple[i].socket] = map_processor_id_to_tuple[i].core; } @@ -314,11 +314,11 @@ static void load_cache(const char *sysfs return; } for (i = 0; i <= max_socket_id; ++i) { PLPA_CPU_ZERO(&(cores_on_sockets[i])); } - for (i = 0; i <= max_processor_num; ++i) { + for (i = 0; i <= max_processor_id; ++i) { if (map_processor_id_to_tuple[i].socket >= 0) { PLPA_CPU_SET(map_processor_id_to_tuple[i].core, &(cores_on_sockets[map_processor_id_to_tuple[i].socket])); } } @@ -368,11 +368,11 @@ static void load_cache(const char *sysfs &map_processor_id_to_tuple[invalid_entry]; /* See if this (socket,core) tuple exists in the other map. If so, set this entry to point to it (overriding the invalid entry default). */ - for (k = 0; k <= max_processor_num; ++k) { + for (k = 0; k <= max_processor_id; ++k) { if (map_processor_id_to_tuple[k].socket == i && map_processor_id_to_tuple[k].core == j) { map_tuple_to_processor_id[i][j] = &map_processor_id_to_tuple[k]; #if defined(PLPA_DEBUG) && PLPA_DEBUG @@ -494,11 +494,11 @@ int PLPA_NAME(map_to_socket_core)(int pr if (!supported) { return ENOSYS; } /* Check for some invalid entries */ - if (processor_id < 0 || processor_id > max_processor_num) { + if (processor_id < 0 || processor_id > max_processor_id) { return ENOENT; } ret = map_processor_id_to_tuple[processor_id].socket; if (-1 == ret) { return ENOENT; @@ -509,11 +509,11 @@ int PLPA_NAME(map_to_socket_core)(int pr *core = map_processor_id_to_tuple[processor_id].core; return 0; } int PLPA_NAME(get_processor_info)(int *num_processors_arg, - int *max_processor_num_arg) + int *max_processor_id_arg) { int ret; /* Initialize if not already done so */ if (!PLPA_NAME(initialized)) { @@ -521,22 +521,22 @@ int PLPA_NAME(get_processor_info)(int *n return ret; } } /* Check for bozo arguments */ - if (NULL == max_processor_num_arg || NULL == num_processors_arg) { + if (NULL == max_processor_id_arg || NULL == num_processors_arg) { return EINVAL; } /* If this system doesn't support mapping, sorry Charlie */ if (!supported) { return ENOSYS; } /* All done */ *num_processors_arg = num_processors; - *max_processor_num_arg = max_processor_num; + *max_processor_id_arg = max_processor_id; return 0; } /* Return the max socket number */ int PLPA_NAME(get_socket_info)(int *num_sockets_arg, int *max_socket_id_arg)