[SCM] Samba Shared Repository - branch master updated

Rusty Russell rusty at samba.org
Wed Mar 21 20:30:04 MDT 2012


The branch, master has been updated
       via  4816ffa lib/tdb2: fix -Wcast-qual warnings.
       via  4ea9f8d lib/tdb2: fix -Wshadow warnings.
       via  a93e03d lib/tdb2: fix OpenBSD incoherent mmap (tdb2 version)
       via  aa53786 lib/tdb2: fix OpenBSD incoherent mmap (tdb1 version)
       via  fde6942 lib/tdb: fix OpenBSD incoherent mmap.
       via  584b996 lib/replace: test for incoherent mmap.
       via  b3a6ffd lib/ccan/failtest: compile fix for OpenBSD
       via  6755932 lib/ccan: namespacize ccan/list to avoid conflict with OpenIndiana's sys/list.h
       via  eafd837 lib/tdb: fix up run-die-during-transaction test cases on Solaris.
      from  4882a4c docs:man:vfs_gpfs: fix formatting of values for gpfs:syncio

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 4816ffacb81d3234231730149c7b0629bb3646a4
Author: Rusty Russell <rusty at rustcorp.com.au>
Date:   Thu Mar 22 10:47:27 2012 +1030

    lib/tdb2: fix -Wcast-qual warnings.
    
    We use tdb_mkdata() to get rid of many of them from the tests, and
    explicit cast_const() in a few places.
    
    tlist_for_each() still causes a warning, but that needs to be fixed in
    CCAN.
    
    Signed-off-by: Rusty Russell <rusty at rustcorp.com.au>
    
    Autobuild-User: Rusty Russell <rusty at rustcorp.com.au>
    Autobuild-Date: Thu Mar 22 03:29:32 CET 2012 on sn-devel-104

commit 4ea9f8d4c0d08343910d85f44eebdd2d7bff6571
Author: Rusty Russell <rusty at rustcorp.com.au>
Date:   Thu Mar 22 10:47:27 2012 +1030

    lib/tdb2: fix -Wshadow warnings.
    
    These warnings clutter things up, even though they're of marginal
    utility.
    
    Signed-off-by: Rusty Russell <rusty at rustcorp.com.au>

commit a93e03d27de573988263aa4e39e55e7edbe34069
Author: Rusty Russell <rusty at rustcorp.com.au>
Date:   Thu Mar 22 10:47:27 2012 +1030

    lib/tdb2: fix OpenBSD incoherent mmap (tdb2 version)
    
    This handles incoherent mmaps for TDB2 native databases, by forcing
    mmap on for such systems, just like we did for tdb1.
    
    Signed-off-by: Rusty Russell <rusty at rustcorp.com.au>

commit aa5378602d8da09cccc9a435a6457245b13c2677
Author: Rusty Russell <rusty at rustcorp.com.au>
Date:   Thu Mar 22 10:47:26 2012 +1030

    lib/tdb2: fix OpenBSD incoherent mmap (tdb1 version)
    
    This is a direct port of the previous patch, to the TDB2 codebase.
    
    Signed-off-by: Rusty Russell <rusty at rustcorp.com.au>

commit fde694274e1e5a11d1473695e7ec7a97f95d39e4
Author: Rusty Russell <rusty at rustcorp.com.au>
Date:   Thu Mar 22 10:47:26 2012 +1030

    lib/tdb: fix OpenBSD incoherent mmap.
    
    This comment appears in two places in the code (commit
    4c6a8273c6dd3e2aeda5a63c4a62aa55bc133099 from 2001):
    
    	/*
    	 * We must ensure the file is unmapped before doing this
    	 * to ensure consistency with systems like OpenBSD where
    	 * writes and mmaps are not consistent.
    	 */
    
    But this doesn't help, because if one process is using mmap and another
    using pwrite, we get incoherent results.  As demonstrated by OpenBSD's
    failure on the tdb unit tests.
    
    Rather than disable mmap on OpenBSD, we test for this issue and force mmap
    to be enabled.  This means that we will fail on very large TDBs on 32-bit
    systems, but it's better than the horrendous performance penalty on every
    OpenBSD system.
    
    Signed-off-by: Rusty Russell <rusty at rustcorp.com.au>

