diff options
author | Alasdair Kergon <agk@redhat.com> | 2008-11-03 22:14:30 +0000 |
---|---|---|
committer | Alasdair Kergon <agk@redhat.com> | 2008-11-03 22:14:30 +0000 |
commit | 2c44337bd5ff7aa217a39003460cba4742a1b867 (patch) | |
tree | 96e88ac95f4a573f099338ec48df36c9c55ff926 /libdm/datastruct | |
parent | 28f60ff82f7c13236475129295a88a01d61838c7 (diff) | |
download | lvm2-2c44337bd5ff7aa217a39003460cba4742a1b867.tar.gz lvm2-2c44337bd5ff7aa217a39003460cba4742a1b867.tar.xz lvm2-2c44337bd5ff7aa217a39003460cba4742a1b867.zip |
Right, a simple build (without options) is working again.
Diffstat (limited to 'libdm/datastruct')
-rw-r--r-- | libdm/datastruct/list.c | 42 | ||||
-rw-r--r-- | libdm/datastruct/list.h | 90 |
2 files changed, 66 insertions, 66 deletions
diff --git a/libdm/datastruct/list.c b/libdm/datastruct/list.c index 3f8fb8a8..cacebdac 100644 --- a/libdm/datastruct/list.c +++ b/libdm/datastruct/list.c @@ -19,7 +19,7 @@ * Initialise a list before use. * The list head's next and previous pointers point back to itself. */ -void list_init(struct list *head) +void dm_list_init(struct dm_list *head) { head->n = head->p = head; } @@ -28,7 +28,7 @@ void list_init(struct list *head) * Insert an element before 'head'. * If 'head' is the list head, this adds an element to the end of the list. */ -void list_add(struct list *head, struct list *elem) +void dm_list_add(struct dm_list *head, struct dm_list *elem) { assert(head->n); @@ -43,7 +43,7 @@ void list_add(struct list *head, struct list *elem) * Insert an element after 'head'. * If 'head' is the list head, this adds an element to the front of the list. */ -void list_add_h(struct list *head, struct list *elem) +void dm_list_add_h(struct dm_list *head, struct dm_list *elem) { assert(head->n); @@ -59,7 +59,7 @@ void list_add_h(struct list *head, struct list *elem) * Note that this doesn't change the element itself - it may still be safe * to follow its pointers. */ -void list_del(struct list *elem) +void dm_list_del(struct dm_list *elem) { elem->n->p = elem->p; elem->p->n = elem->n; @@ -68,16 +68,16 @@ void list_del(struct list *elem) /* * Remove an element from existing list and insert before 'head'. */ -void list_move(struct list *head, struct list *elem) +void dm_list_move(struct dm_list *head, struct dm_list *elem) { - list_del(elem); - list_add(head, elem); + dm_list_del(elem); + dm_list_add(head, elem); } /* * Is the list empty? */ -int list_empty(const struct list *head) +int dm_list_empty(const struct dm_list *head) { return head->n == head; } @@ -85,7 +85,7 @@ int list_empty(const struct list *head) /* * Is this the first element of the list? */ -int list_start(const struct list *head, const struct list *elem) +int dm_list_start(const struct dm_list *head, const struct dm_list *elem) { return elem->p == head; } @@ -93,7 +93,7 @@ int list_start(const struct list *head, const struct list *elem) /* * Is this the last element of the list? */ -int list_end(const struct list *head, const struct list *elem) +int dm_list_end(const struct dm_list *head, const struct dm_list *elem) { return elem->n == head; } @@ -101,44 +101,44 @@ int list_end(const struct list *head, const struct list *elem) /* * Return first element of the list or NULL if empty */ -struct list *list_first(const struct list *head) +struct dm_list *dm_list_first(const struct dm_list *head) { - return (list_empty(head) ? NULL : head->n); + return (dm_list_empty(head) ? NULL : head->n); } /* * Return last element of the list or NULL if empty */ -struct list *list_last(const struct list *head) +struct dm_list *dm_list_last(const struct dm_list *head) { - return (list_empty(head) ? NULL : head->p); + return (dm_list_empty(head) ? NULL : head->p); } /* * Return the previous element of the list, or NULL if we've reached the start. */ -struct list *list_prev(const struct list *head, const struct list *elem) +struct dm_list *dm_list_prev(const struct dm_list *head, const struct dm_list *elem) { - return (list_start(head, elem) ? NULL : elem->p); + return (dm_list_start(head, elem) ? NULL : elem->p); } /* * Return the next element of the list, or NULL if we've reached the end. */ -struct list *list_next(const struct list *head, const struct list *elem) +struct dm_list *dm_list_next(const struct dm_list *head, const struct dm_list *elem) { - return (list_end(head, elem) ? NULL : elem->n); + return (dm_list_end(head, elem) ? NULL : elem->n); } /* * Return the number of elements in a list by walking it. */ -unsigned int list_size(const struct list *head) +unsigned int dm_list_size(const struct dm_list *head) { unsigned int s = 0; - const struct list *v; + const struct dm_list *v; - list_iterate(v, head) + dm_list_iterate(v, head) s++; return s; diff --git a/libdm/datastruct/list.h b/libdm/datastruct/list.h index 02b6dd4d..46a17bdc 100644 --- a/libdm/datastruct/list.h +++ b/libdm/datastruct/list.h @@ -24,106 +24,106 @@ * The list head's pointers point to the first and the last element. */ -struct list { - struct list *n, *p; +struct dm_list { + struct dm_list *n, *p; }; /* * Initialise a list before use. * The list head's next and previous pointers point back to itself. */ -#define LIST_INIT(name) struct list name = { &(name), &(name) } -void list_init(struct list *head); +#define DM_LIST_INIT(name) struct dm_list name = { &(name), &(name) } +void dm_list_init(struct dm_list *head); /* * Insert an element before 'head'. * If 'head' is the list head, this adds an element to the end of the list. */ -void list_add(struct list *head, struct list *elem); +void dm_list_add(struct dm_list *head, struct dm_list *elem); /* * Insert an element after 'head'. * If 'head' is the list head, this adds an element to the front of the list. */ -void list_add_h(struct list *head, struct list *elem); +void dm_list_add_h(struct dm_list *head, struct dm_list *elem); /* * Delete an element from its list. * Note that this doesn't change the element itself - it may still be safe * to follow its pointers. */ -void list_del(struct list *elem); +void dm_list_del(struct dm_list *elem); /* * Remove an element from existing list and insert before 'head'. */ -void list_move(struct list *head, struct list *elem); +void dm_list_move(struct dm_list *head, struct dm_list *elem); /* * Is the list empty? */ -int list_empty(const struct list *head); +int dm_list_empty(const struct dm_list *head); /* * Is this the first element of the list? */ -int list_start(const struct list *head, const struct list *elem); +int dm_list_start(const struct dm_list *head, const struct dm_list *elem); /* * Is this the last element of the list? */ -int list_end(const struct list *head, const struct list *elem); +int dm_list_end(const struct dm_list *head, const struct dm_list *elem); /* * Return first element of the list or NULL if empty */ -struct list *list_first(const struct list *head); +struct dm_list *dm_list_first(const struct dm_list *head); /* * Return last element of the list or NULL if empty */ -struct list *list_last(const struct list *head); +struct dm_list *dm_list_last(const struct dm_list *head); /* * Return the previous element of the list, or NULL if we've reached the start. */ -struct list *list_prev(const struct list *head, const struct list *elem); +struct dm_list *dm_list_prev(const struct dm_list *head, const struct dm_list *elem); /* * Return the next element of the list, or NULL if we've reached the end. */ -struct list *list_next(const struct list *head, const struct list *elem); +struct dm_list *dm_list_next(const struct dm_list *head, const struct dm_list *elem); /* - * Given the address v of an instance of 'struct list' called 'head' + * Given the address v of an instance of 'struct dm_list' called 'head' * contained in a structure of type t, return the containing structure. */ -#define list_struct_base(v, t, head) \ +#define dm_list_struct_base(v, t, head) \ ((t *)((uintptr_t)(v) - (uintptr_t)&((t *) 0)->head)) /* - * Given the address v of an instance of 'struct list list' contained in + * Given the address v of an instance of 'struct dm_list list' contained in * a structure of type t, return the containing structure. */ -#define list_item(v, t) list_struct_base((v), t, list) +#define dm_list_item(v, t) dm_list_struct_base((v), t, list) /* * Given the address v of one known element e in a known structure of type t, * return another element f. */ -#define struct_field(v, t, e, f) \ +#define dm_struct_field(v, t, e, f) \ (((t *)((uintptr_t)(v) - (uintptr_t)&((t *) 0)->e))->f) /* * Given the address v of a known element e in a known structure of type t, * return the list head 'list' */ -#define list_head(v, t, e) struct_field(v, t, e, list) +#define dm_list_head(v, t, e) dm_struct_field(v, t, e, list) /* * Set v to each element of a list in turn. */ -#define list_iterate(v, head) \ +#define dm_list_iterate(v, head) \ for (v = (head)->n; v != head; v = v->n) /* @@ -133,7 +133,7 @@ struct list *list_next(const struct list *head, const struct list *elem); * already-processed elements. * If 'start' is 'head' it walks the list backwards. */ -#define list_uniterate(v, head, start) \ +#define dm_list_uniterate(v, head, start) \ for (v = (start)->p; v != head; v = v->p) /* @@ -141,68 +141,68 @@ struct list *list_next(const struct list *head, const struct list *elem); * the way. * t must be defined as a temporary variable of the same type as v. */ -#define list_iterate_safe(v, t, head) \ +#define dm_list_iterate_safe(v, t, head) \ for (v = (head)->n, t = v->n; v != head; v = t, t = v->n) /* * Walk a list, setting 'v' in turn to the containing structure of each item. * The containing structure should be the same type as 'v'. - * The 'struct list' variable within the containing structure is 'field'. + * The 'struct dm_list' variable within the containing structure is 'field'. */ -#define list_iterate_items_gen(v, head, field) \ - for (v = list_struct_base((head)->n, typeof(*v), field); \ +#define dm_list_iterate_items_gen(v, head, field) \ + for (v = dm_list_struct_base((head)->n, typeof(*v), field); \ &v->field != (head); \ - v = list_struct_base(v->field.n, typeof(*v), field)) + v = dm_list_struct_base(v->field.n, typeof(*v), field)) /* * Walk a list, setting 'v' in turn to the containing structure of each item. * The containing structure should be the same type as 'v'. - * The list should be 'struct list list' within the containing structure. + * The list should be 'struct dm_list list' within the containing structure. */ -#define list_iterate_items(v, head) list_iterate_items_gen(v, (head), list) +#define dm_list_iterate_items(v, head) dm_list_iterate_items_gen(v, (head), list) /* * Walk a list, setting 'v' in turn to the containing structure of each item. * The containing structure should be the same type as 'v'. - * The 'struct list' variable within the containing structure is 'field'. + * The 'struct dm_list' variable within the containing structure is 'field'. * t must be defined as a temporary variable of the same type as v. */ -#define list_iterate_items_gen_safe(v, t, head, field) \ - for (v = list_struct_base((head)->n, typeof(*v), field), \ - t = list_struct_base(v->field.n, typeof(*v), field); \ +#define dm_list_iterate_items_gen_safe(v, t, head, field) \ + for (v = dm_list_struct_base((head)->n, typeof(*v), field), \ + t = dm_list_struct_base(v->field.n, typeof(*v), field); \ &v->field != (head); \ - v = t, t = list_struct_base(v->field.n, typeof(*v), field)) + v = t, t = dm_list_struct_base(v->field.n, typeof(*v), field)) /* * Walk a list, setting 'v' in turn to the containing structure of each item. * The containing structure should be the same type as 'v'. - * The list should be 'struct list list' within the containing structure. + * The list should be 'struct dm_list list' within the containing structure. * t must be defined as a temporary variable of the same type as v. */ -#define list_iterate_items_safe(v, t, head) \ - list_iterate_items_gen_safe(v, t, (head), list) +#define dm_list_iterate_items_safe(v, t, head) \ + dm_list_iterate_items_gen_safe(v, t, (head), list) /* * Walk a list backwards, setting 'v' in turn to the containing structure * of each item. * The containing structure should be the same type as 'v'. - * The 'struct list' variable within the containing structure is 'field'. + * The 'struct dm_list' variable within the containing structure is 'field'. */ -#define list_iterate_back_items_gen(v, head, field) \ - for (v = list_struct_base((head)->p, typeof(*v), field); \ +#define dm_list_iterate_back_items_gen(v, head, field) \ + for (v = dm_list_struct_base((head)->p, typeof(*v), field); \ &v->field != (head); \ - v = list_struct_base(v->field.p, typeof(*v), field)) + v = dm_list_struct_base(v->field.p, typeof(*v), field)) /* * Walk a list backwards, setting 'v' in turn to the containing structure * of each item. * The containing structure should be the same type as 'v'. - * The list should be 'struct list list' within the containing structure. + * The list should be 'struct dm_list list' within the containing structure. */ -#define list_iterate_back_items(v, head) list_iterate_back_items_gen(v, (head), list) +#define dm_list_iterate_back_items(v, head) dm_list_iterate_back_items_gen(v, (head), list) /* * Return the number of elements in a list by walking it. */ -unsigned int list_size(const struct list *head); +unsigned int dm_list_size(const struct dm_list *head); #endif |