[PATCH] add klist_node_attached() to determine if a node is on a list or not.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[PATCH] add klist_node_attached() to determine if a node is on a list or not.

Signed-off-by: Patrick Mochel <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

diff -Nru a/include/linux/klist.h b/include/linux/klist.h

---
commit 8b0c250be489dcbf1a3a33bb4ec4c7f33735a365
tree 17935d1064101df10ad7bb2f7ed94e6a88af295c
parent 2287c322b61fced7e0c326a1a9606aa73147e3df
author [email protected] <[email protected]> Thu, 24 Mar 2005 12:58:57 -0800
committer Greg Kroah-Hartman <[email protected]> Mon, 20 Jun 2005 15:15:17 -0700

 include/linux/klist.h |    2 ++
 lib/klist.c           |   16 ++++++++++++++++
 2 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/include/linux/klist.h b/include/linux/klist.h
--- a/include/linux/klist.h
+++ b/include/linux/klist.h
@@ -37,6 +37,8 @@ extern void klist_add_head(struct klist 
 extern void klist_del(struct klist_node * n);
 extern void klist_remove(struct klist_node * n);
 
+extern int klist_node_attached(struct klist_node * n);
+
 
 struct klist_iter {
 	struct klist		* i_klist;
diff --git a/lib/klist.c b/lib/klist.c
--- a/lib/klist.c
+++ b/lib/klist.c
@@ -112,6 +112,7 @@ static void klist_release(struct kref * 
 	struct klist_node * n = container_of(kref, struct klist_node, n_ref);
 	list_del(&n->n_node);
 	complete(&n->n_removed);
+	n->n_klist = NULL;
 }
 
 static int klist_dec_and_del(struct klist_node * n)
@@ -154,6 +155,19 @@ EXPORT_SYMBOL_GPL(klist_remove);
 
 
 /**
+ *	klist_node_attached - Say whether a node is bound to a list or not.
+ *	@n:	Node that we're testing.
+ */
+
+int klist_node_attached(struct klist_node * n)
+{
+	return (n->n_klist != NULL);
+}
+
+EXPORT_SYMBOL_GPL(klist_node_attached);
+
+
+/**
  *	klist_iter_init_node - Initialize a klist_iter structure.
  *	@k:	klist we're iterating.
  *	@i:	klist_iter we're filling.
@@ -246,3 +260,5 @@ struct klist_node * klist_next(struct kl
 }
 
 EXPORT_SYMBOL_GPL(klist_next);
+
+

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux