Lines Matching full:node
38 char *before_cmd_line; /* added before node cmd_line */
51 QOSGraphNode *node; member
57 /* Each entry in these hash table will consist of <string, node/edge> pair. */
67 * from @source to @dest node, and inserts it in the
129 * create_node(): creates a node @name of type @type
131 * By default, node is not available.
136 g_printerr("Node %s already created\n", name); in create_node()
140 QOSGraphNode *node = g_new0(QOSGraphNode, 1); in create_node() local
141 node->type = type; in create_node()
142 node->available = false; in create_node()
143 node->name = g_strdup(name); in create_node()
144 g_hash_table_insert(node_table, node->name, node); in create_node()
145 return node; in create_node()
149 * destroy_node(): frees a node @val from the nodes hash table.
150 * Note that node->name is not free'd since it will represent the
155 QOSGraphNode *node = val; in destroy_node() local
156 g_free(node->qemu_name); in destroy_node()
157 g_free(node->command_line); in destroy_node()
158 g_free(node); in destroy_node()
163 * Actually frees the node->name
171 * search_node(): search for a node @key in the nodes hash table
215 * search_machine(): search for a machine @name in the node hash
216 * table. A machine is the child of the root node.
218 * to check the node is a proper machine
240 * a node @node in the node hash table, if not
241 * creates a node @node of type #QNODE_INTERFACE
245 static void create_interface(const char *node) in create_interface() argument
248 interface = search_node(node); in create_interface()
250 create_node(node, QNODE_INTERFACE); in create_interface()
252 fprintf(stderr, "Error: Node %s is not an interface\n", node); in create_interface()
259 * @node. The node name must be a valid qemu identifier, since it
268 static void build_machine_cmd_line(QOSGraphNode *node, const char *args) in build_machine_cmd_line() argument
270 char *machine = qos_get_machine_type(node->name); in build_machine_cmd_line()
272 node->command_line = g_strconcat("-M ", machine, ",", args, NULL); in build_machine_cmd_line()
274 node->command_line = g_strconcat("-M ", machine, " ", NULL); in build_machine_cmd_line()
280 * @node. The node name must be a valid qemu identifier, since it
286 * For drivers, prepend -device to the node name.
288 static void build_driver_cmd_line(QOSGraphNode *node) in build_driver_cmd_line() argument
290 const char *name = node->qemu_name ?: node->name; in build_driver_cmd_line()
291 node->command_line = g_strconcat(" -device ", name, NULL); in build_driver_cmd_line()
324 /* qos_push(): push a node @el and edge @e in the qos_node_stack */
338 .node = el, in qos_push()
359 e->node->visited = false; in qos_pop()
374 el->node->path_edge = NULL; in qos_reverse_path()
377 el->parent->node->path_edge = el->parent_edge; in qos_reverse_path()
381 return el->node; in qos_reverse_path()
387 * reaches a test node.
405 v = s_el->node; in qos_traverse_graph()
424 fprintf(stderr, "node %s in %s -> %s does not exist\n", in qos_traverse_graph()
444 bool qos_graph_has_node(const char *node) in qos_graph_has_node() argument
446 QOSGraphNode *n = search_node(node); in qos_graph_has_node()
450 QOSNodeType qos_graph_get_node_type(const char *node) in qos_graph_get_node_type() argument
452 QOSGraphNode *n = search_node(node); in qos_graph_get_node_type()
459 bool qos_graph_get_node_availability(const char *node) in qos_graph_get_node_availability() argument
461 QOSGraphNode *n = search_node(node); in qos_graph_get_node_availability()
468 QOSGraphEdge *qos_graph_get_edge(const char *node, const char *dest) in qos_graph_get_edge() argument
470 QOSGraphEdgeList *list = get_edgelist(node); in qos_graph_get_edge()
537 QOSGraphNode *qos_graph_get_machine(const char *node) in qos_graph_get_machine() argument
539 return search_machine(node); in qos_graph_get_machine()
542 bool qos_graph_has_machine(const char *node) in qos_graph_has_machine() argument
544 QOSGraphNode *m = search_machine(node); in qos_graph_has_machine()
594 QOSGraphNode *node; in qos_add_test() local
601 node = create_node(test_name, QNODE_TEST); in qos_add_test()
602 node->u.test.function = test_func; in qos_add_test()
603 node->u.test.arg = opts->arg; in qos_add_test()
607 node->u.test.before = opts->before; in qos_add_test()
608 node->u.test.subprocess = opts->subprocess; in qos_add_test()
609 node->available = true; in qos_add_test()
623 QOSGraphNode *node = create_node(name, QNODE_MACHINE); in qos_node_create_machine_args() local
624 build_machine_cmd_line(node, opts); in qos_node_create_machine_args()
625 node->u.machine.constructor = function; in qos_node_create_machine_args()
631 QOSGraphNode *node = create_node(name, QNODE_DRIVER); in qos_node_create_driver() local
632 build_driver_cmd_line(node); in qos_node_create_driver()
633 node->u.driver.constructor = function; in qos_node_create_driver()
639 QOSGraphNode *node = create_node(name, QNODE_DRIVER); in qos_node_create_driver_named() local
640 node->qemu_name = g_strdup(qemu_name); in qos_node_create_driver_named()
641 build_driver_cmd_line(node); in qos_node_create_driver_named()
642 node->u.driver.constructor = function; in qos_node_create_driver_named()
677 static void qos_graph_node_set_availability_explicit(const char *node, bool av) in qos_graph_node_set_availability_explicit() argument
680 QOSGraphNode *n = search_node(node); in qos_graph_node_set_availability_explicit()
686 elist = get_edgelist(node); in qos_graph_node_set_availability_explicit()
699 * former always matches by node name only, whereas this function matches both
700 * by node name and node's optional 'qemu_name' field.
702 void qos_graph_node_set_availability(const char *node, bool av) in qos_graph_node_set_availability() argument
714 * node's 'qemu_name' is set if there is more than one device with in qos_graph_node_set_availability()
718 if (g_strcmp0(node_name, node) == 0) { in qos_graph_node_set_availability()
740 QOSGraphObject *qos_machine_new(QOSGraphNode *node, QTestState *qts) in qos_machine_new() argument
744 g_assert(node->type == QNODE_MACHINE); in qos_machine_new()
745 obj = node->u.machine.constructor(qts); in qos_machine_new()
750 QOSGraphObject *qos_driver_new(QOSGraphNode *node, QOSGraphObject *parent, in qos_driver_new() argument
755 g_assert(node->type == QNODE_DRIVER); in qos_driver_new()
756 obj = node->u.driver.constructor(parent, alloc, arg); in qos_driver_new()
802 QOSGraphNode *node = search_node(name); in qos_delete_cmd_line() local
803 if (node) { in qos_delete_cmd_line()
804 g_free(node->command_line); in qos_delete_cmd_line()
805 node->command_line = NULL; in qos_delete_cmd_line()
815 QOSGraphNode *dest_node, *node; in qos_dump_graph() local
825 qos_printf("\t\t|-> dest='%s' type=%d (node=%p)", in qos_dump_graph()
840 node = g_hash_table_lookup(node_table, key); in qos_dump_graph()
842 if (node->qemu_name) { in qos_dump_graph()
843 qos_printf_literal("qemu_name='%s' ", node->qemu_name); in qos_dump_graph()
846 node->type, node->command_line, in qos_dump_graph()
847 node->available ? "available" : "UNAVAILABLE" in qos_dump_graph()