diff options
author | Jerry Jelinek <jerry.jelinek@joyent.com> | 2019-02-21 16:02:04 +0000 |
---|---|---|
committer | Jerry Jelinek <jerry.jelinek@joyent.com> | 2019-02-21 16:02:04 +0000 |
commit | 15c5e8a21e5a254e3ccfda29deff00097f655289 (patch) | |
tree | 8bcb6d80e87575f392f1d05c09dca63f6a76f193 | |
parent | 50c68d602321e451c36464d5c7d903c892e2f775 (diff) | |
parent | 7957da45b8e66b8cd6e917ac6bd8965817d7ef06 (diff) | |
download | illumos-joyent-15c5e8a21e5a254e3ccfda29deff00097f655289.tar.gz |
[illumos-gate merge]
commit 7957da45b8e66b8cd6e917ac6bd8965817d7ef06
10144 BZ2_bzDecompressReset() gets NULL check wrong
commit a8b4e7c71a6c1ef07e77c48dbb92fcdc8624266d
10424 uts: NULL pointer errors in DEBUG build
commit f1ccfd86d00d3a46fa8dc85b88860e10a3ad1019
10423 bridge: cast between incompatible function types
commit fb05fcb92e04bd3719e79f64be4c3432c2f1a119
10422 conskbd: cast between incompatible function types
commit 98bfe312451089fb99dd3ccde47363ce4d275459
10420 consms: cast between incompatible function types
commit 336380cbc80cdb79336de7f2b9a5d418c0991618
10383 myri10ge: NULL pointer errors
commit 0333c43738b2582094bb2644c0a1f4211751447b
10364 vnode: cast between incompatible function types
commit af34582fe571c99d9f74acf7c271e26c744fef5b
10416 zoneadmd leaves trailing comma on link address
commit ffe245b40fe1731e6f0ea5c097a74eb78bc839e2
10415 Memory leak in ipadm_zone_get_network()
commit b9e319bfd413f32cc39ec7b8ccc527f35712da7f
10419 ntxn: cast between incompatible function types
commit 4fa33403ece8f42c56cba2b672d10f6ab4dc32cd
10418 chxge: cast between incompatible function types
commit 888d78e951c54427c93b8ef788383952b9c63687
10410 kmdb: set terminal window size
commit 3ab29d2187aaeb14feecd145834ac2f151dc822c
10378 agpgart: NULL pointer errors
commit 7e12ceb3ebc63aeb71e91b496032ca22ca55f660
10376 uts: NULL pointer issues in genunix
commit 7e897d1fc847b22dc338da9a5a59dae0cd8765de
10373 vm_anon: cast between incompatible function types
commit 735c423ad1b2b03125a2c8d3840540d6b17f7dbf
10372 vmem: cast between incompatible function types
commit b6d49c8438f976a7c4a6c9390228076c8f132847
10371 vfs: cast between incompatible function types
commit d0cb1fb92629bc0283c88d4719df7285c1612700
9425 allow channel programs to be stopped via signals
commit 9d1587b49e4692b8d6652e6c0b113a53b1af5313
10124 smatch fixes for cryptoadm
Conflicts:
usr/src/cmd/zoneadmd/vplat.c
67 files changed, 656 insertions, 405 deletions
diff --git a/usr/src/cmd/cmd-crypto/cryptoadm/adm_kef_ioctl.c b/usr/src/cmd/cmd-crypto/cryptoadm/adm_kef_ioctl.c index a65316abbc..ed1b284990 100644 --- a/usr/src/cmd/cmd-crypto/cryptoadm/adm_kef_ioctl.c +++ b/usr/src/cmd/cmd-crypto/cryptoadm/adm_kef_ioctl.c @@ -23,6 +23,7 @@ */ /* * Copyright 2010 Nexenta Systems, Inc. All rights reserved. + * Copyright (c) 2018, Joyent, Inc. */ #include <fcntl.h> @@ -266,6 +267,7 @@ get_dev_list(crypto_get_dev_list_t **ppdevlist) if ((fd = open(ADMIN_IOCTL_DEVICE, O_RDONLY)) == -1) { cryptoerror(LOG_STDERR, gettext("failed to open %s: %s"), ADMIN_IOCTL_DEVICE, strerror(errno)); + free(pdevlist); return (FAILURE); } diff --git a/usr/src/cmd/cmd-crypto/cryptoadm/adm_uef.c b/usr/src/cmd/cmd-crypto/cryptoadm/adm_uef.c index 47d0ab51f0..873642d190 100644 --- a/usr/src/cmd/cmd-crypto/cryptoadm/adm_uef.c +++ b/usr/src/cmd/cmd-crypto/cryptoadm/adm_uef.c @@ -23,6 +23,7 @@ */ /* * Copyright 2010 Nexenta Systems, Inc. All rights resrved. + * Copyright (c) 2018, Joyent, Inc. */ #include <cryptoutil.h> @@ -161,7 +162,7 @@ convert_mechlist(CK_MECHANISM_TYPE **pmech_list, CK_ULONG *mech_count, } *pmech_list = malloc(n * sizeof (CK_MECHANISM_TYPE)); - if (pmech_list == NULL) { + if (*pmech_list == NULL) { cryptodebug("out of memory"); return (FAILURE); } diff --git a/usr/src/cmd/cmd-crypto/cryptoadm/cryptoadm.c b/usr/src/cmd/cmd-crypto/cryptoadm/cryptoadm.c index 989eae315a..f4d5e17b17 100644 --- a/usr/src/cmd/cmd-crypto/cryptoadm/cryptoadm.c +++ b/usr/src/cmd/cmd-crypto/cryptoadm/cryptoadm.c @@ -22,6 +22,9 @@ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. */ +/* + * Copyright (c) 2018, Joyent, Inc. + */ #include <fcntl.h> #include <stdio.h> @@ -1302,7 +1305,6 @@ list_simple_for_all(boolean_t verbose) "failed to retrieve the providers' " "information from file kcf.conf - %s.", _PATH_KCF_CONF); - free(psoftlist_kernel); rc = FAILURE; } else { diff --git a/usr/src/cmd/mdb/common/kmdb/kmdb_promif.c b/usr/src/cmd/mdb/common/kmdb/kmdb_promif.c index b82ab3275e..8200325c0c 100644 --- a/usr/src/cmd/mdb/common/kmdb/kmdb_promif.c +++ b/usr/src/cmd/mdb/common/kmdb/kmdb_promif.c @@ -543,8 +543,16 @@ kmdb_prom_term_init(kmdb_auxv_t *kav, kmdb_promif_t *pif) 0x00, 0x11, 0x13, 0x1a, 0x19, 0x12, 0x0f, 0x17, 0x16 }; char *conin = NULL, *conout = NULL; - if (kmdb_prom_stdout_is_framebuffer(kav)) + if (kmdb_prom_stdout_is_framebuffer(kav)) { + struct winsize *wsz = &pif->pif_wsz; + + /* Set default dimensions. */ + wsz->ws_row = KMDB_PIF_WINSIZE_ROWS; + wsz->ws_col = KMDB_PIF_WINSIZE_COLS; + + kmdb_prom_get_tem_size(kav, &wsz->ws_row, &wsz->ws_col); pif->pif_oterm = ATTACHED_TERM_TYPE; + } bzero(&pif->pif_tios, sizeof (struct termios)); @@ -680,8 +688,9 @@ kmdb_prom_term_ctl(int req, void *arg) */ if (mdb.m_promif->pif_oterm != NULL) { struct winsize *wsz = arg; - wsz->ws_row = KMDB_PIF_WINSIZE_ROWS; - wsz->ws_col = KMDB_PIF_WINSIZE_COLS; + + wsz->ws_row = mdb.m_promif->pif_wsz.ws_row; + wsz->ws_col = mdb.m_promif->pif_wsz.ws_col; wsz->ws_xpixel = wsz->ws_ypixel = 0; return (0); } diff --git a/usr/src/cmd/mdb/common/kmdb/kmdb_promif_impl.h b/usr/src/cmd/mdb/common/kmdb/kmdb_promif_impl.h index 10f6e5562c..509ee107ba 100644 --- a/usr/src/cmd/mdb/common/kmdb/kmdb_promif_impl.h +++ b/usr/src/cmd/mdb/common/kmdb/kmdb_promif_impl.h @@ -27,8 +27,6 @@ #ifndef _KMDB_PROMIF_IMPL_H #define _KMDB_PROMIF_IMPL_H -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/consdev.h> #include <kmdb/kmdb_promif.h> @@ -57,6 +55,7 @@ extern struct boot_syscalls *kmdb_sysp; typedef struct kmdb_promif { char *pif_oterm; /* term type for local console (NULL if rem) */ struct termios pif_tios; /* derived settings for console */ + struct winsize pif_wsz; /* winsize for local console */ } kmdb_promif_t; extern void kmdb_prom_init_finish_isadep(kmdb_auxv_t *); @@ -67,6 +66,7 @@ extern void kmdb_prom_free_ddi_prop(char *); extern ssize_t kmdb_prom_obp_writer(caddr_t, size_t); extern int kmdb_prom_stdout_is_framebuffer(kmdb_auxv_t *); +extern void kmdb_prom_get_tem_size(kmdb_auxv_t *, ushort_t *, ushort_t *); #ifdef __cplusplus } diff --git a/usr/src/cmd/mdb/intel/kmdb/kctl/kctl_isadep.c b/usr/src/cmd/mdb/intel/kmdb/kctl/kctl_isadep.c index be78d7fa48..9b5d4b72ec 100644 --- a/usr/src/cmd/mdb/intel/kmdb/kctl/kctl_isadep.c +++ b/usr/src/cmd/mdb/intel/kmdb/kctl/kctl_isadep.c @@ -78,12 +78,14 @@ kctl_ddi_prop_read(char *pname, char *prop_buf, int buf_len) * query and thus have guilty knowledge of the properties that the * debugger wants to see. * - * Here actually we only support six console properties: - * input-device, output-device, tty[a-d]-mode. + * Here actually we only support eight console properties: + * input-device, output-device, tty[a-d]-mode, screen-#rows, screen-#cols. */ #define KCTL_PROPNV_NIODEV 2 #define KCTL_PROPNV_NTTYMD 4 -#define KCTL_PROPNV_NENT (KCTL_PROPNV_NIODEV + KCTL_PROPNV_NTTYMD) +#define KCTL_PROPNV_NSCREEN 2 +#define KCTL_PROPNV_NENT (KCTL_PROPNV_NIODEV + KCTL_PROPNV_NTTYMD + \ + KCTL_PROPNV_NSCREEN) static kmdb_auxv_nv_t * kctl_pcache_create(int *nprops) @@ -92,7 +94,7 @@ kctl_pcache_create(int *nprops) kmdb_auxv_nv_t *pnv; size_t psz = sizeof (kmdb_auxv_nv_t) * KCTL_PROPNV_NENT; char *inputdev, *outputdev; - int i; + int i, j; char ttymode[] = "ttyX-mode"; if (kctl.kctl_boot_loaded) { @@ -132,12 +134,22 @@ kctl_pcache_create(int *nprops) } /* Set tty modes or defaults. */ - for (i = KCTL_PROPNV_NIODEV; i < KCTL_PROPNV_NENT; i++) { + j = KCTL_PROPNV_NIODEV + KCTL_PROPNV_NTTYMD; + for (i = KCTL_PROPNV_NIODEV; i < j; i++) { if (!preader((&pnv[i])->kanv_name, (&pnv[i])->kanv_val, sizeof ((&pnv[0])->kanv_val))) (void) strcpy((&pnv[i])->kanv_val, "9600,8,n,1,-"); } + (void) strcpy((&pnv[j])->kanv_name, "screen-#rows"); + (void) strcpy((&pnv[j + 1])->kanv_name, "screen-#cols"); + (void) strcpy((&pnv[j])->kanv_val, "0"); + (void) strcpy((&pnv[j + 1])->kanv_val, "0"); + (void) preader((&pnv[j])->kanv_name, (&pnv[j])->kanv_val, + sizeof ((&pnv[j])->kanv_val)); + (void) preader((&pnv[j + 1])->kanv_name, (&pnv[j + 1])->kanv_val, + sizeof ((&pnv[j + 1])->kanv_val)); + *nprops = KCTL_PROPNV_NENT; return (pnv); } diff --git a/usr/src/cmd/mdb/intel/kmdb/kmdb_promif_isadep.c b/usr/src/cmd/mdb/intel/kmdb/kmdb_promif_isadep.c index e1dfeadef0..71bf00979f 100644 --- a/usr/src/cmd/mdb/intel/kmdb/kmdb_promif_isadep.c +++ b/usr/src/cmd/mdb/intel/kmdb/kmdb_promif_isadep.c @@ -30,6 +30,7 @@ #include <sys/types.h> #include <sys/promif.h> +#include <sys/salib.h> #include <kmdb/kmdb_promif_impl.h> #include <kmdb/kmdb_kdi.h> @@ -110,3 +111,21 @@ kmdb_prom_stdout_is_framebuffer(kmdb_auxv_t *kav) /* Anything else is classified as local console. */ return (1); } + +void +kmdb_prom_get_tem_size(kmdb_auxv_t *kav, ushort_t *rows, ushort_t *cols) +{ + char *val; + unsigned long u; + + val = kmdb_prom_get_ddi_prop(kav, "screen-#rows"); + if (val != NULL) { + u = strtoul(val, NULL, 10); + *rows = (ushort_t)u; + } + val = kmdb_prom_get_ddi_prop(kav, "screen-#cols"); + if (val != NULL) { + u = strtoul(val, NULL, 10); + *cols = (ushort_t)u; + } +} diff --git a/usr/src/cmd/mdb/sparc/kmdb/kmdb_promif_isadep.c b/usr/src/cmd/mdb/sparc/kmdb/kmdb_promif_isadep.c index 3456d57dea..6db4861bd7 100644 --- a/usr/src/cmd/mdb/sparc/kmdb/kmdb_promif_isadep.c +++ b/usr/src/cmd/mdb/sparc/kmdb/kmdb_promif_isadep.c @@ -24,8 +24,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * PROM interface */ @@ -106,6 +104,13 @@ kmdb_prom_getprop(pnode_t node, char *name, caddr_t value) return (prom_getprop(node, name, value)); } +/*ARGSUSED*/ +void +kmdb_prom_get_tem_size(kmdb_auxv_t *kav, ushort_t *rows, ushort_t *cols) +{ + /* We fall back to defaults for now. */ +} + typedef struct walk_cpu_data { int (*wcd_cb)(pnode_t, void *, void *); void *wcd_arg; diff --git a/usr/src/cmd/zoneadmd/vplat.c b/usr/src/cmd/zoneadmd/vplat.c index f466836b96..01332d43e8 100644 --- a/usr/src/cmd/zoneadmd/vplat.c +++ b/usr/src/cmd/zoneadmd/vplat.c @@ -23,6 +23,7 @@ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2018, Joyent Inc. * Copyright (c) 2015, 2016 by Delphix. All rights reserved. + * Copyright 2019 OmniOS Community Edition (OmniOSce) Association. */ /* @@ -142,6 +143,8 @@ /* Number of times to retry unmounting if it fails */ #define UMOUNT_RETRIES 30 +#define ALT_MOUNT(mount_cmd) ((mount_cmd) != Z_MNT_BOOT) + /* a reasonable estimate for the number of lwps per process */ #define LWPS_PER_PROCESS 10 @@ -1381,13 +1384,13 @@ free_fs_data(struct zone_fstab *fsarray, uint_t nelem) * scratch zone. The Environment creation process is split up into two * functions(build_mounted_pre_var() and build_mounted_post_var()). It * is done this way because: - * We need to have both /etc and /var in the root of the scratchzone. - * We loopback mount zone's own /etc and /var into the root of the - * scratch zone. Unlike /etc, /var can be a seperate filesystem. So we - * need to delay the mount of /var till the zone's root gets populated. + * We need to have both /etc and /var in the root of the scratchzone. + * We loopback mount zone's own /etc and /var into the root of the + * scratch zone. Unlike /etc, /var can be a seperate filesystem. So we + * need to delay the mount of /var till the zone's root gets populated. * So mounting of localdirs[](/etc and /var) have been moved to the - * build_mounted_post_var() which gets called only after the zone - * specific filesystems are mounted. + * build_mounted_post_var() which gets called only after the zone + * specific filesystems are mounted. * * Note that the scratch zone we set up for updating the zone (Z_MNT_UPDATE) * does not loopback mount the zone's own /etc and /var into the root of the @@ -2728,7 +2731,7 @@ add_net_for_linkid(zlog_t *zlogp, zoneid_t zoneid, zone_addr_list_t *start) goto done; /* over-write last ',' with '\0' */ - zaddr[strnlen(zaddr, zlen) + 1] = '\0'; + zaddr[strnlen(zaddr, zlen) - 1] = '\0'; /* * First make sure L3 protection is not already set on the link. diff --git a/usr/src/common/acl/acl_common.c b/usr/src/common/acl/acl_common.c index c6fd162099..59c2e38b82 100644 --- a/usr/src/common/acl/acl_common.c +++ b/usr/src/common/acl/acl_common.c @@ -781,9 +781,9 @@ acevals_init(acevals_t *vals, uid_t key) static void ace_list_init(ace_list_t *al, int dfacl_flag) { - acevals_init(&al->user_obj, NULL); - acevals_init(&al->group_obj, NULL); - acevals_init(&al->other_obj, NULL); + acevals_init(&al->user_obj, 0); + acevals_init(&al->group_obj, 0); + acevals_init(&al->other_obj, 0); al->numusers = 0; al->numgroups = 0; al->acl_mask = 0; diff --git a/usr/src/common/bzip2/bzlib.c b/usr/src/common/bzip2/bzlib.c index 22e2d8826e..de5c009de8 100644 --- a/usr/src/common/bzip2/bzlib.c +++ b/usr/src/common/bzip2/bzlib.c @@ -673,12 +673,13 @@ int BZ_API(BZ2_bzDecompressInit) */ int BZ_API(BZ2_bzDecompressReset) ( bz_stream* strm ) { - DState* s = strm->state; + DState* s; if (!bz_config_ok()) return BZ_CONFIG_ERROR; if (strm == NULL) return BZ_PARAM_ERROR; + s = strm->state; s->strm = strm; s->state = BZ_X_MAGIC_1; diff --git a/usr/src/lib/libipadm/common/ipadm_ngz.c b/usr/src/lib/libipadm/common/ipadm_ngz.c index 899eb47ff0..9effd285d1 100644 --- a/usr/src/lib/libipadm/common/ipadm_ngz.c +++ b/usr/src/lib/libipadm/common/ipadm_ngz.c @@ -20,6 +20,7 @@ */ /* * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright 2019 OmniOS Community Edition (OmniOSce) Association. */ #include <errno.h> @@ -347,6 +348,7 @@ i_ipadm_zone_get_network(zoneid_t zoneid, datalink_id_t linkid, int type, void *buf, size_t *bufsize) { zone_net_data_t *zndata; + ipadm_status_t ret = IPADM_SUCCESS; zndata = calloc(1, sizeof (*zndata) + *bufsize); if (zndata == NULL) @@ -357,11 +359,14 @@ i_ipadm_zone_get_network(zoneid_t zoneid, datalink_id_t linkid, int type, if (zone_getattr(zoneid, ZONE_ATTR_NETWORK, zndata, sizeof (*zndata) + *bufsize) < 0) { - return (ipadm_errno2status(errno)); + ret = ipadm_errno2status(errno); + goto out; } *bufsize = zndata->zn_len; bcopy(zndata->zn_val, buf, *bufsize); - return (IPADM_SUCCESS); +out: + free(zndata); + return (ret); } /* @@ -447,7 +452,7 @@ fail: */ ipadm_status_t ipadm_init_net_from_gz(ipadm_handle_t iph, char *ifname, - void (*persist_if)(char *, boolean_t, boolean_t)) + void (*persist_if)(char *, boolean_t, boolean_t)) { ngz_walk_data_t nwd; uint64_t flags; diff --git a/usr/src/pkg/manifests/system-test-zfstest.mf b/usr/src/pkg/manifests/system-test-zfstest.mf index 19f249965a..c4d70e7980 100644 --- a/usr/src/pkg/manifests/system-test-zfstest.mf +++ b/usr/src/pkg/manifests/system-test-zfstest.mf @@ -605,6 +605,9 @@ file \ file \ path=opt/zfs-tests/tests/functional/channel_program/synctask_core/tst.snapshot_simple.zcp \ mode=0444 +file \ + path=opt/zfs-tests/tests/functional/channel_program/synctask_core/tst.terminate_by_signal \ + mode=0555 $(i386_ONLY)file path=opt/zfs-tests/tests/functional/checksum/edonr_test.amd64 \ mode=0555 $(i386_ONLY)file path=opt/zfs-tests/tests/functional/checksum/edonr_test.i386 \ diff --git a/usr/src/test/zfs-tests/tests/functional/channel_program/synctask_core/tst.terminate_by_signal.ksh b/usr/src/test/zfs-tests/tests/functional/channel_program/synctask_core/tst.terminate_by_signal.ksh new file mode 100644 index 0000000000..6f58cc1f4f --- /dev/null +++ b/usr/src/test/zfs-tests/tests/functional/channel_program/synctask_core/tst.terminate_by_signal.ksh @@ -0,0 +1,98 @@ +#!/bin/ksh -p +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright (c) 2017 by Delphix. All rights reserved. +# +. $STF_SUITE/tests/functional/channel_program/channel_common.kshlib + +# +# DESCRIPTION: Execute a long-running zfs channel program and attempt to +# cancel it by sending a signal. +# + +verify_runnable "global" + +rootfs=$TESTPOOL/$TESTFS +snapname=snap +limit=50000000 + +function cleanup +{ + datasetexists $rootfs && log_must zfs destroy -R $rootfs +} + +log_onexit cleanup + +# +# Create a working set of 100 file systems +# +for i in {1..100}; do + log_must zfs create "$rootfs/child$i" +done + +# +# Attempt to create 100 snapshots with zfs.sync.snapshot() along with some +# time consuming efforts. We use loops of zfs.check.* (dry run operations) +# to consume instructions before the next zfs.sync.snapshot() occurs. +# +# Without a signal interruption this ZCP would take several minutes and +# generate over 30 million Lua instructions. +# +function chan_prog +{ +zfs program -t $limit $TESTPOOL - $rootfs $snapname <<-EOF + arg = ... + fs = arg["argv"][1] + snap = arg["argv"][2] + for child in zfs.list.children(fs) do + local snapname = child .. "@" .. snap + zfs.check.snapshot(snapname) + zfs.sync.snapshot(snapname) + for i=1,20000,1 do + zfs.check.snapshot(snapname) + zfs.check.destroy(snapname) + zfs.check.destroy(fs) + end + end + return "should not have reached here" +EOF +} + +log_note "Executing a long-running zfs program in the background" +chan_prog & +CHILD=$! + +# +# After waiting, send a kill signal to the channel program process. +# This should stop the ZCP near a million instructions but still have +# created some of the snapshots. Note that since the above zfs program +# command might get wrapped, we also issue a kill to the group. +# +sleep 10 +log_pos pkill -P $CHILD +log_pos kill $CHILD + +# +# Make sure the channel program did not fully complete by enforcing +# that not all of the snapshots were created. +# +snap_count=$(zfs list -t snapshot | grep $TESTPOOL | wc -l) +log_note "$snap_count snapshots created by ZCP" + +if [ "$snap_count" -eq 0 ]; then + log_fail "Channel progam failed to run." +elif [ "$snap_count" -gt 50 ]; then + log_fail "Too many snapshots after a cancel ($snap_count)." +else + log_pass "Canceling a long-running channel program works." +fi diff --git a/usr/src/uts/common/disp/class.c b/usr/src/uts/common/disp/class.c index 46fbf711ba..237ecb0497 100644 --- a/usr/src/uts/common/disp/class.c +++ b/usr/src/uts/common/disp/class.c @@ -24,8 +24,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/types.h> #include <sys/systm.h> #include <sys/cmn_err.h> @@ -154,7 +152,7 @@ getcidbyname_locked(char *clname, id_t *cidp) ASSERT(MUTEX_HELD(&class_lock)); - if (*clname == NULL) + if (*clname == '\0') return (EINVAL); for (clp = &sclass[0]; clp < &sclass[nclass]; clp++) { diff --git a/usr/src/uts/common/fs/dnlc.c b/usr/src/uts/common/fs/dnlc.c index 0ec57ff7f7..81a5e65ae0 100644 --- a/usr/src/uts/common/fs/dnlc.c +++ b/usr/src/uts/common/fs/dnlc.c @@ -954,7 +954,7 @@ dnlc_reduce_cache(void *reduce_percent) if (dnlc_reduce_idle && (dnlc_nentries >= ncsize || reduce_percent)) { dnlc_reduce_idle = 0; if ((taskq_dispatch(system_taskq, do_dnlc_reduce_cache, - reduce_percent, TQ_NOSLEEP)) == NULL) + reduce_percent, TQ_NOSLEEP)) == (uintptr_t)NULL) dnlc_reduce_idle = 1; } } diff --git a/usr/src/uts/common/fs/swapfs/swap_vnops.c b/usr/src/uts/common/fs/swapfs/swap_vnops.c index 07d303afbb..b6c8c2cfe7 100644 --- a/usr/src/uts/common/fs/swapfs/swap_vnops.c +++ b/usr/src/uts/common/fs/swapfs/swap_vnops.c @@ -246,7 +246,7 @@ again: swap_phys_free(pvp, poff, PAGESIZE); ap->an_pvp = NULL; - ap->an_poff = NULL; + ap->an_poff = 0; hat_setmod(pp); } @@ -423,7 +423,7 @@ swap_getconpage( swap_phys_free(pvp, poff, PAGESIZE); ap->an_pvp = NULL; - ap->an_poff = NULL; + ap->an_poff = 0; hat_setmod(pp); mutex_exit(ahm); } diff --git a/usr/src/uts/common/fs/vfs.c b/usr/src/uts/common/fs/vfs.c index 49a1bf70b9..77bc7817a8 100644 --- a/usr/src/uts/common/fs/vfs.c +++ b/usr/src/uts/common/fs/vfs.c @@ -29,7 +29,7 @@ */ /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ -/* All Rights Reserved */ +/* All Rights Reserved */ /* * University Copyright- Copyright (c) 1982, 1986, 1988 @@ -348,8 +348,9 @@ fs_copyfsops(const fs_operation_def_t *template, vfsops_t *actual, fs_nosys, fs_nosys, VFSNAME_FREEVFS, offsetof(vfsops_t, vfs_freevfs), - (fs_generic_func_p)fs_freevfs, - (fs_generic_func_p)fs_freevfs, /* Shouldn't fail */ + (fs_generic_func_p)(uintptr_t)fs_freevfs, + /* Shouldn't fail */ + (fs_generic_func_p)(uintptr_t)fs_freevfs, VFSNAME_VNSTATE, offsetof(vfsops_t, vfs_vnstate), (fs_generic_func_p)fs_nosys, @@ -1581,7 +1582,7 @@ domount(char *fsname, struct mounta *uap, vnode_t *vp, struct cred *credp, /* * Serialize with zone state transitions. * See vfs_list_add; zone mounted into is: - * zone_find_by_path(refstr_value(vfsp->vfs_mntpt)) + * zone_find_by_path(refstr_value(vfsp->vfs_mntpt)) * not the zone doing the mount (curproc->p_zone), but if we're already * inside a NGZ, then we know what zone we are. */ @@ -2814,8 +2815,8 @@ vfs_mnttabvp_setup(void) vnode_t *tvp; vnodeops_t *vfs_mntdummyvnops; const fs_operation_def_t mnt_dummyvnodeops_template[] = { - VOPNAME_READ, { .vop_read = vfs_mntdummyread }, - VOPNAME_WRITE, { .vop_write = vfs_mntdummywrite }, + VOPNAME_READ, { .vop_read = vfs_mntdummyread }, + VOPNAME_WRITE, { .vop_write = vfs_mntdummywrite }, VOPNAME_GETATTR, { .vop_getattr = vfs_mntdummygetattr }, VOPNAME_VNEVENT, { .vop_vnevent = fs_vnevent_support }, NULL, NULL @@ -4177,7 +4178,7 @@ vfsinit(void) VFSNAME_UNMOUNT, { .error = vfs_EIO }, VFSNAME_ROOT, { .error = vfs_EIO }, VFSNAME_STATVFS, { .error = vfs_EIO }, - VFSNAME_SYNC, { .vfs_sync = vfs_EIO_sync }, + VFSNAME_SYNC, { .vfs_sync = vfs_EIO_sync }, VFSNAME_VGET, { .error = vfs_EIO }, VFSNAME_MOUNTROOT, { .error = vfs_EIO }, VFSNAME_FREEVFS, { .error = vfs_EIO }, @@ -4190,7 +4191,7 @@ vfsinit(void) VFSNAME_UNMOUNT, { .error = vfsstray }, VFSNAME_ROOT, { .error = vfsstray }, VFSNAME_STATVFS, { .error = vfsstray }, - VFSNAME_SYNC, { .vfs_sync = vfsstray_sync }, + VFSNAME_SYNC, { .vfs_sync = vfsstray_sync }, VFSNAME_VGET, { .error = vfsstray }, VFSNAME_MOUNTROOT, { .error = vfsstray }, VFSNAME_FREEVFS, { .error = vfsstray }, diff --git a/usr/src/uts/common/fs/vnode.c b/usr/src/uts/common/fs/vnode.c index d5262214f5..b55a7ca584 100644 --- a/usr/src/uts/common/fs/vnode.c +++ b/usr/src/uts/common/fs/vnode.c @@ -27,7 +27,7 @@ */ /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ -/* All Rights Reserved */ +/* All Rights Reserved */ /* * University Copyright- Copyright (c) 1982, 1986, 1988 @@ -145,7 +145,7 @@ static uint_t vsd_nkeys; /* size of destructor array */ /* list of vsd_node's */ static list_t *vsd_list = NULL; /* per-key destructor funcs */ -static void (**vsd_destructor)(void *); +static void (**vsd_destructor)(void *); /* * The following is the common set of actions needed to update the @@ -308,8 +308,8 @@ static const fs_operation_trans_def_t vn_ops_table[] = { fs_rwlock, fs_rwlock, VOPNAME_RWUNLOCK, offsetof(struct vnodeops, vop_rwunlock), - (fs_generic_func_p) fs_rwunlock, - (fs_generic_func_p) fs_rwunlock, /* no errors allowed */ + (fs_generic_func_p)(uintptr_t)fs_rwunlock, + (fs_generic_func_p)(uintptr_t)fs_rwunlock, /* no errors allowed */ VOPNAME_SEEK, offsetof(struct vnodeops, vop_seek), fs_nosys, fs_nosys, @@ -359,8 +359,8 @@ static const fs_operation_trans_def_t vn_ops_table[] = { fs_nosys, fs_nosys, VOPNAME_DISPOSE, offsetof(struct vnodeops, vop_dispose), - (fs_generic_func_p) fs_dispose, - (fs_generic_func_p) fs_nodispose, + (fs_generic_func_p)(uintptr_t)fs_dispose, + (fs_generic_func_p)(uintptr_t)fs_nodispose, VOPNAME_SETSECATTR, offsetof(struct vnodeops, vop_setsecattr), fs_nosys, fs_nosys, @@ -920,7 +920,7 @@ vn_rele_async(vnode_t *vp, taskq_t *taskq) if (vp->v_count == 1) { mutex_exit(&vp->v_lock); VERIFY(taskq_dispatch(taskq, (task_func_t *)vn_rele_inactive, - vp, TQ_SLEEP) != NULL); + vp, TQ_SLEEP) != (uintptr_t)NULL); return; } VN_RELE_LOCKED(vp); diff --git a/usr/src/uts/common/fs/zfs/dsl_synctask.c b/usr/src/uts/common/fs/zfs/dsl_synctask.c index 7014581d0e..a78b4cb030 100644 --- a/usr/src/uts/common/fs/zfs/dsl_synctask.c +++ b/usr/src/uts/common/fs/zfs/dsl_synctask.c @@ -41,7 +41,7 @@ dsl_null_checkfunc(void *arg, dmu_tx_t *tx) static int dsl_sync_task_common(const char *pool, dsl_checkfunc_t *checkfunc, - dsl_syncfunc_t *syncfunc, void *arg, + dsl_syncfunc_t *syncfunc, dsl_sigfunc_t *sigfunc, void *arg, int blocks_modified, zfs_space_check_t space_check, boolean_t early) { spa_t *spa; @@ -85,6 +85,11 @@ top: dmu_tx_commit(tx); + if (sigfunc != NULL && txg_wait_synced_sig(dp, dst.dst_txg)) { + /* current contract is to call func once */ + sigfunc(arg, tx); + sigfunc = NULL; /* in case of an EAGAIN retry */ + } txg_wait_synced(dp, dst.dst_txg); if (dst.dst_error == EAGAIN) { @@ -124,7 +129,7 @@ dsl_sync_task(const char *pool, dsl_checkfunc_t *checkfunc, dsl_syncfunc_t *syncfunc, void *arg, int blocks_modified, zfs_space_check_t space_check) { - return (dsl_sync_task_common(pool, checkfunc, syncfunc, arg, + return (dsl_sync_task_common(pool, checkfunc, syncfunc, NULL, arg, blocks_modified, space_check, B_FALSE)); } @@ -146,10 +151,23 @@ dsl_early_sync_task(const char *pool, dsl_checkfunc_t *checkfunc, dsl_syncfunc_t *syncfunc, void *arg, int blocks_modified, zfs_space_check_t space_check) { - return (dsl_sync_task_common(pool, checkfunc, syncfunc, arg, + return (dsl_sync_task_common(pool, checkfunc, syncfunc, NULL, arg, blocks_modified, space_check, B_TRUE)); } +/* + * A standard synctask that can be interrupted from a signal. The sigfunc + * is called once if a signal occurred while waiting for the task to sync. + */ +int +dsl_sync_task_sig(const char *pool, dsl_checkfunc_t *checkfunc, + dsl_syncfunc_t *syncfunc, dsl_sigfunc_t *sigfunc, void *arg, + int blocks_modified, zfs_space_check_t space_check) +{ + return (dsl_sync_task_common(pool, checkfunc, syncfunc, sigfunc, arg, + blocks_modified, space_check, B_FALSE)); +} + static void dsl_sync_task_nowait_common(dsl_pool_t *dp, dsl_syncfunc_t *syncfunc, void *arg, int blocks_modified, zfs_space_check_t space_check, dmu_tx_t *tx, diff --git a/usr/src/uts/common/fs/zfs/sys/dsl_synctask.h b/usr/src/uts/common/fs/zfs/sys/dsl_synctask.h index da6c7a40da..957963ffe5 100644 --- a/usr/src/uts/common/fs/zfs/sys/dsl_synctask.h +++ b/usr/src/uts/common/fs/zfs/sys/dsl_synctask.h @@ -37,6 +37,7 @@ struct dsl_pool; typedef int (dsl_checkfunc_t)(void *, dmu_tx_t *); typedef void (dsl_syncfunc_t)(void *, dmu_tx_t *); +typedef void (dsl_sigfunc_t)(void *, dmu_tx_t *); typedef enum zfs_space_check { /* @@ -116,6 +117,8 @@ int dsl_early_sync_task(const char *, dsl_checkfunc_t *, dsl_syncfunc_t *, void *, int, zfs_space_check_t); void dsl_early_sync_task_nowait(struct dsl_pool *, dsl_syncfunc_t *, void *, int, zfs_space_check_t, dmu_tx_t *); +int dsl_sync_task_sig(const char *, dsl_checkfunc_t *, dsl_syncfunc_t *, + dsl_sigfunc_t *, void *, int, zfs_space_check_t); #ifdef __cplusplus } diff --git a/usr/src/uts/common/fs/zfs/sys/txg.h b/usr/src/uts/common/fs/zfs/sys/txg.h index 272108ea19..d5c22e4147 100644 --- a/usr/src/uts/common/fs/zfs/sys/txg.h +++ b/usr/src/uts/common/fs/zfs/sys/txg.h @@ -88,6 +88,11 @@ extern void txg_kick(struct dsl_pool *dp); extern void txg_wait_synced(struct dsl_pool *dp, uint64_t txg); /* + * Wait as above. Returns true if the thread was signaled while waiting. + */ +extern boolean_t txg_wait_synced_sig(struct dsl_pool *dp, uint64_t txg); + +/* * Wait until the given transaction group, or one after it, is * the open transaction group. Try to make this happen as soon * as possible (eg. kick off any necessary syncs immediately). diff --git a/usr/src/uts/common/fs/zfs/sys/zcp.h b/usr/src/uts/common/fs/zfs/sys/zcp.h index 5713a748f7..a6cb575b5b 100644 --- a/usr/src/uts/common/fs/zfs/sys/zcp.h +++ b/usr/src/uts/common/fs/zfs/sys/zcp.h @@ -52,6 +52,12 @@ typedef struct zcp_cleanup_handler { list_node_t zch_node; } zcp_cleanup_handler_t; +typedef struct zcp_alloc_arg { + boolean_t aa_must_succeed; + int64_t aa_alloc_remaining; + int64_t aa_alloc_limit; +} zcp_alloc_arg_t; + typedef struct zcp_run_info { dsl_pool_t *zri_pool; @@ -94,6 +100,11 @@ typedef struct zcp_run_info { boolean_t zri_timed_out; /* + * Channel program was canceled by user + */ + boolean_t zri_canceled; + + /* * Boolean indicating whether or not we are running in syncing * context. */ @@ -104,6 +115,26 @@ typedef struct zcp_run_info { * triggered in the event of a fatal error. */ list_t zri_cleanup_handlers; + + /* + * The Lua state context of our channel program. + */ + lua_State *zri_state; + + /* + * Lua memory allocator arguments. + */ + zcp_alloc_arg_t *zri_allocargs; + + /* + * Contains output values from zcp script or error string. + */ + nvlist_t *zri_outnvl; + + /* + * The errno number returned to caller of zcp_eval(). + */ + int zri_result; } zcp_run_info_t; zcp_run_info_t *zcp_run_info(lua_State *); diff --git a/usr/src/uts/common/fs/zfs/txg.c b/usr/src/uts/common/fs/zfs/txg.c index a9a44a6286..c97cfdb82c 100644 --- a/usr/src/uts/common/fs/zfs/txg.c +++ b/usr/src/uts/common/fs/zfs/txg.c @@ -635,8 +635,8 @@ txg_delay(dsl_pool_t *dp, uint64_t txg, hrtime_t delay, hrtime_t resolution) mutex_exit(&tx->tx_sync_lock); } -void -txg_wait_synced(dsl_pool_t *dp, uint64_t txg) +static boolean_t +txg_wait_synced_impl(dsl_pool_t *dp, uint64_t txg, boolean_t wait_sig) { tx_state_t *tx = &dp->dp_tx; @@ -655,9 +655,39 @@ txg_wait_synced(dsl_pool_t *dp, uint64_t txg) "tx_synced=%llu waiting=%llu dp=%p\n", tx->tx_synced_txg, tx->tx_sync_txg_waiting, dp); cv_broadcast(&tx->tx_sync_more_cv); - cv_wait(&tx->tx_sync_done_cv, &tx->tx_sync_lock); + if (wait_sig) { + /* + * Condition wait here but stop if the thread receives a + * signal. The caller may call txg_wait_synced*() again + * to resume waiting for this txg. + */ + if (cv_wait_sig(&tx->tx_sync_done_cv, + &tx->tx_sync_lock) == 0) { + mutex_exit(&tx->tx_sync_lock); + return (B_TRUE); + } + } else { + cv_wait(&tx->tx_sync_done_cv, &tx->tx_sync_lock); + } } mutex_exit(&tx->tx_sync_lock); + return (B_FALSE); +} + +void +txg_wait_synced(dsl_pool_t *dp, uint64_t txg) +{ + VERIFY0(txg_wait_synced_impl(dp, txg, B_FALSE)); +} + +/* + * Similar to a txg_wait_synced but it can be interrupted from a signal. + * Returns B_TRUE if the thread was signaled while waiting. + */ +boolean_t +txg_wait_synced_sig(dsl_pool_t *dp, uint64_t txg) +{ + return (txg_wait_synced_impl(dp, txg, B_TRUE)); } void diff --git a/usr/src/uts/common/fs/zfs/zcp.c b/usr/src/uts/common/fs/zfs/zcp.c index bad8a56f58..a3ac9a9824 100644 --- a/usr/src/uts/common/fs/zfs/zcp.c +++ b/usr/src/uts/common/fs/zfs/zcp.c @@ -115,21 +115,6 @@ static int zcp_nvpair_value_to_lua(lua_State *, nvpair_t *, char *, int); static int zcp_lua_to_nvlist_impl(lua_State *, int, nvlist_t *, const char *, int); -typedef struct zcp_alloc_arg { - boolean_t aa_must_succeed; - int64_t aa_alloc_remaining; - int64_t aa_alloc_limit; -} zcp_alloc_arg_t; - -typedef struct zcp_eval_arg { - lua_State *ea_state; - zcp_alloc_arg_t *ea_allocargs; - cred_t *ea_cred; - nvlist_t *ea_outnvl; - int ea_result; - uint64_t ea_instrlimit; -} zcp_eval_arg_t; - /* * The outer-most error callback handler for use with lua_pcall(). On * error Lua will call this callback with a single argument that @@ -449,7 +434,7 @@ zcp_lua_to_nvlist_helper(lua_State *state) static void zcp_convert_return_values(lua_State *state, nvlist_t *nvl, - const char *key, zcp_eval_arg_t *evalargs) + const char *key, int *result) { int err; VERIFY3U(1, ==, lua_gettop(state)); @@ -461,7 +446,7 @@ zcp_convert_return_values(lua_State *state, nvlist_t *nvl, err = lua_pcall(state, 3, 0, 0); /* zcp_lua_to_nvlist_helper */ if (err != 0) { zcp_lua_to_nvlist(state, 1, nvl, ZCP_RET_ERROR); - evalargs->ea_result = SET_ERROR(ECHRNG); + *result = SET_ERROR(ECHRNG); } } @@ -788,13 +773,24 @@ zcp_lua_alloc(void *ud, void *ptr, size_t osize, size_t nsize) static void zcp_lua_counthook(lua_State *state, lua_Debug *ar) { - /* - * If we're called, check how many instructions the channel program has - * executed so far, and compare against the limit. - */ lua_getfield(state, LUA_REGISTRYINDEX, ZCP_RUN_INFO_KEY); zcp_run_info_t *ri = lua_touserdata(state, -1); + /* + * Check if we were canceled while waiting for the + * txg to sync or from our open context thread + */ + if (ri->zri_canceled || + (!ri->zri_sync && issig(JUSTLOOKING) && issig(FORREAL))) { + ri->zri_canceled = B_TRUE; + (void) lua_pushstring(state, "Channel program was canceled."); + (void) lua_error(state); + } + + /* + * Check how many instructions the channel program has + * executed so far, and compare against the limit. + */ ri->zri_curinstrs += zfs_lua_check_instrlimit_interval; if (ri->zri_maxinstrs != 0 && ri->zri_curinstrs > ri->zri_maxinstrs) { ri->zri_timed_out = B_TRUE; @@ -813,31 +809,25 @@ zcp_panic_cb(lua_State *state) } static void -zcp_eval_impl(dmu_tx_t *tx, boolean_t sync, zcp_eval_arg_t *evalargs) +zcp_eval_impl(dmu_tx_t *tx, zcp_run_info_t *ri) { int err; - zcp_run_info_t ri; - lua_State *state = evalargs->ea_state; + lua_State *state = ri->zri_state; VERIFY3U(3, ==, lua_gettop(state)); + /* finish initializing our runtime state */ + ri->zri_pool = dmu_tx_pool(tx); + ri->zri_tx = tx; + list_create(&ri->zri_cleanup_handlers, sizeof (zcp_cleanup_handler_t), + offsetof(zcp_cleanup_handler_t, zch_node)); + /* * Store the zcp_run_info_t struct for this run in the Lua registry. * Registry entries are not directly accessible by the Lua scripts but * can be accessed by our callbacks. */ - ri.zri_space_used = 0; - ri.zri_pool = dmu_tx_pool(tx); - ri.zri_cred = evalargs->ea_cred; - ri.zri_tx = tx; - ri.zri_timed_out = B_FALSE; - ri.zri_sync = sync; - list_create(&ri.zri_cleanup_handlers, sizeof (zcp_cleanup_handler_t), - offsetof(zcp_cleanup_handler_t, zch_node)); - ri.zri_curinstrs = 0; - ri.zri_maxinstrs = evalargs->ea_instrlimit; - - lua_pushlightuserdata(state, &ri); + lua_pushlightuserdata(state, ri); lua_setfield(state, LUA_REGISTRYINDEX, ZCP_RUN_INFO_KEY); VERIFY3U(3, ==, lua_gettop(state)); @@ -854,7 +844,7 @@ zcp_eval_impl(dmu_tx_t *tx, boolean_t sync, zcp_eval_arg_t *evalargs) * off control to the channel program. Channel programs that use too * much memory should die with ENOSPC. */ - evalargs->ea_allocargs->aa_must_succeed = B_FALSE; + ri->zri_allocargs->aa_must_succeed = B_FALSE; /* * Call the Lua function that open-context passed us. This pops the @@ -866,14 +856,14 @@ zcp_eval_impl(dmu_tx_t *tx, boolean_t sync, zcp_eval_arg_t *evalargs) /* * Let Lua use KM_SLEEP while we interpret the return values. */ - evalargs->ea_allocargs->aa_must_succeed = B_TRUE; + ri->zri_allocargs->aa_must_succeed = B_TRUE; /* * Remove the error handler callback from the stack. At this point, * there shouldn't be any cleanup handler registered in the handler * list (zri_cleanup_handlers), regardless of whether it ran or not. */ - list_destroy(&ri.zri_cleanup_handlers); + list_destroy(&ri->zri_cleanup_handlers); lua_remove(state, 1); switch (err) { @@ -893,16 +883,16 @@ zcp_eval_impl(dmu_tx_t *tx, boolean_t sync, zcp_eval_arg_t *evalargs) int return_count = lua_gettop(state); if (return_count == 1) { - evalargs->ea_result = 0; - zcp_convert_return_values(state, evalargs->ea_outnvl, - ZCP_RET_RETURN, evalargs); + ri->zri_result = 0; + zcp_convert_return_values(state, ri->zri_outnvl, + ZCP_RET_RETURN, &ri->zri_result); } else if (return_count > 1) { - evalargs->ea_result = SET_ERROR(ECHRNG); + ri->zri_result = SET_ERROR(ECHRNG); lua_settop(state, 0); (void) lua_pushfstring(state, "Multiple return " "values not supported"); - zcp_convert_return_values(state, evalargs->ea_outnvl, - ZCP_RET_ERROR, evalargs); + zcp_convert_return_values(state, ri->zri_outnvl, + ZCP_RET_ERROR, &ri->zri_result); } break; } @@ -916,14 +906,16 @@ zcp_eval_impl(dmu_tx_t *tx, boolean_t sync, zcp_eval_arg_t *evalargs) * stack. */ VERIFY3U(1, ==, lua_gettop(state)); - if (ri.zri_timed_out) { - evalargs->ea_result = SET_ERROR(ETIME); + if (ri->zri_timed_out) { + ri->zri_result = SET_ERROR(ETIME); + } else if (ri->zri_canceled) { + ri->zri_result = SET_ERROR(EINTR); } else { - evalargs->ea_result = SET_ERROR(ECHRNG); + ri->zri_result = SET_ERROR(ECHRNG); } - zcp_convert_return_values(state, evalargs->ea_outnvl, - ZCP_RET_ERROR, evalargs); + zcp_convert_return_values(state, ri->zri_outnvl, + ZCP_RET_ERROR, &ri->zri_result); break; } case LUA_ERRERR: { @@ -934,14 +926,16 @@ zcp_eval_impl(dmu_tx_t *tx, boolean_t sync, zcp_eval_arg_t *evalargs) * return the error message. */ VERIFY3U(1, ==, lua_gettop(state)); - if (ri.zri_timed_out) { - evalargs->ea_result = SET_ERROR(ETIME); + if (ri->zri_timed_out) { + ri->zri_result = SET_ERROR(ETIME); + } else if (ri->zri_canceled) { + ri->zri_result = SET_ERROR(EINTR); } else { - evalargs->ea_result = SET_ERROR(ECHRNG); + ri->zri_result = SET_ERROR(ECHRNG); } - zcp_convert_return_values(state, evalargs->ea_outnvl, - ZCP_RET_ERROR, evalargs); + zcp_convert_return_values(state, ri->zri_outnvl, + ZCP_RET_ERROR, &ri->zri_result); break; } case LUA_ERRMEM: @@ -949,7 +943,7 @@ zcp_eval_impl(dmu_tx_t *tx, boolean_t sync, zcp_eval_arg_t *evalargs) * Lua ran out of memory while running the channel program. * There's not much we can do. */ - evalargs->ea_result = SET_ERROR(ENOSPC); + ri->zri_result = SET_ERROR(ENOSPC); break; default: VERIFY0(err); @@ -957,21 +951,35 @@ zcp_eval_impl(dmu_tx_t *tx, boolean_t sync, zcp_eval_arg_t *evalargs) } static void -zcp_pool_error(zcp_eval_arg_t *evalargs, const char *poolname) +zcp_pool_error(zcp_run_info_t *ri, const char *poolname) { - evalargs->ea_result = SET_ERROR(ECHRNG); - lua_settop(evalargs->ea_state, 0); - (void) lua_pushfstring(evalargs->ea_state, "Could not open pool: %s", + ri->zri_result = SET_ERROR(ECHRNG); + lua_settop(ri->zri_state, 0); + (void) lua_pushfstring(ri->zri_state, "Could not open pool: %s", poolname); - zcp_convert_return_values(evalargs->ea_state, evalargs->ea_outnvl, - ZCP_RET_ERROR, evalargs); + zcp_convert_return_values(ri->zri_state, ri->zri_outnvl, + ZCP_RET_ERROR, &ri->zri_result); + +} + +/* + * This callback is called when txg_wait_synced_sig encountered a signal. + * The txg_wait_synced_sig will continue to wait for the txg to complete + * after calling this callback. + */ +/* ARGSUSED */ +static void +zcp_eval_sig(void *arg, dmu_tx_t *tx) +{ + zcp_run_info_t *ri = arg; + ri->zri_canceled = B_TRUE; } static void zcp_eval_sync(void *arg, dmu_tx_t *tx) { - zcp_eval_arg_t *evalargs = arg; + zcp_run_info_t *ri = arg; /* * Open context should have setup the stack to contain: @@ -979,15 +987,14 @@ zcp_eval_sync(void *arg, dmu_tx_t *tx) * 2: Script to run (converted to a Lua function) * 3: nvlist input to function (converted to Lua table or nil) */ - VERIFY3U(3, ==, lua_gettop(evalargs->ea_state)); + VERIFY3U(3, ==, lua_gettop(ri->zri_state)); - zcp_eval_impl(tx, B_TRUE, evalargs); + zcp_eval_impl(tx, ri); } static void -zcp_eval_open(zcp_eval_arg_t *evalargs, const char *poolname) +zcp_eval_open(zcp_run_info_t *ri, const char *poolname) { - int error; dsl_pool_t *dp; dmu_tx_t *tx; @@ -995,11 +1002,11 @@ zcp_eval_open(zcp_eval_arg_t *evalargs, const char *poolname) /* * See comment from the same assertion in zcp_eval_sync(). */ - VERIFY3U(3, ==, lua_gettop(evalargs->ea_state)); + VERIFY3U(3, ==, lua_gettop(ri->zri_state)); error = dsl_pool_hold(poolname, FTAG, &dp); if (error != 0) { - zcp_pool_error(evalargs, poolname); + zcp_pool_error(ri, poolname); return; } @@ -1014,7 +1021,7 @@ zcp_eval_open(zcp_eval_arg_t *evalargs, const char *poolname) */ tx = dmu_tx_create_dd(dp->dp_mos_dir); - zcp_eval_impl(tx, B_FALSE, evalargs); + zcp_eval_impl(tx, ri); dmu_tx_abort(tx); @@ -1027,7 +1034,7 @@ zcp_eval(const char *poolname, const char *program, boolean_t sync, { int err; lua_State *state; - zcp_eval_arg_t evalargs; + zcp_run_info_t runinfo; if (instrlimit > zfs_lua_max_instrlimit) return (SET_ERROR(EINVAL)); @@ -1127,24 +1134,29 @@ zcp_eval(const char *poolname, const char *program, boolean_t sync, } VERIFY3U(3, ==, lua_gettop(state)); - evalargs.ea_state = state; - evalargs.ea_allocargs = &allocargs; - evalargs.ea_instrlimit = instrlimit; - evalargs.ea_cred = CRED(); - evalargs.ea_outnvl = outnvl; - evalargs.ea_result = 0; + runinfo.zri_state = state; + runinfo.zri_allocargs = &allocargs; + runinfo.zri_outnvl = outnvl; + runinfo.zri_result = 0; + runinfo.zri_cred = CRED(); + runinfo.zri_timed_out = B_FALSE; + runinfo.zri_canceled = B_FALSE; + runinfo.zri_sync = sync; + runinfo.zri_space_used = 0; + runinfo.zri_curinstrs = 0; + runinfo.zri_maxinstrs = instrlimit; if (sync) { - err = dsl_sync_task(poolname, NULL, - zcp_eval_sync, &evalargs, 0, ZFS_SPACE_CHECK_ZCP_EVAL); + err = dsl_sync_task_sig(poolname, NULL, zcp_eval_sync, + zcp_eval_sig, &runinfo, 0, ZFS_SPACE_CHECK_ZCP_EVAL); if (err != 0) - zcp_pool_error(&evalargs, poolname); + zcp_pool_error(&runinfo, poolname); } else { - zcp_eval_open(&evalargs, poolname); + zcp_eval_open(&runinfo, poolname); } lua_close(state); - return (evalargs.ea_result); + return (runinfo.zri_result); } /* diff --git a/usr/src/uts/common/fs/zfs/zfs_ioctl.c b/usr/src/uts/common/fs/zfs/zfs_ioctl.c index a31ac21646..486b7398a4 100644 --- a/usr/src/uts/common/fs/zfs/zfs_ioctl.c +++ b/usr/src/uts/common/fs/zfs/zfs_ioctl.c @@ -6389,7 +6389,7 @@ zfsdev_ioctl(dev_t dev, int cmd, intptr_t arg, int flag, cred_t *cr, int *rvalp) error = vec->zvec_func(zc->zc_name, innvl, outnvl); /* - * Some commands can partially execute, modfiy state, and still + * Some commands can partially execute, modify state, and still * return an error. In these cases, attempt to record what * was modified. */ diff --git a/usr/src/uts/common/inet/ip/inet_ntop.c b/usr/src/uts/common/inet/ip/inet_ntop.c index efad4fc176..c6876cc030 100644 --- a/usr/src/uts/common/inet/ip/inet_ntop.c +++ b/usr/src/uts/common/inet/ip/inet_ntop.c @@ -285,7 +285,7 @@ __inet_pton(int af, char *inp, void *outp, int compat) in6_addr_t v6addr_u; } v6buf, *v6outp; uint16_t *dbl_col = NULL; - char lastbyte = NULL; + char lastbyte = '\0'; v6outp = (union v6buf_u *)outp; @@ -333,7 +333,7 @@ __inet_pton(int af, char *inp, void *outp, int compat) } else { v6buf.v6words_u[i] = htons((uint16_t)byte); } - if (*end == NULL || i == 7) { + if (*end == '\0' || i == 7) { inp = end; break; } @@ -349,7 +349,7 @@ __inet_pton(int af, char *inp, void *outp, int compat) dbl_col = &v6buf.v6words_u[i]; if (i == 0) inp++; - } else if (*inp == NULL || *inp == ' ' || + } else if (*inp == '\0' || *inp == ' ' || *inp == '\t') { break; } else { @@ -362,12 +362,12 @@ __inet_pton(int af, char *inp, void *outp, int compat) return (0); } inp++; - if (*inp == NULL || *inp == ' ' || *inp == '\t') { + if (*inp == '\0' || *inp == ' ' || *inp == '\t') { break; } lastbyte = *inp; } - if (*inp != NULL && *inp != ' ' && *inp != '\t') { + if (*inp != '\0' && *inp != ' ' && *inp != '\t') { return (0); } /* diff --git a/usr/src/uts/common/io/bridge.c b/usr/src/uts/common/io/bridge.c index dc79139ce6..375d166972 100644 --- a/usr/src/uts/common/io/bridge.c +++ b/usr/src/uts/common/io/bridge.c @@ -222,8 +222,8 @@ static struct qinit bridge_dld_rinit = { }; static struct qinit bridge_dld_winit = { - (int (*)())dld_wput, /* qi_putp */ - (int (*)())dld_wsrv, /* qi_srvp */ + dld_wput, /* qi_putp */ + dld_wsrv, /* qi_srvp */ NULL, /* qi_qopen */ NULL, /* qi_qclose */ NULL, /* qi_qadmin */ @@ -3409,7 +3409,7 @@ bridge_ioctl(queue_t *wq, mblk_t *mp) miocnak(wq, mp, 0, rc); } -static void +static int bridge_wput(queue_t *wq, mblk_t *mp) { switch (DB_TYPE(mp)) { @@ -3428,6 +3428,7 @@ bridge_wput(queue_t *wq, mblk_t *mp) freemsg(mp); break; } + return (0); } /* @@ -3531,7 +3532,7 @@ bridge_detach(dev_info_t *dip, ddi_detach_cmd_t cmd) /* ARGSUSED */ static int bridge_info(dev_info_t *dip, ddi_info_cmd_t infocmd, void *arg, - void **result) + void **result) { int rc; diff --git a/usr/src/uts/common/io/chxge/com/my3126.c b/usr/src/uts/common/io/chxge/com/my3126.c index 0cc4f6a911..d06731aa73 100644 --- a/usr/src/uts/common/io/chxge/com/my3126.c +++ b/usr/src/uts/common/io/chxge/com/my3126.c @@ -23,8 +23,6 @@ * Copyright (C) 2003-2005 Chelsio Communications. All rights reserved. */ -#pragma ident "%Z%%M% %I% %E% SMI" /* my3126.c */ - #include "cphy.h" #include "elmer0.h" #include "suni1x10gexp_regs.h" @@ -66,9 +64,10 @@ static int my3126_interrupt_clear(struct cphy *cphy) return (0); } -#define OFFSET(REG_ADDR) (REG_ADDR << 2) +#define OFFSET(REG_ADDR) (REG_ADDR << 2) -static int my3126_interrupt_handler(struct cphy *cphy) +static int +my3126_interrupt_handler(struct cphy *cphy) { u32 val; u16 val16; @@ -85,33 +84,34 @@ static int my3126_interrupt_handler(struct cphy *cphy) (void) mdio_read(cphy, 0x1, 0x1, &val); val16 = (u16) val; status = cphy->bmsr ^ val16; - + if (status & BMSR_LSTATUS) { link_changed(adapter, 0); } cphy->bmsr = val16; - /* We have only enabled link change interrupts so it - must be that + /* + * We have only enabled link change interrupts so it + * must be that. */ cphy->count = 0; } (void) t1_tpi_write(adapter, OFFSET(SUNI1x10GEXP_REG_MSTAT_CONTROL), - SUNI1x10GEXP_BITMSK_MSTAT_SNAP); + SUNI1x10GEXP_BITMSK_MSTAT_SNAP); (void) t1_tpi_read(adapter, - OFFSET(SUNI1x10GEXP_REG_MSTAT_COUNTER_1_LOW), &act_count); + OFFSET(SUNI1x10GEXP_REG_MSTAT_COUNTER_1_LOW), &act_count); (void) t1_tpi_read(adapter, - OFFSET(SUNI1x10GEXP_REG_MSTAT_COUNTER_33_LOW), &val); + OFFSET(SUNI1x10GEXP_REG_MSTAT_COUNTER_33_LOW), &val); act_count += val; val = cphy->elmer_gpo; if ((val & (1 << 8)) || - (cphy->act_count == act_count) || (cphy->act_on)) { + (cphy->act_count == act_count) || (cphy->act_on)) { val |= (1 << 9); (void) t1_tpi_write(adapter, A_ELMER0_GPO, val); cphy->act_on = 0; } else { val &= ~(1 << 9); - (void) t1_tpi_write(adapter, A_ELMER0_GPO, val); + (void) t1_tpi_write(adapter, A_ELMER0_GPO, val); cphy->act_on = 1; } cphy->elmer_gpo = val; @@ -145,11 +145,11 @@ static int my3126_get_link_status(struct cphy *cphy, val = cphy->elmer_gpo; *link_ok = (val16 & BMSR_LSTATUS); if (*link_ok) { - // Light the LED. - val &= ~(1 << 8); + /* Light the LED. */ + val &= ~(1 << 8); } else { - // Turn off the LED. - val |= (1 << 8); + /* Turn off the LED. */ + val |= (1 << 8); } (void) t1_tpi_write(adapter, A_ELMER0_GPO, val); cphy->elmer_gpo = val; @@ -164,7 +164,7 @@ static int my3126_get_link_status(struct cphy *cphy, static void my3126_destroy(struct cphy *cphy) { - t1_os_free((void *) cphy, sizeof(*cphy)); + t1_os_free(cphy, sizeof (*cphy)); } #ifdef C99_NOT_SUPPORTED @@ -185,29 +185,34 @@ static struct cphy_ops my3126_ops = { }; #else static struct cphy_ops my3126_ops = { - .destroy = my3126_destroy, - .reset = my3126_reset, - .interrupt_enable = my3126_interrupt_enable, - .interrupt_disable = my3126_interrupt_disable, - .interrupt_clear = my3126_interrupt_clear, - .interrupt_handler = my3126_interrupt_handler, - .get_link_status = my3126_get_link_status, - .set_loopback = my3126_set_loopback, + .destroy = my3126_destroy, + .reset = my3126_reset, + .interrupt_enable = my3126_interrupt_enable, + .interrupt_disable = my3126_interrupt_disable, + .interrupt_clear = my3126_interrupt_clear, + .interrupt_handler = my3126_interrupt_handler, + .get_link_status = my3126_get_link_status, + .set_loopback = my3126_set_loopback, }; #endif +static void +my3126_cyclic_cb(void *ptr) +{ + (void) my3126_interrupt_handler(ptr); +} + static struct cphy *my3126_phy_create(adapter_t *adapter, int phy_addr, - struct mdio_ops *mdio_ops) + struct mdio_ops *mdio_ops) { - struct cphy *cphy = t1_os_malloc_wait_zero(sizeof(*cphy)); + struct cphy *cphy = t1_os_malloc_wait_zero(sizeof (*cphy)); if (cphy) cphy_init(cphy, adapter, phy_addr, &my3126_ops, mdio_ops); if (is_T2(adapter)) { - ch_init_cyclic(adapter, &cphy->phy_update_cyclic, - (void (*)(void *))my3126_interrupt_handler, - cphy); + ch_init_cyclic(adapter, &cphy->phy_update_cyclic, + my3126_cyclic_cb, cphy); cphy->bmsr = 0; } @@ -215,7 +220,7 @@ static struct cphy *my3126_phy_create(adapter_t *adapter, int phy_addr, } /* Chip Reset */ -static int my3126_phy_reset(adapter_t * adapter) +static int my3126_phy_reset(adapter_t *adapter) { u32 val; diff --git a/usr/src/uts/common/io/conskbd.c b/usr/src/uts/common/io/conskbd.c index 53238205c2..c250a6be8c 100644 --- a/usr/src/uts/common/io/conskbd.c +++ b/usr/src/uts/common/io/conskbd.c @@ -93,9 +93,9 @@ static int conskbd_info(dev_info_t *, ddi_info_cmd_t, void *, void **); /* * STREAMS queue processing procedures */ -static void conskbduwsrv(queue_t *); -static void conskbdlwserv(queue_t *); -static void conskbdlrput(queue_t *, mblk_t *); +static int conskbduwsrv(queue_t *); +static int conskbdlwserv(queue_t *); +static int conskbdlrput(queue_t *, mblk_t *); static int conskbdclose(queue_t *, int, cred_t *); static int conskbdopen(queue_t *, dev_t *, int, int, cred_t *); @@ -126,8 +126,8 @@ static struct qinit conskbdurinit = { /* upper write queue processing procedures structuresi */ static struct qinit conskbduwinit = { - (int (*)())putq, /* qi_putp */ - (int (*)())conskbduwsrv, /* qi_srvp */ + putq, /* qi_putp */ + conskbduwsrv, /* qi_srvp */ conskbdopen, /* qi_qopen */ conskbdclose, /* qi_qclose */ (int (*)())NULL, /* qi_qadmin */ @@ -137,7 +137,7 @@ static struct qinit conskbduwinit = { /* lower read queue processing procedures structures */ static struct qinit conskbdlrinit = { - (int (*)())conskbdlrput, /* qi_putp */ + conskbdlrput, /* qi_putp */ (int (*)())NULL, /* qi_srvp */ (int (*)())NULL, /* qi_qopen */ (int (*)())NULL, /* qi_qclose */ @@ -149,7 +149,7 @@ static struct qinit conskbdlrinit = { /* lower write processing procedures structures */ static struct qinit conskbdlwinit = { putq, /* qi_putp */ - (int (*)())conskbdlwserv, /* qi_srvp */ + conskbdlwserv, /* qi_srvp */ (int (*)())NULL, /* qi_qopen */ (int (*)())NULL, /* qi_qclose */ (int (*)())NULL, /* qi_qadmin */ @@ -167,7 +167,7 @@ static struct streamtab conskbd_str_info = { /* Entry points structure */ -static struct cb_ops cb_conskbd_ops = { +static struct cb_ops cb_conskbd_ops = { nulldev, /* cb_open */ nulldev, /* cb_close */ nodev, /* cb_strategy */ @@ -316,7 +316,7 @@ static void conskbd_streams_setled(struct kbtrans_hardware *, int); static boolean_t conskbd_override_kbtrans(queue_t *, mblk_t *); static boolean_t conskbd_polled_keycheck(struct kbtrans_hardware *, - kbtrans_key_t *, enum keystate *); + kbtrans_key_t *, enum keystate *); /* * Callbacks needed by kbtrans @@ -426,7 +426,7 @@ _info(struct modinfo *modinfop) * conskbd_attach() * * Description: - * This routine creates two device nodes. One is the "kbd" node, which + * This routine creates two device nodes. One is the "kbd" node, which * is used by user application programs(such as Xserver).The other is the * "conskbd" node, which is an internal node. consconfig_dacf module will * open this internal node, and link the conskbd under the wc (workstaion @@ -507,7 +507,7 @@ conskbd_detach(dev_info_t *devi, ddi_detach_cmd_t cmd) /* ARGSUSED */ static int conskbd_info(dev_info_t *dip, ddi_info_cmd_t infocmd, void *arg, - void **result) + void **result) { register int error; @@ -658,12 +658,12 @@ conskbdclose(queue_t *q, int flag, cred_t *crp) * qi_putq() routine, which is a standard putq() routine, puts all * messages into a queue, and lets the following service procedure * deal with all messages. - * This routine is invoked when ioctl commands are send down + * This routine is invoked when ioctl commands are send down * by a consumer of the keyboard device, eg, when the keyboard * consumer tries to determine the keyboard layout type, or sets * the led states. */ -static void +static int conskbduwsrv(queue_t *q) { mblk_t *mp; @@ -817,6 +817,7 @@ conskbduwsrv(queue_t *q) } } /* end of while */ + return (0); } /* conskbduwsrv() */ static void @@ -1104,7 +1105,7 @@ conskbd_legacy_kbd_ioctl(queue_t *q, mblk_t *mp) * Service procedure for lower write queue. * Puts things on the queue below us, if it lets us. */ -static void +static int conskbdlwserv(queue_t *q) { register mblk_t *mp; @@ -1112,6 +1113,7 @@ conskbdlwserv(queue_t *q) while (canput(q->q_next) && (mp = getq(q)) != NULL) putnext(q, mp); + return (0); } /* conskbdlwserv() */ /* @@ -1119,11 +1121,11 @@ conskbdlwserv(queue_t *q) * Pass everything up to minor device 0 if "directio" set, otherwise to minor * device 1. */ -static void +static int conskbdlrput(queue_t *q, mblk_t *mp) { conskbd_lower_queue_t *lqs; - struct iocblk *iocp; + struct iocblk *iocp; Firm_event *fe; DPRINTF(PRINT_L1, PRINT_MASK_ALL, ("conskbdlrput\n")); @@ -1224,6 +1226,7 @@ conskbdlrput(queue_t *q, mblk_t *mp) break; } + return (0); } /* conskbdlrput() */ @@ -1340,15 +1343,15 @@ conskbd_handle_downstream_msg(queue_t *q, mblk_t *mp) * is not available in normal mode once returning * from kmdb; * 3) for KIOCCMD - * 3.1) for KBD_CMD_NOBELL - * there's no beep in USB and PS2 keyboard, - * this ioctl actually disables the beep on - * system mainboard. Note that all the cloned - * messages sent down to lower queues do the - * same job for system mainboard. Therefore, - * even if we fail to send this ioctl to most - * of lower queues, the beep still would be - * disabled. So, no trouble exists here. + * 3.1) for KBD_CMD_NOBELL + * there's no beep in USB and PS2 keyboard, + * this ioctl actually disables the beep on + * system mainboard. Note that all the cloned + * messages sent down to lower queues do the + * same job for system mainboard. Therefore, + * even if we fail to send this ioctl to most + * of lower queues, the beep still would be + * disabled. So, no trouble exists here. * 3.2) for others * nothing; * @@ -1623,7 +1626,7 @@ err_exit: static void conskbd_kioctrans_complete(conskbd_lower_queue_t *lqs, mblk_t *mp) { - struct iocblk *iocp; + struct iocblk *iocp; mblk_t *req; queue_t *lowerque; int err = ENOMEM; @@ -2107,11 +2110,11 @@ conskbd_legacy_upstream_msg(conskbd_lower_queue_t *lqs, mblk_t *mp) * Kbtrans will invoke it in two cases: * * 1) application initiated request - * A KIOCSLED ioctl is sent by an application. The ioctl will be - * be prcoessed by queue service procedure conskbduwsrv(), which - * in turn calls kbtrans to process the ioctl. Then kbtrans invokes - * conskbd_streams_setled() to set LED, after that, kbtrans will - * return an ACK message to upper module. + * A KIOCSLED ioctl is sent by an application. The ioctl will be + * be prcoessed by queue service procedure conskbduwsrv(), which + * in turn calls kbtrans to process the ioctl. Then kbtrans invokes + * conskbd_streams_setled() to set LED, after that, kbtrans will + * return an ACK message to upper module. * * 2) Kbtrans initiated the request * When conskbd works in TR_ASCII translation mode, if anyone of @@ -2180,10 +2183,10 @@ conskbd_polledio_setled(struct kbtrans_hardware *hw, int led_state) static boolean_t conskbd_polled_keycheck(struct kbtrans_hardware *hw, - kbtrans_key_t *keycode, enum keystate *state) + kbtrans_key_t *keycode, enum keystate *state) { conskbd_state_t *conskbdp = (conskbd_state_t *)hw; - struct cons_polledio *cb; + struct cons_polledio *cb; conskbd_lower_queue_t *lqs; boolean_t ret = B_FALSE; diff --git a/usr/src/uts/common/io/consms.c b/usr/src/uts/common/io/consms.c index 9d426ce840..036b8cd745 100644 --- a/usr/src/uts/common/io/consms.c +++ b/usr/src/uts/common/io/consms.c @@ -81,11 +81,11 @@ static void consms_mux_ack(consms_msg_t *, mblk_t *); static void consms_mux_disp_data(mblk_t *); -static int consmsopen(); -static int consmsclose(); -static void consmsuwput(); -static void consmslrput(); -static void consmslwserv(); +static int consmsopen(queue_t *, dev_t *, int, int, cred_t *); +static int consmsclose(queue_t *, int, cred_t *); +static int consmsuwput(queue_t *, mblk_t *); +static int consmslrput(queue_t *, mblk_t *); +static int consmslwserv(queue_t *); static struct module_info consmsm_info = { 0, @@ -107,7 +107,7 @@ static struct qinit consmsurinit = { }; static struct qinit consmsuwinit = { - (int (*)())consmsuwput, + consmsuwput, (int (*)())NULL, consmsopen, consmsclose, @@ -117,7 +117,7 @@ static struct qinit consmsuwinit = { }; static struct qinit consmslrinit = { - (int (*)())consmslrput, + consmslrput, (int (*)())NULL, (int (*)())NULL, (int (*)())NULL, @@ -128,7 +128,7 @@ static struct qinit consmslrinit = { static struct qinit consmslwinit = { putq, - (int (*)())consmslwserv, + consmslwserv, (int (*)())NULL, (int (*)())NULL, (int (*)())NULL, @@ -177,7 +177,7 @@ static struct { }; -static struct cb_ops cb_consms_ops = { +static struct cb_ops cb_consms_ops = { nulldev, /* cb_open */ nulldev, /* cb_close */ nodev, /* cb_strategy */ @@ -324,9 +324,9 @@ consms_detach(dev_info_t *devi, ddi_detach_cmd_t cmd) /*ARGSUSED*/ static int consms_info(dev_info_t *dip, ddi_info_cmd_t infocmd, void *arg, - void **result) + void **result) { - register int error; + int error; switch (infocmd) { case DDI_INFO_DEVT2DEVINFO: @@ -350,11 +350,7 @@ consms_info(dev_info_t *dip, ddi_info_cmd_t infocmd, void *arg, /*ARGSUSED*/ static int -consmsopen(q, devp, flag, sflag, crp) - queue_t *q; - dev_t *devp; - int flag, sflag; - cred_t *crp; +consmsopen(queue_t *q, dev_t *devp, int flag, int sflag, cred_t *crp) { upperqueue = q; qprocson(q); @@ -363,10 +359,7 @@ consmsopen(q, devp, flag, sflag, crp) /*ARGSUSED*/ static int -consmsclose(q, flag, crp) - queue_t *q; - int flag; - cred_t *crp; +consmsclose(queue_t *q, int flag, cred_t *crp) { qprocsoff(q); upperqueue = NULL; @@ -376,10 +369,8 @@ consmsclose(q, flag, crp) /* * Put procedure for upper write queue. */ -static void -consmsuwput(q, mp) - register queue_t *q; - register mblk_t *mp; +static int +consmsuwput(queue_t *q, mblk_t *mp) { struct iocblk *iocbp = (struct iocblk *)mp->b_rptr; consms_msg_t *msg; @@ -445,14 +436,13 @@ consmsuwput(q, mp) *mp->b_rptr = (char)error; qreply(q, mp); } + return (0); } static void -consmsioctl(q, mp) - register queue_t *q; - register mblk_t *mp; +consmsioctl(queue_t *q, mblk_t *mp) { - register struct iocblk *iocp; + struct iocblk *iocp; int error; mblk_t *datap; @@ -520,23 +510,21 @@ consmsioctl(q, mp) * Service procedure for lower write queue. * Puts things on the queue below us, if it lets us. */ -static void -consmslwserv(q) - register queue_t *q; +static int +consmslwserv(queue_t *q) { - register mblk_t *mp; + mblk_t *mp; while (canput(q->q_next) && (mp = getq(q)) != NULL) putnext(q, mp); + return (0); } /* * Put procedure for lower read queue. */ -static void -consmslrput(q, mp) - register queue_t *q; - register mblk_t *mp; +static int +consmslrput(queue_t *q, mblk_t *mp) { struct iocblk *iocbp = (struct iocblk *)mp->b_rptr; struct copyreq *copyreq = (struct copyreq *)mp->b_rptr; @@ -613,6 +601,7 @@ consmslrput(q, mp) freemsg(mp); /* anything useful here? */ break; } + return (0); } /* ARGSUSED */ @@ -1306,7 +1295,7 @@ consms_mux_max_wheel_report(mblk_t *mp) static void consms_mux_cache_states(mblk_t *mp) { - struct iocblk *iocp; + struct iocblk *iocp; Ms_parms *parms; Ms_screen_resolution *sr; wheel_state *ws; diff --git a/usr/src/uts/common/io/dld/dld_str.c b/usr/src/uts/common/io/dld/dld_str.c index 4cb0f95cf5..a8ab4eba50 100644 --- a/usr/src/uts/common/io/dld/dld_str.c +++ b/usr/src/uts/common/io/dld/dld_str.c @@ -394,7 +394,7 @@ dld_close(queue_t *rq, int flags __unused, cred_t *credp __unused) /* * qi_qputp: put(9e) */ -void +int dld_wput(queue_t *wq, mblk_t *mp) { dld_str_t *dsp = (dld_str_t *)wq->q_ptr; @@ -463,17 +463,19 @@ dld_wput(queue_t *wq, mblk_t *mp) freemsg(mp); break; } + return (0); } /* * qi_srvp: srv(9e) */ -void +int dld_wsrv(queue_t *wq) { dld_str_t *dsp = wq->q_ptr; DLD_CLRQFULL(dsp); + return (0); } void diff --git a/usr/src/uts/common/io/myri10ge/drv/myri10ge.c b/usr/src/uts/common/io/myri10ge/drv/myri10ge.c index d706e3ab70..6b89f71d52 100644 --- a/usr/src/uts/common/io/myri10ge/drv/myri10ge.c +++ b/usr/src/uts/common/io/myri10ge/drv/myri10ge.c @@ -76,7 +76,7 @@ static int myri10ge_lso_copy = 0; static mblk_t *myri10ge_send_wrapper(void *arg, mblk_t *mp); int myri10ge_tx_handles_initial = 128; -static kmutex_t myri10ge_param_lock; +static kmutex_t myri10ge_param_lock; static void* myri10ge_db_lastfree; static int myri10ge_attach(dev_info_t *dip, ddi_attach_cmd_t cmd); @@ -103,7 +103,7 @@ unsigned char myri10ge_broadcastaddr[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; static ddi_dma_attr_t myri10ge_misc_dma_attr = { DMA_ATTR_V0, /* version number. */ - (uint64_t)0, /* low address */ + (uint64_t)0, /* low address */ (uint64_t)0xffffffffffffffffULL, /* high address */ (uint64_t)0x7ffffff, /* address counter max */ (uint64_t)4096, /* alignment */ @@ -124,7 +124,7 @@ static ddi_dma_attr_t myri10ge_misc_dma_attr = { static ddi_dma_attr_t myri10ge_rx_jumbo_dma_attr = { DMA_ATTR_V0, /* version number. */ - (uint64_t)0, /* low address */ + (uint64_t)0, /* low address */ (uint64_t)0xffffffffffffffffULL, /* high address */ (uint64_t)0x7ffffff, /* address counter max */ (uint64_t)4096, /* alignment */ @@ -139,7 +139,7 @@ static ddi_dma_attr_t myri10ge_rx_jumbo_dma_attr = { static ddi_dma_attr_t myri10ge_rx_std_dma_attr = { DMA_ATTR_V0, /* version number. */ - (uint64_t)0, /* low address */ + (uint64_t)0, /* low address */ (uint64_t)0xffffffffffffffffULL, /* high address */ (uint64_t)0x7ffffff, /* address counter max */ #if defined sparc64 || defined __sparcv9 @@ -162,7 +162,7 @@ static ddi_dma_attr_t myri10ge_rx_std_dma_attr = { static ddi_dma_attr_t myri10ge_tx_dma_attr = { DMA_ATTR_V0, /* version number. */ - (uint64_t)0, /* low address */ + (uint64_t)0, /* low address */ (uint64_t)0xffffffffffffffffULL, /* high address */ (uint64_t)0x7ffffff, /* address counter max */ (uint64_t)1, /* alignment */ @@ -393,8 +393,7 @@ myri10ge_pull_jpool(struct myri10ge_slice_state *ss) { struct myri10ge_jpool_stuff *jpool = &ss->jpool; struct myri10ge_jpool_entry *jtail, *j, *jfree; - volatile uintptr_t *putp; - uintptr_t put; + volatile void *putp; int i; /* find tail */ @@ -412,11 +411,10 @@ myri10ge_pull_jpool(struct myri10ge_slice_state *ss) */ for (i = 0; i < MYRI10GE_MAX_CPUS; i++) { /* take per-CPU free list */ - putp = (void *)&jpool->cpu[i & MYRI10GE_MAX_CPU_MASK].head; - if (*putp == NULL) + putp = &jpool->cpu[i & MYRI10GE_MAX_CPU_MASK].head; + jfree = atomic_swap_ptr(putp, NULL); + if (jfree == NULL) continue; - put = atomic_swap_ulong(putp, 0); - jfree = (struct myri10ge_jpool_entry *)put; /* append to pool */ if (jtail == NULL) { @@ -1048,7 +1046,7 @@ myri10ge_reg_set(dev_info_t *dip, int *reg_set, int *span, #define BUS_NUMBER(ip) (ip[0] >> 16 & 0xff) #define ADDRESS_SPACE(ip) (ip[0] >> 24 & 0x03) #define PCI_ADDR_HIGH(ip) (ip[1]) -#define PCI_ADDR_LOW(ip) (ip[2]) +#define PCI_ADDR_LOW(ip) (ip[2]) #define PCI_SPAN_HIGH(ip) (ip[3]) #define PCI_SPAN_LOW(ip) (ip[4]) @@ -1291,8 +1289,8 @@ myri10ge_dummy_rdma(struct myri10ge_priv *mgp, int enable) buf[0] = mgp->cmd_dma.high; /* confirm addr MSW */ buf[1] = mgp->cmd_dma.low; /* confirm addr LSW */ buf[2] = htonl(0xffffffff); /* confirm data */ - buf[3] = htonl(mgp->cmd_dma.high); /* dummy addr MSW */ - buf[4] = htonl(mgp->cmd_dma.low); /* dummy addr LSW */ + buf[3] = htonl(mgp->cmd_dma.high); /* dummy addr MSW */ + buf[4] = htonl(mgp->cmd_dma.low); /* dummy addr LSW */ buf[5] = htonl(enable); /* enable? */ @@ -1353,7 +1351,7 @@ myri10ge_load_firmware(struct myri10ge_priv *mgp) * do not. Therefore the handoff copy must skip the first 8 bytes */ buf[3] = htonl(MYRI10GE_FW_OFFSET + 8); /* where the code starts */ - buf[4] = htonl(size - 8); /* length of code */ + buf[4] = htonl(size - 8); /* length of code */ buf[5] = htonl(8); /* where to copy to */ buf[6] = htonl(0); /* where to jump to */ @@ -2913,7 +2911,7 @@ myri10ge_pullup(struct myri10ge_slice_state *ss, mblk_t *mp) return (DDI_FAILURE); } MYRI10GE_ATOMIC_SLICE_STAT_INC(xmit_pullup); - mac_hcksum_set(mp, start, stuff, NULL, NULL, tx_offload_flags); + mac_hcksum_set(mp, start, stuff, 0, 0, tx_offload_flags); if (tx_offload_flags & HW_LSO) DB_LSOMSS(mp) = (uint16_t)mss; lso_info_set(mp, mss, tx_offload_flags); @@ -4244,9 +4242,9 @@ myri10ge_enable_nvidia_ecrc(struct myri10ge_priv *mgp) ddi_acc_handle_t handle; unsigned long bus_number, dev_number, func_number; unsigned long cfg_pa, paddr, base, pgoffset; - char *cvaddr, *ptr; + char *cvaddr, *ptr; uint32_t *ptr32; - int retval = DDI_FAILURE; + int retval = DDI_FAILURE; int dontcare; uint16_t read_vid, read_did, vendor_id, device_id; @@ -4270,8 +4268,8 @@ myri10ge_enable_nvidia_ecrc(struct myri10ge_priv *mgp) pci_config_teardown(&handle); if (myri10ge_verbose) { - unsigned long bus_number, dev_number, func_number; - int reg_set, span; + unsigned long bus_number, dev_number, func_number; + int reg_set, span; (void) myri10ge_reg_set(parent_dip, ®_set, &span, &bus_number, &dev_number, &func_number); if (myri10ge_verbose) @@ -4793,7 +4791,7 @@ static int myri10ge_find_cap(ddi_acc_handle_t handle, uint8_t *capptr, uint8_t capid) { uint16_t status; - uint8_t ptr; + uint8_t ptr; /* check to see if we have capabilities */ status = pci_config_get16(handle, PCI_CONF_STAT); @@ -6023,7 +6021,7 @@ static int myri10ge_detach(dev_info_t *dip, ddi_detach_cmd_t cmd) { struct myri10ge_priv *mgp, *tmp; - int status, i, jbufs_alloced; + int status, i, jbufs_alloced; if (cmd == DDI_SUSPEND) { status = myri10ge_suspend(dip); diff --git a/usr/src/uts/common/io/ntxn/unm_nic_main.c b/usr/src/uts/common/io/ntxn/unm_nic_main.c index 8e395bb58b..4cf989f5dc 100644 --- a/usr/src/uts/common/io/ntxn/unm_nic_main.c +++ b/usr/src/uts/common/io/ntxn/unm_nic_main.c @@ -123,8 +123,8 @@ static boolean_t ntxn_m_getcapab(void *arg, mac_capab_t cap, void *cap_data); */ int unm_pci_alloc_consistent(unm_adapter *adapter, - int size, caddr_t *address, ddi_dma_cookie_t *cookie, - ddi_dma_handle_t *dma_handle, ddi_acc_handle_t *handlep) + int size, caddr_t *address, ddi_dma_cookie_t *cookie, + ddi_dma_handle_t *dma_handle, ddi_acc_handle_t *handlep) { int err; uint32_t ncookies; @@ -1148,9 +1148,9 @@ unm_nic_check_temp(struct unm_adapter_s *adapter) } static void -unm_watchdog(unsigned long v) +unm_watchdog(void *v) { - unm_adapter *adapter = (unm_adapter *)v; + unm_adapter *adapter = v; if ((adapter->portnum == 0) && unm_nic_check_temp(adapter)) { /* @@ -1165,8 +1165,8 @@ unm_watchdog(unsigned long v) /* * This function schedules a call for itself. */ - adapter->watchdog_timer = timeout((void (*)(void *))&unm_watchdog, - (void *)adapter, 2 * drv_usectohz(1000000)); + adapter->watchdog_timer = timeout(&unm_watchdog, + adapter, 2 * drv_usectohz(1000000)); } @@ -1566,8 +1566,8 @@ unm_post_rx_buffers_nodb(struct unm_adapter_s *adapter, unm_rcv_desc_ctx_t *rcv_desc = &recv_ctx->rcv_desc[ringid]; struct unm_rx_buffer *rx_buffer; rcvDesc_t *pdesc; - int count, producer = rcv_desc->producer; - int last_producer = producer; + int count, producer = rcv_desc->producer; + int last_producer = producer; for (count = 0; count < rcv_desc->rx_desc_handled; count++) { rx_buffer = unm_reserve_rx_buffer(rcv_desc); @@ -1606,7 +1606,7 @@ unm_post_rx_buffers_nodb(struct unm_adapter_s *adapter, int unm_nic_fill_statistics_128M(struct unm_adapter_s *adapter, - struct unm_statistics *unm_stats) + struct unm_statistics *unm_stats) { void *addr; if (adapter->ahw.board_type == UNM_NIC_XGBE) { @@ -2108,7 +2108,7 @@ unm_kstat_update(kstat_t *ksp, int flag) static kstat_t * unm_setup_named_kstat(unm_adapter *adapter, int instance, char *name, - const unm_ksindex_t *ksip, size_t size, int (*update)(kstat_t *, int)) + const unm_ksindex_t *ksip, size_t size, int (*update)(kstat_t *, int)) { kstat_t *ksp; kstat_named_t *knp; diff --git a/usr/src/uts/common/io/pci_intr_lib.c b/usr/src/uts/common/io/pci_intr_lib.c index ec385e0583..b5a4ffd3ef 100644 --- a/usr/src/uts/common/io/pci_intr_lib.c +++ b/usr/src/uts/common/io/pci_intr_lib.c @@ -118,7 +118,7 @@ pci_get_msi_ctrl(dev_info_t *dip, int type, ushort_t *msi_ctrl, if ((PCI_CAP_LOCATE(*h, PCI_CAP_ID_MSI, caps_ptr) == DDI_SUCCESS) && (type == DDI_INTR_TYPE_MSI)) { - if ((*msi_ctrl = PCI_CAP_GET16(*h, NULL, *caps_ptr, + if ((*msi_ctrl = PCI_CAP_GET16(*h, 0, *caps_ptr, PCI_MSI_CTRL)) == PCI_CAP_EINVAL16) goto done; @@ -130,7 +130,7 @@ pci_get_msi_ctrl(dev_info_t *dip, int type, ushort_t *msi_ctrl, if ((PCI_CAP_LOCATE(*h, PCI_CAP_ID_MSI_X, caps_ptr) == DDI_SUCCESS) && (type == DDI_INTR_TYPE_MSIX)) { - if ((*msi_ctrl = PCI_CAP_GET16(*h, NULL, *caps_ptr, + if ((*msi_ctrl = PCI_CAP_GET16(*h, 0, *caps_ptr, PCI_MSIX_CTRL)) == PCI_CAP_EINVAL16) goto done; @@ -214,37 +214,35 @@ pci_msi_configure(dev_info_t *rdip, int type, int count, int inum, if (type == DDI_INTR_TYPE_MSI) { /* Set the bits to inform how many MSIs are enabled */ msi_ctrl |= ((highbit(count) -1) << PCI_MSI_MME_SHIFT); - PCI_CAP_PUT16(h, NULL, caps_ptr, PCI_MSI_CTRL, msi_ctrl); + PCI_CAP_PUT16(h, 0, caps_ptr, PCI_MSI_CTRL, msi_ctrl); DDI_INTR_NEXDBG((CE_CONT, "pci_msi_configure: msi_ctrl = %x\n", - PCI_CAP_GET16(h, NULL, caps_ptr, PCI_MSI_CTRL))); + PCI_CAP_GET16(h, 0, caps_ptr, PCI_MSI_CTRL))); /* Set the "data" and "addr" bits */ - PCI_CAP_PUT32(h, NULL, caps_ptr, PCI_MSI_ADDR_OFFSET, addr); + PCI_CAP_PUT32(h, 0, caps_ptr, PCI_MSI_ADDR_OFFSET, addr); DDI_INTR_NEXDBG((CE_CONT, "pci_msi_configure: msi_addr = %x\n", - PCI_CAP_GET32(h, NULL, caps_ptr, PCI_MSI_ADDR_OFFSET))); + PCI_CAP_GET32(h, 0, caps_ptr, PCI_MSI_ADDR_OFFSET))); if (msi_ctrl & PCI_MSI_64BIT_MASK) { - PCI_CAP_PUT32(h, NULL, caps_ptr, PCI_MSI_ADDR_OFFSET + PCI_CAP_PUT32(h, 0, caps_ptr, PCI_MSI_ADDR_OFFSET + 4, addr >> 32); DDI_INTR_NEXDBG((CE_CONT, "pci_msi_configure: upper " - "32bit msi_addr = %x\n", PCI_CAP_GET32(h, NULL, + "32bit msi_addr = %x\n", PCI_CAP_GET32(h, 0, caps_ptr, PCI_MSI_ADDR_OFFSET + 4))); - PCI_CAP_PUT16(h, NULL, caps_ptr, PCI_MSI_64BIT_DATA, - data); + PCI_CAP_PUT16(h, 0, caps_ptr, PCI_MSI_64BIT_DATA, data); DDI_INTR_NEXDBG((CE_CONT, "pci_msi_configure: msi_data " - "= %x\n", PCI_CAP_GET16(h, NULL, caps_ptr, + "= %x\n", PCI_CAP_GET16(h, 0, caps_ptr, PCI_MSI_64BIT_DATA))); } else { - PCI_CAP_PUT16(h, NULL, caps_ptr, PCI_MSI_32BIT_DATA, - data); + PCI_CAP_PUT16(h, 0, caps_ptr, PCI_MSI_32BIT_DATA, data); DDI_INTR_NEXDBG((CE_CONT, "pci_msi_configure: msi_data " - "= %x\n", PCI_CAP_GET16(h, NULL, caps_ptr, + "= %x\n", PCI_CAP_GET16(h, 0, caps_ptr, PCI_MSI_32BIT_DATA))); } } else if (type == DDI_INTR_TYPE_MSIX) { @@ -307,22 +305,20 @@ pci_msi_unconfigure(dev_info_t *rdip, int type, int inum) if (type == DDI_INTR_TYPE_MSI) { msi_ctrl &= (~PCI_MSI_MME_MASK); - PCI_CAP_PUT16(h, NULL, caps_ptr, PCI_MSI_CTRL, msi_ctrl); + PCI_CAP_PUT16(h, 0, caps_ptr, PCI_MSI_CTRL, msi_ctrl); - PCI_CAP_PUT32(h, NULL, caps_ptr, PCI_MSI_ADDR_OFFSET, 0); + PCI_CAP_PUT32(h, 0, caps_ptr, PCI_MSI_ADDR_OFFSET, 0); if (msi_ctrl & PCI_MSI_64BIT_MASK) { - PCI_CAP_PUT16(h, NULL, caps_ptr, PCI_MSI_64BIT_DATA, - 0); - PCI_CAP_PUT32(h, NULL, caps_ptr, PCI_MSI_ADDR_OFFSET + PCI_CAP_PUT16(h, 0, caps_ptr, PCI_MSI_64BIT_DATA, 0); + PCI_CAP_PUT32(h, 0, caps_ptr, PCI_MSI_ADDR_OFFSET + 4, 0); } else { - PCI_CAP_PUT16(h, NULL, caps_ptr, PCI_MSI_32BIT_DATA, - 0); + PCI_CAP_PUT16(h, 0, caps_ptr, PCI_MSI_32BIT_DATA, 0); } DDI_INTR_NEXDBG((CE_CONT, "pci_msi_unconfigure: msi_ctrl " - "= %x\n", PCI_CAP_GET16(h, NULL, caps_ptr, PCI_MSI_CTRL))); + "= %x\n", PCI_CAP_GET16(h, 0, caps_ptr, PCI_MSI_CTRL))); } else if (type == DDI_INTR_TYPE_MSIX) { uintptr_t off; @@ -411,14 +407,14 @@ pci_msi_enable_mode(dev_info_t *rdip, int type) goto finished; msi_ctrl |= PCI_MSI_ENABLE_BIT; - PCI_CAP_PUT16(cfg_hdle, NULL, caps_ptr, PCI_MSI_CTRL, msi_ctrl); + PCI_CAP_PUT16(cfg_hdle, 0, caps_ptr, PCI_MSI_CTRL, msi_ctrl); } else if (type == DDI_INTR_TYPE_MSIX) { if (msi_ctrl & PCI_MSIX_ENABLE_BIT) goto finished; msi_ctrl |= PCI_MSIX_ENABLE_BIT; - PCI_CAP_PUT16(cfg_hdle, NULL, caps_ptr, PCI_MSIX_CTRL, + PCI_CAP_PUT16(cfg_hdle, 0, caps_ptr, PCI_MSIX_CTRL, msi_ctrl); } @@ -459,14 +455,13 @@ pci_msi_disable_mode(dev_info_t *rdip, int type) if (!(msi_ctrl & PCI_MSI_ENABLE_BIT)) goto finished; msi_ctrl &= ~PCI_MSI_ENABLE_BIT; - PCI_CAP_PUT16(cfg_hdle, NULL, caps_ptr, PCI_MSI_CTRL, msi_ctrl); + PCI_CAP_PUT16(cfg_hdle, 0, caps_ptr, PCI_MSI_CTRL, msi_ctrl); } else if (type == DDI_INTR_TYPE_MSIX) { if (!(msi_ctrl & PCI_MSIX_ENABLE_BIT)) goto finished; msi_ctrl &= ~PCI_MSIX_ENABLE_BIT; - PCI_CAP_PUT16(cfg_hdle, NULL, caps_ptr, PCI_MSIX_CTRL, - msi_ctrl); + PCI_CAP_PUT16(cfg_hdle, 0, caps_ptr, PCI_MSIX_CTRL, msi_ctrl); } finished: @@ -507,13 +502,13 @@ pci_msi_set_mask(dev_info_t *rdip, int type, int inum) offset = (msi_ctrl & PCI_MSI_64BIT_MASK) ? PCI_MSI_64BIT_MASKBITS : PCI_MSI_32BIT_MASK; - if ((mask_bits = PCI_CAP_GET32(cfg_hdle, NULL, caps_ptr, + if ((mask_bits = PCI_CAP_GET32(cfg_hdle, 0, caps_ptr, offset)) == PCI_CAP_EINVAL32) goto done; mask_bits |= (1 << inum); - PCI_CAP_PUT32(cfg_hdle, NULL, caps_ptr, offset, mask_bits); + PCI_CAP_PUT32(cfg_hdle, 0, caps_ptr, offset, mask_bits); } else if (type == DDI_INTR_TYPE_MSIX) { uintptr_t off; @@ -570,13 +565,13 @@ pci_msi_clr_mask(dev_info_t *rdip, int type, int inum) offset = (msi_ctrl & PCI_MSI_64BIT_MASK) ? PCI_MSI_64BIT_MASKBITS : PCI_MSI_32BIT_MASK; - if ((mask_bits = PCI_CAP_GET32(cfg_hdle, NULL, caps_ptr, + if ((mask_bits = PCI_CAP_GET32(cfg_hdle, 0, caps_ptr, offset)) == PCI_CAP_EINVAL32) goto done; mask_bits &= ~(1 << inum); - PCI_CAP_PUT32(cfg_hdle, NULL, caps_ptr, offset, mask_bits); + PCI_CAP_PUT32(cfg_hdle, 0, caps_ptr, offset, mask_bits); } else if (type == DDI_INTR_TYPE_MSIX) { uintptr_t off; @@ -637,7 +632,7 @@ pci_msi_get_pending(dev_info_t *rdip, int type, int inum, int *pendingp) offset = (msi_ctrl & PCI_MSI_64BIT_MASK) ? PCI_MSI_64BIT_PENDING : PCI_MSI_32BIT_PENDING; - if ((pending_bits = PCI_CAP_GET32(cfg_hdle, NULL, caps_ptr, + if ((pending_bits = PCI_CAP_GET32(cfg_hdle, 0, caps_ptr, offset)) == PCI_CAP_EINVAL32) goto done; @@ -727,7 +722,7 @@ pci_msi_set_nintrs(dev_info_t *rdip, int type, int navail) if (type == DDI_INTR_TYPE_MSI) { msi_ctrl |= ((highbit(navail) -1) << PCI_MSI_MME_SHIFT); - PCI_CAP_PUT16(cfg_hdle, NULL, caps_ptr, PCI_MSI_CTRL, msi_ctrl); + PCI_CAP_PUT16(cfg_hdle, 0, caps_ptr, PCI_MSI_CTRL, msi_ctrl); } else if (type == DDI_INTR_TYPE_MSIX) { DDI_INTR_NEXDBG((CE_CONT, "pci_msi_set_nintrs: unsupported\n")); } @@ -809,7 +804,7 @@ pci_msix_init(dev_info_t *rdip) msix_p->msix_dev_attr.devacc_attr_dataorder = DDI_STRICTORDER_ACC; /* Map the entire MSI-X vector table */ - msix_p->msix_tbl_offset = PCI_CAP_GET32(cfg_hdle, NULL, caps_ptr, + msix_p->msix_tbl_offset = PCI_CAP_GET32(cfg_hdle, 0, caps_ptr, PCI_MSIX_TBL_OFFSET); if ((breg = pci_msix_bir_index[msix_p->msix_tbl_offset & @@ -870,7 +865,7 @@ pci_msix_init(dev_info_t *rdip) /* * Map in the MSI-X Pending Bit Array */ - msix_p->msix_pba_offset = PCI_CAP_GET32(cfg_hdle, NULL, caps_ptr, + msix_p->msix_pba_offset = PCI_CAP_GET32(cfg_hdle, 0, caps_ptr, PCI_MSIX_PBA_OFFSET); if ((breg = pci_msix_bir_index[msix_p->msix_pba_offset & diff --git a/usr/src/uts/common/io/ptms_conf.c b/usr/src/uts/common/io/ptms_conf.c index 16ead0e9b6..f593f5313f 100644 --- a/usr/src/uts/common/io/ptms_conf.c +++ b/usr/src/uts/common/io/ptms_conf.c @@ -23,8 +23,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * This file contains global data and code shared between master and slave parts * of the pseudo-terminal driver. @@ -608,8 +606,8 @@ ptms_constructor(void *maddr, void *arg, int kmflags) pt->pts_rdq = NULL; pt->ptm_rdq = NULL; pt->pt_nullmsg = NULL; - pt->pt_pid = NULL; - pt->pt_minor = NULL; + pt->pt_pid = 0; + pt->pt_minor = 0; pt->pt_refcnt = 0; pt->pt_state = 0; pt->pt_zoneid = GLOBAL_ZONEID; diff --git a/usr/src/uts/common/io/stream.c b/usr/src/uts/common/io/stream.c index 994ca8baa8..55fd87db45 100644 --- a/usr/src/uts/common/io/stream.c +++ b/usr/src/uts/common/io/stream.c @@ -2099,7 +2099,7 @@ dup_failed: if (freezer != curthread) mutex_exit(QLOCK(q)); - STR_FTEVENT_MSG(bp, q, FTEV_GETQ, NULL); + STR_FTEVENT_MSG(bp, q, FTEV_GETQ, 0); return (bp); } @@ -2296,7 +2296,7 @@ rmvq_noenab(queue_t *q, mblk_t *mp) if (freezer != curthread) mutex_exit(QLOCK(q)); - STR_FTEVENT_MSG(mp, q, FTEV_RMVQ, NULL); + STR_FTEVENT_MSG(mp, q, FTEV_RMVQ, 0); } /* @@ -2344,7 +2344,7 @@ flushq_common(queue_t *q, int flag, int pcproto_flag) nmp = mp->b_next; mp->b_next = mp->b_prev = NULL; - STR_FTEVENT_MBLK(mp, q, FTEV_FLUSHQ, NULL); + STR_FTEVENT_MBLK(mp, q, FTEV_FLUSHQ, 0); if (pcproto_flag && (mp->b_datap->db_type == M_PCPROTO)) (void) putq(q, mp); @@ -2783,7 +2783,7 @@ putq(queue_t *q, mblk_t *bp) } } - STR_FTEVENT_MSG(bp, q, FTEV_PUTQ, NULL); + STR_FTEVENT_MSG(bp, q, FTEV_PUTQ, 0); if ((mcls > QNORM) || (canenable(q) && (q->q_flag & QWANTR || bp->b_band))) @@ -2965,7 +2965,7 @@ putbq(queue_t *q, mblk_t *bp) } } - STR_FTEVENT_MSG(bp, q, FTEV_PUTBQ, NULL); + STR_FTEVENT_MSG(bp, q, FTEV_PUTBQ, 0); if ((mcls > QNORM) || (canenable(q) && (q->q_flag & QWANTR))) qenable_locked(q); @@ -3105,7 +3105,7 @@ badord: } } - STR_FTEVENT_MSG(mp, q, FTEV_INSQ, NULL); + STR_FTEVENT_MSG(mp, q, FTEV_INSQ, 0); if (canenable(q) && (q->q_flag & QWANTR)) qenable_locked(q); diff --git a/usr/src/uts/common/ipp/ippconf.c b/usr/src/uts/common/ipp/ippconf.c index 851a0ecca0..75e880dc83 100644 --- a/usr/src/uts/common/ipp/ippconf.c +++ b/usr/src/uts/common/ipp/ippconf.c @@ -3231,7 +3231,7 @@ hash( * Make a hash value by XORing all the ascii codes in the text string. */ - for (ptr = (char *)name; *ptr != NULL; ptr++) { + for (ptr = (char *)name; *ptr != '\0'; ptr++) { val ^= *ptr; } diff --git a/usr/src/uts/common/os/bio.c b/usr/src/uts/common/os/bio.c index 81d26a4777..b5b2bee298 100644 --- a/usr/src/uts/common/os/bio.c +++ b/usr/src/uts/common/os/bio.c @@ -29,7 +29,7 @@ */ /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ -/* All Rights Reserved */ +/* All Rights Reserved */ /* * University Copyright- Copyright (c) 1982, 1986, 1988 @@ -76,7 +76,7 @@ static kmutex_t bfree_lock; /* protects the bfreelist structure */ struct hbuf *hbuf; /* Hash buckets */ struct dwbuf *dwbuf; /* Delayed write buckets */ static struct buf *bhdrlist; /* buf header free list */ -static int nbuf; /* number of buffer headers allocated */ +static int nbuf; /* number of buffer headers allocated */ static int lastindex; /* Reference point on where to start */ /* when looking for free buffers */ @@ -84,7 +84,7 @@ static int lastindex; /* Reference point on where to start */ #define bio_bhash(dev, bn) (hash2ints((dev), (int)(bn)) & v.v_hmask) #define EMPTY_LIST ((struct buf *)-1) -static kcondvar_t bio_mem_cv; /* Condition variables */ +static kcondvar_t bio_mem_cv; /* Condition variables */ static kcondvar_t bio_flushinval_cv; static int bio_doingflush; /* flush in progress */ static int bio_doinginval; /* inval in progress */ @@ -139,12 +139,12 @@ void (*bio_snapshot_strategy)(void *, buf_t *); /* Private routines */ static struct buf *bio_getfreeblk(long); -static void bio_mem_get(long); +static void bio_mem_get(long); static void bio_bhdr_free(struct buf *); static struct buf *bio_bhdr_alloc(void); static void bio_recycle(int, long); -static void bio_pageio_done(struct buf *); -static int bio_incore(dev_t, daddr_t); +static void bio_pageio_done(struct buf *); +static int bio_incore(dev_t, daddr_t); /* * Buffer cache constants @@ -642,7 +642,7 @@ loop: notavail(bp); mutex_exit(hmp); - ASSERT((bp->b_flags & B_NOCACHE) == NULL); + ASSERT((bp->b_flags & B_NOCACHE) == 0); if (nbp == NULL) { /* @@ -716,7 +716,7 @@ loop: nbp->b_vp = NULL; } - ASSERT((nbp->b_flags & B_NOCACHE) == NULL); + ASSERT((nbp->b_flags & B_NOCACHE) == 0); binshash(nbp, dp); mutex_exit(hmp); diff --git a/usr/src/uts/common/os/dacf.c b/usr/src/uts/common/os/dacf.c index 1ab2afa986..8d4cd486d8 100644 --- a/usr/src/uts/common/os/dacf.c +++ b/usr/src/uts/common/os/dacf.c @@ -23,8 +23,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * DACF: device autoconfiguration support * @@ -141,7 +139,7 @@ static dacf_ds_t dacf_devspecs[] = { { "minor-nodetype", DACF_DS_MIN_NT }, { "driver-minorname", DACF_DS_DRV_MNAME }, { "device-path", DACF_DS_DEV_PATH }, - { NULL, NULL }, + { NULL, DACF_DS_ERROR }, }; mod_hash_t *posta_mntype, *posta_mname, *posta_devname; /* post-attach */ diff --git a/usr/src/uts/common/os/damap.c b/usr/src/uts/common/os/damap.c index f90c5569c4..dc219318c6 100644 --- a/usr/src/uts/common/os/damap.c +++ b/usr/src/uts/common/os/damap.c @@ -1546,7 +1546,7 @@ dam_addrset_stable_cb(void *arg) */ if ((mapp->dam_flags & DAM_SPEND) || (taskq_dispatch(system_taskq, dam_stabilize_map, mapp, - TQ_NOSLEEP | TQ_NOQUEUE) == NULL)) { + TQ_NOSLEEP | TQ_NOQUEUE) == (uintptr_t)NULL)) { DAM_INCR_STAT(mapp, dam_overrun); mapp->dam_stable_overrun++; dam_sched_timeout(dam_addrset_stable_cb, mapp, diff --git a/usr/src/uts/common/os/dumpsubr.c b/usr/src/uts/common/os/dumpsubr.c index a30f4841d7..0eb96464bf 100644 --- a/usr/src/uts/common/os/dumpsubr.c +++ b/usr/src/uts/common/os/dumpsubr.c @@ -1255,7 +1255,7 @@ dumpinit(vnode_t *vp, char *name, int justchecking) if (IS_SWAPVP(common_specvp(cvp))) error = EBUSY; else if ((error = VOP_IOCTL(cdev_vp, - DKIOCDUMPINIT, NULL, FKIOCTL, kcred, + DKIOCDUMPINIT, 0, FKIOCTL, kcred, NULL, NULL)) != 0) dumpfini(); } @@ -1300,7 +1300,7 @@ dumpfini(void) if (is_zfs && (cdev_vp = makespecvp(VTOS(dumpvp)->s_dev, VCHR)) != NULL) { if (VOP_OPEN(&cdev_vp, FREAD | FWRITE, kcred, NULL) == 0) { - (void) VOP_IOCTL(cdev_vp, DKIOCDUMPFINI, NULL, FKIOCTL, + (void) VOP_IOCTL(cdev_vp, DKIOCDUMPFINI, 0, FKIOCTL, kcred, NULL, NULL); (void) VOP_CLOSE(cdev_vp, FREAD | FWRITE, 1, 0, kcred, NULL); @@ -2888,7 +2888,7 @@ dumpsys(void) } ++dumpcfg.nhelper_used; hp->helper = FREEHELPER; - hp->taskqid = NULL; + hp->taskqid = 0; hp->ds = ds; bzero(&hp->perpage, sizeof (hp->perpage)); if (dumpcfg.clevel >= DUMP_CLEVEL_BZIP2) diff --git a/usr/src/uts/common/os/evchannels.c b/usr/src/uts/common/os/evchannels.c index f2ca732594..cef23555f6 100644 --- a/usr/src/uts/common/os/evchannels.c +++ b/usr/src/uts/common/os/evchannels.c @@ -563,7 +563,7 @@ evch_evq_destroy(evch_eventq_t *eqp) ASSERT(evch_dl_getnum(&eqp->eq_subscr) == 0); /* Kill delivery thread */ - if (eqp->eq_thrid != NULL) { + if (eqp->eq_thrid != 0) { mutex_enter(&eqp->eq_queuemx); eqp->eq_tabortflag = 1; eqp->eq_holdmode = 0; diff --git a/usr/src/uts/common/os/exec.c b/usr/src/uts/common/os/exec.c index 96b6081489..500bd1ecb6 100644 --- a/usr/src/uts/common/os/exec.c +++ b/usr/src/uts/common/os/exec.c @@ -389,7 +389,7 @@ exec_common(const char *fname, const char **argp, const char **envp, */ up->u_acflag &= ~AFORK; bcopy(exec_file, up->u_comm, MAXCOMLEN+1); - curthread->t_predcache = NULL; + curthread->t_predcache = 0; /* * Clear contract template state @@ -1729,7 +1729,7 @@ stk_copyin(execa_t *uap, uarg_t *args, intpdata_t *intp, void **auxvpp) if (args->scrubenv && strncmp(tmp, "LD_", 3) == 0) { /* Undo the copied string */ args->stk_strp = tmp; - *(args->stk_offp++) = NULL; + *(args->stk_offp++) = 0; } envp += ptrsize; } diff --git a/usr/src/uts/common/os/main.c b/usr/src/uts/common/os/main.c index db6d74b2c2..3364d1e523 100644 --- a/usr/src/uts/common/os/main.c +++ b/usr/src/uts/common/os/main.c @@ -277,7 +277,7 @@ exec_init(const char *initpath, const char *args) lwp->lwp_ap = lwp->lwp_arg; lwp->lwp_arg[0] = exec_fnamep; lwp->lwp_arg[1] = uap; - lwp->lwp_arg[2] = NULL; + lwp->lwp_arg[2] = 0; curthread->t_post_sys = 1; curthread->t_sysnum = SYS_execve; diff --git a/usr/src/uts/common/os/modctl.c b/usr/src/uts/common/os/modctl.c index 91f5774b53..f1003f7834 100644 --- a/usr/src/uts/common/os/modctl.c +++ b/usr/src/uts/common/os/modctl.c @@ -2301,17 +2301,17 @@ modctl_hp(int subcmd, const char *path, char *cn_name, uintptr_t arg, switch (subcmd) { case MODHPOPS_CHANGE_STATE: error = ddihp_modctl(DDI_HPOP_CN_CHANGE_STATE, devpath, - cn_name_str, arg, NULL); + cn_name_str, arg, 0); break; case MODHPOPS_CREATE_PORT: /* Create an empty PORT */ error = ddihp_modctl(DDI_HPOP_CN_CREATE_PORT, devpath, - cn_name_str, NULL, NULL); + cn_name_str, 0, 0); break; case MODHPOPS_REMOVE_PORT: /* Remove an empty PORT */ error = ddihp_modctl(DDI_HPOP_CN_REMOVE_PORT, devpath, - cn_name_str, NULL, NULL); + cn_name_str, 0, 0); break; case MODHPOPS_BUS_GET: error = ddihp_modctl(DDI_HPOP_CN_GET_PROPERTY, devpath, diff --git a/usr/src/uts/common/os/modsysfile.c b/usr/src/uts/common/os/modsysfile.c index 92d7fd9c92..a04294eed5 100644 --- a/usr/src/uts/common/os/modsysfile.c +++ b/usr/src/uts/common/os/modsysfile.c @@ -1204,7 +1204,7 @@ sys_set_var(int fcn, struct sysparam *sysp, void *p) } else return; - if (symaddr != NULL) { + if (symaddr != (uintptr_t)NULL) { switch (size) { case 1: set_int8_var(symaddr, sysp); diff --git a/usr/src/uts/common/os/pcifm.c b/usr/src/uts/common/os/pcifm.c index a95686fc54..863b3a5105 100644 --- a/usr/src/uts/common/os/pcifm.c +++ b/usr/src/uts/common/os/pcifm.c @@ -49,7 +49,7 @@ pci_fm_err_t pci_err_tbl[] = { PCI_MA, PCI_STAT_R_MAST_AB, PCI_TARG_MA, DDI_FM_UNKNOWN, PCI_REC_TA, PCI_STAT_R_TARG_AB, PCI_TARG_REC_TA, DDI_FM_UNKNOWN, PCI_SIG_TA, PCI_STAT_S_TARG_AB, NULL, DDI_FM_UNKNOWN, - NULL, NULL, NULL, NULL, + NULL, 0, NULL, DDI_FM_OK, }; pci_fm_err_t pci_bdg_err_tbl[] = { @@ -61,14 +61,14 @@ pci_fm_err_t pci_bdg_err_tbl[] = { #endif PCI_REC_TA, PCI_STAT_R_TARG_AB, PCI_TARG_REC_TA, DDI_FM_UNKNOWN, PCI_SIG_TA, PCI_STAT_S_TARG_AB, NULL, DDI_FM_UNKNOWN, - NULL, NULL, NULL, NULL, + NULL, 0, NULL, DDI_FM_OK, }; static pci_fm_err_t pcix_err_tbl[] = { PCIX_SPL_DIS, PCI_PCIX_SPL_DSCD, NULL, DDI_FM_UNKNOWN, PCIX_UNEX_SPL, PCI_PCIX_UNEX_SPL, NULL, DDI_FM_UNKNOWN, PCIX_RX_SPL_MSG, PCI_PCIX_RX_SPL_MSG, NULL, DDI_FM_UNKNOWN, - NULL, NULL, NULL, NULL, + NULL, 0, NULL, DDI_FM_OK, }; static pci_fm_err_t pcix_sec_err_tbl[] = { @@ -76,7 +76,7 @@ static pci_fm_err_t pcix_sec_err_tbl[] = { PCIX_UNEX_SPL, PCI_PCIX_BSS_UNEX_SPL, NULL, DDI_FM_UNKNOWN, PCIX_BSS_SPL_OR, PCI_PCIX_BSS_SPL_OR, NULL, DDI_FM_OK, PCIX_BSS_SPL_DLY, PCI_PCIX_BSS_SPL_DLY, NULL, DDI_FM_OK, - NULL, NULL, NULL, NULL, + NULL, 0, NULL, DDI_FM_OK, }; static int @@ -1113,7 +1113,7 @@ pci_ereport_post(dev_info_t *dip, ddi_fm_error_t *derr, uint16_t *xx_status) ASSERT(fmhdl); - if (de.fme_ena == NULL) + if (de.fme_ena == 0) de.fme_ena = fm_ena_generate(0, FM_ENA_FMT1); erpt_p = (pci_erpt_t *)fmhdl->fh_bus_specific; diff --git a/usr/src/uts/common/os/policy.c b/usr/src/uts/common/os/policy.c index 8cc7f009a3..861c748cff 100644 --- a/usr/src/uts/common/os/policy.c +++ b/usr/src/uts/common/os/policy.c @@ -2087,7 +2087,7 @@ secpolicy_rpcmod_open(const cred_t *cr) if (PRIV_POLICY_ONLY(cr, PRIV_SYS_NFS, B_FALSE)) return (secpolicy_nfs(cr)); else - return (secpolicy_net_config(cr, NULL)); + return (secpolicy_net_config(cr, B_FALSE)); } int diff --git a/usr/src/uts/common/os/pool.c b/usr/src/uts/common/os/pool.c index c79c7dad51..6d183cd71c 100644 --- a/usr/src/uts/common/os/pool.c +++ b/usr/src/uts/common/os/pool.c @@ -566,14 +566,14 @@ pool_status(int status) if (ret != 0) return (ret); pool_state = POOL_ENABLED; - pool_event_dispatch(POOL_E_ENABLE, NULL); + pool_event_dispatch(POOL_E_ENABLE, 0); break; case POOL_DISABLED: ret = pool_disable(); if (ret != 0) return (ret); pool_state = POOL_DISABLED; - pool_event_dispatch(POOL_E_DISABLE, NULL); + pool_event_dispatch(POOL_E_DISABLE, 0); break; default: ret = EINVAL; diff --git a/usr/src/uts/common/os/streamio.c b/usr/src/uts/common/os/streamio.c index 1f9ceee188..68afeef013 100644 --- a/usr/src/uts/common/os/streamio.c +++ b/usr/src/uts/common/os/streamio.c @@ -5507,7 +5507,7 @@ strioctl(struct vnode *vp, int cmd, intptr_t arg, int flag, int copyflag, struct str_mlist *mlist; STRUCT_DECL(str_list, strlist); - if (arg == NULL) { /* Return number of modules plus driver */ + if (arg == 0) { /* Return number of modules plus driver */ if (stp->sd_vnode->v_type == VFIFO) *rvalp = stp->sd_pushcnt; else diff --git a/usr/src/uts/common/os/strsubr.c b/usr/src/uts/common/os/strsubr.c index 21de784e1b..3e72b7e8df 100644 --- a/usr/src/uts/common/os/strsubr.c +++ b/usr/src/uts/common/os/strsubr.c @@ -4035,7 +4035,7 @@ esballoc_enqueue_mblk(mblk_t *mp) { if (taskq_dispatch(system_taskq, (task_func_t *)esballoc_mblk_free, mp, - TQ_NOSLEEP) == NULL) { + TQ_NOSLEEP) == (uintptr_t)NULL) { mblk_t *first_mp = mp; /* * System is low on resources and can't perform a non-sleeping diff --git a/usr/src/uts/common/os/sunpci.c b/usr/src/uts/common/os/sunpci.c index b26685d941..0dd4f4c206 100644 --- a/usr/src/uts/common/os/sunpci.c +++ b/usr/src/uts/common/os/sunpci.c @@ -357,7 +357,7 @@ static pci_cap_entry_t pci_cap_table[] = { * {PCI_CAP_ID_AGP_8X, 0, NULL}, * {PCI_CAP_ID_SECURE_DEV, 0, NULL}, */ - {PCI_CAP_NEXT_PTR_NULL, 0, NULL} + {PCI_CAP_NEXT_PTR_NULL, 0, 0} }; diff --git a/usr/src/uts/common/os/task.c b/usr/src/uts/common/os/task.c index bafcfd45e0..91325429a3 100644 --- a/usr/src/uts/common/os/task.c +++ b/usr/src/uts/common/os/task.c @@ -456,7 +456,7 @@ task_rele(task_t *tk) * the task fails. */ if (taskq_dispatch(exacct_queue, exacct_commit_task, tk, - TQ_NOSLEEP | TQ_NOQUEUE) == NULL) { + TQ_NOSLEEP | TQ_NOQUEUE) == (uintptr_t)NULL) { mutex_enter(&task_commit_lock); if (task_commit_head == NULL) { task_commit_head = task_commit_tail = tk; diff --git a/usr/src/uts/common/os/taskq.c b/usr/src/uts/common/os/taskq.c index 1fe93e9735..9a7697d16a 100644 --- a/usr/src/uts/common/os/taskq.c +++ b/usr/src/uts/common/os/taskq.c @@ -700,7 +700,7 @@ uint_t taskq_smtbf = UINT_MAX; /* mean time between injected failures */ taskq_random = (taskq_random * 2416 + 374441) % 1771875;\ if ((flag & TQ_NOSLEEP) && \ taskq_random < 1771875 / taskq_dmtbf) { \ - return (NULL); \ + return ((taskqid_t)NULL); \ } #define TASKQ_S_RANDOM_DISPATCH_FAILURE(tq, flag) \ @@ -710,7 +710,7 @@ uint_t taskq_smtbf = UINT_MAX; /* mean time between injected failures */ (tq->tq_nalloc > tq->tq_minalloc)) && \ (taskq_random < (1771875 / taskq_smtbf))) { \ mutex_exit(&tq->tq_lock); \ - return (NULL); \ + return ((taskqid_t)NULL); \ } #else #define TASKQ_S_RANDOM_DISPATCH_FAILURE(tq, flag) @@ -1167,7 +1167,7 @@ taskq_dispatch(taskq_t *tq, task_func_t func, void *arg, uint_t flags) if ((tqe = taskq_ent_alloc(tq, flags)) == NULL) { tq->tq_nomem++; mutex_exit(&tq->tq_lock); - return (NULL); + return ((taskqid_t)tqe); } /* Make sure we start without any flags */ tqe->tqent_un.tqent_flags = 0; diff --git a/usr/src/uts/common/os/vmem.c b/usr/src/uts/common/os/vmem.c index 1b027b4409..ad35fd7187 100644 --- a/usr/src/uts/common/os/vmem.c +++ b/usr/src/uts/common/os/vmem.c @@ -1104,8 +1104,12 @@ do_alloc: mutex_exit(&vmp->vm_lock); if (vmp->vm_cflags & VMC_XALLOC) { size_t oasize = asize; - vaddr = ((vmem_ximport_t *) - vmp->vm_source_alloc)(vmp->vm_source, + vmem_ximport_t *vmem_ximport; + + vmem_ximport = (vmem_ximport_t *) + (uintptr_t)vmp->vm_source_alloc; + + vaddr = vmem_ximport(vmp->vm_source, &asize, align, vmflag & VM_KMFLAGS); ASSERT(asize >= oasize); ASSERT(P2PHASE(asize, @@ -1576,12 +1580,14 @@ vmem_xcreate(const char *name, void *base, size_t size, size_t quantum, vmem_ximport_t *afunc, vmem_free_t *ffunc, vmem_t *source, size_t qcache_max, int vmflag) { + vmem_alloc_t *af; + + af = (vmem_alloc_t *)(uintptr_t)afunc; ASSERT(!(vmflag & (VMC_POPULATOR | VMC_XALLOC))); vmflag &= ~(VMC_POPULATOR | VMC_XALLOC); return (vmem_create_common(name, base, size, quantum, - (vmem_alloc_t *)afunc, ffunc, source, qcache_max, - vmflag | VMC_XALLOC)); + af, ffunc, source, qcache_max, vmflag | VMC_XALLOC)); } vmem_t * diff --git a/usr/src/uts/common/os/zone.c b/usr/src/uts/common/os/zone.c index ebde0d7850..1db130797c 100644 --- a/usr/src/uts/common/os/zone.c +++ b/usr/src/uts/common/os/zone.c @@ -4477,9 +4477,9 @@ zsched(void *arg) bcopy("zsched", PTOU(pp)->u_psargs, sizeof ("zsched")); bcopy("zsched", PTOU(pp)->u_comm, sizeof ("zsched")); PTOU(pp)->u_argc = 0; - PTOU(pp)->u_argv = NULL; - PTOU(pp)->u_envp = NULL; - PTOU(pp)->u_commpagep = NULL; + PTOU(pp)->u_argv = 0; + PTOU(pp)->u_envp = 0; + PTOU(pp)->u_commpagep = 0; closeall(P_FINFO(pp)); /* diff --git a/usr/src/uts/common/sys/dld.h b/usr/src/uts/common/sys/dld.h index cb6bbe1c12..5be223ce93 100644 --- a/usr/src/uts/common/sys/dld.h +++ b/usr/src/uts/common/sys/dld.h @@ -293,7 +293,7 @@ typedef struct dld_ioc_macprop_s { datalink_id_t pr_linkid; mac_prop_id_t pr_num; uint_t pr_perm_flags; - char pr_name[MAXLINKPROPNAME]; + char pr_name[MAXLINKPROPNAME]; uint_t pr_valsize; /* sizeof pr_val */ char pr_val[1]; } dld_ioc_macprop_t; @@ -453,8 +453,8 @@ int dld_getinfo(dev_info_t *, ddi_info_cmd_t, void *, void **); int dld_devt_to_instance(dev_t); int dld_open(queue_t *, dev_t *, int, int, cred_t *); int dld_close(queue_t *, int, cred_t *); -void dld_wput(queue_t *, mblk_t *); -void dld_wsrv(queue_t *); +int dld_wput(queue_t *, mblk_t *); +int dld_wsrv(queue_t *); int dld_str_open(queue_t *, dev_t *, void *); int dld_str_close(queue_t *); void *dld_str_private(queue_t *); diff --git a/usr/src/uts/common/syscall/lgrpsys.c b/usr/src/uts/common/syscall/lgrpsys.c index be60d1a445..34bd08fd12 100644 --- a/usr/src/uts/common/syscall/lgrpsys.c +++ b/usr/src/uts/common/syscall/lgrpsys.c @@ -182,7 +182,7 @@ meminfo(int addr_count, struct meminfo *mip) out_array[i] = lgrp->lgrp_id; val_array[i] = VALID_ADDR | VALID_REQ; } else { - out_array[i] = NULL; + out_array[i] = 0; val_array[i] = 0; } } @@ -1857,7 +1857,7 @@ lgrp_snapshot_copy32(caddr32_t buf, size32_t bufsize) snap_size = snap_hdr_size + info_size + cpuids_size + bitmasks_size + lats_size; - if (buf == NULL || bufsize <= 0) { + if (buf == 0 || bufsize <= 0) { return (snap_size); } diff --git a/usr/src/uts/common/syscall/lwp_create.c b/usr/src/uts/common/syscall/lwp_create.c index 53ecd8c5e2..361654cabb 100644 --- a/usr/src/uts/common/syscall/lwp_create.c +++ b/usr/src/uts/common/syscall/lwp_create.c @@ -126,7 +126,7 @@ syslwp_create(ucontext_t *ucp, int flags, id_t *new_lwp) mutex_enter(&curproc->p_lock); pool_barrier_enter(); mutex_exit(&curproc->p_lock); - lwp = lwp_create(lwp_rtt, NULL, NULL, curproc, TS_STOPPED, + lwp = lwp_create(lwp_rtt, NULL, 0, curproc, TS_STOPPED, curthread->t_pri, &sigmask, curthread->t_cid, 0); mutex_enter(&curproc->p_lock); pool_barrier_exit(); diff --git a/usr/src/uts/common/syscall/poll.c b/usr/src/uts/common/syscall/poll.c index 2eb50323a0..2214bacaf8 100644 --- a/usr/src/uts/common/syscall/poll.c +++ b/usr/src/uts/common/syscall/poll.c @@ -486,12 +486,12 @@ poll_common(pollstate_t *ps, pollfd_t *fds, nfds_t nfds, timespec_t *tsp, /* * Note that pcs_usradr field of an used entry won't be - * NULL because it stores the address of passed-in fds, - * and NULL fds will not be cached (Then it is either + * 0 because it stores the address of passed-in fds, + * and 0 fds will not be cached (Then it is either * the special timeout case when nfds is 0 or it returns * failure directly). */ - if (pcset[cacheindex].pcs_usradr == NULL) { + if (pcset[cacheindex].pcs_usradr == (uintptr_t)NULL) { /* * found an unused entry. Use it to cache * this poll list. @@ -2223,7 +2223,7 @@ pcacheset_cache_list(pollstate_t *ps, pollfd_t *fds, int *fdcntp, int which) pcacheset_remove_list(ps, pollfdp, 0, i, which, 0); kmem_free(newfdlist, ps->ps_nfds * sizeof (pollfd_t)); pcacheset[which].pcs_pollfd = NULL; - pcacheset[which].pcs_usradr = NULL; + pcacheset[which].pcs_usradr = (uintptr_t)NULL; break; } } diff --git a/usr/src/uts/common/syscall/uadmin.c b/usr/src/uts/common/syscall/uadmin.c index bf31c3dcd6..dfe7f22d44 100644 --- a/usr/src/uts/common/syscall/uadmin.c +++ b/usr/src/uts/common/syscall/uadmin.c @@ -282,7 +282,7 @@ kadmin(int cmd, int fcn, void *mdep, cred_t *credp) * vfs_syncall() can acquire the vfs locks they need. */ sema_p(&fsflush_sema); - (void) callb_execute_class(CB_CL_UADMIN_PRE_VFS, NULL); + (void) callb_execute_class(CB_CL_UADMIN_PRE_VFS, 0); vfs_unmountall(); (void) VFS_MOUNTROOT(rootvfs, ROOT_UNMOUNT); @@ -444,7 +444,7 @@ uadmin(int cmd, int fcn, uintptr_t mdep) * Certain subcommands intepret a non-NULL mdep value as a pointer to * a boot string. We pull that in as bootargs, if applicable. */ - if (mdep != NULL && + if (mdep != (uintptr_t)NULL && (cmd == A_SHUTDOWN || cmd == A_REBOOT || cmd == A_DUMP || cmd == A_FREEZE || cmd == A_CONFIG)) { bootargs = kmem_zalloc(BOOTARGS_MAX, KM_SLEEP); diff --git a/usr/src/uts/common/vm/hat_refmod.c b/usr/src/uts/common/vm/hat_refmod.c index ad15becea4..31a85d4cf6 100644 --- a/usr/src/uts/common/vm/hat_refmod.c +++ b/usr/src/uts/common/vm/hat_refmod.c @@ -230,7 +230,7 @@ hat_freestat(struct as *as, int id) mutex_enter(&hat_statlock); for (prev_ahrm = NULL; hrm; hrm = hrm->hrm_anext) { - if ((id == hrm->hrm_id) || (id == NULL)) { + if ((id == hrm->hrm_id) || (id == 0)) { hrm_hashout(hrm); hrm->hrm_hnext = hrm_blist; diff --git a/usr/src/uts/common/vm/seg_kp.c b/usr/src/uts/common/vm/seg_kp.c index d33ff004f1..02c844bff6 100644 --- a/usr/src/uts/common/vm/seg_kp.c +++ b/usr/src/uts/common/vm/seg_kp.c @@ -1357,7 +1357,7 @@ swapsize(caddr_t v) if ((kpd = segkp_find(segkp, v)) != NULL) return (SEGKP_MAPLEN(kpd->kp_len, kpd->kp_flags)); else - return (NULL); + return (0); } /* diff --git a/usr/src/uts/common/vm/vm_anon.c b/usr/src/uts/common/vm/vm_anon.c index 01db9b23d7..6ca64f77da 100644 --- a/usr/src/uts/common/vm/vm_anon.c +++ b/usr/src/uts/common/vm/vm_anon.c @@ -24,7 +24,7 @@ */ /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ -/* All Rights Reserved */ +/* All Rights Reserved */ /* * University Copyright- Copyright (c) 1982, 1986, 1988 @@ -512,9 +512,8 @@ anon_set_ptr(struct anon_hdr *ahp, ulong_t an_idx, struct anon *ap, int flags) * Copy anon array into a given new anon array */ int -anon_copy_ptr(struct anon_hdr *sahp, ulong_t s_idx, - struct anon_hdr *dahp, ulong_t d_idx, - pgcnt_t npages, int flags) +anon_copy_ptr(struct anon_hdr *sahp, ulong_t s_idx, struct anon_hdr *dahp, + ulong_t d_idx, pgcnt_t npages, int flags) { void **sapp, **dapp; void *ap; @@ -770,9 +769,9 @@ set_anoninfo(void) * reserve swap space, we need to check memory-based as well * as disk-backed (physical) swap. The following algorithm * is used: - * Check the space on physical swap - * i.e. amount needed < ani_max - ani_phys_resv - * If we are swapping on swapfs check + * Check the space on physical swap + * i.e. amount needed < ani_max - ani_phys_resv + * If we are swapping on swapfs check * amount needed < (availrmem - swapfs_minfree) * Since the algorithm to check for the quantity of swap space is * almost the same as that for reserving it, we'll just use anon_resvmem @@ -1273,7 +1272,8 @@ anon_decref_pages( if (ap->an_pvp != NULL && !vn_matchopval(ap->an_pvp, VOPNAME_DISPOSE, - (fs_generic_func_p)fs_dispose)) + (fs_generic_func_p)(uintptr_t) + fs_dispose)) dispose = 1; } for (j = i; j < i + curpgcnt; j++) { @@ -1339,7 +1339,7 @@ anon_decref_pages( */ void anon_dup(struct anon_hdr *old, ulong_t old_idx, struct anon_hdr *new, - ulong_t new_idx, size_t size) + ulong_t new_idx, size_t size) { spgcnt_t npages; kmutex_t *ahm; @@ -3205,7 +3205,7 @@ anon_map_demotepages( pgcnt_t i, pg_idx; ulong_t an_idx; caddr_t vaddr; - int err; + int err; int retry = 0; uint_t vpprot; @@ -3453,7 +3453,7 @@ anonmap_free(struct anon_map *amp) */ int non_anon(struct anon_hdr *ahp, ulong_t anon_idx, u_offset_t *offp, - size_t *lenp) + size_t *lenp) { ulong_t i, el; ssize_t low, high; @@ -3571,7 +3571,7 @@ ulong_t * anon_get_slot(struct anon_hdr *ahp, ulong_t an_idx) { struct anon **app; - void **ppp; + void **ppp; ASSERT(an_idx < ahp->size); @@ -3630,7 +3630,7 @@ anon_array_enter(struct anon_map *amp, ulong_t an_idx, anon_sync_obj_t *sobj) int anon_array_try_enter(struct anon_map *amp, ulong_t an_idx, - anon_sync_obj_t *sobj) + anon_sync_obj_t *sobj) { ulong_t *ap_slot; kmutex_t *mtx; diff --git a/usr/src/uts/intel/ia32/syscall/getcontext.c b/usr/src/uts/intel/ia32/syscall/getcontext.c index 8f72b5da72..38e908acaf 100644 --- a/usr/src/uts/intel/ia32/syscall/getcontext.c +++ b/usr/src/uts/intel/ia32/syscall/getcontext.c @@ -78,7 +78,7 @@ savecontext(ucontext_t *ucp, const k_sigset_t *mask) * been disabled for this LWP. If stack bounds checking is disabled * or the copyin() fails, we fall back to the legacy behavior. */ - if (lwp->lwp_ustack == NULL || + if (lwp->lwp_ustack == (uintptr_t)NULL || copyin((void *)lwp->lwp_ustack, &ucp->uc_stack, sizeof (ucp->uc_stack)) != 0 || ucp->uc_stack.ss_size == 0) { @@ -308,7 +308,7 @@ savecontext32(ucontext32_t *ucp, const k_sigset_t *mask) ucp->uc_flags = UC_ALL; ucp->uc_link = (caddr32_t)lwp->lwp_oldcontext; - if (lwp->lwp_ustack == NULL || + if (lwp->lwp_ustack == (uintptr_t)NULL || copyin((void *)lwp->lwp_ustack, &ucp->uc_stack, sizeof (ucp->uc_stack)) != 0 || ucp->uc_stack.ss_size == 0) { diff --git a/usr/src/uts/intel/io/agpgart/agp_kstat.c b/usr/src/uts/intel/io/agpgart/agp_kstat.c index 1913fb878c..21305c60c5 100644 --- a/usr/src/uts/intel/io/agpgart/agp_kstat.c +++ b/usr/src/uts/intel/io/agpgart/agp_kstat.c @@ -3,8 +3,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/kstat.h> #include <sys/ddi.h> #include <sys/sunddi.h> @@ -102,7 +100,7 @@ agp_init_kstats(agpgart_softstate_t *sc) KSTAT_TYPE_NAMED, sizeof (agpkstat_name)/sizeof (char *) - 1, KSTAT_FLAG_PERSISTENT); if (ksp == NULL) - return (NULL); + return (1); ksp->ks_private = sc; ksp->ks_update = agp_kstat_update; |