summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
authorEric Taylor <Eric.Taylor@Sun.COM>2010-06-28 09:19:17 -0600
committerEric Taylor <Eric.Taylor@Sun.COM>2010-06-28 09:19:17 -0600
commit3c112a2b34403220c06c3e2fcac403358cfba168 (patch)
treeaf70bd8e7475a8cde365f3200a31fb4dc8d6d7ea /usr/src
parentd24e1a1da37e9f5e4c5b11a5da612fdd70d873f0 (diff)
downloadillumos-joyent-3c112a2b34403220c06c3e2fcac403358cfba168.tar.gz
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 --HG-- rename : usr/src/uts/common/os/list.c => usr/src/common/list/list.c
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/cmd/cmd-inet/usr.lib/ilbd/Makefile14
-rw-r--r--usr/src/cmd/cmd-inet/usr.sbin/ilbadm/Makefile11
-rw-r--r--usr/src/cmd/mdb/Makefile.common4
-rw-r--r--usr/src/cmd/mdb/common/modules/libcmdutils/libcmdutils.c43
-rw-r--r--usr/src/cmd/mdb/common/modules/zfs/zfs.c12
-rw-r--r--usr/src/cmd/mdb/intel/amd64/libcmdutils/Makefile34
-rw-r--r--usr/src/cmd/mdb/intel/ia32/libcmdutils/Makefile33
-rw-r--r--usr/src/cmd/mdb/sparc/v7/libcmdutils/Makefile33
-rw-r--r--usr/src/cmd/mdb/sparc/v9/libcmdutils/Makefile34
-rw-r--r--usr/src/cmd/smbsrv/smbd/Makefile2
-rw-r--r--usr/src/cmd/syseventd/modules/zfs_mod/Makefile7
-rw-r--r--usr/src/cmd/syseventd/modules/zfs_mod/zfs_mod.c81
-rw-r--r--usr/src/cmd/ztest/Makefile.com5
-rw-r--r--usr/src/common/list/list.c (renamed from usr/src/uts/common/os/list.c)16
-rw-r--r--usr/src/lib/Makefile7
-rw-r--r--usr/src/lib/libcmdutils/Makefile.com19
-rw-r--r--usr/src/lib/libcmdutils/common/mapfile-vers17
-rw-r--r--usr/src/lib/libilb/Makefile.com10
-rw-r--r--usr/src/lib/libzpool/Makefile.com14
-rw-r--r--usr/src/lib/smbsrv/libmlsvc/Makefile.com5
-rw-r--r--usr/src/lib/smbsrv/libsmb/Makefile.com3
-rw-r--r--usr/src/lib/smbsrv/libsmb/common/mapfile-vers14
-rw-r--r--usr/src/lib/smbsrv/libsmb/common/smb_list.c195
-rw-r--r--usr/src/lib/smbsrv/libsmbns/Makefile.com7
-rw-r--r--usr/src/pkg/manifests/developer-debug-mdb.mf2
-rw-r--r--usr/src/uts/common/Makefile.rules7
26 files changed, 335 insertions, 294 deletions
diff --git a/usr/src/cmd/cmd-inet/usr.lib/ilbd/Makefile b/usr/src/cmd/cmd-inet/usr.lib/ilbd/Makefile
index 7e7c1f82c9..4a4c482e3a 100644
--- a/usr/src/cmd/cmd-inet/usr.lib/ilbd/Makefile
+++ b/usr/src/cmd/cmd-inet/usr.lib/ilbd/Makefile
@@ -30,13 +30,10 @@ ILBD_OBJS= ilbd_main.o ilbd_support.o ilbd_sg.o ilbd_rules.o ilbd_hc.o \
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 @@ clobber:= TARGET= clobber
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 @@ all install clean clobber lint: $(ILBSUBDIRS)
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)
diff --git a/usr/src/cmd/cmd-inet/usr.sbin/ilbadm/Makefile b/usr/src/cmd/cmd-inet/usr.sbin/ilbadm/Makefile
index d5af9bc5fb..a7c3210109 100644
--- a/usr/src/cmd/cmd-inet/usr.sbin/ilbadm/Makefile
+++ b/usr/src/cmd/cmd-inet/usr.sbin/ilbadm/Makefile
@@ -25,11 +25,9 @@ PROG= ilbadm
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.cmd
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 @@ check: $(ILB_SRCS) $(PROG).h
$(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)
diff --git a/usr/src/cmd/mdb/Makefile.common b/usr/src/cmd/mdb/Makefile.common
index 08fcfef74e..4e282bf001 100644
--- a/usr/src/cmd/mdb/Makefile.common
+++ b/usr/src/cmd/mdb/Makefile.common
@@ -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 @@ COMMON_MODULES_PROC = \
dof \
libavl \
libc \
+ libcmdutils \
libnvpair \
libproc \
libpython2.6 \
diff --git a/usr/src/cmd/mdb/common/modules/libcmdutils/libcmdutils.c b/usr/src/cmd/mdb/common/modules/libcmdutils/libcmdutils.c
new file mode 100644
index 0000000000..bff3f1b733
--- /dev/null
+++ b/usr/src/cmd/mdb/common/modules/libcmdutils/libcmdutils.c
@@ -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);
+}
diff --git a/usr/src/cmd/mdb/common/modules/zfs/zfs.c b/usr/src/cmd/mdb/common/modules/zfs/zfs.c
index e7bb40809b..48d8a66023 100644
--- a/usr/src/cmd/mdb/common/modules/zfs/zfs.c
+++ b/usr/src/cmd/mdb/common/modules/zfs/zfs.c
@@ -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_dcmd_t dcmds[] = {
};
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",
diff --git a/usr/src/cmd/mdb/intel/amd64/libcmdutils/Makefile b/usr/src/cmd/mdb/intel/amd64/libcmdutils/Makefile
new file mode 100644
index 0000000000..8ca2a87ffe
--- /dev/null
+++ b/usr/src/cmd/mdb/intel/amd64/libcmdutils/Makefile
@@ -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
diff --git a/usr/src/cmd/mdb/intel/ia32/libcmdutils/Makefile b/usr/src/cmd/mdb/intel/ia32/libcmdutils/Makefile
new file mode 100644
index 0000000000..de337c3563
--- /dev/null
+++ b/usr/src/cmd/mdb/intel/ia32/libcmdutils/Makefile
@@ -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
diff --git a/usr/src/cmd/mdb/sparc/v7/libcmdutils/Makefile b/usr/src/cmd/mdb/sparc/v7/libcmdutils/Makefile
new file mode 100644
index 0000000000..d41231e3e0
--- /dev/null
+++ b/usr/src/cmd/mdb/sparc/v7/libcmdutils/Makefile
@@ -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
diff --git a/usr/src/cmd/mdb/sparc/v9/libcmdutils/Makefile b/usr/src/cmd/mdb/sparc/v9/libcmdutils/Makefile
new file mode 100644
index 0000000000..9e1f58c3bf
--- /dev/null
+++ b/usr/src/cmd/mdb/sparc/v9/libcmdutils/Makefile
@@ -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
diff --git a/usr/src/cmd/smbsrv/smbd/Makefile b/usr/src/cmd/smbsrv/smbd/Makefile
index 2078b536ad..dca4858474 100644
--- a/usr/src/cmd/smbsrv/smbd/Makefile
+++ b/usr/src/cmd/smbsrv/smbd/Makefile
@@ -51,7 +51,7 @@ $(ROOTVARSMBDLL):= FILEMODE = 0755
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
diff --git a/usr/src/cmd/syseventd/modules/zfs_mod/Makefile b/usr/src/cmd/syseventd/modules/zfs_mod/Makefile
index 9970a6ae30..ad550e28dc 100644
--- a/usr/src/cmd/syseventd/modules/zfs_mod/Makefile
+++ b/usr/src/cmd/syseventd/modules/zfs_mod/Makefile
@@ -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:
diff --git a/usr/src/cmd/syseventd/modules/zfs_mod/zfs_mod.c b/usr/src/cmd/syseventd/modules/zfs_mod/zfs_mod.c
index 6d98534243..b64cf14078 100644
--- a/usr/src/cmd/syseventd/modules/zfs_mod/zfs_mod.c
+++ b/usr/src/cmd/syseventd/modules/zfs_mod/zfs_mod.c
@@ -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 @@ zfs_iter_vdev(zpool_handle_t *zhp, nvlist_t *nvl, void *data)
(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_pool(zpool_handle_t *zhp, void *data)
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 @@ zfs_deliver_dle(nvlist_t *nvl)
" found\n", devname);
return (1);
}
- nvlist_free(nvl);
return (0);
}
@@ -596,12 +655,30 @@ slm_init()
{
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);
}
diff --git a/usr/src/cmd/ztest/Makefile.com b/usr/src/cmd/ztest/Makefile.com
index 166d94edc8..5f0a87b53a 100644
--- a/usr/src/cmd/ztest/Makefile.com
+++ b/usr/src/cmd/ztest/Makefile.com
@@ -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 @@ include ../../Makefile.ctf
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
diff --git a/usr/src/uts/common/os/list.c b/usr/src/common/list/list.c
index e8db13a5cf..94f7782a87 100644
--- a/usr/src/uts/common/os/list.c
+++ b/usr/src/common/list/list.c
@@ -19,12 +19,9 @@
* CDDL HEADER END
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
+ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
* Generic doubly-linked list implementation
*/
@@ -33,9 +30,18 @@
#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)
diff --git a/usr/src/lib/Makefile b/usr/src/lib/Makefile
index 9bd2a3443f..53c33825eb 100644
--- a/usr/src/lib/Makefile
+++ b/usr/src/lib/Makefile
@@ -610,7 +610,7 @@ sasl_plugins: pkcs11 libgss libsocket libsasl
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 @@ udapl/udapl_tavor: udapl/libdat
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
diff --git a/usr/src/lib/libcmdutils/Makefile.com b/usr/src/lib/libcmdutils/Makefile.com
index b2b6e1b533..7961146e1a 100644
--- a/usr/src/lib/libcmdutils/Makefile.com
+++ b/usr/src/lib/libcmdutils/Makefile.com
@@ -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 @@ LIBS = $(DYNLIB) $(LINTLIB)
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 @@ all: $(LIBS)
lint: lintcheck
+pics/%.o: $(COMDIR)/%.c
+ $(COMPILE.c) -o $@ $<
+ $(POST_PROCESS_O)
+
include ../../Makefile.targ
diff --git a/usr/src/lib/libcmdutils/common/mapfile-vers b/usr/src/lib/libcmdutils/common/mapfile-vers
index e60aa814f3..74f59e8fdb 100644
--- a/usr/src/lib/libcmdutils/common/mapfile-vers
+++ b/usr/src/lib/libcmdutils/common/mapfile-vers
@@ -42,6 +42,23 @@ SYMBOL_VERSION SUNWprivate_1.1 {
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;
diff --git a/usr/src/lib/libilb/Makefile.com b/usr/src/lib/libilb/Makefile.com
index 1c78ff5686..abc7c7f1fa 100644
--- a/usr/src/lib/libilb/Makefile.com
+++ b/usr/src/lib/libilb/Makefile.com
@@ -28,10 +28,7 @@ VERS = .1
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: $(LIB_SRCS)
$(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)
diff --git a/usr/src/lib/libzpool/Makefile.com b/usr/src/lib/libzpool/Makefile.com
index 8f3ce46a30..27338b95dc 100644
--- a/usr/src/lib/libzpool/Makefile.com
+++ b/usr/src/lib/libzpool/Makefile.com
@@ -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 @@ VERS= .1
# 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 @@ ZFS_SHARED_SRCS= $(ZFS_SHARED_OBJS:%.o=../../../common/zfs/%.c)
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 @@ C99LMODE= -Xc99=%all
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: ../../../uts/common/fs/zfs/%.c
pics/%.o: ../../../common/zfs/%.c
$(COMPILE.c) -o $@ $<
$(POST_PROCESS_O)
-
-pics/%.o: ../../../uts/common/os/%.c
- $(COMPILE.c) -o $@ $<
- $(POST_PROCESS_O)
diff --git a/usr/src/lib/smbsrv/libmlsvc/Makefile.com b/usr/src/lib/smbsrv/libmlsvc/Makefile.com
index 60a07f57d3..3864bca67b 100644
--- a/usr/src/lib/smbsrv/libmlsvc/Makefile.com
+++ b/usr/src/lib/smbsrv/libmlsvc/Makefile.com
@@ -82,12 +82,11 @@ INCS += -I$(SRC)/common/smbsrv
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
diff --git a/usr/src/lib/smbsrv/libsmb/Makefile.com b/usr/src/lib/smbsrv/libsmb/Makefile.com
index 468dac6f28..f916b6a4db 100644
--- a/usr/src/lib/smbsrv/libsmb/Makefile.com
+++ b/usr/src/lib/smbsrv/libsmb/Makefile.com
@@ -53,7 +53,6 @@ OBJS_COMMON = \
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 @@ INCS += -I$(SRC)/common/smbsrv
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) \
diff --git a/usr/src/lib/smbsrv/libsmb/common/mapfile-vers b/usr/src/lib/smbsrv/libsmb/common/mapfile-vers
index 1d4828eab2..4b18ec8636 100644
--- a/usr/src/lib/smbsrv/libsmb/common/mapfile-vers
+++ b/usr/src/lib/smbsrv/libsmb/common/mapfile-vers
@@ -59,20 +59,6 @@ SYMBOL_VERSION SUNWprivate {
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;
diff --git a/usr/src/lib/smbsrv/libsmb/common/smb_list.c b/usr/src/lib/smbsrv/libsmb/common/smb_list.c
deleted file mode 100644
index db891ffb2f..0000000000
--- a/usr/src/lib/smbsrv/libsmb/common/smb_list.c
+++ /dev/null
@@ -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));
-}
diff --git a/usr/src/lib/smbsrv/libsmbns/Makefile.com b/usr/src/lib/smbsrv/libsmbns/Makefile.com
index ebe8dd1be7..7ab36a6127 100644
--- a/usr/src/lib/smbsrv/libsmbns/Makefile.com
+++ b/usr/src/lib/smbsrv/libsmbns/Makefile.com
@@ -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 @@ SRCS= $(OBJS_COMMON:%.o=$(SRCDIR)/%.c) \
$(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
diff --git a/usr/src/pkg/manifests/developer-debug-mdb.mf b/usr/src/pkg/manifests/developer-debug-mdb.mf
index 392991c2a7..4f7e36b506 100644
--- a/usr/src/pkg/manifests/developer-debug-mdb.mf
+++ b/usr/src/pkg/manifests/developer-debug-mdb.mf
@@ -283,6 +283,7 @@ $(i386_ONLY)file path=usr/lib/mdb/kvm/usba.so group=sys mode=0555
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 @@ $(i386_ONLY)file path=usr/lib/mdb/proc/$(ARCH64)/mdb_test.so group=sys \
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
diff --git a/usr/src/uts/common/Makefile.rules b/usr/src/uts/common/Makefile.rules
index 246212a52d..adde072286 100644
--- a/usr/src/uts/common/Makefile.rules
+++ b/usr/src/uts/common/Makefile.rules
@@ -1399,6 +1399,10 @@ $(OBJS_DIR)/%.o: $(UTSBASE)/common/krtld/%.c
$(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/krtld/%.c
$(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))