Lines Matching refs:dgraph
43 #include "dgraph.h"
63 dgraph_error_t dgraph_init(dgraph_t * dgraph)
65 bzero(dgraph, sizeof(dgraph_t));
67 dgraph->capacity = (5); // pulled from a hat
71 dgraph->graph = (dgraph_entry_t **)malloc(
72 dgraph->capacity * sizeof(dgraph_entry_t *));
74 if (!dgraph->graph) {
86 dgraph_t * dgraph,
100 result = dgraph_init(dgraph);
127 current_dependent = dgraph_add_dependent(dgraph, argv[i],
134 if (!dgraph_add_dependency(dgraph, current_dependent, argv[i],
143 dgraph->root = dgraph_find_root(dgraph);
144 dgraph_establish_load_order(dgraph);
146 if (!dgraph->root) {
151 if (dgraph->root->is_kernel_component && !dgraph->root->is_symbol_set) {
156 for (i = 0; i < dgraph->length; i++) {
157 if (dgraph->graph[i]->loaded_address == 0) {
208 dgraph_t * dgraph,
213 if (!dgraph) {
217 for (entry_index = 0; entry_index < dgraph->length; entry_index++) {
218 dgraph_entry_t * current = dgraph->graph[entry_index];
222 if (dgraph->graph) {
223 free(dgraph->graph);
224 dgraph->graph = NULL;
227 if (dgraph->load_order) {
228 free(dgraph->load_order);
229 dgraph->load_order = NULL;
232 if (free_graph && dgraph) {
233 free(dgraph);
243 dgraph_entry_t * dgraph_find_root(dgraph_t * dgraph) {
254 for (candidate_index = 0; candidate_index < dgraph->length;
257 candidate = dgraph->graph[candidate_index];
259 for (scan_index = 0; scan_index < dgraph->length; scan_index++) {
261 dgraph_entry_t * scan_entry = dgraph->graph[scan_index];
379 int dgraph_establish_load_order(dgraph_t * dgraph) {
392 if (dgraph->load_order) {
393 free(dgraph->load_order);
394 dgraph->load_order = NULL;
401 total_dependencies = dgraph->length;
403 for (entry_index = 0; entry_index < dgraph->length; entry_index ++) {
404 dgraph_entry_t * curdep = dgraph->graph[entry_index];
424 &total_dependencies, dgraph->root, &list_index);
430 load_order_size = dgraph->length * sizeof(dgraph_entry_t *);
431 dgraph->load_order = (dgraph_entry_t **)malloc(load_order_size);
432 if (!dgraph->load_order) {
436 bzero(dgraph->load_order, load_order_size);
439 /* Reverse the list into the dgraph's load_order list,
460 if (current_entry == dgraph->load_order[list_index]) {
472 dgraph->load_order[forward_index++] = current_entry;
525 dgraph_entry_t * dgraph_find_dependent(dgraph_t * dgraph, const char * name)
529 for (i = 0; i < dgraph->length; i++) {
530 dgraph_entry_t * current_entry = dgraph->graph[i];
543 dgraph_t * dgraph,
566 found_entry = dgraph_find_dependent(dgraph, name);
596 if (dgraph->length == dgraph->capacity) {
597 unsigned int old_capacity = dgraph->capacity;
600 dgraph->capacity *= 2;
601 newgraph = (dgraph_entry_t **)malloc(dgraph->capacity *
606 memcpy(newgraph, dgraph->graph, old_capacity * sizeof(dgraph_entry_t *));
607 free(dgraph->graph);
608 dgraph->graph = newgraph;
650 dgraph->has_symbol_sets |= new_entry->is_symbol_set;
671 dgraph->graph[dgraph->length++] = new_entry;
706 dgraph_t * dgraph,
751 dependency = dgraph_add_dependent(dgraph, name,
784 dgraph->has_opaque_links |= current_dependent->opaque_link;