diff options
author | Jerry Jelinek <jerry.jelinek@joyent.com> | 2019-02-26 12:43:20 +0000 |
---|---|---|
committer | Jerry Jelinek <jerry.jelinek@joyent.com> | 2019-02-26 12:43:20 +0000 |
commit | e5af3bd1c99c58d9dd19baec10e1b5e8f064858d (patch) | |
tree | e4674045e090ab283ea4b0877c9b58f9ac7bee64 | |
parent | 1b1bcfc89ac08be2fc9fd5df44b98ec44e4d909b (diff) | |
parent | 52abb70e073c2a88808c0d66fd810ba8c5080572 (diff) | |
download | illumos-joyent-e5af3bd1c99c58d9dd19baec10e1b5e8f064858d.tar.gz |
[illumos-gate merge]
commit 52abb70e073c2a88808c0d66fd810ba8c5080572
9691 fat zap should prefetch when iterating
commit 8648b7db4afb6cc9a8e5b55e38e99c8c64b74e86
10435 dld: NULL pointer errors
commit c4b91d4b4753f33280a63b16f5116d23427088b1
10444 linenoise: this statement may fall through
commit 584814c74382743e01cc62cc8764cfde61718c46
10443 loader: move panic.c to libstand
commit c11cea93a9321bd25667986dc65a86b56de2ac04
10441 hxge: NULL pointer errors
commit 1f14a912903a53cb5b4ed3f75e9e4d2be8ded1ba
10440 ipd: NULL pointer errors
commit 2520aea3664a4259338aefa2aa4a4945654615c6
10439 ecpp: NULL pointer errors
commit 55aeed12a7fb74469f7ea0fbb3d2329d4c8c96ae
10438 fd: NULL pointer errors
commit 5c63ad82aeee3300425b5803b5324fd102047957
10437 dca: NULL pointer errors
commit 8d3c0bf06dddf77026f7ea064cfccfae818b5b0f
10434 dump: NULL pointer errors
commit a3f59f6e87a609ee4950ebfcf34be0cca305e58b
10433 bpf: NULL pointer errors
commit 093aa5c8de00cc7b99cc4a2cfaeb7d95115847b7
10432 devinfo: NULL pointer errors
commit a897f299fb4fe4ed74ba062d6b8984404d1b94bc
10431 conskbd: NULL pointer errors
commit b63d0986fbd0638ed6abf1248f1a297c5d9a4f91
10151 mv_xattrs() checks for a NULL array name
commit 5085a9e0a8c766d5e9b74954833264533f617614
10369 sysent: cast between incompatible function types
commit ebc6491a5a66ba44ff1a3fa2a627e67d665604f0
10163 ufs_fsck: bitwise comparison always evaluates to false
34 files changed, 249 insertions, 156 deletions
diff --git a/usr/src/boot/Makefile.version b/usr/src/boot/Makefile.version index 302dd133b6..c5bcb01763 100644 --- a/usr/src/boot/Makefile.version +++ b/usr/src/boot/Makefile.version @@ -33,4 +33,4 @@ LOADER_VERSION = 1.1 # Use date like formatting here, YYYY.MM.DD.XX, without leading zeroes. # The version is processed from left to right, the version number can only # be increased. -BOOT_VERSION = $(LOADER_VERSION)-2019.02.16.1 +BOOT_VERSION = $(LOADER_VERSION)-2019.02.23.1 diff --git a/usr/src/boot/lib/libstand/Makefile.inc b/usr/src/boot/lib/libstand/Makefile.inc index 1fb9e216f9..8bb6258ac0 100644 --- a/usr/src/boot/lib/libstand/Makefile.inc +++ b/usr/src/boot/lib/libstand/Makefile.inc @@ -29,7 +29,7 @@ SRCS += $(SASRC)/sbrk.c $(SASRC)/twiddle.c SRCS += $(SASRC)/zalloc.c $(SASRC)/zalloc_malloc.c OBJS= __main.o assert.o bcd.o environment.o \ - getopt.o gets.o globals.o pager.o printf.o \ + getopt.o gets.o globals.o pager.o panic.o printf.o \ strdup.o strerror.o strtol.o strtoul.o random.o \ sbrk.o twiddle.o zalloc.o zalloc_malloc.o diff --git a/usr/src/boot/sys/boot/common/panic.c b/usr/src/boot/lib/libstand/panic.c index 6e4c76d0e0..14a7c4d8dd 100644 --- a/usr/src/boot/sys/boot/common/panic.c +++ b/usr/src/boot/lib/libstand/panic.c @@ -1,7 +1,7 @@ /* * $NetBSD: panic.c,v 1.2 1997/03/22 01:48:36 thorpej Exp $ */ -/*- +/* * Copyright (c) 1996 * Matthias Drochner. All rights reserved. * @@ -34,7 +34,6 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); #include <stand.h> #include <machine/stdarg.h> @@ -42,9 +41,9 @@ __FBSDID("$FreeBSD$"); extern void exit(int) __dead2; void -panic(const char *fmt,...) +panic(const char *fmt, ...) { - va_list ap; + va_list ap; printf("panic: "); va_start(ap, fmt); diff --git a/usr/src/boot/sys/boot/common/Makefile.inc b/usr/src/boot/sys/boot/common/Makefile.inc index a02ef4732e..bbf81332d2 100644 --- a/usr/src/boot/sys/boot/common/Makefile.inc +++ b/usr/src/boot/sys/boot/common/Makefile.inc @@ -1,8 +1,8 @@ # $FreeBSD$ -SRCS+= boot.c commands.c console.c devopen.c interp.c -SRCS+= interp_backslash.c interp_parse.c ls.c misc.c -SRCS+= module.c panic.c +SRCS+= boot.c commands.c console.c devopen.c interp.c +SRCS+= interp_backslash.c interp_parse.c ls.c misc.c +SRCS+= module.c .if ${MACHINE} == "i386" || ${MACHINE_CPUARCH} == "amd64" SRCS+= load_elf32.c load_elf32_obj.c reloc_elf32.c diff --git a/usr/src/boot/sys/boot/common/linenoise/linenoise.c b/usr/src/boot/sys/boot/common/linenoise/linenoise.c index 871ffb5437..e3a72151a4 100755 --- a/usr/src/boot/sys/boot/common/linenoise/linenoise.c +++ b/usr/src/boot/sys/boot/common/linenoise/linenoise.c @@ -650,6 +650,7 @@ static int linenoiseEdit(char *buf, size_t buflen, const char *prompt) buf[0] = '\0'; l.pos = l.len = 0; refreshLine(&l); + break; case BACKSPACE: /* backspace */ case 8: /* ctrl-h */ linenoiseEditBackspace(&l); diff --git a/usr/src/boot/sys/boot/efi/loader/Makefile.common b/usr/src/boot/sys/boot/efi/loader/Makefile.common index c77cc4437c..622fad5d1d 100644 --- a/usr/src/boot/sys/boot/efi/loader/Makefile.common +++ b/usr/src/boot/sys/boot/efi/loader/Makefile.common @@ -2,11 +2,11 @@ SRCS += boot.c commands.c console.c devopen.c interp.c SRCS += interp_backslash.c interp_parse.c ls.c misc.c -SRCS += module.c panic.c linenoise.c zfs_cmd.c +SRCS += module.c linenoise.c zfs_cmd.c OBJS += boot.o commands.o console.o devopen.o interp.o \ interp_backslash.o interp_parse.o ls.o misc.o \ - module.o panic.o linenoise.o zfs_cmd.o + module.o linenoise.o zfs_cmd.o SRCS += load_elf32.c load_elf32_obj.c reloc_elf32.c SRCS += load_elf64.c load_elf64_obj.c reloc_elf64.c diff --git a/usr/src/boot/sys/boot/i386/gptzfsboot/Makefile b/usr/src/boot/sys/boot/i386/gptzfsboot/Makefile index 201ae6b609..dfe323f6ca 100644 --- a/usr/src/boot/sys/boot/i386/gptzfsboot/Makefile +++ b/usr/src/boot/sys/boot/i386/gptzfsboot/Makefile @@ -60,7 +60,7 @@ all: $(PROG) install: all $(ROOTBOOTPROG) -OBJS = multiboot.o zfsboot.o sio.o cons.o panic.o devopen.o bio.o \ +OBJS = multiboot.o zfsboot.o sio.o cons.o devopen.o bio.o \ part.o biosmem.o smbios.o biosdisk.o devicename.o disk.o bcache.o \ time.o zfs_cmd.o diff --git a/usr/src/boot/sys/boot/i386/isoboot/Makefile b/usr/src/boot/sys/boot/i386/isoboot/Makefile index f6337bc3a9..5b13aa6f65 100644 --- a/usr/src/boot/sys/boot/i386/isoboot/Makefile +++ b/usr/src/boot/sys/boot/i386/isoboot/Makefile @@ -51,7 +51,7 @@ all: $(PROG) install: all $(ROOTBOOTPROG) -OBJS= multiboot.o isoboot.o sio.o drv.o cons.o gptldr.o panic.o +OBJS= multiboot.o isoboot.o sio.o drv.o cons.o gptldr.o CLEANFILES += isoboot diff --git a/usr/src/boot/sys/boot/i386/loader/Makefile b/usr/src/boot/sys/boot/i386/loader/Makefile index a31d1155fe..1f486e48f8 100644 --- a/usr/src/boot/sys/boot/i386/loader/Makefile +++ b/usr/src/boot/sys/boot/i386/loader/Makefile @@ -56,7 +56,7 @@ LIBFICL= ../../libficl/$(MACH)/libficl.a # Always add MI sources SRCS += boot.c commands.c console.c devopen.c interp.c SRCS += interp_backslash.c interp_parse.c ls.c misc.c -SRCS += module.c panic.c linenoise.c multiboot2.c +SRCS += module.c linenoise.c multiboot2.c SRCS += zfs_cmd.c SRCS += font.c $(FONT).c list.c tem.c diff --git a/usr/src/cmd/fs.d/ufs/fsck/pass2.c b/usr/src/cmd/fs.d/ufs/fsck/pass2.c index 998f98f3f6..30c23f2d57 100644 --- a/usr/src/cmd/fs.d/ufs/fsck/pass2.c +++ b/usr/src/cmd/fs.d/ufs/fsck/pass2.c @@ -4,7 +4,7 @@ */ /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ -/* All Rights Reserved */ +/* All Rights Reserved */ /* * Copyright (c) 1980, 1986, 1990 The Regents of the University of California. @@ -25,8 +25,6 @@ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <stdio.h> #include <stdlib.h> #include <sys/param.h> @@ -50,13 +48,13 @@ static int pass2check(struct inodesc *); void pass2(void) { - struct dinode *dp, *dp2, *dpattr; - struct inoinfo **inpp, *inp; - struct inoinfo **inpend; - struct inodesc curino; - struct inodesc ldesc; - struct dinode dino; - char pathbuf[MAXPATHLEN + 1]; + struct dinode *dp, *dp2, *dpattr; + struct inoinfo **inpp, *inp; + struct inoinfo **inpend; + struct inodesc curino; + struct inodesc ldesc; + struct dinode dino; + char pathbuf[MAXPATHLEN + 1]; int found; int dirtype; caddr_t errmsg; @@ -115,7 +113,7 @@ pass2(void) default: errexit("BAD STATE 0x%x FOR ROOT INODE\n", - statemap[UFSROOTINO]); + statemap[UFSROOTINO]); } statemap[UFSROOTINO] = DFOUND; @@ -169,12 +167,12 @@ pass2(void) pwarn("DIRECTORY %s: LENGTH %lld NOT MULTIPLE OF %d", pathbuf, (longlong_t)inp->i_isize, DIRBLKSIZ); inp->i_isize = roundup(inp->i_isize, - (offset_t)DIRBLKSIZ); + (offset_t)DIRBLKSIZ); if (preen || reply("ADJUST") == 1) { dp = ginode(inp->i_number); dp->di_size = - (u_offset_t)roundup(inp->i_isize, - (offset_t)DIRBLKSIZ); + (u_offset_t)roundup(inp->i_isize, + (offset_t)DIRBLKSIZ); inodirty(); if (preen) (void) printf(" (ADJUSTED)\n"); @@ -197,7 +195,7 @@ pass2(void) dp = &dino; dp->di_size = (u_offset_t)inp->i_isize; (void) memmove((void *)&dp->di_db[0], (void *)&inp->i_blks[0], - inp->i_blkssize); + inp->i_blkssize); init_inodesc(&curino); curino.id_type = DATA; curino.id_func = pass2check; @@ -240,14 +238,14 @@ pass2(void) * directory-related states need to be checked. There * should never be any flags associated with USTATE. */ - if ((statemap[inp->i_number] & STMASK) == DCLEAR || + if ((statemap[inp->i_number] & (STMASK | INCLEAR)) == DCLEAR || statemap[inp->i_number] == USTATE) { continue; } if (statemap[inp->i_parent] == DFOUND && S_IS_DUNFOUND(statemap[inp->i_number])) { statemap[inp->i_number] = DFOUND | - (statemap[inp->i_number] & INCLEAR); + (statemap[inp->i_number] & INCLEAR); } if (inp->i_dotdot == inp->i_parent || inp->i_dotdot == (fsck_ino_t)-1) { @@ -340,7 +338,7 @@ pass2(void) continue; } fileerror(inp->i_parent, inp->i_number, - "BAD INODE NUMBER FOR '..'"); + "BAD INODE NUMBER FOR '..'"); if (reply("FIX") == 0) { iscorrupt = 1; continue; @@ -438,7 +436,7 @@ pass2check(struct inodesc *idesc) entrysize = DIRSIZ(&proto); if (dirp->d_ino != 0 && strcmp(dirp->d_name, "..") != 0) { pfatal("CANNOT FIX, FIRST ENTRY IN DIRECTORY CONTAINS %s\n", - dirp->d_name); + dirp->d_name); iscorrupt = 1; } else if ((int)dirp->d_reclen < entrysize) { pfatal("CANNOT FIX, INSUFFICIENT SPACE TO ADD '.'\n"); @@ -549,7 +547,7 @@ chk1: * we get called on them. */ errexit("pass2check got NULL from getinoinfo at chk1 I=%d\n", - idesc->id_number); + idesc->id_number); } proto.d_ino = inp->i_parent; proto.d_namlen = 2; @@ -625,7 +623,7 @@ chk1: * that we're still on the "." entry. */ fileerror(idesc->id_number, dirp->d_ino, - "I OUT OF RANGE"); + "I OUT OF RANGE"); dirp->d_ino = 0; if (reply("FIX") == 1) { ret |= ALTERED; @@ -647,7 +645,7 @@ chk1: if (dirp->d_ino != 0 && strcmp(dirp->d_name, "..") != 0) { fileerror(inp->i_parent, idesc->id_number, "MISSING '..'"); pfatal("CANNOT FIX, SECOND ENTRY IN DIRECTORY CONTAINS %s\n", - dirp->d_name); + dirp->d_name); iscorrupt = 1; inp->i_dotdot = (fsck_ino_t)-1; } else if ((int)dirp->d_reclen < entrysize) { @@ -783,8 +781,8 @@ again: * at this point. */ errexit("pass2check found a zero-len " - "reference to bad I=%d\n", - dirp->d_ino); + "reference to bad I=%d\n", + dirp->d_ino); } if (inp->i_parent != 0) { (void) printf( @@ -842,8 +840,8 @@ again: * zero-len case above. */ errexit("pass2check found bad reference to " - "hard-linked directory I=%d\n", - dirp->d_ino); + "hard-linked directory I=%d\n", + dirp->d_ino); } dp = ginode(idesc->id_number); if (inp->i_parent != 0 && idesc->id_entryno > 2 && @@ -858,18 +856,21 @@ again: pwarn( "%s IS AN EXTRANEOUS HARD LINK TO DIRECTORY %s\n", pathbuf, namebuf); - if (preen) + if (preen) { (void) printf(" (IGNORED)\n"); - else if ((act = reply(PASS2B_PROMPT, - idesc->id_number)) == 1) { - update_lncntp = 1; - broke_dir_link = 1; - break; + } else { + act = reply(PASS2B_PROMPT, + idesc->id_number); + if (act == 1) { + update_lncntp = 1; + broke_dir_link = 1; + break; + } } } if ((idesc->id_entryno > 2) && - (inp->i_extattr != idesc->id_number)) { + (inp->i_extattr != idesc->id_number)) { inp->i_parent = idesc->id_number; } /* FALLTHROUGH */ @@ -1003,7 +1004,7 @@ again: pdirp = ginode( idesc->id_number); if (pdirp->di_oeftflag - != 0) { + != 0) { pdirp->di_oeftflag = 0; inodirty(); } diff --git a/usr/src/lib/libcmdutils/common/process_xattrs.c b/usr/src/lib/libcmdutils/common/process_xattrs.c index 50b1de58d6..802981053c 100644 --- a/usr/src/lib/libcmdutils/common/process_xattrs.c +++ b/usr/src/lib/libcmdutils/common/process_xattrs.c @@ -23,6 +23,7 @@ * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. * Copyright 2012 Milan Jurik. All rights reserved. + * Copyright (c) 2019, Joyent, Inc. */ #include "libcmdutils.h" @@ -70,7 +71,7 @@ get_attrdirs(int indfd, int outdfd, char *attrfile, int *sfd, int *tfd) /* * mv_xattrs - Copies the content of the extended attribute files. Then - * moves the extended system attributes from the input attribute files + * moves the extended system attributes from the input attribute files * to the target attribute files. Moves the extended system attributes * from source to the target file. This function returns 0 on success * and nonzero on error. @@ -162,8 +163,7 @@ mv_xattrs(char *cmd, char *infile, char *outfile, int sattr, int silent) * Gets non default extended system attributes from * source to copy to target. */ - if (dp->d_name != NULL) - res = sysattr_list(cmd, sattrfd, dp->d_name); + res = sysattr_list(cmd, sattrfd, dp->d_name); if (res != NULL && get_attrdirs(indfd, outdfd, dp->d_name, &asfd, diff --git a/usr/src/uts/common/crypto/io/dca.c b/usr/src/uts/common/crypto/io/dca.c index b76cbaeb55..015112ade4 100644 --- a/usr/src/uts/common/crypto/io/dca.c +++ b/usr/src/uts/common/crypto/io/dca.c @@ -664,8 +664,8 @@ dca_attach(dev_info_t *dip, ddi_attach_cmd_t cmd) dca = ddi_get_soft_state(dca_state, instance); ASSERT(dca != NULL); dca->dca_dip = dip; - WORKLIST(dca, MCR1)->dwl_prov = NULL; - WORKLIST(dca, MCR2)->dwl_prov = NULL; + WORKLIST(dca, MCR1)->dwl_prov = 0; + WORKLIST(dca, MCR2)->dwl_prov = 0; /* figure pagesize */ dca->dca_pagesize = ddi_ptob(dip, 1); @@ -856,11 +856,11 @@ dca_attach(dev_info_t *dip, ddi_attach_cmd_t cmd) failed: /* unregister from the crypto framework */ - if (WORKLIST(dca, MCR1)->dwl_prov != NULL) { + if (WORKLIST(dca, MCR1)->dwl_prov != 0) { (void) crypto_unregister_provider( WORKLIST(dca, MCR1)->dwl_prov); } - if (WORKLIST(dca, MCR2)->dwl_prov != NULL) { + if (WORKLIST(dca, MCR2)->dwl_prov != 0) { (void) crypto_unregister_provider( WORKLIST(dca, MCR2)->dwl_prov); } @@ -925,7 +925,7 @@ dca_detach(dev_info_t *dip, ddi_detach_cmd_t cmd) * Unregister from kCF. * This needs to be done at the beginning of detach. */ - if (WORKLIST(dca, MCR1)->dwl_prov != NULL) { + if (WORKLIST(dca, MCR1)->dwl_prov != 0) { if (crypto_unregister_provider( WORKLIST(dca, MCR1)->dwl_prov) != CRYPTO_SUCCESS) { dca_error(dca, "unable to unregister MCR1 from kcf"); @@ -933,7 +933,7 @@ dca_detach(dev_info_t *dip, ddi_detach_cmd_t cmd) } } - if (WORKLIST(dca, MCR2)->dwl_prov != NULL) { + if (WORKLIST(dca, MCR2)->dwl_prov != 0) { if (crypto_unregister_provider( WORKLIST(dca, MCR2)->dwl_prov) != CRYPTO_SUCCESS) { dca_error(dca, "unable to unregister MCR2 from kcf"); @@ -1243,7 +1243,7 @@ dca_uninit(dca_t *dca) mutex_destroy(&wlp->dwl_freereqslock); mutex_destroy(&wlp->dwl_freelock); cv_destroy(&wlp->dwl_cv); - wlp->dwl_prov = NULL; + wlp->dwl_prov = 0; } } @@ -1927,7 +1927,7 @@ dca_bindchains(dca_request_t *reqp, size_t incnt, size_t outcnt) reqp->dr_in_next = reqp->dr_chain_in_head.dc_next_paddr; reqp->dr_in_len = reqp->dr_chain_in_head.dc_buffer_length; } else { - reqp->dr_in_paddr = NULL; + reqp->dr_in_paddr = 0; reqp->dr_in_next = 0; reqp->dr_in_len = 0; } @@ -1960,7 +1960,7 @@ dca_bindchains(dca_request_t *reqp, size_t incnt, size_t outcnt) reqp->dr_out_next = reqp->dr_chain_out_head.dc_next_paddr; reqp->dr_out_len = reqp->dr_chain_out_head.dc_buffer_length; } else { - reqp->dr_out_paddr = NULL; + reqp->dr_out_paddr = 0; reqp->dr_out_next = 0; reqp->dr_out_len = 0; } @@ -1978,7 +1978,7 @@ dca_unbindchains(dca_request_t *reqp) int rv1 = DDI_SUCCESS; /* Clear the input chain */ - if (reqp->dr_chain_in_head.dc_buffer_paddr != NULL) { + if (reqp->dr_chain_in_head.dc_buffer_paddr != 0) { (void) ddi_dma_unbind_handle(reqp->dr_chain_in_dmah); reqp->dr_chain_in_head.dc_buffer_paddr = 0; } @@ -1988,7 +1988,7 @@ dca_unbindchains(dca_request_t *reqp) } /* Clear the output chain */ - if (reqp->dr_chain_out_head.dc_buffer_paddr != NULL) { + if (reqp->dr_chain_out_head.dc_buffer_paddr != 0) { (void) ddi_dma_unbind_handle(reqp->dr_chain_out_dmah); reqp->dr_chain_out_head.dc_buffer_paddr = 0; } @@ -2011,7 +2011,7 @@ dca_bindchains_one(dca_request_t *reqp, size_t cnt, int dr_offset, caddr_t chain_kaddr_pre; caddr_t chain_kaddr; uint32_t chain_paddr; - int i; + int i; /* Advance past the context structure to the starting address */ chain_paddr = reqp->dr_ctx_paddr + dr_offset; diff --git a/usr/src/uts/common/fs/zfs/ddt_zap.c b/usr/src/uts/common/fs/zfs/ddt_zap.c index d6a991c7c1..6618137433 100644 --- a/usr/src/uts/common/fs/zfs/ddt_zap.c +++ b/usr/src/uts/common/fs/zfs/ddt_zap.c @@ -21,6 +21,7 @@ /* * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018 by Delphix. All rights reserved. */ #include <sys/zfs_context.h> @@ -114,7 +115,18 @@ ddt_zap_walk(objset_t *os, uint64_t object, ddt_entry_t *dde, uint64_t *walk) zap_attribute_t za; int error; - zap_cursor_init_serialized(&zc, os, object, *walk); + if (*walk == 0) { + /* + * We don't want to prefetch the entire ZAP object, because + * it can be enormous. Also the primary use of DDT iteration + * is for scrubbing, in which case we will be issuing many + * scrub i/os for each ZAP block that we read in, so + * reading the ZAP is unlikely to be the bottleneck. + */ + zap_cursor_init_noprefetch(&zc, os, object); + } else { + zap_cursor_init_serialized(&zc, os, object, *walk); + } if ((error = zap_cursor_retrieve(&zc, &za)) == 0) { uchar_t cbuf[sizeof (dde->dde_phys) + 1]; uint64_t csize = za.za_num_integers; diff --git a/usr/src/uts/common/fs/zfs/dmu.c b/usr/src/uts/common/fs/zfs/dmu.c index da84226c14..e299096351 100644 --- a/usr/src/uts/common/fs/zfs/dmu.c +++ b/usr/src/uts/common/fs/zfs/dmu.c @@ -88,6 +88,13 @@ uint32_t zfs_per_txg_dirty_frees_percent = 30; */ int zfs_object_remap_one_indirect_delay_ticks = 0; +/* + * Limit the amount we can prefetch with one call to this amount. This + * helps to limit the amount of memory that can be used by prefetching. + * Larger objects should be prefetched a bit at a time. + */ +uint64_t dmu_prefetch_max = 8 * SPA_MAXBLOCKSIZE; + const dmu_object_type_info_t dmu_ot[DMU_OT_NUMTYPES] = { { DMU_BSWAP_UINT8, TRUE, FALSE, "unallocated" }, { DMU_BSWAP_ZAP, TRUE, TRUE, "object directory" }, @@ -638,6 +645,11 @@ dmu_prefetch(objset_t *os, uint64_t object, int64_t level, uint64_t offset, } /* + * See comment before the definition of dmu_prefetch_max. + */ + len = MIN(len, dmu_prefetch_max); + + /* * XXX - Note, if the dnode for the requested object is not * already cached, we will do a *synchronous* read in the * dnode_hold() call. The same is true for any indirects. diff --git a/usr/src/uts/common/fs/zfs/sys/zap.h b/usr/src/uts/common/fs/zfs/sys/zap.h index e7f5358140..15e912d1c3 100644 --- a/usr/src/uts/common/fs/zfs/sys/zap.h +++ b/usr/src/uts/common/fs/zfs/sys/zap.h @@ -21,7 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012, 2016 by Delphix. All rights reserved. + * Copyright (c) 2012, 2018 by Delphix. All rights reserved. * Copyright 2017 Nexenta Systems, Inc. */ @@ -347,6 +347,7 @@ typedef struct zap_cursor { uint64_t zc_serialized; uint64_t zc_hash; uint32_t zc_cd; + boolean_t zc_prefetch; } zap_cursor_t; typedef struct { @@ -373,6 +374,8 @@ typedef struct { * zapobj. You must _fini the cursor when you are done with it. */ void zap_cursor_init(zap_cursor_t *zc, objset_t *ds, uint64_t zapobj); +void zap_cursor_init_noprefetch(zap_cursor_t *zc, objset_t *os, + uint64_t zapobj); void zap_cursor_fini(zap_cursor_t *zc); /* diff --git a/usr/src/uts/common/fs/zfs/zap.c b/usr/src/uts/common/fs/zfs/zap.c index 7a1994f603..de8e212077 100644 --- a/usr/src/uts/common/fs/zfs/zap.c +++ b/usr/src/uts/common/fs/zfs/zap.c @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012, 2016 by Delphix. All rights reserved. + * Copyright (c) 2012, 2018 by Delphix. All rights reserved. * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved. */ @@ -49,6 +49,36 @@ #include <sys/zap_impl.h> #include <sys/zap_leaf.h> +/* + * If zap_iterate_prefetch is set, we will prefetch the entire ZAP object + * (all leaf blocks) when we start iterating over it. + * + * For zap_cursor_init(), the callers all intend to iterate through all the + * entries. There are a few cases where an error (typically i/o error) could + * cause it to bail out early. + * + * For zap_cursor_init_serialized(), there are callers that do the iteration + * outside of ZFS. Typically they would iterate over everything, but we + * don't have control of that. E.g. zfs_ioc_snapshot_list_next(), + * zcp_snapshots_iter(), and other iterators over things in the MOS - these + * are called by /sbin/zfs and channel programs. The other example is + * zfs_readdir() which iterates over directory entries for the getdents() + * syscall. /sbin/ls iterates to the end (unless it receives a signal), but + * userland doesn't have to. + * + * Given that the ZAP entries aren't returned in a specific order, the only + * legitimate use cases for partial iteration would be: + * + * 1. Pagination: e.g. you only want to display 100 entries at a time, so you + * get the first 100 and then wait for the user to hit "next page", which + * they may never do). + * + * 2. You want to know if there are more than X entries, without relying on + * the zfs-specific implementation of the directory's st_size (which is + * the number of entries). + */ +boolean_t zap_iterate_prefetch = B_TRUE; + int fzap_default_block_shift = 14; /* 16k blocksize */ extern inline zap_phys_t *zap_f_phys(zap_t *zap); @@ -1169,6 +1199,20 @@ fzap_cursor_retrieve(zap_t *zap, zap_cursor_t *zc, zap_attribute_t *za) /* retrieve the next entry at or after zc_hash/zc_cd */ /* if no entry, return ENOENT */ + /* + * If we are reading from the beginning, we're almost + * certain to iterate over the entire ZAP object. If there are + * multiple leaf blocks (freeblk > 2), prefetch the whole + * object, so that we read the leaf blocks concurrently. + * (Unless noprefetch was requested via zap_cursor_init_noprefetch()). + */ + if (zc->zc_hash == 0 && zap_iterate_prefetch && + zc->zc_prefetch && zap_f_phys(zap)->zap_freeblk > 2) { + dmu_prefetch(zc->zc_objset, zc->zc_zapobj, 0, 0, + zap_f_phys(zap)->zap_freeblk << FZAP_BLOCK_SHIFT(zap), + ZIO_PRIORITY_ASYNC_READ); + } + if (zc->zc_leaf && (ZAP_HASH_IDX(zc->zc_hash, zap_leaf_phys(zc->zc_leaf)->l_hdr.lh_prefix_len) != diff --git a/usr/src/uts/common/fs/zfs/zap_micro.c b/usr/src/uts/common/fs/zfs/zap_micro.c index d093fe1e73..bb5da13ba1 100644 --- a/usr/src/uts/common/fs/zfs/zap_micro.c +++ b/usr/src/uts/common/fs/zfs/zap_micro.c @@ -21,7 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2011, 2017 by Delphix. All rights reserved. + * Copyright (c) 2011, 2018 by Delphix. All rights reserved. * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved. * Copyright (c) 2014 Integros [integros.com] * Copyright 2017 Nexenta Systems, Inc. @@ -1386,9 +1386,9 @@ zap_remove_uint64(objset_t *os, uint64_t zapobj, const uint64_t *key, * Routines for iterating over the attributes. */ -void -zap_cursor_init_serialized(zap_cursor_t *zc, objset_t *os, uint64_t zapobj, - uint64_t serialized) +static void +zap_cursor_init_impl(zap_cursor_t *zc, objset_t *os, uint64_t zapobj, + uint64_t serialized, boolean_t prefetch) { zc->zc_objset = os; zc->zc_zap = NULL; @@ -1397,12 +1397,33 @@ zap_cursor_init_serialized(zap_cursor_t *zc, objset_t *os, uint64_t zapobj, zc->zc_serialized = serialized; zc->zc_hash = 0; zc->zc_cd = 0; + zc->zc_prefetch = prefetch; +} +void +zap_cursor_init_serialized(zap_cursor_t *zc, objset_t *os, uint64_t zapobj, + uint64_t serialized) +{ + zap_cursor_init_impl(zc, os, zapobj, serialized, B_TRUE); } +/* + * Initialize a cursor at the beginning of the ZAP object. The entire + * ZAP object will be prefetched. + */ void zap_cursor_init(zap_cursor_t *zc, objset_t *os, uint64_t zapobj) { - zap_cursor_init_serialized(zc, os, zapobj, 0); + zap_cursor_init_impl(zc, os, zapobj, 0, B_TRUE); +} + +/* + * Initialize a cursor at the beginning, but request that we not prefetch + * the entire ZAP object. + */ +void +zap_cursor_init_noprefetch(zap_cursor_t *zc, objset_t *os, uint64_t zapobj) +{ + zap_cursor_init_impl(zc, os, zapobj, 0, B_FALSE); } void diff --git a/usr/src/uts/common/inet/ipd/ipd.c b/usr/src/uts/common/inet/ipd/ipd.c index 747a7a814f..25e0b699c5 100644 --- a/usr/src/uts/common/inet/ipd/ipd.c +++ b/usr/src/uts/common/inet/ipd/ipd.c @@ -241,7 +241,7 @@ static unsigned int ipd_max_delay = IPD_MAX_DELAY; /* max delay in us */ static kmutex_t ipd_nsl_lock; /* lock for the nestack list */ static list_t ipd_nsl; /* list of netstacks */ static kmutex_t ipd_nactive_lock; /* lock for nactive */ -static unsigned int ipd_nactive; /* number of active netstacks */ +static unsigned int ipd_nactive; /* number of active netstacks */ static int ipd_nactive_fudge = 4; /* amount to fudge by in list */ /* @@ -880,7 +880,7 @@ ipd_ioctl_list(intptr_t arg, cred_t *cr) nzones = MIN(cur, rzones); if (nzones > 0) { if (ddi_copyout(configs, STRUCT_FGETP(h, ipil_info), - nzones * sizeof (ipd_ioc_info_t), NULL) != 0) + nzones * sizeof (ipd_ioc_info_t), 0) != 0) rval = EFAULT; } diff --git a/usr/src/uts/common/io/bpf/bpf.c b/usr/src/uts/common/io/bpf/bpf.c index 59c71f8d4b..564637f824 100644 --- a/usr/src/uts/common/io/bpf/bpf.c +++ b/usr/src/uts/common/io/bpf/bpf.c @@ -294,7 +294,7 @@ next: MBPF_CLIENT_CLOSE(bpr, mcip); mcip = 0; } - if (mh != NULL) { + if (mh != 0) { MBPF_CLOSE(bpr, mh); mh = 0; } @@ -1386,7 +1386,7 @@ bpf_ifname(struct bpf_d *d, char *buffer, int bufsize) { mutex_enter(&d->bd_lock); - if (d->bd_bif == NULL) { + if (d->bd_bif == 0) { mutex_exit(&d->bd_lock); return (EINVAL); } diff --git a/usr/src/uts/common/io/conskbd.c b/usr/src/uts/common/io/conskbd.c index c250a6be8c..feaf659d33 100644 --- a/usr/src/uts/common/io/conskbd.c +++ b/usr/src/uts/common/io/conskbd.c @@ -455,7 +455,7 @@ conskbd_attach(dev_info_t *devi, ddi_attach_cmd_t cmd) } if ((ddi_create_minor_node(devi, "kbd", S_IFCHR, - 0, DDI_PSEUDO, NULL) == DDI_FAILURE) || + 0, DDI_PSEUDO, 0) == DDI_FAILURE) || (ddi_create_internal_pathname(devi, "conskbd", S_IFCHR, 1) == DDI_FAILURE)) { ddi_remove_minor_node(devi, NULL); @@ -1686,7 +1686,7 @@ conskbd_alloc_firm_event(ushort_t id, int value) fe = (Firm_event *)mb->b_wptr; fe->id = id; fe->pair_type = FE_PAIR_NONE; - fe->pair = NULL; + fe->pair = '\0'; fe->value = value; mb->b_wptr += sizeof (Firm_event); } diff --git a/usr/src/uts/common/io/devinfo.c b/usr/src/uts/common/io/devinfo.c index 84a48e086e..68ccd8eea4 100644 --- a/usr/src/uts/common/io/devinfo.c +++ b/usr/src/uts/common/io/devinfo.c @@ -461,9 +461,9 @@ di_attach(dev_info_t *dip, ddi_attach_cmd_t cmd) di_max_opens * sizeof (struct di_state *), KM_SLEEP); if (ddi_create_minor_node(dip, "devinfo", S_IFCHR, - DI_FULL_PARENT, DDI_PSEUDO, NULL) == DDI_FAILURE || + DI_FULL_PARENT, DDI_PSEUDO, 0) == DDI_FAILURE || ddi_create_minor_node(dip, "devinfo,ro", S_IFCHR, - DI_READONLY_PARENT, DDI_PSEUDO, NULL) == DDI_FAILURE) { + DI_READONLY_PARENT, DDI_PSEUDO, 0) == DDI_FAILURE) { kmem_free(di_states, di_max_opens * sizeof (struct di_state *)); ddi_remove_minor_node(dip, NULL); @@ -1298,7 +1298,7 @@ di_key_cmp(mod_hash_key_t key1, mod_hash_key_t key2) static void di_copy_aliases(struct di_state *st, alias_pair_t *apair, di_off_t *offp) { - di_off_t off; + di_off_t off; struct di_all *all = DI_ALL_PTR(st); struct di_alias *di_alias; di_off_t curroff; @@ -1817,7 +1817,7 @@ di_copynode(struct dev_info *node, struct di_stack *dsp, struct di_state *st) me->top_phci = 0; /* Filled up by build_phci_list. */ me->next_phci = 0; /* Filled up by build_phci_list. */ me->multipath_component = MULTIPATH_COMPONENT_NONE; /* set default. */ - me->user_private_data = NULL; + me->user_private_data = 0; /* * Get parent's offset in snapshot from the stack @@ -2517,7 +2517,7 @@ out: */ static di_off_t di_getmdata(struct ddi_minor_data *mnode, di_off_t *off_p, di_off_t node, - struct di_state *st) + struct di_state *st) { di_off_t off; struct di_minor *me; @@ -2536,7 +2536,7 @@ di_getmdata(struct ddi_minor_data *mnode, di_off_t *off_p, di_off_t node, me->self = off; me->type = mnode->type; me->node = node; - me->user_private_data = NULL; + me->user_private_data = 0; off += sizeof (struct di_minor); diff --git a/usr/src/uts/common/io/dld/dld_proto.c b/usr/src/uts/common/io/dld/dld_proto.c index 238dd9bb22..1371fa47c0 100644 --- a/usr/src/uts/common/io/dld/dld_proto.c +++ b/usr/src/uts/common/io/dld/dld_proto.c @@ -1291,7 +1291,7 @@ proto_unitdata_req(dld_str_t *dsp, mblk_t *mp) * No lock can be held across modules and putnext()'s, * which can happen here with the call from DLD_TX(). */ - if (DLD_TX(dsp, bp, 0, 0) != NULL) { + if (DLD_TX(dsp, bp, 0, 0) != 0) { /* flow-controlled */ DLD_SETQFULL(dsp); } diff --git a/usr/src/uts/common/io/dld/dld_str.c b/usr/src/uts/common/io/dld/dld_str.c index a8ab4eba50..3029288b19 100644 --- a/usr/src/uts/common/io/dld/dld_str.c +++ b/usr/src/uts/common/io/dld/dld_str.c @@ -955,7 +955,7 @@ str_mdata_fastpath_put(dld_str_t *dsp, mblk_t *mp, uintptr_t f_hint, } } - if ((cookie = DLD_TX(dsp, mp, f_hint, flag)) != NULL) { + if ((cookie = DLD_TX(dsp, mp, f_hint, flag)) != 0) { DLD_SETQFULL(dsp); } return (cookie); @@ -963,7 +963,7 @@ str_mdata_fastpath_put(dld_str_t *dsp, mblk_t *mp, uintptr_t f_hint, discard: /* TODO: bump kstat? */ freemsg(mp); - return (NULL); + return (0); } /* @@ -1025,7 +1025,7 @@ str_mdata_raw_put(dld_str_t *dsp, mblk_t *mp) goto discard; } - if (DLD_TX(dsp, mp, 0, 0) != NULL) { + if (DLD_TX(dsp, mp, 0, 0) != 0) { /* Turn on flow-control for dld */ DLD_SETQFULL(dsp); } diff --git a/usr/src/uts/common/io/dump.c b/usr/src/uts/common/io/dump.c index ab5a9d0240..4fd52e6448 100644 --- a/usr/src/uts/common/io/dump.c +++ b/usr/src/uts/common/io/dump.c @@ -54,7 +54,7 @@ dump_attach(dev_info_t *devi, ddi_attach_cmd_t cmd) { if (cmd != DDI_ATTACH) return (DDI_FAILURE); - if (ddi_create_minor_node(devi, "dump", S_IFCHR, 0, DDI_PSEUDO, NULL) == + if (ddi_create_minor_node(devi, "dump", S_IFCHR, 0, DDI_PSEUDO, 0) == DDI_FAILURE) { ddi_remove_minor_node(devi, NULL); return (DDI_FAILURE); @@ -235,7 +235,7 @@ struct cb_ops dump_cb_ops = { dump_ioctl, /* ioctl */ nodev, /* devmap */ nodev, /* mmap */ - nodev, /* segmap */ + nodev, /* segmap */ nochpoll, /* poll */ ddi_prop_op, /* prop_op */ 0, /* streamtab */ diff --git a/usr/src/uts/common/io/ecpp.c b/usr/src/uts/common/io/ecpp.c index c7c03826b5..ce2411ea71 100644 --- a/usr/src/uts/common/io/ecpp.c +++ b/usr/src/uts/common/io/ecpp.c @@ -177,19 +177,19 @@ int ecpp_debug = ECPP_DEBUG; int noecp = 0; /* flag not to use ECP mode */ /* driver entry point fn definitions */ -static int ecpp_open(queue_t *, dev_t *, int, int, cred_t *); +static int ecpp_open(queue_t *, dev_t *, int, int, cred_t *); static int ecpp_close(queue_t *, int, cred_t *); -static uint_t ecpp_isr(caddr_t); +static uint_t ecpp_isr(caddr_t); static uint_t ecpp_softintr(caddr_t); /* configuration entry point fn definitions */ -static int ecpp_getinfo(dev_info_t *, ddi_info_cmd_t, void *, void **); +static int ecpp_getinfo(dev_info_t *, ddi_info_cmd_t, void *, void **); static int ecpp_attach(dev_info_t *, ddi_attach_cmd_t); static int ecpp_detach(dev_info_t *, ddi_detach_cmd_t); static struct ecpp_hw_bind *ecpp_determine_sio_type(struct ecppunit *); /* isr support routines */ -static uint_t ecpp_nErr_ihdlr(struct ecppunit *); +static uint_t ecpp_nErr_ihdlr(struct ecppunit *); static uint_t ecpp_pio_ihdlr(struct ecppunit *); static uint_t ecpp_dma_ihdlr(struct ecppunit *); static uint_t ecpp_M1553_intr(struct ecppunit *); @@ -213,8 +213,8 @@ static void ecpp_putioc_stateful_copyin(queue_t *, mblk_t *, size_t); static void ecpp_srvioc_devid(queue_t *, mblk_t *, struct ecpp_device_id *, int *); static void ecpp_srvioc_prnif(queue_t *, mblk_t *); -static void ecpp_ack_ioctl(queue_t *, mblk_t *); -static void ecpp_nack_ioctl(queue_t *, mblk_t *, int); +static void ecpp_ack_ioctl(queue_t *, mblk_t *); +static void ecpp_nack_ioctl(queue_t *, mblk_t *, int); /* kstat routines */ static void ecpp_kstat_init(struct ecppunit *); @@ -275,10 +275,10 @@ static uint8_t m1553_read_config_reg(struct ecppunit *, uint8_t); static void m1553_write_config_reg(struct ecppunit *, uint8_t, uint8_t); /* M1553 Southbridge DMAC 8237 support routines */ -static int dma8237_dma_start(struct ecppunit *); +static int dma8237_dma_start(struct ecppunit *); static int dma8237_dma_stop(struct ecppunit *, size_t *); static size_t dma8237_getcnt(struct ecppunit *); -static void dma8237_write_addr(struct ecppunit *, uint32_t); +static void dma8237_write_addr(struct ecppunit *, uint32_t); static void dma8237_write_count(struct ecppunit *, uint32_t); static uint32_t dma8237_read_count(struct ecppunit *); static void dma8237_write(struct ecppunit *, int, uint8_t); @@ -301,7 +301,7 @@ static size_t x86_getcnt(struct ecppunit *); /* IEEE 1284 phase transitions */ static void ecpp_1284_init_interface(struct ecppunit *); static int ecpp_1284_termination(struct ecppunit *); -static uchar_t ecpp_idle_phase(struct ecppunit *); +static uchar_t ecpp_idle_phase(struct ecppunit *); static int ecp_forward2reverse(struct ecppunit *); static int ecp_reverse2forward(struct ecppunit *); static int read_nibble_backchan(struct ecppunit *); @@ -315,8 +315,8 @@ static void ecpp_ecp_read_timeout(void *); static void ecpp_ecp_read_completion(struct ecppunit *); /* IEEE 1284 mode transitions */ -static void ecpp_default_negotiation(struct ecppunit *); -static int ecpp_mode_negotiation(struct ecppunit *, uchar_t); +static void ecpp_default_negotiation(struct ecppunit *); +static int ecpp_mode_negotiation(struct ecppunit *, uchar_t); static int ecpp_1284_negotiation(struct ecppunit *, uint8_t, uint8_t *); static int ecp_negotiation(struct ecppunit *); static int nibble_negotiation(struct ecppunit *); @@ -691,7 +691,7 @@ ecpp_attach(dev_info_t *dip, ddi_attach_cmd_t cmd) (void) sprintf(name, "ecpp%d", instance); if (ddi_create_minor_node(dip, name, S_IFCHR, instance, - DDI_NT_PRINTER, NULL) == DDI_FAILURE) { + DDI_NT_PRINTER, 0) == DDI_FAILURE) { ecpp_error(dip, "ecpp_attach: create_minor_node failed\n"); goto fail_minor; } @@ -2353,7 +2353,7 @@ ecpp_srvioc(queue_t *q, mblk_t *mp) break; } - if (new_ifcap & PRN_BIDI) { /* go bidirectional */ + if (new_ifcap & PRN_BIDI) { /* go bidirectional */ ecpp_default_negotiation(pp); } else { /* go unidirectional */ (void) ecpp_mode_negotiation(pp, ECPP_CENTRONICS); @@ -2393,7 +2393,7 @@ ecpp_srvioc(queue_t *q, mblk_t *mp) static void ecpp_srvioc_devid(queue_t *q, mblk_t *mp, struct ecpp_device_id *id, int *rlen) { - struct ecppunit *pp; + struct ecppunit *pp; struct copyresp *csp; struct ecpp_copystate *stp; int error; @@ -3535,7 +3535,7 @@ ecpp_softintr(caddr_t arg) /* * Transfer clean-up: - * shut down the DMAC + * shut down the DMAC * stop the transfer timer * enable write queue */ @@ -4112,7 +4112,7 @@ ecpp_determine_sio_type(struct ecppunit *pp) /* * * IEEE 1284 support routines: - * negotiation and termination; + * negotiation and termination; * phase transitions; * device ID; * @@ -4281,7 +4281,7 @@ ecpp_1284_negotiation(struct ecppunit *pp, uint8_t xreq, uint8_t *rdsr) /* * Event 2: peripheral asserts nAck, deasserts nFault, - * asserts Select, asserts PError + * asserts Select, asserts PError */ if (wait_dsr(pp, ECPP_nERR | ECPP_SLCT | ECPP_PE | ECPP_nACK, ECPP_nERR | ECPP_SLCT | ECPP_PE, 35000) < 0) { @@ -6203,7 +6203,7 @@ dma8237_read_count(struct ecppunit *pp) break; default: - return (NULL); + return (0); } p = (uint16_t *)&pp->uh.m1553.isa_space->isa_reg[c_wcnt]; diff --git a/usr/src/uts/common/io/fd.c b/usr/src/uts/common/io/fd.c index d591e04331..5ad6022610 100644 --- a/usr/src/uts/common/io/fd.c +++ b/usr/src/uts/common/io/fd.c @@ -493,7 +493,7 @@ fd_attach(dev_info_t *dip, ddi_attach_cmd_t cmd) sig_minor = drive_num << 3; for (dmdp = fd_minor; dmdp->name != NULL; dmdp++) { if (ddi_create_minor_node(dip, dmdp->name, dmdp->type, - sig_minor | dmdp->minor, DDI_NT_FD, NULL) + sig_minor | dmdp->minor, DDI_NT_FD, 0) == DDI_FAILURE) { ddi_remove_minor_node(dip, NULL); goto no_attach; @@ -2174,7 +2174,7 @@ fd_prop_op(dev_t dev, dev_info_t *dip, ddi_prop_op_t prop_op, int mod_flags, * request is passed to ddi_prop_op. */ if (dev == DDI_DEV_T_ANY) { -pass: return (ddi_prop_op(dev, dip, prop_op, mod_flags, +pass: return (ddi_prop_op(dev, dip, prop_op, mod_flags, name, valuep, lengthp)); } else { /* @@ -2308,7 +2308,7 @@ fd_check_media(dev_t dev, enum dkio_state state) /* * fd_get_media_info : - * Collects medium information for + * Collects medium information for * DKIOCGMEDIAINFO ioctl. */ diff --git a/usr/src/uts/common/io/hxge/hxge_hw.c b/usr/src/uts/common/io/hxge/hxge_hw.c index dec54b5de8..421ce11d5e 100644 --- a/usr/src/uts/common/io/hxge/hxge_hw.c +++ b/usr/src/uts/common/io/hxge/hxge_hw.c @@ -330,7 +330,7 @@ hxge_peu_handle_sys_errors(p_hxge_t hxgep) "==> hxge_peu_handle_sys_errors: hcr_parerr")); } - HXGE_FM_REPORT_ERROR(hxgep, NULL, HXGE_FM_EREPORT_PEU_ERR); + HXGE_FM_REPORT_ERROR(hxgep, 0, HXGE_FM_EREPORT_PEU_ERR); return (HXGE_OK); } @@ -396,11 +396,11 @@ hxge_syserr_intr(caddr_t arg1, caddr_t arg2) (void) hxge_peu_handle_sys_errors(hxgep); if (estat.bits.peu_err1) - HXGE_FM_REPORT_ERROR(hxgep, NULL, + HXGE_FM_REPORT_ERROR(hxgep, 0, HXGE_FM_EREPORT_PEU_ERR); if (estat.bits.vnm_pio_err1) - HXGE_FM_REPORT_ERROR(hxgep, NULL, + HXGE_FM_REPORT_ERROR(hxgep, 0, HXGE_FM_EREPORT_PEU_VNM_PIO_ERR); } else if (estat.value != 0) { HXGE_ERROR_MSG((hxgep, HXGE_ERR_CTL, diff --git a/usr/src/uts/common/io/hxge/hxge_kstats.c b/usr/src/uts/common/io/hxge/hxge_kstats.c index 09cd73c3a0..f21f690c0a 100644 --- a/usr/src/uts/common/io/hxge/hxge_kstats.c +++ b/usr/src/uts/common/io/hxge/hxge_kstats.c @@ -102,7 +102,7 @@ hxge_kstat_index_t hxge_rdc_stats[] = { {RDC_STAT_RCRTO, KSTAT_DATA_ULONG, "rdc_rcrto"}, {RDC_STAT_RCRTHRES, KSTAT_DATA_ULONG, "rdc_rcrthres"}, {RDC_STAT_PKT_DROP, KSTAT_DATA_ULONG, "rdc_pkt_drop"}, - {RDC_STAT_END, NULL, NULL} + {RDC_STAT_END, KSTAT_DATA_ULONG, NULL} }; typedef enum { @@ -118,7 +118,7 @@ hxge_kstat_index_t hxge_rdc_sys_stats[] = { {RDC_SYS_STAT_CTRL_FIFO_DED, KSTAT_DATA_UINT64, "rdc_ctrl_fifo_ded"}, {RDC_SYS_STAT_DATA_FIFO_SEC, KSTAT_DATA_UINT64, "rdc_data_fifo_sec"}, {RDC_SYS_STAT_DATA_FIFO_DED, KSTAT_DATA_UINT64, "tdc_data_fifo_ded"}, - {RDC_SYS_STAT_END, NULL, NULL} + {RDC_SYS_STAT_END, KSTAT_DATA_UINT64, NULL} }; typedef enum { @@ -184,7 +184,7 @@ hxge_kstat_index_t hxge_tdc_stats[] = { {TDC_STAT_TX_JUMBO_PKTS, KSTAT_DATA_ULONG, "tdc_tx_jumbo_pkts"}, {TDC_STAT_TX_MAX_PEND, KSTAT_DATA_ULONG, "tdc_tx_max_pend"}, {TDC_STAT_TX_MARKS, KSTAT_DATA_ULONG, "tdc_tx_marks"}, - {TDC_STAT_END, NULL, NULL} + {TDC_STAT_END, KSTAT_DATA_ULONG, NULL} }; typedef enum { @@ -198,7 +198,7 @@ hxge_kstat_index_t hxge_tdc_sys_stats[] = { {REORD_TBL_PAR_ERR, KSTAT_DATA_UINT64, "reord_tbl_par_err"}, {REORD_BUF_DED_ERR, KSTAT_DATA_UINT64, "reord_buf_ded_err"}, {REORD_BUF_SEC_ERR, KSTAT_DATA_UINT64, "reord_buf_sec_err"}, - {TDC_SYS_STAT_END, NULL, NULL} + {TDC_SYS_STAT_END, KSTAT_DATA_UINT64, NULL} }; typedef enum { @@ -230,7 +230,7 @@ hxge_kstat_index_t hxge_vmac_stats[] = { {VMAC_STAT_RX_PAUSE_CNT, KSTAT_DATA_UINT64, "vmac_rx_pause_cnt"}, {VMAC_STAT_RX_BCAST_FR_CNT, KSTAT_DATA_UINT64, "vmac_rx_bcast_fr_cnt"}, {VMAC_STAT_RX_MCAST_FR_CNT, KSTAT_DATA_UINT64, "vmac_rx_mcast_fr_cnt"}, - {VMAC_STAT_END, NULL, NULL} + {VMAC_STAT_END, KSTAT_DATA_UINT64, NULL} }; typedef enum { @@ -259,7 +259,7 @@ hxge_kstat_index_t hxge_pfc_stats[] = { " pfc_pkt_drop_class_code"}, {PFC_STAT_TCAM_DROP, KSTAT_DATA_ULONG, " pfc_pkt_drop_tcam"}, {PFC_STAT_VLAN_DROP, KSTAT_DATA_ULONG, " pfc_pkt_drop_vlan"}, - {PFC_STAT_END, NULL, NULL} + {PFC_STAT_END, KSTAT_DATA_ULONG, NULL} }; typedef enum { @@ -297,7 +297,7 @@ hxge_kstat_index_t hxge_peu_sys_stats[] = { {NP_DATAQ_PARERR, KSTAT_DATA_UINT64, "np_dataq_parerr"}, {EIC_MSIX_PARERR, KSTAT_DATA_UINT64, "eic_msix_parerr"}, {HCR_PARERR, KSTAT_DATA_UINT64, "hcr_parerr"}, - {TDC_SYS_STAT_END, NULL, NULL} + {TDC_SYS_STAT_END, KSTAT_DATA_UINT64, NULL} }; typedef enum { @@ -341,7 +341,7 @@ hxge_kstat_index_t hxge_mmac_stats[] = { {MMAC_ADDR_POOL14, KSTAT_DATA_UINT64, "mmac_addr_14"}, {MMAC_ADDR_POOL15, KSTAT_DATA_UINT64, "mmac_addr_15"}, {MMAC_ADDR_POOL16, KSTAT_DATA_UINT64, "mmac_addr_16"}, - {MMAC_STATS_END, NULL, NULL}, + {MMAC_STATS_END, KSTAT_DATA_UINT64, NULL}, }; @@ -624,8 +624,8 @@ hxge_peu_sys_stat_update(kstat_t *ksp, int rw) static kstat_t * hxge_setup_local_kstat(p_hxge_t hxgep, int instance, char *name, - const hxge_kstat_index_t *ksip, size_t count, - int (*update) (kstat_t *, int)) + const hxge_kstat_index_t *ksip, size_t count, + int (*update) (kstat_t *, int)) { kstat_t *ksp; kstat_named_t *knp; diff --git a/usr/src/uts/common/io/hxge/hxge_main.c b/usr/src/uts/common/io/hxge/hxge_main.c index 102b7cb285..39683c9bb1 100644 --- a/usr/src/uts/common/io/hxge/hxge_main.c +++ b/usr/src/uts/common/io/hxge/hxge_main.c @@ -2394,7 +2394,7 @@ hxge_dma_mem_free(p_hxge_dma_common_t dma_p) } dma_p->kaddrp = NULL; - dma_p->alength = NULL; + dma_p->alength = 0; } /* @@ -3255,7 +3255,7 @@ static int hxge_m_getprop(void *barg, const char *pr_name, mac_prop_id_t pr_num, uint_t pr_valsize, void *pr_val) { - hxge_t *hxgep = barg; + hxge_t *hxgep = barg; p_hxge_stats_t statsp = hxgep->statsp; int err = 0; link_flowctrl_t fl; @@ -4462,9 +4462,9 @@ hxge_link_update(p_hxge_t hxgep, link_state_t state) static void hxge_msix_init(p_hxge_t hxgep) { - uint32_t data0; - uint32_t data1; - uint32_t data2; + uint32_t data0; + uint32_t data1; + uint32_t data2; int i; uint32_t msix_entry0; uint32_t msix_entry1; diff --git a/usr/src/uts/common/io/hxge/hxge_pfc.c b/usr/src/uts/common/io/hxge/hxge_pfc.c index e26b4a7c3a..0e4ff9a4fc 100644 --- a/usr/src/uts/common/io/hxge/hxge_pfc.c +++ b/usr/src/uts/common/io/hxge/hxge_pfc.c @@ -511,7 +511,7 @@ hxge_pfc_set_hash(p_hxge_t hxgep, uint32_t seed) { hpi_status_t rs = HPI_SUCCESS; hpi_handle_t handle; - p_hxge_class_pt_cfg_t p_class_cfgp; + p_hxge_class_pt_cfg_t p_class_cfgp; HXGE_DEBUG_MSG((hxgep, PFC_CTL, " ==> hxge_pfc_set_hash")); @@ -777,7 +777,7 @@ hxge_status_t hxge_pfc_ip_class_config(p_hxge_t hxgep, tcam_class_t class, uint32_t config) { uint32_t class_config; - p_hxge_class_pt_cfg_t p_class_cfgp; + p_hxge_class_pt_cfg_t p_class_cfgp; tcam_key_cfg_t cfg; hpi_handle_t handle; hpi_status_t rs = HPI_SUCCESS; @@ -866,7 +866,7 @@ hxge_pfc_update_hw(p_hxge_t hxgep) int max_vlan_groups; int vlan_group_step; - p_hxge_class_pt_cfg_t p_class_cfgp; + p_hxge_class_pt_cfg_t p_class_cfgp; HXGE_DEBUG_MSG((hxgep, PFC_CTL, "==> hxge_pfc_update_hw")); p_class_cfgp = (p_hxge_class_pt_cfg_t)&hxgep->class_config; @@ -1017,7 +1017,7 @@ hxge_classify_init_sw(p_hxge_t hxgep) classify_ptr->tcam_size = TCAM_HXGE_TCAM_MAX_ENTRY; alloc_size = sizeof (tcam_flow_spec_t) * classify_ptr->tcam_size; - classify_ptr->tcam_entries = KMEM_ZALLOC(alloc_size, NULL); + classify_ptr->tcam_entries = KMEM_ZALLOC(alloc_size, KM_SLEEP); bzero(classify_ptr->class_usage, sizeof (classify_ptr->class_usage)); /* Start from the beginning of TCAM */ @@ -1044,7 +1044,7 @@ hxge_classify_exit_sw(p_hxge_t hxgep) alloc_size = fsize * classify_ptr->tcam_size; KMEM_FREE((void *) classify_ptr->tcam_entries, alloc_size); } - hxgep->classifier.state = NULL; + hxgep->classifier.state = 0; HXGE_DEBUG_MSG((hxgep, PFC_CTL, "<== hxge_classify_exit_sw")); diff --git a/usr/src/uts/common/io/hxge/hxge_rxdma.c b/usr/src/uts/common/io/hxge/hxge_rxdma.c index d953061d8b..92e9df2b02 100644 --- a/usr/src/uts/common/io/hxge/hxge_rxdma.c +++ b/usr/src/uts/common/io/hxge/hxge_rxdma.c @@ -183,7 +183,7 @@ hxge_enable_rxdma_channel(p_hxge_t hxgep, uint16_t channel, int n_init_kick) { hpi_handle_t handle; - rdc_desc_cfg_t rdc_desc; + rdc_desc_cfg_t rdc_desc; rdc_rcr_cfg_b_t *cfgb_p; hpi_status_t rs = HPI_SUCCESS; @@ -1900,7 +1900,7 @@ hxge_receive_packet(p_hxge_t hxgep, p_rx_rcr_ring_t rcr_p, rdc_stats->ierrors++; /* Update error stats */ rdc_stats->errlog.compl_err_type = error_type; - HXGE_FM_REPORT_ERROR(hxgep, NULL, HXGE_FM_EREPORT_RDMC_RCR_ERR); + HXGE_FM_REPORT_ERROR(hxgep, 0, HXGE_FM_EREPORT_RDMC_RCR_ERR); if (error_type & RCR_CTRL_FIFO_DED) { rdc_stats->ctrl_fifo_ecc_err++; @@ -2561,13 +2561,13 @@ hxge_map_rxdma_channel_cfg_ring(p_hxge_t hxgep, uint16_t dma_channel, p_hxge_dma_common_t *dma_mbox_cntl_p, p_rx_rbr_ring_t *rbr_p, p_rx_rcr_ring_t *rcr_p, p_rx_mbox_t *rx_mbox_p) { - p_rx_rbr_ring_t rbrp; - p_rx_rcr_ring_t rcrp; - p_rx_mbox_t mboxp; - p_hxge_dma_common_t cntl_dmap; - p_hxge_dma_common_t dmap; - p_rx_msg_t *rx_msg_ring; - p_rx_msg_t rx_msg_p; + p_rx_rbr_ring_t rbrp; + p_rx_rcr_ring_t rcrp; + p_rx_mbox_t mboxp; + p_hxge_dma_common_t cntl_dmap; + p_hxge_dma_common_t dmap; + p_rx_msg_t *rx_msg_ring; + p_rx_msg_t rx_msg_p; rdc_rbr_cfg_a_t *rcfga_p; rdc_rbr_cfg_b_t *rcfgb_p; rdc_rcr_cfg_a_t *cfga_p; @@ -2580,7 +2580,7 @@ hxge_map_rxdma_channel_cfg_ring(p_hxge_t hxgep, uint16_t dma_channel, uint32_t bkaddr; hxge_status_t status = HXGE_OK; int i; - uint32_t hxge_port_rcr_size; + uint32_t hxge_port_rcr_size; HXGE_DEBUG_MSG((hxgep, MEM2_CTL, "==> hxge_map_rxdma_channel_cfg_ring")); @@ -3535,7 +3535,7 @@ hxge_rxdma_handle_sys_errors(p_hxge_t hxgep) if (stat.bits.rx_ctrl_fifo_ded) { /* Global fatal error encountered */ statsp->ctrl_fifo_ded++; - HXGE_FM_REPORT_ERROR(hxgep, NULL, + HXGE_FM_REPORT_ERROR(hxgep, 0, HXGE_FM_EREPORT_RDMC_CTRL_FIFO_DED); HXGE_ERROR_MSG((hxgep, HXGE_ERR_CTL, "==> hxge_rxdma_handle_sys_errors: " @@ -3553,7 +3553,7 @@ hxge_rxdma_handle_sys_errors(p_hxge_t hxgep) if (stat.bits.rx_data_fifo_ded) { /* Global fatal error encountered */ statsp->data_fifo_ded++; - HXGE_FM_REPORT_ERROR(hxgep, NULL, + HXGE_FM_REPORT_ERROR(hxgep, 0, HXGE_FM_EREPORT_RDMC_DATA_FIFO_DED); HXGE_ERROR_MSG((hxgep, HXGE_ERR_CTL, "==> hxge_rxdma_handle_sys_errors: " @@ -3576,7 +3576,7 @@ static hxge_status_t hxge_rxdma_fatal_err_recover(p_hxge_t hxgep, uint16_t channel) { hpi_handle_t handle; - hpi_status_t rs = HPI_SUCCESS; + hpi_status_t rs = HPI_SUCCESS; p_rx_rbr_ring_t rbrp; p_rx_rcr_ring_t rcrp; p_rx_mbox_t mboxp; diff --git a/usr/src/uts/common/io/hxge/hxge_txdma.c b/usr/src/uts/common/io/hxge/hxge_txdma.c index deb5c2b3a1..cf5d0f3eb2 100644 --- a/usr/src/uts/common/io/hxge/hxge_txdma.c +++ b/usr/src/uts/common/io/hxge/hxge_txdma.c @@ -2684,7 +2684,7 @@ hxge_txdma_handle_sys_errors(p_hxge_t hxgep) tdc_sys_stats = &hxgep->statsp->tdc_sys_stats; if (fifo_stat.bits.reord_tbl_par_err) { tdc_sys_stats->reord_tbl_par_err++; - HXGE_FM_REPORT_ERROR(hxgep, NULL, + HXGE_FM_REPORT_ERROR(hxgep, 0, HXGE_FM_EREPORT_TDMC_REORD_TBL_PAR); HXGE_ERROR_MSG((hxgep, HXGE_ERR_CTL, "==> hxge_txdma_handle_sys_errors: fatal error: " @@ -2693,7 +2693,7 @@ hxge_txdma_handle_sys_errors(p_hxge_t hxgep) if (fifo_stat.bits.reord_buf_ded_err) { tdc_sys_stats->reord_buf_ded_err++; - HXGE_FM_REPORT_ERROR(hxgep, NULL, + HXGE_FM_REPORT_ERROR(hxgep, 0, HXGE_FM_EREPORT_TDMC_REORD_BUF_DED); HXGE_ERROR_MSG((hxgep, HXGE_ERR_CTL, "==> hxge_txdma_handle_sys_errors: " diff --git a/usr/src/uts/common/os/sysent.c b/usr/src/uts/common/os/sysent.c index 554ba1b881..fb64000e4d 100644 --- a/usr/src/uts/common/os/sysent.c +++ b/usr/src/uts/common/os/sysent.c @@ -28,7 +28,7 @@ */ /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ -/* All Rights Reserved */ +/* All Rights Reserved */ #include <sys/param.h> #include <sys/types.h> @@ -355,11 +355,11 @@ typedef int64_t (*llfcn_t)(); /* for casting one-word returns */ */ /* returns a 64-bit quantity for both ABIs */ #define SYSENT_C(name, call, narg) \ - { (narg), SE_64RVAL, NULL, NULL, (llfcn_t)(call) } + { (narg), SE_64RVAL, NULL, NULL, (llfcn_t)(uintptr_t)(call) } /* returns one 32-bit value for both ABIs: r_val1 */ #define SYSENT_CI(name, call, narg) \ - { (narg), SE_32RVAL1, NULL, NULL, (llfcn_t)(call) } + { (narg), SE_32RVAL1, NULL, NULL, (llfcn_t)(uintptr_t)(call) } /* returns 2 32-bit values: r_val1 & r_val2 */ #define SYSENT_2CI(name, call, narg) \ @@ -420,7 +420,7 @@ typedef int64_t (*llfcn_t)(); /* for casting one-word returns */ * Initialization macro for loadable native system calls. */ #define SYSENT_LOADABLE() \ - { 0, SE_LOADABLE, (int (*)())nosys, NULL, loadable_syscall } + { 0, SE_LOADABLE, nosys32, NULL, loadable_syscall } /* * Initialization macro for loadable 32-bit compatibility system calls. @@ -622,7 +622,7 @@ struct sysent sysent[NSYSCALL] = /* 157 */ SYSENT_CI("getitimer", getitimer, 2), /* 158 */ SYSENT_CI("setitimer", setitimer, 3), /* 159 */ SYSENT_CI("lwp_create", syslwp_create, 3), - /* 160 */ SYSENT_CI("lwp_exit", (int (*)())syslwp_exit, 0), + /* 160 */ SYSENT_CI("lwp_exit", syslwp_exit, 0), /* 161 */ SYSENT_CI("lwp_suspend", syslwp_suspend, 1), /* 162 */ SYSENT_CI("lwp_continue", syslwp_continue, 1), /* 163 */ SYSENT_CI("lwp_kill", lwp_kill, 2), @@ -820,7 +820,7 @@ extern int ucredsys32(int, int, caddr32_t); struct sysent sysent32[NSYSCALL] = { /* 0 */ SYSENT_C("indir", indir, 1), - /* 1 */ SYSENT_CI("exit", (int (*)())rexit, 1), + /* 1 */ SYSENT_CI("exit", rexit, 1), /* 2 */ SYSENT_CI("psecflags", psecflags, 3), /* 3 */ SYSENT_CI("read", read32, 3), /* 4 */ SYSENT_CI("write", write32, 3), @@ -983,7 +983,7 @@ struct sysent sysent32[NSYSCALL] = /* 157 */ SYSENT_CI("getitimer", getitimer, 2), /* 158 */ SYSENT_CI("setitimer", setitimer, 3), /* 159 */ SYSENT_CI("lwp_create", syslwp_create, 3), - /* 160 */ SYSENT_CI("lwp_exit", (int (*)())syslwp_exit, 0), + /* 160 */ SYSENT_CI("lwp_exit", syslwp_exit, 0), /* 161 */ SYSENT_CI("lwp_suspend", syslwp_suspend, 1), /* 162 */ SYSENT_CI("lwp_continue", syslwp_continue, 1), /* 163 */ SYSENT_CI("lwp_kill", lwp_kill, 2), diff --git a/usr/src/uts/common/sys/dld_impl.h b/usr/src/uts/common/sys/dld_impl.h index 81708aad38..336fa9cb67 100644 --- a/usr/src/uts/common/sys/dld_impl.h +++ b/usr/src/uts/common/sys/dld_impl.h @@ -331,7 +331,7 @@ typedef struct dld_ap { \ mutex_enter(&(dsp)->ds_lock); \ if ((dsp)->ds_dlstate != DL_IDLE || \ - !mac_tx_is_flow_blocked((dsp)->ds_mch, NULL)) { \ + !mac_tx_is_flow_blocked((dsp)->ds_mch, 0)) { \ if ((dsp)->ds_tx_flow_mp == NULL) \ (dsp)->ds_tx_flow_mp = getq(q); \ ASSERT((dsp)->ds_tx_flow_mp != NULL); \ |