commit 584b996a1a27870dad30eb422d375bb08b57c64c
Author: Rusty Russell <rusty at rustcorp.com.au>
Date:   Thu Mar 22 10:47:24 2012 +1030

    lib/replace: test for incoherent mmap.
    
    We test for other mmap features here, and both tdb1 and tdb2 want this check.
    
    Signed-off-by: Rusty Russell <rusty at rustcorp.com.au>

commit b3a6ffd7b269f7a34334d24b54591c225da773a5
Author: Rusty Russell <rusty at rustcorp.com.au>
Date:   Wed Mar 21 11:20:06 2012 +1030

    lib/ccan/failtest: compile fix for OpenBSD
    
    OpenBSD doesn't idempotent-wrap sys/mman.h, so when we #define mmap to
    an alternative, it fails to compile when sys/mman.h is included again.
    
    Workaround is not to #define mmap to add arguments on Open BSD.
    
    (Imported from CCAN commit e18e80fe175422d26efe689addc0f67bdba0e097)
    
    Signed-off-by: Rusty Russell <rusty at rustcorp.com.au>

commit 675593221c25dbebaaf8e4ce9f4271a8fb0171d0
Author: Rusty Russell <rusty at rustcorp.com.au>
Date:   Wed Mar 21 00:58:14 2012 +1030

    lib/ccan: namespacize ccan/list to avoid conflict with OpenIndiana's sys/list.h
    
    CCAN includes a little utility called "namespacize" which prepends ccan_ to
    all public methods of a module, and fixes up any dependencies it finds.  It's
    a little primitive, but it works here.
    
    Signed-off-by: Rusty Russell <rusty at rustcorp.com.au>

commit eafd83736918bc5953e4a91cf2d893e68f2da2a2
Author: Rusty Russell <rusty at rustcorp.com.au>
Date:   Wed Mar 21 00:57:14 2012 +1030

    lib/tdb: fix up run-die-during-transaction test cases on Solaris.
    
    By using a different include order, we end up with a different version of
    FILE_OFFSET_BITS (and probably other things) in parts of the test.  The
    different variants get linked together, and the result is weird: the stat
    returns 0 size.
    
    Signed-off-by: Rusty Russell <rusty at rustcorp.com.au>

-----------------------------------------------------------------------

