There are situations where aga algorithms may want to check if a node is
up-to-date (i.e. has yet been discovered by the current algorithm) without
making it up to date if it's not. This adds an internal function to do so.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
+bool aga_node_needs_update(const struct aga_graph *g,
+ const struct aga_node *node)
+{
+ return (node->sequence != g->sequence);
+}
+
bool aga_update_node(const struct aga_graph *g, struct aga_node *node)
{
bool aga_update_node(const struct aga_graph *g, struct aga_node *node)
{
- if (node->sequence == g->sequence)
+ if (!aga_node_needs_update(g, node))
return false;
node->sequence = g->sequence;
return false;
node->sequence = g->sequence;
#define CCAN_AGA_PRIVATE_H
int aga_start(struct aga_graph *g);
#define CCAN_AGA_PRIVATE_H
int aga_start(struct aga_graph *g);
+bool aga_node_needs_update(const struct aga_graph *g,
+ const struct aga_node *node);
bool aga_update_node(const struct aga_graph *g, struct aga_node *node);
bool aga_check_state(const struct aga_graph *g);
void aga_fail(struct aga_graph *g, int error);
bool aga_update_node(const struct aga_graph *g, struct aga_node *node);
bool aga_check_state(const struct aga_graph *g);
void aga_fail(struct aga_graph *g, int error);