Print this page
3525 Persistent L2ARC

*** 20,41 **** */ /* * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #ifndef _SYS_LIST_H #define _SYS_LIST_H - #pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/list_impl.h> #ifdef __cplusplus extern "C" { #endif typedef struct list_node list_node_t; typedef struct list list_t; void list_create(list_t *, size_t, size_t); void list_destroy(list_t *); --- 20,55 ---- */ /* * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ + /* + * Copyright 2013 Saso Kiselkov, All rights reserved. + */ #ifndef _SYS_LIST_H #define _SYS_LIST_H #include <sys/list_impl.h> #ifdef __cplusplus extern "C" { #endif + /* + * Please note that a list_node_t contains pointers back to its parent list_t + * so you cannot copy the list_t around once it has been initialized. In + * particular, this kind of construct won't work: + * + * struct { list_t l; } a, b; + * list_create(&a.l, ...); + * b = a; <= This will break the list in `b', as the `l' element in `a' + * got copied to a different memory address. + * + * When copying structures with lists use list_move_tail() to move the list + * from the src to dst (the source reference will then become invalid). + */ typedef struct list_node list_node_t; typedef struct list list_t; void list_create(list_t *, size_t, size_t); void list_destroy(list_t *);