Mercurial > illumos > illumos-gate
changeset 12710:66c9c36f2046
6677657 smb_list.c shouldn't exist
6840819 zfs does not automount directories after the pool is restored
6953725 sporadic syseventd core dump during lun expansion due to double free
6962880 erroneous creation date in usr/src/cmd/mdb/Makefile.common copyright
6963174 user-land libraries shouldn't directly compile uts/common/os/list.c
line wrap: on
line diff
--- a/usr/src/cmd/cmd-inet/usr.lib/ilbd/Makefile Mon Jun 28 09:11:16 2010 -0600 +++ b/usr/src/cmd/cmd-inet/usr.lib/ilbd/Makefile Mon Jun 28 09:19:17 2010 -0600 @@ -30,13 +30,10 @@ ILBD_SRCS= $(ILBD_OBJS:%.o=%.c) HDRS= ilbd.h -LIST_OBJS= list.o -LIST_SRCS= $(LIST_OBJS:%.o=../../../uts/common/os/%.c) - LIB_INC= $(SRC)/lib/libilb/common -OBJS= $(ILBD_OBJS) $(LIST_OBJS) -SRCS= $(ILBD_SRCS) $(LIST_SRCS) +OBJS= $(ILBD_OBJS) +SRCS= $(ILBD_SRCS) ILBSUBDIRS= ilb @@ -65,7 +62,7 @@ lint:= TARGET= lint -LDLIBS += -lsocket -lsecdb -lnsl -lilb -lscf -linetutil -lbsm +LDLIBS += -lcmdutils -lsocket -lsecdb -lnsl -lilb -lscf -linetutil -lbsm .KEEP_STATE: @@ -95,11 +92,6 @@ include ../../../Makefile.targ -# the below is needed to get list.o built -%.o: ../../../../uts/common/os/%.c - $(COMPILE.c) -o $@ $< - $(POST_PROCESS_O) - $(ILBSUBDIRS): FRC @cd $@; pwd; $(MAKE) $(TARGET)
--- a/usr/src/cmd/cmd-inet/usr.sbin/ilbadm/Makefile Mon Jun 28 09:11:16 2010 -0600 +++ b/usr/src/cmd/cmd-inet/usr.sbin/ilbadm/Makefile Mon Jun 28 09:19:17 2010 -0600 @@ -25,11 +25,9 @@ ILB_OBJS = ilbadm.o ilbadm_sg.o ilbadm_rules.o ilbadm_hc.o ILB_OBJS += ilbadm_subr.o ilbadm_import.o ilbadm_nat.o ilbadm_stats.o -LIST_OBJS = list.o -OBJS = $(ILB_OBJS) $(LIST_OBJS) +OBJS = $(ILB_OBJS) ILB_SRCS= $(ILB_OBJS:.o=.c) -LIST_SRCS= $(LIST_OBJS:%.o=../../../../uts/common/os/%.c) SRCS= $(ILB_SRC) $(LIST_SRCS) @@ -37,7 +35,7 @@ include ../../../Makefile.ctf include ../../Makefile.cmd-inet -LDLIBS += -lsocket -lnsl -lilb -linetutil -lkstat +LDLIBS += -lcmdutils -lsocket -lnsl -lilb -linetutil -lkstat CPPFLAGS += -I$(SRC)/lib/libilb/common -I$(SRC)/uts/common C99MODE = $(C99_ENABLE) @@ -71,8 +69,3 @@ $(HDRCHK) $(PROG).h include ../../../Makefile.targ - -# the below is needed to get list.o built -%.o: ../../../../uts/common/os/%.c - $(COMPILE.c) -o $@ $< - $(POST_PROCESS_O)
--- a/usr/src/cmd/mdb/Makefile.common Mon Jun 28 09:11:16 2010 -0600 +++ b/usr/src/cmd/mdb/Makefile.common Mon Jun 28 09:19:17 2010 -0600 @@ -18,8 +18,7 @@ # # CDDL HEADER END # -# -# Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. # # MDB modules used for debugging user processes that every ISA's build # subdirectory will need to build. @@ -29,6 +28,7 @@ dof \ libavl \ libc \ + libcmdutils \ libnvpair \ libproc \ libpython2.6 \
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usr/src/cmd/mdb/common/modules/libcmdutils/libcmdutils.c Mon Jun 28 09:19:17 2010 -0600 @@ -0,0 +1,43 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + */ + +#include <mdb/mdb_modapi.h> + +#include "../genunix/list.h" + +static const mdb_walker_t walkers[] = { + { LIST_WALK_NAME, LIST_WALK_DESC, + list_walk_init, list_walk_step, list_walk_fini }, + { NULL } +}; + +static const mdb_modinfo_t modinfo = { + MDB_API_VERSION, NULL, walkers +}; + +const mdb_modinfo_t * +_mdb_init(void) +{ + return (&modinfo); +}
--- a/usr/src/cmd/mdb/common/modules/zfs/zfs.c Mon Jun 28 09:11:16 2010 -0600 +++ b/usr/src/cmd/mdb/common/modules/zfs/zfs.c Mon Jun 28 09:19:17 2010 -0600 @@ -42,10 +42,6 @@ #include <sys/zfs_acl.h> #include <sys/sa_impl.h> -#ifndef _KERNEL -#include "../genunix/list.h" -#endif - #ifdef _KERNEL #define ZFS_OBJ_NAME "zfs" #else @@ -3019,14 +3015,6 @@ }; static const mdb_walker_t walkers[] = { - /* - * In userland, there is no generic provider of list_t walkers, so we - * need to add it. - */ -#ifndef _KERNEL - { LIST_WALK_NAME, LIST_WALK_DESC, - list_walk_init, list_walk_step, list_walk_fini }, -#endif { "zms_freelist", "walk ZFS metaslab freelist", freelist_walk_init, freelist_walk_step, NULL }, { "txg_list", "given any txg_list_t *, walk all entries in all txgs",
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usr/src/cmd/mdb/intel/amd64/libcmdutils/Makefile Mon Jun 28 09:19:17 2010 -0600 @@ -0,0 +1,34 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# +# +# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. +# + +MODULE = libcmdutils.so +MDBTGT = proc + +MODSRCS = libcmdutils.c \ + list.c + +include ../../../../Makefile.cmd +include ../../../../Makefile.cmd.64 +include ../../Makefile.amd64 +include ../../../Makefile.module
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usr/src/cmd/mdb/intel/ia32/libcmdutils/Makefile Mon Jun 28 09:19:17 2010 -0600 @@ -0,0 +1,33 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# +# +# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. +# + +MODULE = libcmdutils.so +MDBTGT = proc + +MODSRCS = libcmdutils.c \ + list.c + +include ../../../../Makefile.cmd +include ../../Makefile.ia32 +include ../../../Makefile.module
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usr/src/cmd/mdb/sparc/v7/libcmdutils/Makefile Mon Jun 28 09:19:17 2010 -0600 @@ -0,0 +1,33 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# +# +# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. +# + +MODULE = libcmdutils.so +MDBTGT = proc + +MODSRCS = libcmdutils.c \ + list.c + +include ../../../../Makefile.cmd +include ../../Makefile.sparcv7 +include ../../../Makefile.module
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usr/src/cmd/mdb/sparc/v9/libcmdutils/Makefile Mon Jun 28 09:19:17 2010 -0600 @@ -0,0 +1,34 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# +# +# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. +# + +MODULE = libcmdutils.so +MDBTGT = proc + +MODSRCS = libcmdutils.c \ + list.c + +include ../../../../Makefile.cmd +include ../../../../Makefile.cmd.64 +include ../../Makefile.sparcv9 +include ../../../Makefile.module
--- a/usr/src/cmd/smbsrv/smbd/Makefile Mon Jun 28 09:11:16 2010 -0600 +++ b/usr/src/cmd/smbsrv/smbd/Makefile Mon Jun 28 09:19:17 2010 -0600 @@ -51,7 +51,7 @@ include ../Makefile.smbsrv.defs LDLIBS += -L$(ROOT)/usr/lib/smbsrv -lmlsvc -lmlrpc -lsmbns -lsmb \ - -lzfs -lbsm -lsocket -lnsl -lscf -lumem + -lzfs -lbsm -lsocket -lnsl -lscf -lumem -lcmdutils LDFLAGS += -R/usr/lib/smbsrv ROOTSMBDDIR = $(ROOTLIB)/smbsrv
--- a/usr/src/cmd/syseventd/modules/zfs_mod/Makefile Mon Jun 28 09:11:16 2010 -0600 +++ b/usr/src/cmd/syseventd/modules/zfs_mod/Makefile Mon Jun 28 09:19:17 2010 -0600 @@ -19,16 +19,15 @@ # CDDL HEADER END # # -# Copyright 2008 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. +# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. # -#ident "%Z%%M% %I% %E% SMI" LIBRARY= zfs_mod include ../Makefile.com -LDLIBS += -lzfs -ldevid -lnvpair +CPPFLAGS += -I../../../../lib/libc/inc +LDLIBS += -lzfs -ldevid -lcmdutils -lnvpair .KEEP_STATE:
--- a/usr/src/cmd/syseventd/modules/zfs_mod/zfs_mod.c Mon Jun 28 09:11:16 2010 -0600 +++ b/usr/src/cmd/syseventd/modules/zfs_mod/zfs_mod.c Mon Jun 28 09:19:17 2010 -0600 @@ -69,9 +69,11 @@ #include <stdlib.h> #include <string.h> #include <syslog.h> +#include <sys/list.h> #include <sys/sunddi.h> #include <sys/sysevent/eventdefs.h> #include <sys/sysevent/dev.h> +#include <thread_pool.h> #include <unistd.h> #include "syseventd.h" @@ -88,6 +90,41 @@ typedef void (*zfs_process_func_t)(zpool_handle_t *, nvlist_t *, boolean_t); libzfs_handle_t *g_zfshdl; +list_t g_pool_list; +tpool_t *g_tpool; + +typedef struct unavailpool { + zpool_handle_t *uap_zhp; + list_node_t uap_node; +} unavailpool_t; + +int +zfs_toplevel_state(zpool_handle_t *zhp) +{ + nvlist_t *nvroot; + vdev_stat_t *vs; + unsigned int c; + + verify(nvlist_lookup_nvlist(zpool_get_config(zhp, NULL), + ZPOOL_CONFIG_VDEV_TREE, &nvroot) == 0); + verify(nvlist_lookup_uint64_array(nvroot, ZPOOL_CONFIG_VDEV_STATS, + (uint64_t **)&vs, &c) == 0); + return (vs->vs_state); +} + +static int +zfs_unavail_pool(zpool_handle_t *zhp, void *data) +{ + if (zfs_toplevel_state(zhp) < VDEV_STATE_DEGRADED) { + unavailpool_t *uap; + uap = malloc(sizeof (unavailpool_t)); + uap->uap_zhp = zhp; + list_insert_tail((list_t *)data, uap); + } else { + zpool_close(zhp); + } + return (0); +} /* * The device associated with the given vdev (either by devid or physical path) @@ -278,12 +315,23 @@ (dp->dd_func)(zhp, nvl, dp->dd_isdisk); } +void +zfs_enable_ds(void *arg) +{ + unavailpool_t *pool = (unavailpool_t *)arg; + + (void) zpool_enable_datasets(pool->uap_zhp, NULL, 0); + zpool_close(pool->uap_zhp); + free(pool); +} + static int zfs_iter_pool(zpool_handle_t *zhp, void *data) { nvlist_t *config, *nvl; dev_data_t *dp = data; uint64_t pool_guid; + unavailpool_t *pool; if ((config = zpool_get_config(zhp, NULL)) != NULL) { if (dp->dd_pool_guid == 0 || @@ -294,6 +342,18 @@ zfs_iter_vdev(zhp, nvl, data); } } + for (pool = list_head(&g_pool_list); pool != NULL; + pool = list_next(&g_pool_list, pool)) { + + if (strcmp(zpool_get_name(zhp), + zpool_get_name(pool->uap_zhp))) + continue; + if (zfs_toplevel_state(zhp) >= VDEV_STATE_DEGRADED) { + list_remove(&g_pool_list, pool); + (void) tpool_dispatch(g_tpool, zfs_enable_ds, pool); + break; + } + } zpool_close(zhp); return (0); @@ -530,7 +590,6 @@ " found\n", devname); return (1); } - nvlist_free(nvl); return (0); } @@ -596,12 +655,30 @@ { if ((g_zfshdl = libzfs_init()) == NULL) return (NULL); - + /* collect a list of unavailable pools */ + list_create(&g_pool_list, sizeof (struct unavailpool), + offsetof(struct unavailpool, uap_node)); + (void) zpool_iter(g_zfshdl, zfs_unavail_pool, (void *)&g_pool_list); + if (!list_is_empty(&g_pool_list)) + g_tpool = tpool_create(1, sysconf(_SC_NPROCESSORS_ONLN), + 0, NULL); return (&zfs_mod_ops); } void slm_fini() { + unavailpool_t *pool; + + if (g_tpool) { + tpool_wait(g_tpool); + tpool_destroy(g_tpool); + } + while ((pool = (list_head(&g_pool_list))) != NULL) { + list_remove(&g_pool_list, pool); + zpool_close(pool->uap_zhp); + free(pool); + } + list_destroy(&g_pool_list); libzfs_fini(g_zfshdl); }
--- a/usr/src/cmd/ztest/Makefile.com Mon Jun 28 09:11:16 2010 -0600 +++ b/usr/src/cmd/ztest/Makefile.com Mon Jun 28 09:19:17 2010 -0600 @@ -19,8 +19,7 @@ # CDDL HEADER END # # -# Copyright 2009 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. +# Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. # PROG= ztest @@ -33,7 +32,7 @@ INCS += -I../../../lib/libzpool/common INCS += -I../../../uts/common/fs/zfs -LDLIBS += -lumem -lzpool -lm -lnvpair +LDLIBS += -lumem -lzpool -lcmdutils -lm -lnvpair C99MODE= -xc99=%all C99LMODE= -Xc99=%all
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usr/src/common/list/list.c Mon Jun 28 09:19:17 2010 -0600 @@ -0,0 +1,251 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + */ + +/* + * Generic doubly-linked list implementation + */ + +#include <sys/list.h> +#include <sys/list_impl.h> +#include <sys/types.h> +#include <sys/sysmacros.h> +#ifdef _KERNEL +#include <sys/debug.h> +#else +#include <assert.h> +#define ASSERT(a) assert(a) +#endif + +#ifdef lint +extern list_node_t *list_d2l(list_t *list, void *obj); +#else +#define list_d2l(a, obj) ((list_node_t *)(((char *)obj) + (a)->list_offset)) +#endif +#define list_object(a, node) ((void *)(((char *)node) - (a)->list_offset)) +#define list_empty(a) ((a)->list_head.list_next == &(a)->list_head) + +#define list_insert_after_node(list, node, object) { \ + list_node_t *lnew = list_d2l(list, object); \ + lnew->list_prev = (node); \ + lnew->list_next = (node)->list_next; \ + (node)->list_next->list_prev = lnew; \ + (node)->list_next = lnew; \ +} + +#define list_insert_before_node(list, node, object) { \ + list_node_t *lnew = list_d2l(list, object); \ + lnew->list_next = (node); \ + lnew->list_prev = (node)->list_prev; \ + (node)->list_prev->list_next = lnew; \ + (node)->list_prev = lnew; \ +} + +#define list_remove_node(node) \ + (node)->list_prev->list_next = (node)->list_next; \ + (node)->list_next->list_prev = (node)->list_prev; \ + (node)->list_next = (node)->list_prev = NULL + +void +list_create(list_t *list, size_t size, size_t offset) +{ + ASSERT(list); + ASSERT(size > 0); + ASSERT(size >= offset + sizeof (list_node_t)); + + list->list_size = size; + list->list_offset = offset; + list->list_head.list_next = list->list_head.list_prev = + &list->list_head; +} + +void +list_destroy(list_t *list) +{ + list_node_t *node = &list->list_head; + + ASSERT(list); + ASSERT(list->list_head.list_next == node); + ASSERT(list->list_head.list_prev == node); + + node->list_next = node->list_prev = NULL; +} + +void +list_insert_after(list_t *list, void *object, void *nobject) +{ + if (object == NULL) { + list_insert_head(list, nobject); + } else { + list_node_t *lold = list_d2l(list, object); + list_insert_after_node(list, lold, nobject); + } +} + +void +list_insert_before(list_t *list, void *object, void *nobject) +{ + if (object == NULL) { + list_insert_tail(list, nobject); + } else { + list_node_t *lold = list_d2l(list, object); + list_insert_before_node(list, lold, nobject); + } +} + +void +list_insert_head(list_t *list, void *object) +{ + list_node_t *lold = &list->list_head; + list_insert_after_node(list, lold, object); +} + +void +list_insert_tail(list_t *list, void *object) +{ + list_node_t *lold = &list->list_head; + list_insert_before_node(list, lold, object); +} + +void +list_remove(list_t *list, void *object) +{ + list_node_t *lold = list_d2l(list, object); + ASSERT(!list_empty(list)); + ASSERT(lold->list_next != NULL); + list_remove_node(lold); +} + +void * +list_remove_head(list_t *list) +{ + list_node_t *head = list->list_head.list_next; + if (head == &list->list_head) + return (NULL); + list_remove_node(head); + return (list_object(list, head)); +} + +void * +list_remove_tail(list_t *list) +{ + list_node_t *tail = list->list_head.list_prev; + if (tail == &list->list_head) + return (NULL); + list_remove_node(tail); + return (list_object(list, tail)); +} + +void * +list_head(list_t *list) +{ + if (list_empty(list)) + return (NULL); + return (list_object(list, list->list_head.list_next)); +} + +void * +list_tail(list_t *list) +{ + if (list_empty(list)) + return (NULL); + return (list_object(list, list->list_head.list_prev)); +} + +void * +list_next(list_t *list, void *object) +{ + list_node_t *node = list_d2l(list, object); + + if (node->list_next != &list->list_head) + return (list_object(list, node->list_next)); + + return (NULL); +} + +void * +list_prev(list_t *list, void *object) +{ + list_node_t *node = list_d2l(list, object); + + if (node->list_prev != &list->list_head) + return (list_object(list, node->list_prev)); + + return (NULL); +} + +/* + * Insert src list after dst list. Empty src list thereafter. + */ +void +list_move_tail(list_t *dst, list_t *src) +{ + list_node_t *dstnode = &dst->list_head; + list_node_t *srcnode = &src->list_head; + + ASSERT(dst->list_size == src->list_size); + ASSERT(dst->list_offset == src->list_offset); + + if (list_empty(src)) + return; + + dstnode->list_prev->list_next = srcnode->list_next; + srcnode->list_next->list_prev = dstnode->list_prev; + dstnode->list_prev = srcnode->list_prev; + srcnode->list_prev->list_next = dstnode; + + /* empty src list */ + srcnode->list_next = srcnode->list_prev = srcnode; +} + +void +list_link_replace(list_node_t *lold, list_node_t *lnew) +{ + ASSERT(list_link_active(lold)); + ASSERT(!list_link_active(lnew)); + + lnew->list_next = lold->list_next; + lnew->list_prev = lold->list_prev; + lold->list_prev->list_next = lnew; + lold->list_next->list_prev = lnew; + lold->list_next = lold->list_prev = NULL; +} + +void +list_link_init(list_node_t *link) +{ + link->list_next = NULL; + link->list_prev = NULL; +} + +int +list_link_active(list_node_t *link) +{ + return (link->list_next != NULL); +} + +int +list_is_empty(list_t *list) +{ + return (list_empty(list)); +}
--- a/usr/src/lib/Makefile Mon Jun 28 09:11:16 2010 -0600 +++ b/usr/src/lib/Makefile Mon Jun 28 09:19:17 2010 -0600 @@ -610,7 +610,7 @@ libsctp: libsocket libshell: libast libcmd libdll libsocket libsecdb libsip: libmd5 -libsmbfs: libsocket libnsl libkrb5 +libsmbfs: libcmdutils libsocket libnsl libkrb5 libsocket: libnsl libstmfproxy: libstmf libsocket libnsl libpthread libsum: libast @@ -640,14 +640,15 @@ libzfs: libdevid libgen libnvpair libuutil \ libadm libavl libefi libidmap libmd libzfs_jni: libdiskmgt libnvpair libzfs -libzpool: libavl libumem libnvpair +libzpool: libavl libumem libnvpair libcmdutils libsec: libavl libidmap brand: libc libsocket libshare: libscf libzfs libuuid libfsmgt libsecdb libumem libsmbfs libexacct/demo: libexacct libproject libsocket libnsl libtsalarm: libpcp smbsrv: libsocket libnsl libmd libxnet libpthread librt \ - libshare libidmap pkcs11 libsqlite libcryptoutil libreparse + libshare libidmap pkcs11 libsqlite libcryptoutil \ + libreparse libcmdutils libv12n: libds libuuid libvrrpadm: libsocket libdladm libscf libvscan: libscf
--- a/usr/src/lib/libcmdutils/Makefile.com Mon Jun 28 09:11:16 2010 -0600 +++ b/usr/src/lib/libcmdutils/Makefile.com Mon Jun 28 09:19:17 2010 -0600 @@ -19,15 +19,14 @@ # CDDL HEADER END # # -# Copyright 2008 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# ident "%Z%%M% %I% %E% SMI" +# Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. # LIBRARY= libcmdutils.a VERS= .1 -OBJECTS= avltree.o sysattrs.o writefile.o process_xattrs.o +CMD_OBJS= avltree.o sysattrs.o writefile.o process_xattrs.o +COM_OBJS= list.o +OBJECTS= $(CMD_OBJS) $(COM_OBJS) include ../../Makefile.lib include ../../Makefile.rootfs @@ -37,6 +36,12 @@ LDLIBS += -lc -lavl -lnvpair SRCDIR = ../common + +COMDIR= $(SRC)/common/list +SRCS= \ + $(CMD_OBJS:%.o=$(SRCDIR)/%.c) \ + $(COM_OBJS:%.o=$(COMDIR)/%.c) + $(LINTLIB) := SRCS = $(SRCDIR)/$(LINTSRC) CFLAGS += $(CCVERBOSE) @@ -51,4 +56,8 @@ lint: lintcheck +pics/%.o: $(COMDIR)/%.c + $(COMPILE.c) -o $@ $< + $(POST_PROCESS_O) + include ../../Makefile.targ
--- a/usr/src/lib/libcmdutils/common/mapfile-vers Mon Jun 28 09:11:16 2010 -0600 +++ b/usr/src/lib/libcmdutils/common/mapfile-vers Mon Jun 28 09:19:17 2010 -0600 @@ -42,6 +42,23 @@ global: add_tnode; destroy_tree; + list_create; + list_destroy; + list_head; + list_insert_after; + list_insert_before; + list_insert_head; + list_insert_tail; + list_is_empty; + list_link_active; + list_link_init; + list_move_tail; + list_next; + list_prev; + list_remove; + list_remove_head; + list_remove_tail; + list_tail; tnode_compare; sysattr_type; sysattr_support;
--- a/usr/src/lib/libilb/Makefile.com Mon Jun 28 09:11:16 2010 -0600 +++ b/usr/src/lib/libilb/Makefile.com Mon Jun 28 09:19:17 2010 -0600 @@ -28,10 +28,7 @@ LIB_OBJS = ilb_sg.o ilb_comm.o ilb_subr.o ilb_rules.o LIB_OBJS += ilb_hc.o ilb_nat.o -# We don't have a userland-accessible implementation of list handling -# so we use the one in uts (filched off libzpool) -LIST_OBJS = list.o -OBJECTS = $(LIB_OBJS) $(LIST_OBJS) +OBJECTS = $(LIB_OBJS) include ../../Makefile.lib @@ -57,8 +54,3 @@ $(LINT.c) $(LINTCHECKFLAGS) $(LIB_SRCS) $(LDLIBS) include ../../Makefile.targ - -# the below is needed to get list.o built -pics/%.o: ../../../uts/common/os/%.c - $(COMPILE.c) -o $@ $< - $(POST_PROCESS_O)
--- a/usr/src/lib/libzpool/Makefile.com Mon Jun 28 09:11:16 2010 -0600 +++ b/usr/src/lib/libzpool/Makefile.com Mon Jun 28 09:19:17 2010 -0600 @@ -19,8 +19,7 @@ # CDDL HEADER END # # -# Copyright 2009 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. +# Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. # LIBRARY= libzpool.a @@ -29,9 +28,8 @@ # include the list of ZFS sources include ../../../uts/common/Makefile.files KERNEL_OBJS = kernel.o taskq.o util.o -LIST_OBJS = list.o -OBJECTS=$(ZFS_COMMON_OBJS) $(ZFS_SHARED_OBJS) $(KERNEL_OBJS) $(LIST_OBJS) +OBJECTS=$(ZFS_COMMON_OBJS) $(ZFS_SHARED_OBJS) $(KERNEL_OBJS) # include library definitions include ../../Makefile.lib @@ -41,7 +39,7 @@ KERNEL_SRCS= $(KERNEL_OBJS:%.o=../common/%.c) LIST_SRCS= $(LIST_OBJS:%.o=../../../uts/common/os/%.c) -SRCS=$(ZFS_COMMON_SRCS) $(ZFS_SHARED_SRCS) $(KERNEL_SRCS) $(LIST_SRCS) +SRCS=$(ZFS_COMMON_SRCS) $(ZFS_SHARED_SRCS) $(KERNEL_SRCS) SRCDIR= ../common # There should be a mapfile here @@ -61,7 +59,7 @@ CFLAGS += -g $(CCVERBOSE) $(CNOGLOBAL) CFLAGS64 += -g $(CCVERBOSE) $(CNOGLOBAL) -LDLIBS += -lumem -lavl -lnvpair -lz -lc -lsysevent -lmd +LDLIBS += -lcmdutils -lumem -lavl -lnvpair -lz -lc -lsysevent -lmd CPPFLAGS += $(INCS) .KEEP_STATE: @@ -79,7 +77,3 @@ pics/%.o: ../../../common/zfs/%.c $(COMPILE.c) -o $@ $< $(POST_PROCESS_O) - -pics/%.o: ../../../uts/common/os/%.c - $(COMPILE.c) -o $@ $< - $(POST_PROCESS_O)
--- a/usr/src/lib/smbsrv/libmlsvc/Makefile.com Mon Jun 28 09:11:16 2010 -0600 +++ b/usr/src/lib/smbsrv/libmlsvc/Makefile.com Mon Jun 28 09:19:17 2010 -0600 @@ -82,12 +82,11 @@ LDLIBS += $(MACH_LDLIBS) LDLIBS += -lmlrpc -lsmbrdr -lsmb -lsmbns -lshare -lresolv -lnsl -lpkcs11 -lscf \ - -lavl -lnvpair -lsec -luutil -luuid -lgen -lzfs -lc + -lavl -lcmdutils -lnvpair -lsec -luutil -luuid -lgen -lzfs -lc CPPFLAGS += $(INCS) -D_REENTRANT -SRCS= $(OBJS_COMMON:%.o=$(SRCDIR)/%.c) \ - $(OBJS_SHARED:%.o=$(SRC)/common/smbsrv/%.c) +SRCS= $(OBJS_COMMON:%.o=$(SRCDIR)/%.c) include ../../Makefile.targ include ../../../Makefile.targ
--- a/usr/src/lib/smbsrv/libsmb/Makefile.com Mon Jun 28 09:11:16 2010 -0600 +++ b/usr/src/lib/smbsrv/libsmb/Makefile.com Mon Jun 28 09:19:17 2010 -0600 @@ -53,7 +53,6 @@ smb_idmap.o \ smb_info.o \ smb_kmod.o \ - smb_list.o \ smb_lgrp.o \ smb_mac.o \ smb_nic.o \ @@ -76,7 +75,7 @@ LDLIBS += $(MACH_LDLIBS) LDLIBS += -lscf -lmd -luuid -lnsl -lpkcs11 -lsec -lsocket -lresolv -LDLIBS += -lidmap -lreparse -lnvpair -lavl -lc +LDLIBS += -lidmap -lreparse -lnvpair -lcmdutils -lavl -lc CPPFLAGS += $(INCS) -D_REENTRANT SRCS= $(OBJS_COMMON:%.o=$(SRCDIR)/%.c) \
--- a/usr/src/lib/smbsrv/libsmb/common/mapfile-vers Mon Jun 28 09:11:16 2010 -0600 +++ b/usr/src/lib/smbsrv/libsmb/common/mapfile-vers Mon Jun 28 09:19:17 2010 -0600 @@ -59,20 +59,6 @@ ht_remove_item; ht_replace_item; ht_set_cmpfn; - list_create; - list_destroy; - list_head; - list_insert_after; - list_insert_before; - list_insert_head; - list_insert_tail; - list_is_empty; - list_link_active; - list_move_tail; - list_next; - list_prev; - list_remove; - list_tail; lsa_account_xdr; oemtoucs; rand_hash;
--- a/usr/src/lib/smbsrv/libsmb/common/smb_list.c Mon Jun 28 09:11:16 2010 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,195 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Generic doubly-linked list implementation - */ - -#include <sys/list.h> -#include <sys/list_impl.h> -#include <sys/types.h> -#include <sys/sysmacros.h> -#include <sys/debug.h> -#include <assert.h> - -#define list_d2l(a, obj) ((void *)(((char *)obj) + (a)->list_offset)) -#define list_object(a, node) ((void *)(((char *)node) - (a)->list_offset)) -#define list_empty(a) ((a)->list_head.list_next == &(a)->list_head) - -#define list_insert_after_node(list, node, object) { \ - list_node_t *lnew = list_d2l(list, object); \ - lnew->list_prev = node; \ - lnew->list_next = node->list_next; \ - node->list_next->list_prev = lnew; \ - node->list_next = lnew; \ -} - -#define list_insert_before_node(list, node, object) { \ - list_node_t *lnew = list_d2l(list, object); \ - lnew->list_next = node; \ - lnew->list_prev = node->list_prev; \ - node->list_prev->list_next = lnew; \ - node->list_prev = lnew; \ -} - -void -list_create(list_t *list, size_t size, size_t offset) -{ - assert(list); - assert(size > 0); - assert(size >= offset + sizeof (list_node_t)); - - list->list_size = size; - list->list_offset = offset; - list->list_head.list_next = list->list_head.list_prev = - &list->list_head; -} - -void -list_destroy(list_t *list) -{ - list_node_t *node = &list->list_head; - - assert(list); - assert(list->list_head.list_next == node); - assert(list->list_head.list_prev == node); - - node->list_next = node->list_prev = NULL; -} - -void -list_insert_after(list_t *list, void *object, void *nobject) -{ - list_node_t *lold = list_d2l(list, object); - list_insert_after_node(list, lold, nobject); -} - -void -list_insert_before(list_t *list, void *object, void *nobject) -{ - list_node_t *lold = list_d2l(list, object); - list_insert_before_node(list, lold, nobject) -} - -void -list_insert_head(list_t *list, void *object) -{ - list_node_t *lold = &list->list_head; - list_insert_after_node(list, lold, object); -} - -void -list_insert_tail(list_t *list, void *object) -{ - list_node_t *lold = &list->list_head; - list_insert_before_node(list, lold, object); -} - -void -list_remove(list_t *list, void *object) -{ - list_node_t *lold = list_d2l(list, object); - assert(!list_empty(list)); - assert(lold->list_next != NULL); - lold->list_prev->list_next = lold->list_next; - lold->list_next->list_prev = lold->list_prev; - lold->list_next = lold->list_prev = NULL; -} - -void * -list_head(list_t *list) -{ - if (list_empty(list)) - return (NULL); - return (list_object(list, list->list_head.list_next)); -} - -void * -list_tail(list_t *list) -{ - if (list_empty(list)) - return (NULL); - return (list_object(list, list->list_head.list_prev)); -} - -void * -list_next(list_t *list, void *object) -{ - list_node_t *node = list_d2l(list, object); - - if (node->list_next != &list->list_head) - return (list_object(list, node->list_next)); - - return (NULL); -} - -void * -list_prev(list_t *list, void *object) -{ - list_node_t *node = list_d2l(list, object); - - if (node->list_prev != &list->list_head) - return (list_object(list, node->list_prev)); - - return (NULL); -} - -/* - * Insert src list after dst list. Empty src list thereafter. - */ -void -list_move_tail(list_t *dst, list_t *src) -{ - list_node_t *dstnode = &dst->list_head; - list_node_t *srcnode = &src->list_head; - - assert(dst->list_size == src->list_size); - assert(dst->list_offset == src->list_offset); - - if (list_empty(src)) - return; - - dstnode->list_prev->list_next = srcnode->list_next; - srcnode->list_next->list_prev = dstnode->list_prev; - dstnode->list_prev = srcnode->list_prev; - srcnode->list_prev->list_next = dstnode; - - /* empty src list */ - srcnode->list_next = srcnode->list_prev = srcnode; -} - -int -list_link_active(list_node_t *link) -{ - return (link->list_next != NULL); -} - -int -list_is_empty(list_t *list) -{ - return (list_empty(list)); -}
--- a/usr/src/lib/smbsrv/libsmbns/Makefile.com Mon Jun 28 09:11:16 2010 -0600 +++ b/usr/src/lib/smbsrv/libsmbns/Makefile.com Mon Jun 28 09:19:17 2010 -0600 @@ -18,9 +18,7 @@ # # CDDL HEADER END # -# -# Copyright 2010 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. +# Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. # LIBRARY= libsmbns.a @@ -50,7 +48,8 @@ $(OBJS_SHARED:%.o=$(SRC)/common/smbsrv/%.c) LDLIBS += $(MACH_LDLIBS) -LDLIBS += -lsmb -lgss -lldap -lresolv -lnsl -lsocket -lc -lcryptoutil +LDLIBS += -lsmb -lgss -lcmdutils -lldap -lresolv -lnsl -lsocket +LDLIBS += -lc -lcryptoutil CPPFLAGS += -D_REENTRANT # DYNLIB libraries do not have lint libs and are not linted
--- a/usr/src/pkg/manifests/developer-debug-mdb.mf Mon Jun 28 09:11:16 2010 -0600 +++ b/usr/src/pkg/manifests/developer-debug-mdb.mf Mon Jun 28 09:19:17 2010 -0600 @@ -283,6 +283,7 @@ file path=usr/lib/mdb/proc/$(ARCH64)/ld.so group=sys mode=0555 file path=usr/lib/mdb/proc/$(ARCH64)/libavl.so group=sys mode=0555 file path=usr/lib/mdb/proc/$(ARCH64)/libc.so group=sys mode=0555 +file path=usr/lib/mdb/proc/$(ARCH64)/libcmdutils.so group=sys mode=0555 file path=usr/lib/mdb/proc/$(ARCH64)/libnvpair.so group=sys mode=0555 file path=usr/lib/mdb/proc/$(ARCH64)/libproc.so group=sys mode=0555 file path=usr/lib/mdb/proc/$(ARCH64)/libpython2.6.so group=sys mode=0555 @@ -296,6 +297,7 @@ file path=usr/lib/mdb/proc/ld.so group=sys mode=0555 file path=usr/lib/mdb/proc/libavl.so group=sys mode=0555 file path=usr/lib/mdb/proc/libc.so group=sys mode=0555 +file path=usr/lib/mdb/proc/libcmdutils.so group=sys mode=0555 file path=usr/lib/mdb/proc/libnvpair.so group=sys mode=0555 file path=usr/lib/mdb/proc/libproc.so group=sys mode=0555 file path=usr/lib/mdb/proc/libpython2.6.so group=sys mode=0555
--- a/usr/src/uts/common/Makefile.rules Mon Jun 28 09:11:16 2010 -0600 +++ b/usr/src/uts/common/Makefile.rules Mon Jun 28 09:19:17 2010 -0600 @@ -1399,6 +1399,10 @@ $(COMPILE.c) -o $@ $< $(CTFCONVERT_O) +$(OBJS_DIR)/%.o: $(COMMONBASE)/list/%.c + $(COMPILE.c) -o $@ $< + $(CTFCONVERT_O) + $(OBJS_DIR)/%.o: $(COMMONBASE)/lvm/%.c $(COMPILE.c) -o $@ $< $(CTFCONVERT_O) @@ -2518,6 +2522,9 @@ $(LINTS_DIR)/%.ln: $(UTSBASE)/common/ktli/%.c @($(LHEAD) $(LINT.c) $< $(LTAIL)) +$(LINTS_DIR)/%.ln: $(COMMONBASE)/list/%.c + @($(LHEAD) $(LINT.c) $< $(LTAIL)) + $(LINTS_DIR)/%.ln: $(COMMONBASE)/lvm/%.c @($(LHEAD) $(LINT.c) $< $(LTAIL))
--- a/usr/src/uts/common/os/list.c Mon Jun 28 09:11:16 2010 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,245 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Generic doubly-linked list implementation - */ - -#include <sys/list.h> -#include <sys/list_impl.h> -#include <sys/types.h> -#include <sys/sysmacros.h> -#include <sys/debug.h> - -#define list_d2l(a, obj) ((list_node_t *)(((char *)obj) + (a)->list_offset)) -#define list_object(a, node) ((void *)(((char *)node) - (a)->list_offset)) -#define list_empty(a) ((a)->list_head.list_next == &(a)->list_head) - -#define list_insert_after_node(list, node, object) { \ - list_node_t *lnew = list_d2l(list, object); \ - lnew->list_prev = (node); \ - lnew->list_next = (node)->list_next; \ - (node)->list_next->list_prev = lnew; \ - (node)->list_next = lnew; \ -} - -#define list_insert_before_node(list, node, object) { \ - list_node_t *lnew = list_d2l(list, object); \ - lnew->list_next = (node); \ - lnew->list_prev = (node)->list_prev; \ - (node)->list_prev->list_next = lnew; \ - (node)->list_prev = lnew; \ -} - -#define list_remove_node(node) \ - (node)->list_prev->list_next = (node)->list_next; \ - (node)->list_next->list_prev = (node)->list_prev; \ - (node)->list_next = (node)->list_prev = NULL - -void -list_create(list_t *list, size_t size, size_t offset) -{ - ASSERT(list); - ASSERT(size > 0); - ASSERT(size >= offset + sizeof (list_node_t)); - - list->list_size = size; - list->list_offset = offset; - list->list_head.list_next = list->list_head.list_prev = - &list->list_head; -} - -void -list_destroy(list_t *list) -{ - list_node_t *node = &list->list_head; - - ASSERT(list); - ASSERT(list->list_head.list_next == node); - ASSERT(list->list_head.list_prev == node); - - node->list_next = node->list_prev = NULL; -} - -void -list_insert_after(list_t *list, void *object, void *nobject) -{ - if (object == NULL) { - list_insert_head(list, nobject); - } else { - list_node_t *lold = list_d2l(list, object); - list_insert_after_node(list, lold, nobject); - } -} - -void -list_insert_before(list_t *list, void *object, void *nobject) -{ - if (object == NULL) { - list_insert_tail(list, nobject); - } else { - list_node_t *lold = list_d2l(list, object); - list_insert_before_node(list, lold, nobject); - } -} - -void -list_insert_head(list_t *list, void *object) -{ - list_node_t *lold = &list->list_head; - list_insert_after_node(list, lold, object); -} - -void -list_insert_tail(list_t *list, void *object) -{ - list_node_t *lold = &list->list_head; - list_insert_before_node(list, lold, object); -} - -void -list_remove(list_t *list, void *object) -{ - list_node_t *lold = list_d2l(list, object); - ASSERT(!list_empty(list)); - ASSERT(lold->list_next != NULL); - list_remove_node(lold); -} - -void * -list_remove_head(list_t *list) -{ - list_node_t *head = list->list_head.list_next; - if (head == &list->list_head) - return (NULL); - list_remove_node(head); - return (list_object(list, head)); -} - -void * -list_remove_tail(list_t *list) -{ - list_node_t *tail = list->list_head.list_prev; - if (tail == &list->list_head) - return (NULL); - list_remove_node(tail); - return (list_object(list, tail)); -} - -void * -list_head(list_t *list) -{ - if (list_empty(list)) - return (NULL); - return (list_object(list, list->list_head.list_next)); -} - -void * -list_tail(list_t *list) -{ - if (list_empty(list)) - return (NULL); - return (list_object(list, list->list_head.list_prev)); -} - -void * -list_next(list_t *list, void *object) -{ - list_node_t *node = list_d2l(list, object); - - if (node->list_next != &list->list_head) - return (list_object(list, node->list_next)); - - return (NULL); -} - -void * -list_prev(list_t *list, void *object) -{ - list_node_t *node = list_d2l(list, object); - - if (node->list_prev != &list->list_head) - return (list_object(list, node->list_prev)); - - return (NULL); -} - -/* - * Insert src list after dst list. Empty src list thereafter. - */ -void -list_move_tail(list_t *dst, list_t *src) -{ - list_node_t *dstnode = &dst->list_head; - list_node_t *srcnode = &src->list_head; - - ASSERT(dst->list_size == src->list_size); - ASSERT(dst->list_offset == src->list_offset); - - if (list_empty(src)) - return; - - dstnode->list_prev->list_next = srcnode->list_next; - srcnode->list_next->list_prev = dstnode->list_prev; - dstnode->list_prev = srcnode->list_prev; - srcnode->list_prev->list_next = dstnode; - - /* empty src list */ - srcnode->list_next = srcnode->list_prev = srcnode; -} - -void -list_link_replace(list_node_t *lold, list_node_t *lnew) -{ - ASSERT(list_link_active(lold)); - ASSERT(!list_link_active(lnew)); - - lnew->list_next = lold->list_next; - lnew->list_prev = lold->list_prev; - lold->list_prev->list_next = lnew; - lold->list_next->list_prev = lnew; - lold->list_next = lold->list_prev = NULL; -} - -void -list_link_init(list_node_t *link) -{ - link->list_next = NULL; - link->list_prev = NULL; -} - -int -list_link_active(list_node_t *link) -{ - return (link->list_next != NULL); -} - -int -list_is_empty(list_t *list) -{ - return (list_empty(list)); -}