struct klist_node *klist_next(struct klist_iter *i) { struct klist_node *last = i->i_cur; struct klist_node *next; if (last) { next = to_klist_node(last->n_node.next); } else { next = to_klist_node(i->i_klist->k_list.next); } i->i_cur = NULL; while (next != to_klist_node(&i->i_klist->k_list)) { /* if the knode is not deleted */ if (!knode_dead(next)) { i->i_cur = next; break; } /* skip the deleted knode */ next = to_klist_node(next->n_node.next); } return i->i_cur; }
static void knode_kill(struct klist_node *knode) { /* and no knode should die twice ever either, see we're very humane */ WARN_ON(knode_dead(knode)); *(unsigned long *)&knode->n_klist |= KNODE_DEAD; }
static void knode_set_klist(struct klist_node *knode, struct klist *klist) { knode->n_klist = klist; /* no knode deserves to start its life dead */ WARN_ON(knode_dead(knode)); }