struct klist_node * klist_next(struct klist_iter * i)
{
	struct list_head * next;
	struct klist_node * lnode = i->i_cur;
	struct klist_node * knode = NULL;
	void (*put)(struct klist_node *) = i->i_klist->put;

#if defined(__VMKLNX__)
	VMK_ASSERT(vmk_PreemptionIsEnabled() == VMK_FALSE);
#endif
	spin_lock(&i->i_klist->k_lock);
	if (lnode) {
		next = lnode->n_node.next;
		if (!klist_dec_and_del(lnode))
			put = NULL;
	} else
		next = i->i_head->next;

	if (next != i->i_head) {
		knode = to_klist_node(next);
		kref_get(&knode->n_ref);
	}
	i->i_cur = knode;
	spin_unlock(&i->i_klist->k_lock);
	if (put && lnode)
		put(lnode);
	return knode;
}
Example #2
0
void klist_remove(struct klist_node * n)
{
	struct klist * k = n->n_klist;
	spin_lock(&k->k_lock);
	klist_dec_and_del(n);
	spin_unlock(&k->k_lock);
	wait_for_completion(&n->n_removed);
}
Example #3
0
void klist_del(struct klist_node * n)
{
	struct klist * k = n->n_klist;

	spin_lock(&k->k_lock);
	klist_dec_and_del(n);
	spin_unlock(&k->k_lock);
}
void klist_del(struct klist_node * n)
{
	struct klist * k = n->n_klist;
	void (*put)(struct klist_node *) = k->put;

#if defined(__VMKLNX__)
	VMK_ASSERT(vmk_PreemptionIsEnabled() == VMK_FALSE);
#endif
	spin_lock(&k->k_lock);
	if (!klist_dec_and_del(n))
		put = NULL;
	spin_unlock(&k->k_lock);
	if (put)
		put(n);
}
Example #5
0
struct klist_node * klist_next(struct klist_iter * i)
{
	struct list_head * next;
	struct klist_node * knode = NULL;

	spin_lock(&i->i_klist->k_lock);
	if (i->i_cur) {
		next = i->i_cur->n_node.next;
		klist_dec_and_del(i->i_cur);
	} else
		next = i->i_head->next;

	if (next != i->i_head) {
		knode = to_klist_node(next);
		kref_get(&knode->n_ref);
	}
	i->i_cur = knode;
	spin_unlock(&i->i_klist->k_lock);
	return knode;
}