Commit f06001f6 authored by Neil Horman's avatar Neil Horman

add master list pointer to topo_obj

Its convienient to know how many objects of a given type you have without having
to know the specific object type.  We can get this info with a pointer to a
pointer in each topo object assigned to that objects type master list (cpus,
cache_domains, packages, numa_nodes) when we build the tree
parent 1a287acc
......@@ -77,6 +77,7 @@ static struct topo_obj* add_cache_domain_to_package(struct topo_obj *cache,
return NULL;
package->mask = package_mask;
package->obj_type = OBJ_TYPE_PACKAGE;
package->obj_type_list = &packages;
packages = g_list_append(packages, package);
package_count++;
}
......@@ -119,6 +120,7 @@ static struct topo_obj* add_cpu_to_cache_domain(struct topo_obj *cpu,
cache->obj_type = OBJ_TYPE_CACHE;
cache->mask = cache_mask;
cache->number = cache_domain_count;
cache->obj_type_list = &cache_domains;
cache_domains = g_list_append(cache_domains, cache);
cache_domain_count++;
}
......@@ -250,6 +252,7 @@ static void do_one_cpu(char *path)
cpus_and(cpu_package(cpu)->mask, cpu_package(cpu)->mask, unbanned_cpus);
cpus_and(cpu->mask, cpu->mask, unbanned_cpus);
cpu->obj_type_list = &cpus;
cpus = g_list_append(cpus, cpu);
core_count++;
}
......
......@@ -45,6 +45,7 @@ struct topo_obj unspecified_node = {
.interrupts = NULL,
.children = NULL,
.parent = NULL,
.obj_type_list = &numa_nodes,
};
static void add_one_node(const char *nodename)
......@@ -74,6 +75,7 @@ static void add_one_node(const char *nodename)
}
new->obj_type = OBJ_TYPE_NODE;
new->number = strtoul(&nodename[4], NULL, 10);
new->obj_type_list = &numa_nodes;
numa_nodes = g_list_append(numa_nodes, new);
}
......
......@@ -41,6 +41,7 @@ struct topo_obj {
GList *interrupts;
struct topo_obj *parent;
GList *children;
GList **obj_type_list;
};
struct irq_info {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment