[PATCH] documentation for list.h in 2.4.0-test1

From: Peter T. Breuer (ptb@it.uc3m.es)
Date: Sun Jun 11 2000 - 03:23:00 EST


If anyone knows more or different, let me know. I'm going for breakfast
... check list_entry in particular.

Peter

--- linux-2.4.0-test1/include/linux/list.h.orig Sun Jun 11 09:49:35 2000
+++ linux-2.4.0-test1/include/linux/list.h Sun Jun 11 10:17:37 2000
@@ -5,6 +5,38 @@
 
 /*
  * Simple doubly linked list implementation.
+ *
+ * SYNOPSIS
+ *
+ * // list declarations
+ * LIST_HEAD(foo);
+ * struct list_head foo = LIST_HEAD_INIT(foo);
+ *
+ * // clear list
+ * INIT_LIST_HEAD(&foo);
+ *
+ * // typical item definition. Note the field name for later
+ * struct item { char * data; struct list_head list; } bar;
+ *
+ * // add to head of list
+ * list_add(& bar.list, &foo);
+ *
+ * // add to tail of list
+ * list_add_tail(& bar.list, &foo);
+ *
+ * // get head entry back again
+ * struct item * bar = list_entry(& foo.next, struct item, list);
+ *
+ * // get tail entry back again
+ * struct item * bar = list_entry(& foo.prev, struct item, list);
+ *
+ * // delete from anywhere in list
+ * list_del(& bar.list);
+ *
+ * // predicate for list is empty
+ * if (list_empty(&foo)) { ... }
+ *
+ * (synopsis by ptb@it.uc3m.es; tell me if you figure out more)
  *
  * Some of the internal functions ("__xxx") are useful when
  * manipulating whole lists rather than single entries, as

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Thu Jun 15 2000 - 21:00:22 EST