Summary of changes:
 lib/ccan/failtest/_info                            |    1 +
 lib/ccan/failtest/failtest.c                       |    9 +
 lib/ccan/failtest/failtest.h                       |    2 +-
 lib/ccan/failtest/failtest_override.h              |    6 +
 lib/ccan/failtest/failtest_proto.h                 |    2 +
 lib/ccan/list/.namespacize                         |   34 +++
 lib/ccan/list/list.c                               |   16 +-
 lib/ccan/list/list.h                               |  312 ++++++++++----------
 lib/ccan/list/test/compile_ok-constant.c           |   24 +-
 lib/ccan/list/test/helper.c                        |    2 +-
 lib/ccan/list/test/run-check-corrupt.c             |   28 +-
 lib/ccan/list/test/run-list_del_from-assert.c      |   18 +-
 lib/ccan/list/test/run-single-eval.c               |   96 +++---
 lib/ccan/list/test/run.c                           |  132 ++++----
 lib/ccan/tlist/test/compile_fail-tlist_add.c       |    4 +-
 lib/ccan/tlist/test/compile_fail-tlist_add_tail.c  |    4 +-
 lib/ccan/tlist/test/compile_fail-tlist_del_from.c  |    4 +-
 lib/ccan/tlist/test/compile_fail-tlist_for_each.c  |    4 +-
 .../tlist/test/compile_fail-tlist_for_each_safe.c  |    4 +-
 lib/ccan/tlist/test/compile_fail-tlist_tail.c      |    4 +-
 lib/ccan/tlist/test/compile_fail-tlist_top.c       |    4 +-
 lib/ccan/tlist/test/run.c                          |   10 +-
 lib/ccan/tlist/tlist.h                             |   46 ++--
 lib/replace/libreplace.m4                          |    7 +
 lib/replace/test/incoherent_mmap.c                 |   83 ++++++
 lib/replace/wscript                                |    7 +
 lib/tdb/common/io.c                                |   49 ++--
 lib/tdb/common/open.c                              |    4 +-
 lib/tdb/common/tdb_private.h                       |    2 +-
 lib/tdb/test/run-3G-file.c                         |   27 ++-
 lib/tdb/test/run-die-during-transaction.c          |    3 +-
 lib/tdb/test/run-nested-traverse.c                 |    2 +-
 lib/tdb/test/run-no-lock-during-traverse.c         |    2 +-
 lib/tdb/test/run-traverse-in-transaction.c         |    2 +-
 lib/tdb2/check.c                                   |    8 +-
 lib/tdb2/free.c                                    |    6 +-
 lib/tdb2/io.c                                      |   32 ++-
 lib/tdb2/private.h                                 |    2 +-
 lib/tdb2/pytdb.c                                   |    9 +-
 lib/tdb2/tdb.c                                     |    5 +
 lib/tdb2/tdb1_io.c                                 |   51 ++--
 lib/tdb2/tdb1_private.h                            |    2 +-
 lib/tdb2/test/api-82-lockattr.c                    |    4 +-
 lib/tdb2/test/run-15-append.c                      |    4 +-
 lib/tdb2/test/run-56-open-during-transaction.c     |    6 +-
 lib/tdb2/test/run-tdb1-3G-file.c                   |   29 ++-
 lib/tdb2/test/run-tdb1-check.c                     |    6 +-
 lib/tdb2/test/run-tdb1-corrupt.c                   |    5 +-
 lib/tdb2/test/run-tdb1-endian.c                    |    9 +-
 lib/tdb2/test/run-tdb1-incompatible.c              |   12 +-
 lib/tdb2/test/run-tdb1-nested-transactions.c       |    6 +-
 lib/tdb2/test/run-tdb1-nested-traverse.c           |    6 +-
 lib/tdb2/test/run-tdb1-no-lock-during-traverse.c   |    3 +-
 lib/tdb2/test/run-tdb1-readonly-check.c            |    6 +-
 lib/tdb2/test/run-tdb1-traverse-in-transaction.c   |    6 +-
 lib/tdb2/test/run-tdb1-wronghash-fail.c            |    3 +-
 lib/tdb2/test/run-tdb1-zero-append.c               |    6 +-
 lib/tdb2/test/run-tdb1.c                           |    6 +-
 lib/tdb2/test/run-tdb_errorstr.c                   |   26 +-
 lib/tdb2/test/tdb1-external-agent.c                |    3 +-
 60 files changed, 713 insertions(+), 502 deletions(-)
 create mode 100644 lib/ccan/list/.namespacize
 create mode 100644 lib/replace/test/incoherent_mmap.c


Changeset truncated at 500 lines:

diff --git a/lib/ccan/failtest/_info b/lib/ccan/failtest/_info
index 4a5b97c..ac9b09a 100644
--- a/lib/ccan/failtest/_info
+++ b/lib/ccan/failtest/_info
@@ -68,6 +68,7 @@ int main(int argc, char *argv[])
 		printf("ccan/compiler\n");
 		printf("ccan/hash\n");
 		printf("ccan/htable\n");
+		printf("ccan/list\n");
 		printf("ccan/read_write_all\n");
 		printf("ccan/str\n");
 		printf("ccan/time\n");
diff --git a/lib/ccan/failtest/failtest.c b/lib/ccan/failtest/failtest.c
index 5f68394..a4a374f 100644
--- a/lib/ccan/failtest/failtest.c
+++ b/lib/ccan/failtest/failtest.c
@@ -1177,6 +1177,15 @@ void *failtest_mmap(void *addr, size_t length, int prot, int flags,
 	return p->u.mmap.ret;
 }
 
