Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 29075
b: refs/heads/master
c: 54e7377
h: refs/heads/master
i:
  29073: 121a7d6
  29071: ce604ec
v: v3
  • Loading branch information
Oleg Nesterov authored and Linus Torvalds committed Jun 23, 2006
1 parent 7c7263a commit 4b34a74
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: cb259f07b1daacafac3b12ecd7f180faf7e506b0
refs/heads/master: 54e73770357142e297c916c7865f5fca7499f69c
23 changes: 23 additions & 0 deletions trunk/include/linux/list.h
Original file line number Diff line number Diff line change
Expand Up @@ -197,12 +197,35 @@ static inline void list_del_rcu(struct list_head *entry)
entry->prev = LIST_POISON2;
}

/**
* list_replace - replace old entry by new one
* @old : the element to be replaced
* @new : the new element to insert
* Note: if 'old' was empty, it will be overwritten.
*/
static inline void list_replace(struct list_head *old,
struct list_head *new)
{
new->next = old->next;
new->next->prev = new;
new->prev = old->prev;
new->prev->next = new;
}

static inline void list_replace_init(struct list_head *old,
struct list_head *new)
{
list_replace(old, new);
INIT_LIST_HEAD(old);
}

/*
* list_replace_rcu - replace old entry by new one
* @old : the element to be replaced
* @new : the new element to insert
*
* The old entry will be replaced with the new entry atomically.
* Note: 'old' should not be empty.
*/
static inline void list_replace_rcu(struct list_head *old,
struct list_head *new)
Expand Down

0 comments on commit 4b34a74

Please sign in to comment.