mirror of
git://github.com/lxc/lxc
synced 2025-09-03 16:39:34 +00:00
cleanup list.h
Rename lxc_list.h to list.h Signed-off-by: Daniel Lezcano <daniel.lezcano@free.fr>
This commit is contained in:
committed by
Daniel Lezcano
parent
731cc33fb7
commit
951cc719a3
@@ -11,7 +11,7 @@ pkginclude_HEADERS = \
|
|||||||
lxc.h \
|
lxc.h \
|
||||||
cgroup.h \
|
cgroup.h \
|
||||||
conf.h \
|
conf.h \
|
||||||
lxc_list.h \
|
list.h \
|
||||||
log.h \
|
log.h \
|
||||||
lxc_state.h
|
lxc_state.h
|
||||||
|
|
||||||
@@ -35,7 +35,7 @@ liblxc_la_SOURCES = \
|
|||||||
lock.c lock.h \
|
lock.c lock.h \
|
||||||
namespace.h \
|
namespace.h \
|
||||||
conf.c conf.h \
|
conf.c conf.h \
|
||||||
lxc_list.h \
|
list.h \
|
||||||
lxc_state.c lxc_state.h \
|
lxc_state.c lxc_state.h \
|
||||||
log.c log.h \
|
log.c log.h \
|
||||||
\
|
\
|
||||||
|
@@ -1,52 +1,64 @@
|
|||||||
#ifndef _list_h
|
#ifndef _list_h
|
||||||
#define _list_h
|
#define _list_h
|
||||||
|
|
||||||
struct list {
|
struct lxc_list {
|
||||||
void *elem;
|
void *elem;
|
||||||
struct list *next;
|
struct lxc_list *next;
|
||||||
struct list *prev;
|
struct lxc_list *prev;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define init_list(l) { .next = l, .prev = l, }
|
#define lxc_init_list(l) { .next = l, .prev = l }
|
||||||
|
|
||||||
#define list_for_each(__iterator, __list) \
|
#define lxc_list_for_each(__iterator, __list) \
|
||||||
for (__iterator = (__list)->next; \
|
for (__iterator = (__list)->next; \
|
||||||
__iterator != __list; \
|
__iterator != __list; \
|
||||||
__iterator = __iterator->next)
|
__iterator = __iterator->next)
|
||||||
|
|
||||||
static inline void list_init(struct list *list)
|
static inline void lxc_list_init(struct lxc_list *list)
|
||||||
{
|
{
|
||||||
list->elem = NULL;
|
list->elem = NULL;
|
||||||
list->next = list->prev = list;
|
list->next = list->prev = list;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void list_add_elem(struct list *list, void *elem)
|
static inline void lxc_list_add_elem(struct lxc_list *list, void *elem)
|
||||||
{
|
{
|
||||||
list->elem = elem;
|
list->elem = elem;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void *list_first_elem(struct list *list)
|
static inline void *lxc_list_first_elem(struct lxc_list *list)
|
||||||
{
|
{
|
||||||
return list->next->elem;
|
return list->next->elem;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int list_empty(struct list *list)
|
static inline int lxc_list_empty(struct lxc_list *list)
|
||||||
{
|
{
|
||||||
return list == list->next;
|
return list == list->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void list_add(struct list *list, struct list *new)
|
static inline void __lxc_list_add(struct lxc_list *new,
|
||||||
|
struct lxc_list *prev,
|
||||||
|
struct lxc_list *next)
|
||||||
{
|
{
|
||||||
struct list *next = list->next;
|
next->prev = new;
|
||||||
next->prev = new;
|
new->next = next;
|
||||||
new->next = next;
|
new->prev = prev;
|
||||||
new->prev = list;
|
prev->next = new;
|
||||||
list->next = new;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void list_del(struct list *list)
|
static inline void lxc_list_add(struct lxc_list *head, struct lxc_list *list)
|
||||||
{
|
{
|
||||||
struct list *next, *prev;
|
__lxc_list_add(list, head, head->next);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void lxc_list_add_tail(struct lxc_list *head,
|
||||||
|
struct lxc_list *list)
|
||||||
|
{
|
||||||
|
__lxc_list_add(list, head->prev, head);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void lxc_list_del(struct lxc_list *list)
|
||||||
|
{
|
||||||
|
struct lxc_list *next, *prev;
|
||||||
|
|
||||||
next = list->next;
|
next = list->next;
|
||||||
prev = list->prev;
|
prev = list->prev;
|
||||||
|
@@ -34,7 +34,7 @@ extern "C" {
|
|||||||
**/
|
**/
|
||||||
|
|
||||||
#include <lxc/lxc_state.h>
|
#include <lxc/lxc_state.h>
|
||||||
#include <lxc/lxc_list.h>
|
#include <lxc/list.h>
|
||||||
#include <lxc/log.h>
|
#include <lxc/log.h>
|
||||||
#include <lxc/conf.h>
|
#include <lxc/conf.h>
|
||||||
#include <lxc/lock.h>
|
#include <lxc/lock.h>
|
||||||
|
@@ -1,23 +0,0 @@
|
|||||||
/*
|
|
||||||
* lxc: linux Container library
|
|
||||||
*
|
|
||||||
* (C) Copyright IBM Corp. 2007, 2008
|
|
||||||
*
|
|
||||||
* Authors:
|
|
||||||
* Daniel Lezcano <dlezcano at fr.ibm.com>
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
|
||||||
* License along with this library; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
*/
|
|
||||||
#include <list.h>
|
|
@@ -1,69 +0,0 @@
|
|||||||
#ifndef _list_h
|
|
||||||
#define _list_h
|
|
||||||
|
|
||||||
struct lxc_list {
|
|
||||||
void *elem;
|
|
||||||
struct lxc_list *next;
|
|
||||||
struct lxc_list *prev;
|
|
||||||
};
|
|
||||||
|
|
||||||
#define lxc_init_list(l) { .next = l, .prev = l }
|
|
||||||
|
|
||||||
#define lxc_list_for_each(__iterator, __list) \
|
|
||||||
for (__iterator = (__list)->next; \
|
|
||||||
__iterator != __list; \
|
|
||||||
__iterator = __iterator->next)
|
|
||||||
|
|
||||||
static inline void lxc_list_init(struct lxc_list *list)
|
|
||||||
{
|
|
||||||
list->elem = NULL;
|
|
||||||
list->next = list->prev = list;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void lxc_list_add_elem(struct lxc_list *list, void *elem)
|
|
||||||
{
|
|
||||||
list->elem = elem;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void *lxc_list_first_elem(struct lxc_list *list)
|
|
||||||
{
|
|
||||||
return list->next->elem;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int lxc_list_empty(struct lxc_list *list)
|
|
||||||
{
|
|
||||||
return list == list->next;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void __lxc_list_add(struct lxc_list *new,
|
|
||||||
struct lxc_list *prev,
|
|
||||||
struct lxc_list *next)
|
|
||||||
{
|
|
||||||
next->prev = new;
|
|
||||||
new->next = next;
|
|
||||||
new->prev = prev;
|
|
||||||
prev->next = new;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void lxc_list_add(struct lxc_list *head, struct lxc_list *list)
|
|
||||||
{
|
|
||||||
__lxc_list_add(list, head, head->next);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void lxc_list_add_tail(struct lxc_list *head,
|
|
||||||
struct lxc_list *list)
|
|
||||||
{
|
|
||||||
__lxc_list_add(list, head->prev, head);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void lxc_list_del(struct lxc_list *list)
|
|
||||||
{
|
|
||||||
struct lxc_list *next, *prev;
|
|
||||||
|
|
||||||
next = list->next;
|
|
||||||
prev = list->prev;
|
|
||||||
next->prev = prev;
|
|
||||||
prev->next = next;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
Reference in New Issue
Block a user