+/* Since OpenBSD can't handle adding args, we use this file and line.
+ * This will make all mmaps look the same, reducing coverage. */
+void *failtest_mmap_noloc(void *addr, size_t length, int prot, int flags,
+			  int fd, off_t offset)
+{
+	return failtest_mmap(addr, length, prot, flags, fd, offset,
+			     __FILE__, __LINE__);
+}
+
 static void cleanup_pipe(struct pipe_call *call, bool restore)
 {
 	trace("cleaning up pipe fd=%i%s,%i%s\n",
diff --git a/lib/ccan/failtest/failtest.h b/lib/ccan/failtest/failtest.h
index 9af5669..f4b6ec8 100644
--- a/lib/ccan/failtest/failtest.h
+++ b/lib/ccan/failtest/failtest.h
@@ -155,7 +155,7 @@ struct lseek_call {
  */
 struct failtest_call {
 	/* We're in the history list. */
-	struct list_node list;
+	struct ccan_list_node list;
 	enum failtest_call_type type;
 	/* Where we were called from. */
 	const char *file;
diff --git a/lib/ccan/failtest/failtest_override.h b/lib/ccan/failtest/failtest_override.h
index 204494b..b056d53 100644
--- a/lib/ccan/failtest/failtest_override.h
+++ b/lib/ccan/failtest/failtest_override.h
@@ -64,9 +64,15 @@
 #define fcntl(fd, ...) failtest_fcntl((fd), __FILE__, __LINE__, __VA_ARGS__)
 
 #undef mmap
+/* OpenBSD doesn't idempotent-protect sys/mman.h, so we can't add args. */
+#ifdef __OpenBSD__
+#define mmap(addr, length, prot, flags, fd, offset)			\
+	failtest_mmap_noloc((addr), (length), (prot), (flags), (fd), (offset))
+#else
 #define mmap(addr, length, prot, flags, fd, offset)			\
 	failtest_mmap((addr), (length), (prot), (flags), (fd), (offset), \
 		      __FILE__, __LINE__)
+#endif /* !__OpenBSD__ */
 
 #undef lseek
 #define lseek(fd, offset, whence)					\
diff --git a/lib/ccan/failtest/failtest_proto.h b/lib/ccan/failtest/failtest_proto.h
index c7e6b48..3c2df1d 100644
--- a/lib/ccan/failtest/failtest_proto.h
+++ b/lib/ccan/failtest/failtest_proto.h
@@ -23,6 +23,8 @@ ssize_t failtest_pwrite(int fd, const void *buf, size_t count, off_t offset,
 			const char *file, unsigned line);
 void *failtest_mmap(void *addr, size_t length, int prot, int flags,
 		    int fd, off_t offset, const char *file, unsigned line);
+void *failtest_mmap_noloc(void *addr, size_t length, int prot, int flags,
+			  int fd, off_t offset);
 off_t failtest_lseek(int fd, off_t offset, int whence,
 		     const char *file, unsigned line);
 int failtest_close(int fd, const char *file, unsigned line);
diff --git a/lib/ccan/list/.namespacize b/lib/ccan/list/.namespacize
new file mode 100644
index 0000000..aa6f0b4
--- /dev/null
+++ b/lib/ccan/list/.namespacize
@@ -0,0 +1,34 @@
+list_node_from_off_
+list_node_to_off_
+list_tail_
+list_top_
+list_del_from
+list_del
+list_empty
+list_add_tail
+list_add
+list_head_init
+list_check_node
+list_check
+list_head
+list_node
+list_off_var_
+list_off_
+list_del_from_off
+list_del_off
+list_add_off
+list_tail_off
+list_head_off
+list_entry_off
+list_for_each_safe_off
+list_for_each_off
+list_for_each_safe
+list_for_each_rev
+list_for_each
+list_tail
+list_top
+list_entry
+LIST_HEAD
+LIST_HEAD_INIT
+list_debug_node
+list_debug
diff --git a/lib/ccan/list/list.c b/lib/ccan/list/list.c
index 29dc30b..380212a 100644
--- a/lib/ccan/list/list.c
+++ b/lib/ccan/list/list.c
@@ -4,8 +4,8 @@
 #include "list.h"
 
 static void *corrupt(const char *abortstr,
-		     const struct list_node *head,
-		     const struct list_node *node,
+		     const struct ccan_list_node *head,
+		     const struct ccan_list_node *node,
 		     unsigned int count)
 {
 	if (abortstr) {
@@ -17,10 +17,10 @@ static void *corrupt(const char *abortstr,
 	return NULL;
 }
 
-struct list_node *list_check_node(const struct list_node *node,
+struct ccan_list_node *ccan_list_check_node(const struct ccan_list_node *node,
 				  const char *abortstr)
 {
-	const struct list_node *p, *n;
+	const struct ccan_list_node *p, *n;
 	int count = 0;
 
 	for (p = node, n = node->next; n != node; p = n, n = n->next) {
@@ -32,12 +32,12 @@ struct list_node *list_check_node(const struct list_node *node,
 	if (node->prev != p)
 		return corrupt(abortstr, node, node, 0);
 
-	return (struct list_node *)node;
+	return (struct ccan_list_node *)node;
 }
 
-struct list_head *list_check(const struct list_head *h, const char *abortstr)
+struct ccan_list_head *ccan_list_check(const struct ccan_list_head *h, const char *abortstr)
 {
-	if (!list_check_node(&h->n, abortstr))
+	if (!ccan_list_check_node(&h->n, abortstr))
 		return NULL;
-	return (struct list_head *)h;
+	return (struct ccan_list_head *)h;
 }
diff --git a/lib/ccan/list/list.h b/lib/ccan/list/list.h
index 0091ea4..10a2076 100644
--- a/lib/ccan/list/list.h
+++ b/lib/ccan/list/list.h
@@ -7,7 +7,7 @@
 #include <ccan/check_type/check_type.h>
 
 /**
- * struct list_node - an entry in a doubly-linked list
+ * struct ccan_list_node - an entry in a doubly-linked list
  * @next: next entry (self if empty)
  * @prev: previous entry (self if empty)
  *
@@ -16,34 +16,34 @@
  *	struct child {
  *		const char *name;
  *		// Linked list of all us children.
- *		struct list_node list;
+ *		struct ccan_list_node list;
  *	};
  */
-struct list_node
+struct ccan_list_node
 {
-	struct list_node *next, *prev;
+	struct ccan_list_node *next, *prev;
 };
 
 /**
- * struct list_head - the head of a doubly-linked list
- * @h: the list_head (containing next and prev pointers)
+ * struct ccan_list_head - the head of a doubly-linked list
+ * @h: the ccan_list_head (containing next and prev pointers)
  *
  * This is used as the head of a linked list.
  * Example:
  *	struct parent {
  *		const char *name;
- *		struct list_head children;
+ *		struct ccan_list_head children;
  *		unsigned int num_children;
  *	};
  */
-struct list_head
+struct ccan_list_head
 {
-	struct list_node n;
+	struct ccan_list_node n;
 };
 
 /**
- * list_check - check head of a list for consistency
- * @h: the list_head
+ * ccan_list_check - check head of a list for consistency
+ * @h: the ccan_list_head
  * @abortstr: the location to print on aborting, or NULL.
  *
  * Because list_nodes have redundant information, consistency checking between
@@ -54,7 +54,7 @@ struct list_head
  * Returns the list head if the list is consistent, NULL if not (it
  * can never return NULL if @abortstr is set).
  *
- * See also: list_check_node()
+ * See also: ccan_list_check_node()
  *
  * Example:
  *	static void dump_parent(struct parent *p)
@@ -62,159 +62,159 @@ struct list_head
  *		struct child *c;
  *
  *		printf("%s (%u children):\n", p->name, p->num_children);
- *		list_check(&p->children, "bad child list");
- *		list_for_each(&p->children, c, list)
+ *		ccan_list_check(&p->children, "bad child list");
+ *		ccan_list_for_each(&p->children, c, list)
  *			printf(" -> %s\n", c->name);
  *	}
  */
-struct list_head *list_check(const struct list_head *h, const char *abortstr);
+struct ccan_list_head *ccan_list_check(const struct ccan_list_head *h, const char *abortstr);
 
 /**
- * list_check_node - check node of a list for consistency
- * @n: the list_node
+ * ccan_list_check_node - check node of a list for consistency
+ * @n: the ccan_list_node
  * @abortstr: the location to print on aborting, or NULL.
  *
  * Check consistency of the list node is in (it must be in one).
  *
- * See also: list_check()
+ * See also: ccan_list_check()
  *
  * Example:
  *	static void dump_child(const struct child *c)
  *	{
- *		list_check_node(&c->list, "bad child list");
+ *		ccan_list_check_node(&c->list, "bad child list");
  *		printf("%s\n", c->name);
  *	}
  */
-struct list_node *list_check_node(const struct list_node *n,
+struct ccan_list_node *ccan_list_check_node(const struct ccan_list_node *n,
 				  const char *abortstr);
 
 #ifdef CCAN_LIST_DEBUG
-#define list_debug(h) list_check((h), __func__)
-#define list_debug_node(n) list_check_node((n), __func__)
+#define ccan_list_debug(h) ccan_list_check((h), __func__)
+#define ccan_list_debug_node(n) ccan_list_check_node((n), __func__)
 #else
-#define list_debug(h) (h)
-#define list_debug_node(n) (n)
+#define ccan_list_debug(h) (h)
+#define ccan_list_debug_node(n) (n)
 #endif
 
 /**
- * LIST_HEAD_INIT - initializer for an empty list_head
+ * CCAN_LIST_HEAD_INIT - initializer for an empty ccan_list_head
  * @name: the name of the list.
  *
  * Explicit initializer for an empty list.
  *
  * See also:
- *	LIST_HEAD, list_head_init()
+ *	CCAN_LIST_HEAD, ccan_list_head_init()
  *
  * Example:
- *	static struct list_head my_list = LIST_HEAD_INIT(my_list);
+ *	static struct ccan_list_head my_list = CCAN_LIST_HEAD_INIT(my_list);
  */
-#define LIST_HEAD_INIT(name) { { &name.n, &name.n } }
+#define CCAN_LIST_HEAD_INIT(name) { { &name.n, &name.n } }
 
 /**
- * LIST_HEAD - define and initialize an empty list_head
+ * CCAN_LIST_HEAD - define and initialize an empty ccan_list_head
  * @name: the name of the list.
  *
- * The LIST_HEAD macro defines a list_head and initializes it to an empty
- * list.  It can be prepended by "static" to define a static list_head.
+ * The CCAN_LIST_HEAD macro defines a ccan_list_head and initializes it to an empty
+ * list.  It can be prepended by "static" to define a static ccan_list_head.
  *
  * See also:
- *	LIST_HEAD_INIT, list_head_init()
+ *	CCAN_LIST_HEAD_INIT, ccan_list_head_init()
  *
  * Example:
- *	static LIST_HEAD(my_global_list);
+ *	static CCAN_LIST_HEAD(my_global_list);
  */
-#define LIST_HEAD(name) \
-	struct list_head name = LIST_HEAD_INIT(name)
+#define CCAN_LIST_HEAD(name) \
+	struct ccan_list_head name = CCAN_LIST_HEAD_INIT(name)
 
 /**
- * list_head_init - initialize a list_head
- * @h: the list_head to set to the empty list
+ * ccan_list_head_init - initialize a ccan_list_head
+ * @h: the ccan_list_head to set to the empty list
  *
  * Example:
  *	...
  *	struct parent *parent = malloc(sizeof(*parent));
  *
- *	list_head_init(&parent->children);
+ *	ccan_list_head_init(&parent->children);
  *	parent->num_children = 0;
  */
-static inline void list_head_init(struct list_head *h)
+static inline void ccan_list_head_init(struct ccan_list_head *h)
 {
 	h->n.next = h->n.prev = &h->n;
 }
 
 /**
- * list_add - add an entry at the start of a linked list.
- * @h: the list_head to add the node to
- * @n: the list_node to add to the list.
+ * ccan_list_add - add an entry at the start of a linked list.
+ * @h: the ccan_list_head to add the node to
+ * @n: the ccan_list_node to add to the list.
  *
- * The list_node does not need to be initialized; it will be overwritten.
+ * The ccan_list_node does not need to be initialized; it will be overwritten.
  * Example:
  *	struct child *child = malloc(sizeof(*child));
  *
  *	child->name = "marvin";
- *	list_add(&parent->children, &child->list);
+ *	ccan_list_add(&parent->children, &child->list);
  *	parent->num_children++;
  */
-static inline void list_add(struct list_head *h, struct list_node *n)
+static inline void ccan_list_add(struct ccan_list_head *h, struct ccan_list_node *n)
 {
 	n->next = h->n.next;
 	n->prev = &h->n;
 	h->n.next->prev = n;
 	h->n.next = n;
-	(void)list_debug(h);
+	(void)ccan_list_debug(h);
 }
 
 /**
- * list_add_tail - add an entry at the end of a linked list.
- * @h: the list_head to add the node to
- * @n: the list_node to add to the list.
+ * ccan_list_add_tail - add an entry at the end of a linked list.
+ * @h: the ccan_list_head to add the node to
+ * @n: the ccan_list_node to add to the list.
  *
- * The list_node does not need to be initialized; it will be overwritten.
+ * The ccan_list_node does not need to be initialized; it will be overwritten.
  * Example:
- *	list_add_tail(&parent->children, &child->list);
+ *	ccan_list_add_tail(&parent->children, &child->list);
  *	parent->num_children++;
  */
-static inline void list_add_tail(struct list_head *h, struct list_node *n)
+static inline void ccan_list_add_tail(struct ccan_list_head *h, struct ccan_list_node *n)
 {
 	n->next = &h->n;
 	n->prev = h->n.prev;
 	h->n.prev->next = n;
 	h->n.prev = n;
-	(void)list_debug(h);
+	(void)ccan_list_debug(h);
 }
 
 /**
- * list_empty - is a list empty?
- * @h: the list_head
+ * ccan_list_empty - is a list empty?
+ * @h: the ccan_list_head
  *
  * If the list is empty, returns true.
  *
  * Example:
- *	assert(list_empty(&parent->children) == (parent->num_children == 0));
+ *	assert(ccan_list_empty(&parent->children) == (parent->num_children == 0));
  */
-static inline bool list_empty(const struct list_head *h)
+static inline bool ccan_list_empty(const struct ccan_list_head *h)
 {
-	(void)list_debug(h);
+	(void)ccan_list_debug(h);
 	return h->n.next == &h->n;
 }
 
 /**
- * list_del - delete an entry from an (unknown) linked list.
- * @n: the list_node to delete from the list.
+ * ccan_list_del - delete an entry from an (unknown) linked list.
+ * @n: the ccan_list_node to delete from the list.
  *
  * Note that this leaves @n in an undefined state; it can be added to
  * another list, but not deleted again.
  *
  * See also:
- *	list_del_from()
+ *	ccan_list_del_from()
  *
  * Example:
- *	list_del(&child->list);
+ *	ccan_list_del(&child->list);
  *	parent->num_children--;
  */
-static inline void list_del(struct list_node *n)
+static inline void ccan_list_del(struct ccan_list_node *n)
 {
-	(void)list_debug_node(n);
+	(void)ccan_list_debug_node(n);
 	n->next->prev = n->prev;
 	n->prev->next = n->next;
 #ifdef CCAN_LIST_DEBUG
@@ -224,134 +224,134 @@ static inline void list_del(struct list_node *n)
 }
 
 /**
- * list_del_from - delete an entry from a known linked list.
- * @h: the list_head the node is in.
- * @n: the list_node to delete from the list.
+ * ccan_list_del_from - delete an entry from a known linked list.
+ * @h: the ccan_list_head the node is in.
+ * @n: the ccan_list_node to delete from the list.
  *
  * This explicitly indicates which list a node is expected to be in,
  * which is better documentation and can catch more bugs.
  *
- * See also: list_del()
+ * See also: ccan_list_del()
  *
  * Example:
- *	list_del_from(&parent->children, &child->list);
+ *	ccan_list_del_from(&parent->children, &child->list);
  *	parent->num_children--;
  */
-static inline void list_del_from(struct list_head *h, struct list_node *n)
+static inline void ccan_list_del_from(struct ccan_list_head *h, struct ccan_list_node *n)
 {
 #ifdef CCAN_LIST_DEBUG
 	{
 		/* Thorough check: make sure it was in list! */
-		struct list_node *i;
+		struct ccan_list_node *i;
 		for (i = h->n.next; i != n; i = i->next)
 			assert(i != &h->n);
 	}
 #endif /* CCAN_LIST_DEBUG */
 
 	/* Quick test that catches a surprising number of bugs. */
-	assert(!list_empty(h));
-	list_del(n);
+	assert(!ccan_list_empty(h));
+	ccan_list_del(n);
 }
 
 /**
- * list_entry - convert a list_node back into the structure containing it.
- * @n: the list_node
+ * ccan_list_entry - convert a ccan_list_node back into the structure containing it.
+ * @n: the ccan_list_node
  * @type: the type of the entry
- * @member: the list_node member of the type
+ * @member: the ccan_list_node member of the type
  *
  * Example:
  *	// First list entry is children.next; convert back to child.
- *	child = list_entry(parent->children.n.next, struct child, list);
+ *	child = ccan_list_entry(parent->children.n.next, struct child, list);
  *
  * See Also:
- *	list_top(), list_for_each()


-- 
Samba Shared Repository


More information about the samba-cvs mailing list