MCPcopy Create free account
hub / github.com/F-Stack/f-stack / graph_reaches

Function graph_reaches

freebsd/kern/kern_lockf.c:2042–2062  ·  view source on GitHub ↗

* Return non-zero if y is reachable from x using a brute force * search. If reachable and path is non-null, return the route taken * in path. */

Source from the content-addressed store, hash-verified

2040 * in path.
2041 */
2042static int
2043graph_reaches(struct owner_vertex *x, struct owner_vertex *y,
2044 struct owner_vertex_list *path)
2045{
2046 struct owner_edge *e;
2047
2048 if (x == y) {
2049 if (path)
2050 TAILQ_INSERT_HEAD(path, x, v_link);
2051 return 1;
2052 }
2053
2054 LIST_FOREACH(e, &x->v_outedges, e_outlink) {
2055 if (graph_reaches(e->e_to, y, path)) {
2056 if (path)
2057 TAILQ_INSERT_HEAD(path, x, v_link);
2058 return 1;
2059 }
2060 }
2061 return 0;
2062}
2063
2064/*
2065 * Perform consistency checks on the graph. Make sure the values of

Callers 2

graph_checkFunction · 0.85
graph_add_edgeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected