1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

Add dm_list_splice() to join two lists.

This commit is contained in:
Zdenek Kabelac 2010-05-06 10:10:15 +00:00
parent 180b3dea11
commit 3283f817eb
4 changed files with 31 additions and 1 deletions

View File

@ -1,6 +1,8 @@
Version 2.02.65 - Version 2.02.65 -
================================= =================================
Suppress duplicate error messages about read failures and missing devices. Suppress duplicate error messages about read failures and missing devices.
Install plugins to $(libdir)/device-mapper and $(libdir)/lvm2.
Add dm_list_splice() function to join two lists together.
Version 2.02.64 - 30th April 2010 Version 2.02.64 - 30th April 2010
================================= =================================

View File

@ -155,6 +155,7 @@ dm_list_add
dm_list_add_h dm_list_add_h
dm_list_del dm_list_del
dm_list_move dm_list_move
dm_list_splice
dm_list_empty dm_list_empty
dm_list_start dm_list_start
dm_list_end dm_list_end

View File

@ -1,6 +1,6 @@
/* /*
* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved. * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
* Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved. * Copyright (C) 2004-2010 Red Hat, Inc. All rights reserved.
* *
* This file is part of LVM2. * This file is part of LVM2.
* *
@ -144,3 +144,25 @@ unsigned int dm_list_size(const struct dm_list *head)
return s; return s;
} }
/*
* Join two lists together.
* This moves all the elements of the list 'head1' to the end of the list
* 'head', leaving 'head1' empty.
*/
void dm_list_splice(struct dm_list *head, struct dm_list *head1)
{
assert(head->n);
assert(head1->n);
if (dm_list_empty(head1))
return;
head1->p->n = head;
head1->n->p = head->p;
head->p->n = head1->n;
head->p = head1->p;
dm_list_init(head1);
}

View File

@ -717,6 +717,11 @@ void dm_list_del(struct dm_list *elem);
*/ */
void dm_list_move(struct dm_list *head, struct dm_list *elem); void dm_list_move(struct dm_list *head, struct dm_list *elem);
/*
* Join 'head1' to the of 'head'.
*/
void dm_list_splice(struct dm_list *head, struct dm_list *head1);
/* /*
* Is the list empty? * Is the list empty?
*/ */