xref: /illumos-gate/usr/src/lib/fm/topo/libtopo/common/topo_digraph.h (revision 7b34a9a5df26271af0da06974fc361c468cd48d3)
1 /*
2  * This file and its contents are supplied under the terms of the
3  * Common Development and Distribution License ("CDDL"), version 1.0.
4  * You may only use this file in accordance with the terms of version
5  * 1.0 of the CDDL.
6  *
7  * A full copy of the text of the CDDL should have accompanied this
8  * source.  A copy of the CDDL is also available via the Internet at
9  * http://www.illumos.org/license/CDDL.
10  */
11 
12 /*
13  * Copyright 2020 Joyent, Inc.
14  */
15 
16 #ifndef _TOPO_DIGRAPH_H
17 #define	_TOPO_DIGRAPH_H
18 
19 #include <fm/topo_mod.h>
20 
21 #include <topo_list.h>
22 #include <topo_prop.h>
23 #include <topo_method.h>
24 #include <topo_alloc.h>
25 #include <topo_error.h>
26 #include <topo_file.h>
27 #include <topo_module.h>
28 #include <topo_string.h>
29 #include <topo_subr.h>
30 #include <topo_tree.h>
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
36 struct topo_digraph {
37 	topo_list_t	tdg_list;		/* next/prev pointers */
38 	const char	*tdg_scheme;		/* FMRI scheme */
39 	topo_mod_t	*tdg_mod;		/* builtin enumerator mod */
40 	tnode_t		*tdg_rootnode;		/* see topo_digraph_new() */
41 	topo_list_t	tdg_vertices;		/* adjacency list */
42 	uint_t		tdg_nvertices;		/* total num of vertices */
43 	uint_t		tdg_nedges;		/* total num of edges */
44 };
45 
46 struct topo_vertex {
47 	topo_list_t	tvt_list;		/* next/prev pointers */
48 	tnode_t		*tvt_node;
49 	topo_list_t	tvt_incoming;
50 	topo_list_t	tvt_outgoing;
51 	uint_t		tvt_nincoming;		/* total num incoming edges */
52 	uint_t		tvt_noutgoing;		/* total num outgoing edges */
53 };
54 
55 struct topo_edge {
56 	topo_list_t	tve_list;		/* next/prev pointers */
57 	topo_vertex_t	*tve_vertex;
58 };
59 
60 #ifdef __cplusplus
61 }
62 #endif
63 
64 #endif	/* _TOPO_DIGRAPH_H */
65