diff options
author | Dan McDonald <danmcd@joyent.com> | 2021-05-10 14:34:28 -0400 |
---|---|---|
committer | Dan McDonald <danmcd@joyent.com> | 2021-05-10 14:34:30 -0400 |
commit | ef91a17a6ebaa4665ea40b866772359daad463c6 (patch) | |
tree | 6fa31041aff843b53e782cc6ae2ebde56ca96f64 | |
parent | 12bad196f1094a80f75f7004b6d17522f833ca15 (diff) | |
parent | eee96f107560ac00d5cc32e4aa8a02376aaf19d4 (diff) | |
download | illumos-joyent-ef91a17a6ebaa4665ea40b866772359daad463c6.tar.gz |
[illumos-gate merge]
commit eee96f107560ac00d5cc32e4aa8a02376aaf19d4
13747 udfs: variable may be used uninitialized
commit 920f538e9d81325e0e046cbc740f5c127eaee05a
13748 ypcmd: variable may be used uninitialized
commit c6c850bf6e55f15fd8f56fb2e2c696a02b87948d
13746 statd: variable may be used uninitialized
commit 826703e5ab8201460531b75273c9fa3814413cd9
13760 luxadm: variable may be used uninitialized
commit a16c2dd277fe07b088b1a5da5b953f5415ce55ec
13717 kernel fpu use can still lead to panic
commit 55dca7cbc3def8d68188566c201eb08bfa439fde
13709 sparc: we should be able to read boot_archive in cpio format
commit e476cc14bc84d0f0ee2be4b969d558ef54fd2d8f
13779 su: cast between incompatible function types
commit 2696d28bdff8fd7efcfc04100ee084df09358c52
13773 zs: cast between incompatible function types
commit e3d11eee533a61e848d8b250c8db63f7cb855904
13629 nxge: build errors with gcc 10
commit 1ba081ee9f36cc673e86a7218c97c558c5b193e1
13782 Add missing capabilities for SPARC T4
commit aec0cbfb50629fbd4e80cf64ed4d22f1bb36a1f0
13771 util-tests: create svr4pkg tests
commit 2663b0582183d1cc1437bc1462ecd94eca977da2
13411 zfs_mount_all_mountpoints.ksh: cleanup_all should leave pool root mounted
commit 8459c777fc1aaabb2f7dad05de1313aa169417cd
11245 zfstest rename_dirs_001_pos RENAME_DIRS is undefined
commit c778cbeb4bc8b9609f43b41183c6c774f574a9c2
13745 Make SMBsrv compatible with Modern Cups/ OpenPrinting Cups
commit 9facd51aead02cdbd00e66663a6c34c9254ed0e7
13766 Restore ARC MFU/MRU pressure
Conflicts:
usr/src/pkg/manifests/system-test-utiltest.mf
usr/src/test/util-tests/tests/Makefile
72 files changed, 1522 insertions, 555 deletions
diff --git a/usr/src/Makefile.psm b/usr/src/Makefile.psm index a178b2a208..ba06a3fd2a 100644 --- a/usr/src/Makefile.psm +++ b/usr/src/Makefile.psm @@ -94,13 +94,13 @@ ROOT_PSM_PCBE_DIR = $(ROOT_PSM_PCBE_DIR_$(CLASS)) ROOT_PSM_BRAND_DIR = $(ROOT_PSM_BRAND_DIR_$(CLASS)) ROOT_PSM_MOD_DIRS_32 = $(ROOT_PSM_DRV_DIR_32) -ROOT_PSM_MOD_DIRS_32 += $(ROOT_PSM_EXEC_DIR_32) $(ROOT_PSM_FS_DIR_32) -ROOT_PSM_MOD_DIRS_32 += $(ROOT_PSM_SCHED_DIR_32) $(ROOT_PSM_STRMOD_DIR_32) -ROOT_PSM_MOD_DIRS_32 += $(ROOT_PSM_SYS_DIR_32) $(ROOT_PSM_MISC_DIR_32) +ROOT_PSM_MOD_DIRS_32 += $(ROOT_PSM_EXEC_DIR_32) $(ROOT_PSM_FS_DIR_32) +ROOT_PSM_MOD_DIRS_32 += $(ROOT_PSM_SCHED_DIR_32) $(ROOT_PSM_STRMOD_DIR_32) +ROOT_PSM_MOD_DIRS_32 += $(ROOT_PSM_SYS_DIR_32) $(ROOT_PSM_MISC_DIR_32) ROOT_PSM_MOD_DIRS_32 += $(ROOT_PSM_KGSS_DIR_32) -ROOT_PSM_MOD_DIRS_32 += $(ROOT_PSM_MACH_DIR_32) $(ROOT_PSM_CPU_DIR_32) -ROOT_PSM_MOD_DIRS_32 += $(ROOT_PSM_TOD_DIR_32) -ROOT_PSM_MOD_DIRS_32 += $(ROOT_PSM_MMU_DIR_32) +ROOT_PSM_MOD_DIRS_32 += $(ROOT_PSM_MACH_DIR_32) $(ROOT_PSM_CPU_DIR_32) +ROOT_PSM_MOD_DIRS_32 += $(ROOT_PSM_TOD_DIR_32) +ROOT_PSM_MOD_DIRS_32 += $(ROOT_PSM_MMU_DIR_32) ROOT_PSM_MOD_DIRS_32 += $(ROOT_PSM_DACF_DIR_32) ROOT_PSM_MOD_DIRS_32 += $(ROOT_PSM_CRYPTO_DIR_32) ROOT_PSM_MOD_DIRS_32 += $(ROOT_PSM_PCBE_DIR_32) @@ -111,6 +111,7 @@ ROOT_PSM_LIB_UFS_DIR = $(ROOT_PSM_LIB_FS_DIR)/ufs ROOT_PSM_LIB_NFS_DIR = $(ROOT_PSM_LIB_FS_DIR)/nfs ROOT_PSM_LIB_HSFS_DIR = $(ROOT_PSM_LIB_FS_DIR)/hsfs ROOT_PSM_LIB_ZFS_DIR = $(ROOT_PSM_LIB_FS_DIR)/zfs +ROOT_PSM_LIB_CPIO_DIR = $(ROOT_PSM_LIB_FS_DIR)/cpio USR_PLAT_DIR = $(ROOT)/usr/platform @@ -125,14 +126,15 @@ USR_PSM_SBIN_DIR = $(USR_PSM_DIR)/sbin USR_PSM_ISYS_DIR = $(USR_PSM_INCL_DIR)/sys USR_PSM_IVM_DIR = $(USR_PSM_INCL_DIR)/vm -USR_PSM_LIB_ABI_DIR = $(USR_PSM_LIB_DIR)/abi -USR_PSM_LIB_ABI_DIR_64 = $(USR_PSM_LIB_ABI_DIR)/$(MACH64) +USR_PSM_LIB_ABI_DIR = $(USR_PSM_LIB_DIR)/abi +USR_PSM_LIB_ABI_DIR_64 = $(USR_PSM_LIB_ABI_DIR)/$(MACH64) USR_PSM_LIB_FS_DIR = $(USR_PSM_LIB_DIR)/fs USR_PSM_LIB_UFS_DIR = $(USR_PSM_LIB_FS_DIR)/ufs USR_PSM_LIB_NFS_DIR = $(USR_PSM_LIB_FS_DIR)/nfs USR_PSM_LIB_HSFS_DIR = $(USR_PSM_LIB_FS_DIR)/hsfs USR_PSM_LIB_ZFS_DIR = $(USR_PSM_LIB_FS_DIR)/zfs +USR_PSM_LIB_CPIO_DIR = $(USR_PSM_LIB_FS_DIR)/cpio USR_PSM_DRV_DIR_32 = $(USR_PSM_MOD_DIR)/drv USR_PSM_EXEC_DIR_32 = $(USR_PSM_MOD_DIR)/exec @@ -162,9 +164,9 @@ USR_PSM_MISC_DIR = $(USR_PSM_MISC_DIR_$(CLASS)) USR_PSM_DACF_DIR = $(USR_PSM_DACF_DIR_$(CLASS)) USR_PSM_MOD_DIRS_32 = $(USR_PSM_DRV_DIR_32) -USR_PSM_MOD_DIRS_32 += $(USR_PSM_EXEC_DIR_32) $(USR_PSM_FS_DIR_32) -USR_PSM_MOD_DIRS_32 += $(USR_PSM_SCHED_DIR_32) $(USR_PSM_STRMOD_DIR_32) -USR_PSM_MOD_DIRS_32 += $(USR_PSM_SYS_DIR_32) $(USR_PSM_MISC_DIR_32) +USR_PSM_MOD_DIRS_32 += $(USR_PSM_EXEC_DIR_32) $(USR_PSM_FS_DIR_32) +USR_PSM_MOD_DIRS_32 += $(USR_PSM_SCHED_DIR_32) $(USR_PSM_STRMOD_DIR_32) +USR_PSM_MOD_DIRS_32 += $(USR_PSM_SYS_DIR_32) $(USR_PSM_MISC_DIR_32) USR_PSM_MOD_DIRS_32 += $(USR_PSM_DACF_DIR_32) # diff --git a/usr/src/Makefile.psm.targ b/usr/src/Makefile.psm.targ index 6365e9c35a..9c19babf3f 100644 --- a/usr/src/Makefile.psm.targ +++ b/usr/src/Makefile.psm.targ @@ -121,7 +121,8 @@ $(ROOT_PSM_LIB_FS_DIR): $(ROOT_PSM_LIB_DIR) $(ROOT_PSM_LIB_UFS_DIR) \ $(ROOT_PSM_LIB_NFS_DIR) \ $(ROOT_PSM_LIB_HSFS_DIR) \ -$(ROOT_PSM_LIB_ZFS_DIR): $(ROOT_PSM_LIB_FS_DIR) +$(ROOT_PSM_LIB_ZFS_DIR) \ +$(ROOT_PSM_LIB_CPIO_DIR): $(ROOT_PSM_LIB_FS_DIR) $(INS.dir) $(ROOT_PSM_LIB_UFS_DIR)/%: % $(ROOT_PSM_LIB_UFS_DIR) @@ -136,6 +137,9 @@ $(ROOT_PSM_LIB_HSFS_DIR)/%: % $(ROOT_PSM_LIB_HSFS_DIR) $(ROOT_PSM_LIB_ZFS_DIR)/%: % $(ROOT_PSM_LIB_ZFS_DIR) $(INS.file) +$(ROOT_PSM_LIB_CPIO_DIR)/%: % $(ROOT_PSM_LIB_CPIO_DIR) + $(INS.file) + # # # @@ -156,7 +160,8 @@ $(USR_PSM_LIB_FS_DIR): $(USR_PSM_LIB_DIR) $(LINKED_LIB_FS_DIRS) $(USR_PSM_LIB_UFS_DIR) \ $(USR_PSM_LIB_NFS_DIR) \ $(USR_PSM_LIB_HSFS_DIR) \ -$(USR_PSM_LIB_ZFS_DIR): $(USR_PSM_LIB_FS_DIR) +$(USR_PSM_LIB_ZFS_DIR) \ +$(USR_PSM_LIB_CPIO_DIR): $(USR_PSM_LIB_FS_DIR) -$(INS.dir) $(USR_PSM_MOD_DIR): $(USR_PSM_DIR) @@ -199,6 +204,9 @@ $(USR_PSM_LIB_HSFS_DIR)/%: % $(USR_PSM_LIB_HSFS_DIR) $(USR_PSM_LIB_ZFS_DIR)/%: % $(USR_PSM_LIB_ZFS_DIR) $(RM) -r $@ ; $(SYMLINK) $(BOOTBLK_LINK) $@ +$(USR_PSM_LIB_CPIO_DIR)/%: % $(USR_PSM_LIB_CPIO_DIR) + $(RM) -r $@ ; $(SYMLINK) $(BOOTBLK_LINK) $@ + $(USR_PSM_MOD_DIR)/%: % $(USR_PSM_MOD_DIR) $(INS.file) diff --git a/usr/src/cmd/fs.d/nfs/statd/Makefile b/usr/src/cmd/fs.d/nfs/statd/Makefile index adb5cd9dd5..2ce2aceb99 100644 --- a/usr/src/cmd/fs.d/nfs/statd/Makefile +++ b/usr/src/cmd/fs.d/nfs/statd/Makefile @@ -39,10 +39,8 @@ ATTMK= $(TYPEPROG) include ../../Makefile.fstype CPPFLAGS += -D_REENTRANT -DSUN_THREADS -CERRWARN += -_gcc=-Wno-unused-variable CERRWARN += -_gcc=-Wno-switch CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += $(CNOWARN_UNINIT) # not linted SMATCH=off diff --git a/usr/src/cmd/fs.d/nfs/statd/sm_statd.c b/usr/src/cmd/fs.d/nfs/statd/sm_statd.c index b8d97b7571..3f99292dbe 100644 --- a/usr/src/cmd/fs.d/nfs/statd/sm_statd.c +++ b/usr/src/cmd/fs.d/nfs/statd/sm_statd.c @@ -545,8 +545,6 @@ statd_call_statd(char *name) stat_chge ntf; int i; int rc; - int dummy1, dummy2, dummy3, dummy4; - char ascii_addr[MAXNAMELEN]; size_t unq_len; ntf.mon_name = hostname; @@ -944,7 +942,7 @@ move_file(char *fromdir, char *file, char *todir) int create_symlink(char *todir, char *rname, char *lname) { - int error; + int error = 0; char lpath[MAXPATHLEN]; /* @@ -1296,8 +1294,8 @@ record_addr(char *name, sa_family_t family, struct netobj *ah) int i; int path_len; char *famstr; - struct in_addr addr; - char *addr6; + struct in_addr addr = { 0 }; + char *addr6 = NULL; char ascii_addr[MAXNAMELEN]; char path[MAXPATHLEN]; diff --git a/usr/src/cmd/fs.d/udfs/Makefile b/usr/src/cmd/fs.d/udfs/Makefile index 06e6fc8f40..ecf2cdfff5 100644 --- a/usr/src/cmd/fs.d/udfs/Makefile +++ b/usr/src/cmd/fs.d/udfs/Makefile @@ -31,8 +31,6 @@ all:= TARGET= all install:= TARGET= install clean:= TARGET= clean clobber:= TARGET= clobber -lint:= TARGET= lint -putback:= TARGET= putback catalog:= TARGET= catalog # for messaging catalog @@ -44,7 +42,7 @@ POFILES= $(SUBDIR2:%=%/%.po) .PARALLEL: $(SUBDIRS) -all install: $(SUBDIRS) +all install clean clobber: $(SUBDIRS) catalog: $(POFILE) @@ -52,8 +50,6 @@ $(POFILE): $(SUBDIR2) $(RM) $@ cat $(POFILES) > $@ -clean clobber lint putback : $(SUBDIRS) - $(SUBDIRS): FRC @cd $@; pwd; $(MAKE) $(TARGET) diff --git a/usr/src/cmd/fs.d/udfs/fstyp/ud_lib.c b/usr/src/cmd/fs.d/udfs/common/ud_lib.c index f42c6eea0b..6e517c8a2e 100644 --- a/usr/src/cmd/fs.d/udfs/fstyp/ud_lib.c +++ b/usr/src/cmd/fs.d/udfs/common/ud_lib.c @@ -88,21 +88,12 @@ ud_open_dev(ud_handle_t h, char *special, uint32_t flags) (void) bzero(&i_stat, sizeof (struct stat)); (void) bzero(&r_stat, sizeof (struct stat)); + temp = special; /* * Get the stat structure */ - if (stat(special, &i_stat) < 0) { - temp = special; - } else { - - if ((i_stat.st_mode & S_IFMT) == S_IFCHR) { - - /* - * If Raw deivce is given use it as it is - */ - - temp = special; - } else if ((i_stat.st_mode & S_IFMT) == S_IFBLK) { + if (stat(special, &i_stat) == 0) { + if ((i_stat.st_mode & S_IFMT) == S_IFBLK) { /* * Block device try to convert to raw device diff --git a/usr/src/cmd/fs.d/udfs/fstyp/ud_lib.h b/usr/src/cmd/fs.d/udfs/common/ud_lib.h index 85fec4645e..6c3e560bda 100644 --- a/usr/src/cmd/fs.d/udfs/fstyp/ud_lib.h +++ b/usr/src/cmd/fs.d/udfs/common/ud_lib.h @@ -26,8 +26,6 @@ #ifndef _UD_LIB_H #define _UD_LIB_H -#pragma ident "%Z%%M% %I% %E% SMI" - #ifdef __cplusplus extern "C" { #endif diff --git a/usr/src/cmd/fs.d/udfs/fsck/Makefile b/usr/src/cmd/fs.d/udfs/fsck/Makefile index b1d9610c70..341dbf3209 100644 --- a/usr/src/cmd/fs.d/udfs/fsck/Makefile +++ b/usr/src/cmd/fs.d/udfs/fsck/Makefile @@ -38,7 +38,6 @@ UDFSDIR= ../mkfs UDFSOBJS= udfslib.o #UDFSSRCS= $(UDFSOBJS:%.o=%.c) -CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-parentheses # not linted @@ -72,21 +71,5 @@ $(POFILE): $(SRCS) sed "/^domain/d" messages.po > $@ $(RM) $(POFILE).i messages.po -lint: - $(LINT.c) -mu $(SRCS) - -clean: +clean: $(RM) $(FSCKOBJS) $(UDFSOBJS) - -putback: - -cstyle -p inode.c - -cstyle -p main.c - -cstyle -p pass1.c - -cstyle -p setup.c - -cstyle -p utilities.c - -keywords inode.c - -keywords main.c - -keywords pass1.c - -keywords setup.c - -keywords utilities.c - -keywords Makefile diff --git a/usr/src/cmd/fs.d/udfs/fsck/pass1.c b/usr/src/cmd/fs.d/udfs/fsck/pass1.c index e0c736ec2f..a7b1b2985c 100644 --- a/usr/src/cmd/fs.d/udfs/fsck/pass1.c +++ b/usr/src/cmd/fs.d/udfs/fsck/pass1.c @@ -92,11 +92,11 @@ static uint32_t baseblock; static uint8_t fidbuf[MAXFIDSIZE]; void -pass1() +pass1(void) { - register struct file_entry *fp; - register struct fileinfo *fip; - register struct bufarea *bp; + struct file_entry *fp; + struct fileinfo *fip; + struct bufarea *bp; struct file_id *fidp; struct bufarea *fbp; int err; @@ -115,7 +115,6 @@ pass1() fip->fe_block); goto next; } - /* LINTED */ fp = (struct file_entry *)bp->b_un.b_buf; fip->fe_lcount = fp->fe_lcount; fip->fe_type = fp->fe_icb_tag.itag_ftype; @@ -258,7 +257,6 @@ getallocext(struct file_entry *fp, uint32_t loc, uint32_t len) gettext("Can't read allocation extent\n")); return (1); } - /* LINTED */ aep = (struct alloc_ext_desc *)extbuf; err = verifytag(&aep->aed_tag, loc, &aep->aed_tag, UD_ALLOC_EXT_DESC); if (err) { @@ -274,10 +272,8 @@ getallocext(struct file_entry *fp, uint32_t loc, uint32_t len) /* Swap the descriptors */ for (i = 0, ap = dir_adrlist; i < dir_naddrs; i++, ap += dir_adrsize) { if (dir_adrsize == sizeof (short_ad_t)) { - /* LINTED */ ud_swap_short_ad((short_ad_t *)ap); } else if (dir_adrsize == sizeof (long_ad_t)) { - /* LINTED */ ud_swap_long_ad((long_ad_t *)ap); } } @@ -302,14 +298,13 @@ static int32_t getdir(struct file_entry *fp, struct bufarea **fbp, u_offset_t *poffset, struct file_id **fidpp) { - /* LINTED */ - register struct file_id *fidp = (struct file_id *)fidbuf; - register struct short_ad *sap; - register struct long_ad *lap; - register int i, newoff, xoff = 0; - uint32_t block = 0, nb, len, left; + struct file_id *fidp = (struct file_id *)fidbuf; + struct short_ad *sap; + struct long_ad *lap; + int i, newoff, xoff = 0; + uint32_t block = 0, nb, len = 0, left; u_offset_t offset; - int err, type; + int err, type = 0; again: @@ -332,7 +327,6 @@ again2: again3: switch (fp->fe_icb_tag.itag_flags & 0x3) { case ICB_FLAG_SHORT_AD: - /* LINTED */ sap = &((short_ad_t *)dir_adrlist)[dir_adrindx]; for (i = dir_adrindx; i < dir_naddrs; i++, sap++) { len = EXTLEN(sap->sad_ext_len); @@ -381,7 +375,6 @@ again3: dir_fidp = dirbuf; break; case ICB_FLAG_LONG_AD: - /* LINTED */ lap = &((long_ad_t *)dir_adrlist)[dir_adrindx]; for (i = dir_adrindx; i < dir_naddrs; i++, lap++) { len = EXTLEN(lap->lad_ext_len); @@ -472,15 +465,14 @@ nextone: static void ckinode(struct file_entry *fp) { - register struct short_ad *sap; - register struct long_ad *lap; - register int i, type, len; + struct short_ad *sap = NULL; + struct long_ad *lap; + int i, type, len; switch (fp->fe_icb_tag.itag_flags & 0x3) { case ICB_FLAG_SHORT_AD: dir_adrsize = sizeof (short_ad_t); dir_naddrs = fp->fe_len_adesc / sizeof (short_ad_t); - /* LINTED */ sap = (short_ad_t *)(fp->fe_spec + fp->fe_len_ear); again1: for (i = 0; i < dir_naddrs; i++, sap++) { @@ -497,7 +489,6 @@ again1: /* This changes dir_naddrs and dir_adrlist */ if (getallocext(fp, sap->sad_ext_loc, len)) break; - /* LINTED */ sap = (short_ad_t *)dir_adrlist; goto again1; } @@ -506,7 +497,6 @@ again1: case ICB_FLAG_LONG_AD: dir_adrsize = sizeof (long_ad_t); dir_naddrs = fp->fe_len_adesc / sizeof (long_ad_t); - /* LINTED */ lap = (long_ad_t *)(fp->fe_spec + fp->fe_len_ear); again2: for (i = 0; i < dir_naddrs; i++, lap++) { @@ -523,7 +513,6 @@ again2: /* This changes dir_naddrs and dir_adrlist */ if (getallocext(fp, lap->lad_ext_loc, len)) break; - /* LINTED */ lap = (long_ad_t *)dir_adrlist; goto again2; } @@ -539,14 +528,13 @@ again2: static void adjust(struct fileinfo *fip) { - register struct file_entry *fp; - register struct bufarea *bp; + struct file_entry *fp; + struct bufarea *bp; bp = getfilentry(fip->fe_block, fip->fe_len); if (bp == NULL) errexit(gettext("Unable to read file entry at %x\n"), fip->fe_block); - /* LINTED */ fp = (struct file_entry *)bp->b_un.b_buf; pwarn(gettext("LINK COUNT %s I=%x"), fip->fe_type == FTYPE_DIRECTORY ? "DIR" : @@ -571,10 +559,10 @@ adjust(struct fileinfo *fip) } void -dofreemap() +dofreemap(void) { - register int i; - register char *bp, *fp; + int i; + char *bp, *fp; struct inodesc idesc; if (freemap == NULL) @@ -602,7 +590,7 @@ dofreemap() } void -dolvint() +dolvint(void) { struct lvid_iu *lviup; struct inodesc idesc; diff --git a/usr/src/cmd/fs.d/udfs/fsck/utilities.c b/usr/src/cmd/fs.d/udfs/fsck/utilities.c index 4823b6eab3..d34eef9549 100644 --- a/usr/src/cmd/fs.d/udfs/fsck/utilities.c +++ b/usr/src/cmd/fs.d/udfs/fsck/utilities.c @@ -147,6 +147,7 @@ printfree() int i, startfree, endfree; startfree = -1; + endfree = -1; for (i = 0; i < part_len; i++) { if (!testbusy(i)) { if (startfree <= 0) diff --git a/usr/src/cmd/fs.d/udfs/fsdb/Makefile b/usr/src/cmd/fs.d/udfs/fsdb/Makefile index 44287a3cfa..63d91b80db 100644 --- a/usr/src/cmd/fs.d/udfs/fsdb/Makefile +++ b/usr/src/cmd/fs.d/udfs/fsdb/Makefile @@ -37,7 +37,7 @@ MAPFILES += $(MAPFILE.INT) $(MAPFILE.LEX) $(MAPFILE.NGB) MAPOPTS = $(MAPFILES:%=-Wl,-M%) CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -CPPFLAGS += -I../fstyp +CPPFLAGS += -I../common LDLIBS += -lmalloc -ll -ladm LDFLAGS += $(MAPOPTS) YFLAGS = "-d" @@ -45,7 +45,6 @@ YFLAGS = "-d" CERRWARN += -_gcc=-Wno-implicit-function-declaration CERRWARN += -_gcc=-Wno-unused-label CERRWARN += -_gcc=-Wno-unused-variable -CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-unused-value CERRWARN += -_gcc=-Wno-unused-function @@ -53,7 +52,7 @@ CERRWARN += -_gcc=-Wno-unused-function # not linted SMATCH=off -SRCS= fsdb.c ../fstyp/ud_lib.c +SRCS= fsdb.c ../common/ud_lib.c fsdb : fsdb_yacc.o fsdb_lex.o ud_lib.o fsdb.o $(MAPFILES) $(LINK.c) -o $@ fsdb.o fsdb_yacc.o fsdb_lex.o \ @@ -64,8 +63,8 @@ fsdb.o : fsdb.c $(COMPILE.c) -o $@ fsdb.c $(POST_PROCESS_O) -ud_lib.o : ../fstyp/ud_lib.c ../fstyp/ud_lib.h - $(COMPILE.c) -o $@ ../fstyp/ud_lib.c +ud_lib.o : ../common/ud_lib.c ../common/ud_lib.h + $(COMPILE.c) -o $@ ../common/ud_lib.c $(POST_PROCESS_O) y.tab.c : fsdb_yacc.y @@ -96,7 +95,7 @@ catalog: $(POFILE) CATSRCS= $(SRCS) lex.yy.c y.tab.c -$(POFILE): $(CATSRCS) ../fstyp/ud_lib.h +$(POFILE): $(CATSRCS) ../common/ud_lib.h $(RM) $@ $(COMPILE.cpp) $(CATSRCS) > $(POFILE).i $(XGETTEXT) $(XGETFLAGS) $(POFILE).i diff --git a/usr/src/cmd/fs.d/udfs/fsdb/fsdb.c b/usr/src/cmd/fs.d/udfs/fsdb/fsdb.c index df32173c13..900b7f0e30 100644 --- a/usr/src/cmd/fs.d/udfs/fsdb/fsdb.c +++ b/usr/src/cmd/fs.d/udfs/fsdb/fsdb.c @@ -812,6 +812,8 @@ get_blkno(uint32_t inode, uint32_t *blkno, uint64_t off) return (1); } desc_type = SWAP_16(fe->fe_icb_tag.itag_flags) & 0x7; + sad = NULL; + lad = NULL; if (desc_type == ICB_FLAG_SHORT_AD) { elen = sizeof (struct short_ad); /* LINTED */ @@ -840,14 +842,21 @@ get_blkno(uint32_t inode, uint32_t *blkno, uint64_t off) in = inode; de_count = nent; for (d = 0, i = 0; i < nent; i++) { - if (desc_type == ICB_FLAG_SHORT_AD) { + switch (desc_type) { + case ICB_FLAG_SHORT_AD: prn = 0; bno = SWAP_32(sad->sad_ext_loc); len = SWAP_32(sad->sad_ext_len); - } else if (desc_type == ICB_FLAG_LONG_AD) { + break; + case ICB_FLAG_LONG_AD: prn = SWAP_16(lad->lad_ext_prn); bno = SWAP_32(lad->lad_ext_loc); len = SWAP_32(lad->lad_ext_len); + break; + default: + prn = 0; + bno = 0; + len = 0; } flags = len >> 30; if (flags == 0x3) { diff --git a/usr/src/cmd/fs.d/udfs/fstyp/Makefile b/usr/src/cmd/fs.d/udfs/fstyp/Makefile index 3406009369..2c32170e8f 100644 --- a/usr/src/cmd/fs.d/udfs/fstyp/Makefile +++ b/usr/src/cmd/fs.d/udfs/fstyp/Makefile @@ -25,7 +25,7 @@ FSTYP_VERS=1 FSTYPE= udfs -LIBPROG= fstyp.so.${FSTYP_VERS} +LIBPROG= fstyp.so.${FSTYP_VERS} include ../../../../lib/Makefile.lib include ../../Makefile.fstype @@ -37,13 +37,9 @@ CFLAGS += $(C_PICFLAGS) DYNLIB= $(LIBPROG) CERRWARN += -_gcc=-Wno-unused-function -CERRWARN += $(CNOWARN_UNINIT) LDLIBS += -lnvpair -ladm -lc -LINTFLAGS += -erroff=E_STATIC_UNUSED -erroff=E_NAME_DEF_NOT_USED2 -LINTFLAGS64 += -erroff=E_STATIC_UNUSED -erroff=E_NAME_DEF_NOT_USED2 - # # Override PMAP dependency # @@ -56,7 +52,9 @@ OBJS= fstyp.o ud_lib.o SRCS= $(OBJS:%.o=%.c) -CPPFLAGS += -DFSTYP_VERS=${FSTYP_VERS} -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 +CPPFLAGS += -I../common +CPPFLAGS += -DFSTYP_VERS=${FSTYP_VERS} +CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 $(LIBPROG): $(OBJS) $(LINK.c) $(CPPFLAGS) $(CFLAGS) $(DYNFLAGS) $(GSHARED) -o $@ $(OBJS) \ @@ -67,6 +65,10 @@ $(LIBPROG): $(OBJS) $(COMPILE.c) -o $@ $< $(POST_PROCESS_O) +%.o: ../common/%.c + $(COMPILE.c) -o $@ $< + $(POST_PROCESS_O) + .KEEP_STATE: all: $(LIBPROG) @@ -75,10 +77,5 @@ install: all $(RM) $(ROOTLIBFSTYPE)/fstyp $(LN) $(ROOTUSRSBIN)/fstyp $(ROOTLIBFSTYPE)/fstyp -lint: lint_SRCS - -cstyle: - $(CSTYLE) $(SRCS) - -clean: +clean: $(RM) $(OBJS) diff --git a/usr/src/cmd/fs.d/udfs/labelit/Makefile b/usr/src/cmd/fs.d/udfs/labelit/Makefile index a21bc6ad8a..6fd8f55224 100644 --- a/usr/src/cmd/fs.d/udfs/labelit/Makefile +++ b/usr/src/cmd/fs.d/udfs/labelit/Makefile @@ -34,22 +34,18 @@ include ../../Makefile.fstype LDLIBS += -ladm CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -CPPFLAGS += -I../fstyp - -LINTFLAGS += -xerroff=E_STATIC_UNUSED -LINTFLAGS64 += -xerroff=E_STATIC_UNUSED +CPPFLAGS += -I../common CERRWARN += -_gcc=-Wno-unused-function -CERRWARN += $(CNOWARN_UNINIT) labelit : labelit.o ud_lib.o $(LINK.c) -o $@ labelit.o ud_lib.o $(LDLIBS) $(POST_PROCESS) -labelit.o : labelit.c ../fstyp/ud_lib.h +labelit.o : labelit.c ../common/ud_lib.h -ud_lib.o : ../fstyp/ud_lib.c ../fstyp/ud_lib.h - $(COMPILE.c) -o $@ ../fstyp/ud_lib.c +ud_lib.o : ../common/ud_lib.c ../common/ud_lib.h + $(COMPILE.c) -o $@ ../common/ud_lib.c $(POST_PROCESS_O) # for messaging catalog @@ -60,7 +56,7 @@ POFILE= labelit.po # catalog: $(POFILE) -$(POFILE): $(SRCS) ../fstyp/ud_lib.h +$(POFILE): $(SRCS) ../common/ud_lib.h $(RM) $@ $(COMPILE.cpp) $(SRCS) > $(POFILE).i $(XGETTEXT) $(XGETFLAGS) $(POFILE).i @@ -69,11 +65,3 @@ $(POFILE): $(SRCS) ../fstyp/ud_lib.h clean : rm -f labelit.o ud_lib.o - -lint: - $(LINT.c) -mu $(SRCS) - -putback: - -cstyle -p labelit.c - -keywords labelit.c - -keywords Makefile diff --git a/usr/src/cmd/fs.d/udfs/mkfs/Makefile b/usr/src/cmd/fs.d/udfs/mkfs/Makefile index a2fbab17ab..e52bd8ad60 100644 --- a/usr/src/cmd/fs.d/udfs/mkfs/Makefile +++ b/usr/src/cmd/fs.d/udfs/mkfs/Makefile @@ -47,7 +47,6 @@ UDFSDIR= ../../../../uts/common/fs/ufs UDFSOBJS= CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += $(CNOWARN_UNINIT) # not linted SMATCH=off @@ -62,15 +61,5 @@ $(LIBPROG): $(OBJS) %.o: $(UDFSDIR)/%.c $(COMPILE.c) $< -lint: - $(LINT.c) -mu $(SRCS) - -clean: +clean: $(RM) $(OBJS) - -putback: - -cstyle -p mkfs.c - -cstyle -p udfslib.c - -keywords mkfs.c - -keywords udfslib.c - -keywords Makefile diff --git a/usr/src/cmd/fs.d/udfs/mkfs/mkfs.c b/usr/src/cmd/fs.d/udfs/mkfs/mkfs.c index 2b4f4e3243..115ada72ff 100644 --- a/usr/src/cmd/fs.d/udfs/mkfs/mkfs.c +++ b/usr/src/cmd/fs.d/udfs/mkfs/mkfs.c @@ -602,7 +602,7 @@ wtvolseq(tag_t *tp, daddr_t blk1, daddr_t blk2) } static void -volseqinit() +volseqinit(void) { struct tag *tp; struct nsr_desc *nsp; @@ -1181,7 +1181,7 @@ wtfs(daddr_t bno, int size, char *bf) } static void -usage() +usage(void) { (void) fprintf(stderr, gettext("udfs usage: mkfs [-F FSType] [-V]" @@ -1331,7 +1331,7 @@ true: } static uint32_t -get_bsize() +get_bsize(void) { struct dk_cinfo info; struct fd_char fd_char; @@ -1382,14 +1382,14 @@ get_bsize() * Read in the volume sequences descriptors. */ static int -readvolseq() +readvolseq(void) { struct tag *tp; uint8_t *cp, *end; int err; struct pri_vol_desc *pvolp; - struct part_desc *partp; - struct log_vol_desc *logvp; + struct part_desc *partp = NULL; + struct log_vol_desc *logvp = NULL; struct anch_vol_desc_ptr *avp; char *main_vdbuf; uint32_t nextblock; @@ -1461,7 +1461,7 @@ done: } uint32_t -get_last_block() +get_last_block(void) { struct vtoc vtoc; struct dk_cinfo dki_info; diff --git a/usr/src/cmd/fs.d/udfs/mount/Makefile b/usr/src/cmd/fs.d/udfs/mount/Makefile index dd156065d4..459ec3b1da 100644 --- a/usr/src/cmd/fs.d/udfs/mount/Makefile +++ b/usr/src/cmd/fs.d/udfs/mount/Makefile @@ -19,9 +19,6 @@ # # CDDL HEADER END # -# -#pragma ident "%Z%%M% %I% %E% SMI" -# # Copyright 2003 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # diff --git a/usr/src/cmd/luxadm/Makefile b/usr/src/cmd/luxadm/Makefile index 77781b9202..bdc40225cf 100644 --- a/usr/src/cmd/luxadm/Makefile +++ b/usr/src/cmd/luxadm/Makefile @@ -39,7 +39,6 @@ POFILE = luxadm.po include ../Makefile.cmd CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-unused-label CERRWARN += -_gcc=-Wno-address @@ -57,14 +56,6 @@ INCS += -I$(SRC)/lib/sun_fc/common CPPFLAGS += -D_LARGEFILE64_SOURCE=1 -D_REENTRANT $(INCS) -LINTFLAGS += -erroff=E_FUNC_RET_MAYBE_IGNORED2 -LINTFLAGS += -erroff=E_SEC_PRINTF_VAR_FMT -LINTFLAGS += -erroff=E_SEC_SPRINTF_UNBOUNDED_COPY -LINTFLAGS += -erroff=E_NAME_USED_NOT_DEF2 -LINTFLAGS += -erroff=E_BAD_FORMAT_ARG_TYPE2 -LINTFLAGS += -erroff=E_SEC_FORBIDDEN_WARN_GETS -LINTFLAGS += -erroff=E_SEC_SCANF_UNBOUNDED_COPY - ROOTUSRSBINLINKS = $(PROG:%=$(ROOTUSRSBIN)/%) .KEEP_STATE: @@ -109,6 +100,4 @@ $(POFILE): $(POFILES) clean: $(RM) $(OBJS) $(PROG) $(GENCAT_PROG) $(GENMSG_LUX) -lint: lint_SRCS - include ../Makefile.targ diff --git a/usr/src/cmd/luxadm/adm.c b/usr/src/cmd/luxadm/adm.c index b8c0253b4f..d2507f9fb2 100644 --- a/usr/src/cmd/luxadm/adm.c +++ b/usr/src/cmd/luxadm/adm.c @@ -23,12 +23,6 @@ * Use is subject to license terms. */ - - - -/*LINTLIBRARY*/ - - /* * Administration program for SENA * subsystems and individual FC_AL devices. @@ -441,7 +435,7 @@ getaction(char *cmd, struct keyword *matches, int *retval) int main(int argc, char **argv) { -register int c; +register int c; /* getopt varbs */ extern char *optarg; char *optstring = NULL; @@ -450,7 +444,7 @@ int cmd = 0; /* Cmd verb from cmd line */ int exit_code = 0; /* exit code for program */ int temp_fd; /* For -f option */ char *file_name = NULL; -int option_t_input; +int option_t_input = 0; char *path_phys = NULL; int USE_FCHBA = 0; diff --git a/usr/src/cmd/luxadm/fchba.c b/usr/src/cmd/luxadm/fchba.c index b353532d10..af5fff2a32 100644 --- a/usr/src/cmd/luxadm/fchba.c +++ b/usr/src/cmd/luxadm/fchba.c @@ -889,7 +889,7 @@ fchba_dump_map(char **argv) HBA_FCPTARGETMAPPINGV2 *map; HBA_STATUS status; int count, adapterIndex, portIndex, mapIndex, discIndex; - char name[256], *physical, *comp_phys; + char name[256], *physical = NULL, *comp_phys = NULL; L_inquiry inq; struct scsi_extended_sense sense; HBA_UINT8 scsiStatus; @@ -1099,7 +1099,7 @@ fchba_display_link_status(char **argv) HBA_FCPTARGETMAPPINGV2 *map; HBA_STATUS status; int count, adapterIndex, portIndex, discIndex; - char name[256], *physical, *comp_phys; + char name[256], *physical = NULL, *comp_phys = NULL; int matched; struct fc_rls_acc_params rls; uint32_t rls_size = sizeof (rls); @@ -2073,6 +2073,8 @@ devctl_hdl_t dcp; case DEV_OFFLINE: exit_code = devctl_device_offline(dcp); break; + default: + exit_code = 0; } if (exit_code != 0) { diff --git a/usr/src/cmd/smbsrv/smbd/smbd_spool.c b/usr/src/cmd/smbsrv/smbd/smbd_spool.c index a0e832525e..596b0125ba 100644 --- a/usr/src/cmd/smbsrv/smbd/smbd_spool.c +++ b/usr/src/cmd/smbsrv/smbd/smbd_spool.c @@ -77,12 +77,13 @@ typedef struct smb_cups_ops { void (*cupsFreeDests)(int, cups_dest_t *); ipp_t *(*cupsDoFileRequest)(http_t *, ipp_t *, const char *, const char *); - ipp_t *(*ippNew)(); + ipp_t *(*ippNewRequest)(); void (*ippDelete)(); char *(*ippErrorString)(); ipp_attribute_t *(*ippAddString)(); void (*httpClose)(http_t *); http_t *(*httpConnect)(const char *, int); + ipp_status_t (*ippGetStatusCode)(ipp_t *); } smb_cups_ops_t; static uint32_t smbd_cups_jobnum = 1; @@ -198,7 +199,6 @@ smbd_spool_copyfile(smb_inaddr_t *ipaddr, char *username, char *path, http_t *http = NULL; /* HTTP connection to server */ ipp_t *request = NULL; /* IPP Request */ ipp_t *response = NULL; /* IPP Response */ - cups_lang_t *language = NULL; /* Default language */ char uri[HTTP_MAX_URI]; /* printer-uri attribute */ char new_jobname[SMBD_PJOBLEN]; smbd_printjob_t pjob; @@ -233,22 +233,12 @@ smbd_spool_copyfile(smb_inaddr_t *ipaddr, char *username, char *path, return; } - if ((request = cups->ippNew()) == NULL) { + if ((request = cups->ippNewRequest(IPP_PRINT_JOB)) == NULL) { syslog(LOG_INFO, "smbd_spool_copyfile: ipp not running"); return; } - request->request.op.operation_id = IPP_PRINT_JOB; - request->request.op.request_id = 1; - language = cups->cupsLangDefault(); - - cups->ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET, - "attributes-charset", NULL, cups->cupsLangEncoding(language)); - - cups->ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE, - "attributes-natural-language", NULL, language->language); - (void) snprintf(uri, sizeof (uri), "ipp://localhost/printers/%s", SMBD_PRINTER); pjob.pj_pid = pthread_self(); @@ -291,7 +281,7 @@ smbd_spool_copyfile(smb_inaddr_t *ipaddr, char *username, char *path, response = cups->cupsDoFileRequest(http, request, uri, pjob.pj_filename); if (response != NULL) { - if (response->request.status.status_code >= IPP_OK_CONFLICT) { + if (cups->ippGetStatusCode(response) >= IPP_OK_CONFLICT) { syslog(LOG_ERR, "smbd_spool_copyfile: printer %s: %s", SMBD_PRINTER, @@ -313,9 +303,6 @@ out: if (response) cups->ippDelete(response); - if (language) - cups->cupsLangFree(language); - if (http) cups->httpClose(http); } @@ -358,12 +345,15 @@ smbd_cups_init(void) smb_cups.httpConnect = (http_t *(*)(const char *, int)) dlsym(smb_cups.cups_hdl, "httpConnect"); - smb_cups.ippNew = (ipp_t *(*)())dlsym(smb_cups.cups_hdl, "ippNew"); + smb_cups.ippNewRequest = (ipp_t *(*)()) + dlsym(smb_cups.cups_hdl, "ippNewRequest"); smb_cups.ippDelete = (void (*)())dlsym(smb_cups.cups_hdl, "ippDelete"); smb_cups.ippErrorString = (char *(*)()) dlsym(smb_cups.cups_hdl, "ippErrorString"); smb_cups.ippAddString = (ipp_attribute_t *(*)()) dlsym(smb_cups.cups_hdl, "ippAddString"); + smb_cups.ippGetStatusCode = (ipp_status_t (*)(ipp_t *)) + dlsym(smb_cups.cups_hdl, "ippGetStatusCode"); if (smb_cups.cupsLangDefault == NULL || smb_cups.cupsLangEncoding == NULL || @@ -372,12 +362,13 @@ smbd_cups_init(void) smb_cups.cupsLangFree == NULL || smb_cups.cupsGetDests == NULL || smb_cups.cupsFreeDests == NULL || - smb_cups.ippNew == NULL || + smb_cups.ippNewRequest == NULL || smb_cups.httpClose == NULL || smb_cups.httpConnect == NULL || smb_cups.ippDelete == NULL || smb_cups.ippErrorString == NULL || - smb_cups.ippAddString == NULL) { + smb_cups.ippAddString == NULL || + smb_cups.ippGetStatusCode == NULL) { (void) dlclose(smb_cups.cups_hdl); smb_cups.cups_hdl = NULL; (void) mutex_unlock(&smbd_cups_mutex); diff --git a/usr/src/cmd/ypcmd/Makefile b/usr/src/cmd/ypcmd/Makefile index ffcdc1b6c5..5a239dafe1 100644 --- a/usr/src/cmd/ypcmd/Makefile +++ b/usr/src/cmd/ypcmd/Makefile @@ -147,7 +147,6 @@ NIS2LDAPINC = -I$(SRC)/lib/libnisdb/yptol CERRWARN += -_gcc=-Wno-implicit-function-declaration CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-unused-variable -CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-switch CERRWARN += -_gcc=-Wno-extra CERRWARN += -_gcc=-Wno-unused-label @@ -180,7 +179,6 @@ all:= TARGET= all install:= TARGET= install clean:= TARGET= clean clobber:= TARGET= clobber -cstyle := TARGET= cstyle all: $(SHAREDOBJ) $(SUBDIRS) $(PROG) $(TXTS) @@ -277,9 +275,6 @@ $(SUBDIRS): FRC check: $(CHKMANIFEST) -cstyle: $(SUBDIRS) - ${CSTYLE} `echo $(SRCS) | sed 's/ypinit.c//'` - clean: $(SUBDIRS) $(RM) $(OBJS) $(CLEANFILES) diff --git a/usr/src/cmd/ypcmd/revnetgroup/revnetgroup.c b/usr/src/cmd/ypcmd/revnetgroup/revnetgroup.c index f19a33cd4d..7944e0d23e 100644 --- a/usr/src/cmd/ypcmd/revnetgroup/revnetgroup.c +++ b/usr/src/cmd/ypcmd/revnetgroup/revnetgroup.c @@ -92,9 +92,7 @@ static void loadtable(FILE *nf); static void dumptable(void); int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { char *group; struct grouplist *glist; @@ -102,12 +100,12 @@ main(argc, argv) loadtable(stdin); if (argc == 2 && argv[1][0] == '-' && - (argv[1][1] == 'u' || argv[1][1] == 'h')) { + (argv[1][1] == 'u' || argv[1][1] == 'h')) { byuser = (argv[1][1] == 'u'); } else { (void) fprintf(stderr, - "usage: %s -h (by host), %s -u (by user)\n", - argv[0], argv[0]); + "usage: %s -h (by host), %s -u (by user)\n", + argv[0], argv[0]); exit(1); } @@ -159,7 +157,7 @@ dumptable(void) fputs(entry->name, stdout); putc('\t', stdout); for (groups = entry->groups; groups; - groups = groups->next) { + groups = groups->next) { fputs(groups->str, stdout); if (groups->next) { putc(',', stdout); @@ -189,15 +187,15 @@ storegroup(char *group, struct grouplist *glist, int byuser) for (; glist; glist = glist->gl_nxt) { name = byuser ? glist->gl_name : glist->gl_machine; if (!name) { - name = universal; + name = universal; } else if (!isalnum(*name) && *name != '_') { - continue; + continue; } domain = glist->gl_domain; if (!domain) { - domain = universal; + domain = universal; } - key = malloc((unsigned) (strlen(name)+strlen(domain)+2)); + key = malloc((strlen(name) + strlen(domain) + 2)); (void) sprintf(key, "%s.%s", name, domain); enter(key, group); } @@ -227,11 +225,17 @@ appendgroup(groupentrylist grlist, char *group) { stringlist cur, prev; + prev = NULL; for (cur = grlist->groups; cur; prev = cur, cur = cur->next) { if (strcmp(group, cur->str) == 0) { - return; + return; } } + + /* prev is NULL only when grlist->groups is NULL. */ + if (prev == NULL) + return; + prev->next = MALLOC(stringnode); cur = prev->next; cur->str = group; @@ -243,7 +247,7 @@ enter(char *name, char *group) { int key; groupentrylist gel; - groupentrylist gelprev; + groupentrylist gelprev = NULL; key = tablekey(name); if (grouptable[key] == NULL) { @@ -251,13 +255,13 @@ enter(char *name, char *group) } else { gel = grouptable[key]; while (gel && strcmp(gel->name, name)) { - gelprev = gel; - gel = gel->next; + gelprev = gel; + gel = gel->next; } if (gel) { - appendgroup(gel, group); + appendgroup(gel, group); } else { - gelprev->next = newentry(name, group); + gelprev->next = newentry(name, group); } } } @@ -274,8 +278,9 @@ loadtable(FILE *nf) char *line; while (getaline(buf, MAXGROUPLEN, nf)) { + /* skip leading blanks */ for (p = buf; *p && isspace((int)*p); p++) - ; /* skip leading blanks */ + ; for (; *p && *p != '#' && *p != ' ' && *p != '\t'; p++) ; if (*p == EOS || *p == '#') diff --git a/usr/src/cmd/ypcmd/yppasswd/changepasswd.c b/usr/src/cmd/ypcmd/yppasswd/changepasswd.c index 8dca5c3cbd..6394cc710d 100644 --- a/usr/src/cmd/ypcmd/yppasswd/changepasswd.c +++ b/usr/src/cmd/ypcmd/yppasswd/changepasswd.c @@ -110,7 +110,7 @@ changepasswd(SVCXPRT *transp) * The adj_crypt_* pointers are used to point into adjbuf * NOT adj_encrypt */ - char *adj_crypt_begin, *adj_crypt_end; + char *adj_crypt_begin, *adj_crypt_end = NULL; char name[UTUSERLEN + sizeof (":")]; char *p; diff --git a/usr/src/common/elfcap/elfcap.c b/usr/src/common/elfcap/elfcap.c index 5a8a8cad67..ef9fb8d6b4 100644 --- a/usr/src/common/elfcap/elfcap.c +++ b/usr/src/common/elfcap/elfcap.c @@ -173,6 +173,71 @@ static const elfcap_desc_t hw1_sparc[ELFCAP_NUM_HW1_SPARC] = { AV_SPARC_ASI_CACHE_SPARING, STRDESC("AV_SPARC_ASI_CACHE_SPARING"), STRDESC("CSPARE"), STRDESC("cspare"), + }, + { /* 0x00020000 */ + AV_SPARC_PAUSE, + STRDESC("AV_SPARC_PAUSE"), + STRDESC("PAUSE"), STRDESC("pause"), + }, + { /* 0x00040000 */ + AV_SPARC_CBCOND, + STRDESC("AV_SPARC_CBCOND"), + STRDESC("CBCOND"), STRDESC("cbcond"), + }, + { /* 0x00080000 */ + AV_SPARC_AES, + STRDESC("AV_SPARC_AES"), + STRDESC("AES"), STRDESC("aes"), + }, + { /* 0x00100000 */ + AV_SPARC_DES, + STRDESC("AV_SPARC_DES"), + STRDESC("DES"), STRDESC("des"), + }, + { /* 0x00200000 */ + AV_SPARC_KASUMI, + STRDESC("AV_SPARC_KASUMI"), + STRDESC("KASUMI"), STRDESC("kasumi"), + }, + { /* 0x00400000 */ + AV_SPARC_CAMELLIA, + STRDESC("AV_SPARC_CAMELLIA"), + STRDESC("CAMELLIA"), STRDESC("camellia"), + }, + { /* 0x00800000 */ + AV_SPARC_MD5, + STRDESC("AV_SPARC_MD5"), + STRDESC("MD5"), STRDESC("md5"), + }, + { /* 0x01000000 */ + AV_SPARC_SHA1, + STRDESC("AV_SPARC_SHA1"), + STRDESC("SHA1"), STRDESC("sha1"), + }, + { /* 0x02000000 */ + AV_SPARC_SHA256, + STRDESC("AV_SPARC_SHA256"), + STRDESC("SHA256"), STRDESC("sha256"), + }, + { /* 0x04000000 */ + AV_SPARC_SHA512, + STRDESC("AV_SPARC_SHA512"), + STRDESC("SHA512"), STRDESC("sha512"), + }, + { /* 0x08000000 */ + AV_SPARC_MPMUL, + STRDESC("AV_SPARC_MPMUL"), + STRDESC("MPMUL"), STRDESC("mpmul"), + }, + { /* 0x10000000 */ + AV_SPARC_MONT, + STRDESC("AV_SPARC_MONT"), + STRDESC("MONT"), STRDESC("mont"), + }, + { /* 0x20000000 */ + AV_SPARC_CRC32C, + STRDESC("AV_SPARC_CRC32C"), + STRDESC("CRC32C"), STRDESC("crc32c"), } }; diff --git a/usr/src/common/elfcap/elfcap.h b/usr/src/common/elfcap/elfcap.h index 0dd442ee6b..0d508d02cc 100644 --- a/usr/src/common/elfcap/elfcap.h +++ b/usr/src/common/elfcap/elfcap.h @@ -113,7 +113,7 @@ typedef enum { * must be kept in sync with the arrays found in elfcap.c. */ #define ELFCAP_NUM_SF1 3 -#define ELFCAP_NUM_HW1_SPARC 17 +#define ELFCAP_NUM_HW1_SPARC 30 #define ELFCAP_NUM_HW1_386 32 #define ELFCAP_NUM_HW2_386 29 diff --git a/usr/src/pkg/manifests/system-library-platform.mf b/usr/src/pkg/manifests/system-library-platform.mf index 1af1d2a8f5..92577df8a0 100644 --- a/usr/src/pkg/manifests/system-library-platform.mf +++ b/usr/src/pkg/manifests/system-library-platform.mf @@ -122,6 +122,7 @@ $(sparc_ONLY)dir path=usr/platform/sun4u/lib $(sparc_ONLY)dir path=usr/platform/sun4u/lib/cfgadm $(sparc_ONLY)dir path=usr/platform/sun4u/lib/cfgadm/$(ARCH64) $(sparc_ONLY)dir path=usr/platform/sun4u/lib/fs +$(sparc_ONLY)dir path=usr/platform/sun4u/lib/fs/cpio $(sparc_ONLY)dir path=usr/platform/sun4u/lib/fs/hsfs $(sparc_ONLY)dir path=usr/platform/sun4u/lib/fs/nfs $(sparc_ONLY)dir path=usr/platform/sun4u/lib/fs/ufs @@ -131,6 +132,7 @@ $(sparc_ONLY)dir path=usr/platform/sun4v group=sys $(sparc_ONLY)dir path=usr/platform/sun4v/include $(sparc_ONLY)dir path=usr/platform/sun4v/lib $(sparc_ONLY)dir path=usr/platform/sun4v/lib/fs +$(sparc_ONLY)dir path=usr/platform/sun4v/lib/fs/cpio $(sparc_ONLY)dir path=usr/platform/sun4v/lib/fs/hsfs $(sparc_ONLY)dir path=usr/platform/sun4v/lib/fs/nfs $(sparc_ONLY)dir path=usr/platform/sun4v/lib/fs/ufs @@ -483,6 +485,8 @@ $(sparc_ONLY)link path=usr/platform/sun4u/lib/cfgadm/ac.so target=./ac.so.1 $(sparc_ONLY)link path=usr/platform/sun4u/lib/cfgadm/sbd.so target=./sbd.so.1 $(sparc_ONLY)link path=usr/platform/sun4u/lib/cfgadm/sysctrl.so \ target=./sysctrl.so.1 +$(sparc_ONLY)link path=usr/platform/sun4u/lib/fs/cpio/bootblk \ + target=../../../../../../platform/sun4u/lib/fs/cpio/bootblk $(sparc_ONLY)link path=usr/platform/sun4u/lib/fs/hsfs/bootblk \ target=../../../../../../platform/sun4u/lib/fs/hsfs/bootblk $(sparc_ONLY)link path=usr/platform/sun4u/lib/fs/ufs/bootblk \ @@ -493,6 +497,8 @@ $(sparc_ONLY)link path=usr/platform/sun4u/lib/libprtdiag.so \ target=./libprtdiag.so.1 $(sparc_ONLY)link path=usr/platform/sun4u/lib/libprtdiag_psr.so.1 \ target=../../SUNW,Ultra-2/lib/libprtdiag_psr.so.1 +$(sparc_ONLY)link path=usr/platform/sun4v/lib/fs/cpio/bootblk \ + target=../../../../../../platform/sun4v/lib/fs/cpio/bootblk $(sparc_ONLY)link path=usr/platform/sun4v/lib/fs/hsfs/bootblk \ target=../../../../../../platform/sun4v/lib/fs/hsfs/bootblk $(sparc_ONLY)link path=usr/platform/sun4v/lib/fs/ufs/bootblk \ diff --git a/usr/src/pkg/manifests/system-library-processor.mf b/usr/src/pkg/manifests/system-library-processor.mf index 5afd21c33c..c9809ef8e1 100644 --- a/usr/src/pkg/manifests/system-library-processor.mf +++ b/usr/src/pkg/manifests/system-library-processor.mf @@ -59,6 +59,7 @@ $(sparc_ONLY)dir path=platform/sun4u group=sys $(sparc_ONLY)dir path=platform/sun4u/lib $(sparc_ONLY)dir path=platform/sun4u/lib/$(ARCH64) $(sparc_ONLY)dir path=platform/sun4u/lib/fs +$(sparc_ONLY)dir path=platform/sun4u/lib/fs/cpio $(sparc_ONLY)dir path=platform/sun4u/lib/fs/hsfs $(sparc_ONLY)dir path=platform/sun4u/lib/fs/ufs $(sparc_ONLY)dir path=platform/sun4u/lib/fs/zfs @@ -66,6 +67,7 @@ $(sparc_ONLY)dir path=platform/sun4v group=sys $(sparc_ONLY)dir path=platform/sun4v/lib $(sparc_ONLY)dir path=platform/sun4v/lib/$(ARCH64) $(sparc_ONLY)dir path=platform/sun4v/lib/fs +$(sparc_ONLY)dir path=platform/sun4v/lib/fs/cpio $(sparc_ONLY)dir path=platform/sun4v/lib/fs/hsfs $(sparc_ONLY)dir path=platform/sun4v/lib/fs/ufs $(sparc_ONLY)dir path=platform/sun4v/lib/fs/zfs @@ -80,6 +82,8 @@ $(sparc_ONLY)file \ # We force bootblks into a new BE because we want to make sure # the user can recover from a pre-existing copy of the bootblk # in the event that something goes horribly wrong. +$(sparc_ONLY)file path=platform/sun4u/lib/fs/cpio/bootblk group=sys mode=0444 \ + reboot-needed=true $(sparc_ONLY)file path=platform/sun4u/lib/fs/hsfs/bootblk group=sys mode=0444 \ reboot-needed=true $(sparc_ONLY)file path=platform/sun4u/lib/fs/ufs/bootblk group=sys mode=0444 \ @@ -89,6 +93,8 @@ $(sparc_ONLY)file path=platform/sun4u/lib/fs/zfs/bootblk group=sys mode=0444 \ # We force bootblks into a new BE because we want to make sure # the user can recover from a pre-existing copy of the bootblk # in the event that something goes horribly wrong. +$(sparc_ONLY)file path=platform/sun4v/lib/fs/cpio/bootblk group=sys mode=0444 \ + reboot-needed=true $(sparc_ONLY)file path=platform/sun4v/lib/fs/hsfs/bootblk group=sys mode=0444 \ reboot-needed=true $(sparc_ONLY)file path=platform/sun4v/lib/fs/ufs/bootblk group=sys mode=0444 \ diff --git a/usr/src/pkg/manifests/system-test-utiltest.mf b/usr/src/pkg/manifests/system-test-utiltest.mf index cb280747ca..d2f82e6182 100644 --- a/usr/src/pkg/manifests/system-test-utiltest.mf +++ b/usr/src/pkg/manifests/system-test-utiltest.mf @@ -58,6 +58,10 @@ dir path=opt/util-tests/tests/files/make_a/a dir path=opt/util-tests/tests/files/make_a/b dir path=opt/util-tests/tests/files/make_a/c dir path=opt/util-tests/tests/files/make_l +dir path=opt/util-tests/tests/files/svr4pkg +dir path=opt/util-tests/tests/files/svr4pkg/data +dir path=opt/util-tests/tests/files/svr4pkg/data/a +dir path=opt/util-tests/tests/files/svr4pkg/data/b dir path=opt/util-tests/tests/find dir path=opt/util-tests/tests/head dir path=opt/util-tests/tests/libcustr @@ -1530,6 +1534,8 @@ file path=opt/util-tests/tests/files/make_a/b/make.rules mode=0444 file path=opt/util-tests/tests/files/make_a/c/Makefile mode=0444 file path=opt/util-tests/tests/files/make_a/c/make.rules mode=0444 file path=opt/util-tests/tests/files/make_a/make.rules mode=0444 +file path=opt/util-tests/tests/files/svr4pkg/data/a/file1.txt mode=0444 +file path=opt/util-tests/tests/files/svr4pkg/data/b/file2.txt mode=0444 file path=opt/util-tests/tests/find/findtest mode=0555 file path=opt/util-tests/tests/grep_test mode=0555 file path=opt/util-tests/tests/head/5221.in mode=0444 @@ -1844,6 +1850,7 @@ file path=opt/util-tests/tests/sleep/sleep.awk mode=0444 file path=opt/util-tests/tests/sleep/sleep.d mode=0444 file path=opt/util-tests/tests/sleep/sleeptest mode=0555 file path=opt/util-tests/tests/smbios mode=0555 +file path=opt/util-tests/tests/svr4pkg_test mode=0555 file path=opt/util-tests/tests/vnic-mtu mode=0555 file path=opt/util-tests/tests/xargs_test mode=0555 license lic_CDDL license=lic_CDDL diff --git a/usr/src/psm/stand/bootblks/Makefile b/usr/src/psm/stand/bootblks/Makefile index 49ca4d43ba..04131f777b 100644 --- a/usr/src/psm/stand/bootblks/Makefile +++ b/usr/src/psm/stand/bootblks/Makefile @@ -25,14 +25,13 @@ include ../../../Makefile.master -SUBDIRS = ufs hsfs zfs +SUBDIRS = cpio ufs hsfs zfs -all install clean clobber lint: $(SUBDIRS) +all install clean clobber : $(SUBDIRS) all := TARGET = all clean := TARGET = clean clobber := TARGET = clobber -lint := TARGET = lint install := TARGET = install $(SUBDIRS): FRC diff --git a/usr/src/psm/stand/bootblks/Makefile.1275 b/usr/src/psm/stand/bootblks/Makefile.1275 index c0585d18a7..b50d0585f9 100644 --- a/usr/src/psm/stand/bootblks/Makefile.1275 +++ b/usr/src/psm/stand/bootblks/Makefile.1275 @@ -66,7 +66,4 @@ clean: clobber: clean -$(RM) $(PROG) $(FS_BB) -lint: FRC - FRC: - diff --git a/usr/src/psm/stand/bootblks/common/mkbb.sh b/usr/src/psm/stand/bootblks/common/mkbb.sh index 115126ed1e..f18139771d 100755 --- a/usr/src/psm/stand/bootblks/common/mkbb.sh +++ b/usr/src/psm/stand/bootblks/common/mkbb.sh @@ -46,13 +46,13 @@ shift $(($OPTIND - 1)) # rdoff=$(($bblen - $rdlen)) -bbsize=$(ls -l $1 | awk -e '{ print $5 }') +bbsize=$(ls -l $1 | awk '{ print $5 }') if [ $bbsize -gt $rdoff ]; then printf "$1 must be smaller than $rdoff\n" exit -1 fi -rdsize=$(ls -l $2 | awk -e '{ print $5 }') +rdsize=$(ls -l $2 | awk '{ print $5 }') if [ $rdsize -gt $rdlen ]; then printf "$1 must be smaller than $rdlen\n" exit -1 @@ -70,7 +70,7 @@ dd if=$2 of=$3 conv=notrunc bs=1 oseek=$rdoff # extended bootblk for zfs debug # if [ $totlen -gt $bblen ]; then - extsize=$(ls -l $extra | awk -e '{ print $5 }') + extsize=$(ls -l $extra | awk '{ print $5 }') if [ $extsize -gt 16384 ]; then printf "$1 must be smaller than 16k\n" exit -1 diff --git a/usr/src/psm/stand/bootblks/cpio/Makefile b/usr/src/psm/stand/bootblks/cpio/Makefile new file mode 100644 index 0000000000..7bed5a0a14 --- /dev/null +++ b/usr/src/psm/stand/bootblks/cpio/Makefile @@ -0,0 +1,43 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# + +# +# Copyright 2009 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# psm/stand/bootblks/cpio/Makefile +# + +SUBDIRS = $(MACH) + +all := TARGET= all +install := TARGET= install +clean := TARGET= clean +clobber := TARGET= clobber + +.KEEP_STATE: + +all install clean clobber : $(SUBDIRS) + +$(SUBDIRS): FRC + @cd $@; pwd; $(MAKE) $(TARGET) + +FRC: diff --git a/usr/src/psm/stand/bootblks/cpio/Makefile.cpio b/usr/src/psm/stand/bootblks/cpio/Makefile.cpio new file mode 100644 index 0000000000..26c37d70c7 --- /dev/null +++ b/usr/src/psm/stand/bootblks/cpio/Makefile.cpio @@ -0,0 +1,55 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# +# Copyright 2021 Toomas Soome <tsoome@me.com> +# Copyright 2009 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# psm/stand/bootblks/cpio/Makefile.cpio +# + +include $(BASEDIR)/Makefile.com + +# +# Define FS dependent targets +# + +CPIO_DIR = $(BASEDIR)/cpio/common + +FS_FCODE = boot-cpio.fcode +FS_BB = cpio.bb + +CPIOBOOT_FTH = $(CPIO_DIR)/boot-cpio.fth +CPIO_FTH = $(CPIO_DIR)/cpio.fth + +# +# Where and how stuff gets installed +# +ROOT_PSM_BOOTBLOCK = $(ROOT_PSM_LIB_CPIO_DIR)/$(PROG) +USR_PSM_BOOTBLOCK = $(USR_PSM_LIB_CPIO_DIR)/$(PROG) +BOOTBLK_LINK = $(BOOTBLK_LINK_PREFIX)/cpio/$(PROG) + +USR = $(ROOT)/usr + +%.fcode: $(CPIO_DIR)/%.fth + $(TOKENIZE) $< + +$(FS_FCODE): $(UTIL_FTH) $(CPIO_FTH) $(BOOT_FTH) + $(TOKENIZE) $(CPIOBOOT_FTH) diff --git a/usr/src/psm/stand/bootblks/cpio/common/boot-cpio.fth b/usr/src/psm/stand/bootblks/cpio/common/boot-cpio.fth new file mode 100644 index 0000000000..23ae18072b --- /dev/null +++ b/usr/src/psm/stand/bootblks/cpio/common/boot-cpio.fth @@ -0,0 +1,41 @@ +\ +\ CDDL HEADER START +\ +\ The contents of this file are subject to the terms of the +\ Common Development and Distribution License (the "License"). +\ You may not use this file except in compliance with the License. +\ +\ You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +\ or http://www.opensolaris.org/os/licensing. +\ See the License for the specific language governing permissions +\ and limitations under the License. +\ +\ When distributing Covered Code, include this CDDL HEADER in each +\ file and include the License file at usr/src/OPENSOLARIS.LICENSE. +\ If applicable, add the following below this CDDL HEADER, with the +\ fields enclosed by brackets "[]" replaced with your own identifying +\ information: Portions Copyright [yyyy] [name of copyright owner] +\ +\ CDDL HEADER END +\ +\ +\ Copyright 2009 Sun Microsystems, Inc. All rights reserved. +\ Use is subject to license terms. +\ + + +purpose: CPIO bootblock for sun4u platforms +copyright: Copyright 2009 Sun Microsystems, Inc. All Rights Reserved + + +: fs-pkg$ " cpio-file-system" ; +: fs-type$ " cpio" ; + +\ load common words +fload ../../../common/util.fth + +\ load fs reader +fload ../../common/cpio.fth + +\ load booter +fload ../../../common/boot.fth diff --git a/usr/src/psm/stand/bootblks/cpio/common/cpio.fth b/usr/src/psm/stand/bootblks/cpio/common/cpio.fth new file mode 100644 index 0000000000..6206aea90f --- /dev/null +++ b/usr/src/psm/stand/bootblks/cpio/common/cpio.fth @@ -0,0 +1,385 @@ +\ +\ CDDL HEADER START +\ +\ The contents of this file are subject to the terms of the +\ Common Development and Distribution License (the "License"). +\ You may not use this file except in compliance with the License. +\ +\ You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +\ or http://www.opensolaris.org/os/licensing. +\ See the License for the specific language governing permissions +\ and limitations under the License. +\ +\ When distributing Covered Code, include this CDDL HEADER in each +\ file and include the License file at usr/src/OPENSOLARIS.LICENSE. +\ If applicable, add the following below this CDDL HEADER, with the +\ fields enclosed by brackets "[]" replaced with your own identifying +\ information: Portions Copyright [yyyy] [name of copyright owner] +\ +\ CDDL HEADER END +\ +\ +\ Copyright 2009 Sun Microsystems, Inc. All rights reserved. +\ Use is subject to license terms. +\ + + +purpose: CPIO file system support package +copyright: Copyright 2021 Toomas Soome <tsoome@me.com> + +\ This implementation is based on UFS bootblk code. + +headers +" /packages" get-package push-package + +new-device + fs-pkg$ device-name diag-cr? + + \ + \ CPIO low-level block routines + \ + + h# 2000 constant /max-bsize + d# 512 constant /disk-block + + + 0 instance value dev-ih + + h# 2000 constant /cpio-start + + \ + \ cpio header + \ + + d# 256 constant /max-namelen + d# 76 constant /cpio-header + 0 instance value cpio-header + 0 instance value /temp-block + 0 instance value temp-block + + \ + \ convert ascii octal number stream to integer + \ + : get-uint ( addr len -- v ) + 0 ( addr len v ) + begin over 0> while + 8 * ( addr len v*8 ) + rot ( len v addr ) + dup c@ ascii 0 - ( len v addr n ) + rot + ( len addr n+v ) + swap 1+ ( len v addr+1 ) + rot 1- ( v addr len-1 ) + rot ( addr len v ) + repeat + >R 2drop R> + ; + + : magic? ( -- flag ) cpio-header + dup c@ ascii 0 = swap 1 + + dup c@ ascii 7 = swap 1 + + dup c@ ascii 0 = swap 1 + + dup c@ ascii 7 = swap 1 + + dup c@ ascii 0 = swap 1 + + c@ ascii 7 = + and and and and and + ; + : dev ( -- addr len ) cpio-header 6 + 6 get-uint ; + : ino ( -- addr len ) cpio-header d# 12 + 6 get-uint ; + : mode ( -- addr len ) cpio-header d# 18 + 6 get-uint ; + : uid ( -- addr len ) cpio-header d# 24 + 6 get-uint ; + : gid ( -- addr len ) cpio-header d# 30 + 6 get-uint ; + : nlink ( -- addr len ) cpio-header d# 36 + 6 get-uint ; + : rdev ( -- addr len ) cpio-header d# 42 + 6 get-uint ; + : mtime ( -- addr len ) cpio-header d# 48 + d# 11 get-uint ; + : namesize ( -- addr len ) cpio-header d# 59 + 6 get-uint ; + : filesize ( -- addr len ) cpio-header d# 65 + d# 11 get-uint ; + : filename ( -- addr ) cpio-header d# 76 + ; + : data ( -- addr ) cpio-header d# 76 + namesize + ; + + : get-cpio-header ( offset -- ) + cpio-header /disk-block 2 * rot ( adr len offset ) + dev-ih read-disk + ; + + : ftype ( -- n ) mode h# f000 and ; + : dir? ( -- flag ) ftype h# 4000 = ; + : symlink? ( -- flag ) ftype h# a000 = ; + : regular? ( -- flag ) ftype h# 8000 = ; + : comp? ( -- flag ) data dup c@ h# 1f = swap c@ h# 8b = and ; + + \ + \ CPIO routines + \ + + 0 instance value current-file + + h# 200 constant /fpath-buf + /fpath-buf instance buffer: fpath-buf + : clr-fpath-buf ( -- ) fpath-buf /fpath-buf erase ; + : fpath-buf$ ( -- path$ ) fpath-buf cscount ; + + : cut-tail ( path$ -- path$' ) + 2dup + 1- ( addr len addr+len-- ) + begin + dup c@ ascii / <> + while + 1- ( addr len addr'-- ) + swap 1- swap ( addr len-- addr' ) + repeat + drop ( addr len ) + ; + + : cut-head ( addr n -- ) + dup /temp-block swap - to /temp-block + + to temp-block + ; + + : follow-symlink ( path$ -- path$' ) + clr-fpath-buf + + \ is it absolute link? + temp-block c@ ascii / = if + 2drop + temp-block /temp-block exit + then + + \ if it does start with "./", remove it from link + temp-block c@ ascii . = temp-block 1+ c@ ascii / = and if + temp-block 2 cut-head + then + + \ if it does not start with '.', remove last component from path$ + temp-block c@ ascii . <> if + cut-tail + then + + \ if it does start with "../", remove last component from path$ + \ and remove "../" from the head of link + begin + temp-block 3 s" ../" $= + while + cut-tail + temp-block 3 cut-head + repeat + + over c@ ascii / <> if + s" /" fpath-buf$ $append + then + fpath-buf$ $append + temp-block /temp-block fpath-buf$ $append + fpath-buf$ + ; + + : lookup ( path$ -- true | offset false ) tokenizer[ reveal ]tokenizer + \ all paths should start with '/', but cpio archive does omit + \ leading '/', skip it. + over c@ ascii / = if + str++ + else + 2drop true exit + then + + /cpio-start + begin + dup get-cpio-header ( path$ offset ) + magic? while + -rot ( offset path$ ) + + \ check EOF of cpio archive + filename namesize 1- s" TRAILER!!!" + $= if + 3drop true exit + then + + 2dup + filename namesize 1- + $= if + symlink? if ( offset path$ ) + rot drop ( path$ ) + data to temp-block + filesize to /temp-block + follow-symlink + lookup exit + then + 2drop /cpio-header + namesize + + false exit ( offset false ) + then + rot ( path$ offset ) + /cpio-header + namesize + filesize + + repeat + + 3drop true ( failed ) + ; + + \ + \ CPIO installation routines + \ + + /disk-block 2 * + constant alloc-size + + \ **** Allocate memory for necessary data structures + : allocate-buffers ( -- ) + alloc-size mem-alloc dup 0= if + ." no memory" abort + then ( adr ) + to cpio-header ( adr ) + ; + + : release-buffers ( -- ) + cpio-header alloc-size mem-free + ; + + \ CPIO file interface + \ I am not really sure we do need open file list. Testing + \ does seem to indicate, we do have one file open at a time. + \ However, I keep it for time being. + + struct + /x field >busy + /x field >offset + /x field >addr + /x field >size + constant /file-record + + d# 10 constant #opens + #opens /file-record * constant /file-records + + /file-records instance buffer: file-records + + -1 instance value current-fd + : fd>record ( fd -- record ) /file-record * file-records + ; + + : file-size@ ( -- size ) + current-fd fd>record >size x@ + ; + + : file-addr@ ( -- addr ) + current-fd fd>record >addr x@ + ; + + : file-offset@ ( -- off ) + current-fd fd>record >offset x@ + ; + + : file-offset! ( off -- ) + current-fd fd>record >offset x! + ; + + : get-slot ( -- fd false | true ) + #opens 0 do + i fd>record >busy x@ 0= if + i false unloop exit + then + loop true + ; + + : free-slot ( fd -- ) + 0 swap fd>record >busy x! + ; + + : init-fd ( offset fd -- ) + fd>record ( offset rec ) + swap over ( rec offset rec ) + >addr x! ( rec ) + dup >busy 1 swap x! + dup >size filesize swap x! + >offset 0 swap x! + ; + + : set-fd ( fd -- error? ) + dup fd>record >busy x@ 0= if ( fd ) + drop true exit ( failed ) + then + to current-fd false ( succeeded ) + ; + + + \ advance file io stack by n + : fio+ ( # adr len n -- #+n adr+n len-n ) + dup file-offset@ + file-offset! + dup >r - -rot ( len' # adr r: n ) + r@ + -rot ( adr' len' # r: n ) + r> + -rot ( #' adr' len' ) + ; + + external + + : open ( -- okay? ) + my-args dev-open dup 0= if ( 0 ) + exit ( failed ) + then to dev-ih + + allocate-buffers + file-records /file-records erase + true ( succeeded ) + ; + + : close ( -- ) + dev-ih dev-close + 0 to dev-ih + release-buffers + ; + + : open-file ( path$ -- fd true | false ) + get-slot if + 2drop false exit ( failed ) + then -rot ( fd path$ ) + + lookup if ( fd offset ) + drop false exit ( failed ) + then + + over ( fd offset fd ) + init-fd true ( fd succeeded ) + ; + + : close-file ( fd -- ) + free-slot ( ) + ; + + : size-file ( fd -- size ) + set-fd if 0 else file-size@ then + ; + + : seek-file ( off fd -- off true | false ) + set-fd if ( off ) + drop false exit ( failed ) + then ( off ) + + dup file-size@ > if ( off ) + drop false exit ( failed ) + then ( off ) + dup file-offset! true ( off succeeded ) + ; + + : read-file ( adr len fd -- #read ) + set-fd if ( adr len ) + 2drop 0 exit ( 0 ) + then ( adr len ) + + \ adjust len if reading past eof + dup file-offset@ + file-size@ > if + dup file-offset@ + file-size@ - - + then + dup 0= if 2drop 0 exit then + + dup -rot ( #read adr len ) + file-addr@ file-offset@ + dev-ih read-disk + dup file-offset@ + file-offset! + ; + + : cinfo-file ( fd -- bsize fsize comp? ) + set-fd if 0 0 0 else /max-bsize file-size@ comp? then + ; + + \ read ramdisk fcode at rd-offset + : get-rd ( adr len -- ) + rd-offset dev-ih read-disk + ; + + \ no additional props needed for cpio + : bootprop ( -- ) false ; + +finish-device +pop-package diff --git a/usr/src/psm/stand/bootblks/cpio/sparc/Makefile b/usr/src/psm/stand/bootblks/cpio/sparc/Makefile new file mode 100644 index 0000000000..27d545663e --- /dev/null +++ b/usr/src/psm/stand/bootblks/cpio/sparc/Makefile @@ -0,0 +1,42 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# +# Copyright (c) 1994, 2010, Oracle and/or its affiliates. All rights reserved. +# +# psm/stand/bootblks/cpio/sparc/Makefile +# + +BASEDIR = ../.. + +SUBDIRS = sun4u sun4v + +all := TARGET= all +install := TARGET= install +clean := TARGET= clean +clobber := TARGET= clobber + +.KEEP_STATE: + +all install clean clobber: $(SUBDIRS) + +$(SUBDIRS): FRC + @cd $@; pwd; $(MAKE) $(TARGET) + +FRC: diff --git a/usr/src/psm/stand/bootblks/cpio/sparc/sun4u/Makefile b/usr/src/psm/stand/bootblks/cpio/sparc/sun4u/Makefile new file mode 100644 index 0000000000..0a57294518 --- /dev/null +++ b/usr/src/psm/stand/bootblks/cpio/sparc/sun4u/Makefile @@ -0,0 +1,72 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# +# +# Copyright 2009 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# Copyright 2019 Peter Tribble. +# +# psm/stand/bootblks/cpio/sparc/sun4u/Makefile +# + +# +# Platform specific Makefile for the boot block. +# +# PLATFORM is the target for the binary installation. +# +# PLATLINKS is a list of platforms which are to be linked to the ../fs +# directory. +# +BASEDIR = ../../.. +PLATFORM = sun4u + +PLATLINKS = SUNW,Ultra-2 +PLATLINKS += SUNW,Ultra-250 +PLATLINKS += SUNW,Ultra-4 +PLATLINKS += SUNW,Ultra-Enterprise +PLATLINKS += SUNW,Sun-Blade-100 +PLATLINKS += SUNW,Sun-Blade-1000 +PLATLINKS += SUNW,Sun-Blade-1500 +PLATLINKS += SUNW,Sun-Blade-2500 +PLATLINKS += SUNW,Sun-Fire +PLATLINKS += SUNW,Sun-Fire-V240 +PLATLINKS += SUNW,Sun-Fire-V250 +PLATLINKS += SUNW,Sun-Fire-V440 +PLATLINKS += SUNW,Sun-Fire-280R +PLATLINKS += SUNW,Sun-Fire-880 +PLATLINKS += SUNW,Sun-Fire-480R +PLATLINKS += SUNW,Sun-Fire-V890 +PLATLINKS += SUNW,Sun-Fire-V490 +PLATLINKS += SUNW,Netra-T12 +PLATLINKS += SUNW,Netra-T4 +PLATLINKS += SUNW,SPARC-Enterprise + +LINKED_DIRS = $(PLATLINKS:%=$(USR_PLAT_DIR)/%) +LINKED_LIB_DIRS = $(PLATLINKS:%=$(USR_PLAT_DIR)/%/lib) +LINKED_LIB_FS_DIRS = $(PLATLINKS:%=$(USR_PLAT_DIR)/%/lib/fs) + +include $(BASEDIR)/cpio/Makefile.cpio +include $(BASEDIR)/Makefile.1275 + +.KEEP_STATE: + +all: $(PROG) + +include $(BASEDIR)/Makefile.targ diff --git a/usr/src/psm/stand/bootblks/cpio/sparc/sun4v/Makefile b/usr/src/psm/stand/bootblks/cpio/sparc/sun4v/Makefile new file mode 100644 index 0000000000..201fb35e0b --- /dev/null +++ b/usr/src/psm/stand/bootblks/cpio/sparc/sun4v/Makefile @@ -0,0 +1,53 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License, Version 1.0 only +# (the "License"). You may not use this file except in compliance +# with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# +# +# Copyright 2005 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# psm/stand/bootblks/cpio/sparc/sun4v/Makefile +# + +# +# Platform specific Makefile for the boot block. +# +# PLATFORM is the target for the binary installation. +# +# PLATLINKS is a list of platforms which are to be linked to the ../fs +# directory. +# +BASEDIR = ../../.. +PLATFORM = sun4v + +#PLATLINKS = SUNW,... + +#LINKED_DIRS = $(PLATLINKS:%=$(USR_PLAT_DIR)/%) +#LINKED_LIB_DIRS = $(PLATLINKS:%=$(USR_PLAT_DIR)/%/lib) +#LINKED_LIB_FS_DIRS = $(PLATLINKS:%=$(USR_PLAT_DIR)/%/lib/fs) + +include $(BASEDIR)/cpio/Makefile.cpio +include $(BASEDIR)/Makefile.1275 + +.KEEP_STATE: + +all: $(PROG) + +include $(BASEDIR)/Makefile.targ diff --git a/usr/src/psm/stand/bootblks/ufs/Makefile b/usr/src/psm/stand/bootblks/ufs/Makefile index 5c1c0cb075..55a572b9df 100644 --- a/usr/src/psm/stand/bootblks/ufs/Makefile +++ b/usr/src/psm/stand/bootblks/ufs/Makefile @@ -32,22 +32,12 @@ all := TARGET= all install := TARGET= install clean := TARGET= clean clobber := TARGET= clobber -lint := TARGET= lint .KEEP_STATE: -all install clean clobber lint : $(SUBDIRS) +all install clean clobber: $(SUBDIRS) $(SUBDIRS): FRC @cd $@; pwd; $(MAKE) $(TARGET) FRC: - -# -# install targets -# -$(USR_SBIN): $(USR) - -$(INS.dir) - -$(USR_SBIN)/%: % $(USR_SBIN) - $(INS.file) diff --git a/usr/src/test/util-tests/runfiles/default.run b/usr/src/test/util-tests/runfiles/default.run index b352c96118..7557ae9ac4 100644 --- a/usr/src/test/util-tests/runfiles/default.run +++ b/usr/src/test/util-tests/runfiles/default.run @@ -91,3 +91,6 @@ tests = ['sed_addr', 'multi_test'] [/opt/util-tests/tests/pcieadmtest] [/opt/util-tests/tests/pcieadm-priv] user = root + +[/opt/util-tests/tests/svr4pkg_test] +user = root diff --git a/usr/src/test/util-tests/tests/Makefile b/usr/src/test/util-tests/tests/Makefile index 1d73f5dc94..df9e5d2b36 100644 --- a/usr/src/test/util-tests/tests/Makefile +++ b/usr/src/test/util-tests/tests/Makefile @@ -20,6 +20,6 @@ SUBDIRS = date dis dladm iconv libnvpair_json libsff printf xargs grep_xpg4 SUBDIRS += demangle mergeq workq chown ctf smbios libjedec awk make sleep -SUBDIRS += bunyan libcustr find mdb sed head pcidb pcieadm +SUBDIRS += bunyan libcustr find mdb sed head pcidb pcieadm svr4pkg include $(SRC)/test/Makefile.com diff --git a/usr/src/test/util-tests/tests/svr4pkg/Makefile b/usr/src/test/util-tests/tests/svr4pkg/Makefile new file mode 100644 index 0000000000..44cf401136 --- /dev/null +++ b/usr/src/test/util-tests/tests/svr4pkg/Makefile @@ -0,0 +1,42 @@ +# +# 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 2021 Toomas Soome <tsoome@me.com> +# + +.PARALLEL: $(SUBDIRS) + +include $(SRC)/cmd/Makefile.cmd + +ROOTOPTPKG = $(ROOT)/opt/util-tests +TESTDIR = $(ROOTOPTPKG)/tests + +PROGS = svr4pkg_test + +CMDS = $(PROGS:%=$(TESTDIR)/%) +$(CMDS) := FILEMODE = 0555 + +all clean clobber: + +install: $(CMDS) + +$(CMDS): $(TESTDIR) + +$(TESTDIR): + $(INS.dir) + +$(TESTDIR)/%: %.ksh + $(INS.rename) + +SUBDIRS = files + +include $(SRC)/test/Makefile.com diff --git a/usr/src/test/util-tests/tests/svr4pkg/files/Makefile b/usr/src/test/util-tests/tests/svr4pkg/files/Makefile new file mode 100644 index 0000000000..7f4298f012 --- /dev/null +++ b/usr/src/test/util-tests/tests/svr4pkg/files/Makefile @@ -0,0 +1,39 @@ +# +# 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) 2013 by Delphix. All rights reserved. +# Copyright 2014 Nexenta Systems, Inc. All rights reserved. +# Copyright 2020 Peter Tribble. +# Copyright 2020 Oxide Computer Company +# + +include $(SRC)/cmd/Makefile.cmd + +ROOTOPTPKG = $(ROOT)/opt/util-tests +TESTDIR = $(ROOTOPTPKG)/tests/files/svr4pkg + +DIRS = data +IDIRS = $(DIRS:%=$(TESTDIR)/%) + +all clean clobber: + +install: $(IDIRS) + +$(TESTDIR): + $(INS.dir) + +$(TESTDIR)/%: % + $(INS.dir) + +SUBDIRS = data + +include $(SRC)/test/Makefile.com diff --git a/usr/src/test/util-tests/tests/svr4pkg/files/data/Makefile b/usr/src/test/util-tests/tests/svr4pkg/files/data/Makefile new file mode 100644 index 0000000000..e478e60185 --- /dev/null +++ b/usr/src/test/util-tests/tests/svr4pkg/files/data/Makefile @@ -0,0 +1,43 @@ +# +# 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) 2013 by Delphix. All rights reserved. +# Copyright 2014 Nexenta Systems, Inc. All rights reserved. +# Copyright 2020 Peter Tribble. +# Copyright 2020 Oxide Computer Company +# + +include $(SRC)/cmd/Makefile.cmd + +ROOTOPTPKG = $(ROOT)/opt/util-tests +TESTDIR = $(ROOTOPTPKG)/tests/files/svr4pkg/data + +DIRS = a b +FILES = a/file1.txt b/file2.txt +IDIRS = $(DIRS:%=$(TESTDIR)/%) +IFILES = $(FILES:%=$(TESTDIR)/%) + +$(IFILES) := FILEMODE = 0444 + +all clean clobber: + +install: $(IDIRS) $(IFILES) + +$(CMDS): $(TESTDIR) + +$(IDIRS): + $(INS.dir) + +$(TESTDIR)/%: % + $(INS.file) + +include $(SRC)/test/Makefile.com diff --git a/usr/src/test/util-tests/tests/svr4pkg/files/data/a/file1.txt b/usr/src/test/util-tests/tests/svr4pkg/files/data/a/file1.txt new file mode 100644 index 0000000000..77d2944aa6 --- /dev/null +++ b/usr/src/test/util-tests/tests/svr4pkg/files/data/a/file1.txt @@ -0,0 +1,6 @@ +Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor +incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, +quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo +consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse +cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat +non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. diff --git a/usr/src/test/util-tests/tests/svr4pkg/files/data/b/file2.txt b/usr/src/test/util-tests/tests/svr4pkg/files/data/b/file2.txt new file mode 100644 index 0000000000..77d2944aa6 --- /dev/null +++ b/usr/src/test/util-tests/tests/svr4pkg/files/data/b/file2.txt @@ -0,0 +1,6 @@ +Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor +incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, +quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo +consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse +cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat +non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. diff --git a/usr/src/test/util-tests/tests/svr4pkg/svr4pkg_test.ksh b/usr/src/test/util-tests/tests/svr4pkg/svr4pkg_test.ksh new file mode 100644 index 0000000000..6584353f6b --- /dev/null +++ b/usr/src/test/util-tests/tests/svr4pkg/svr4pkg_test.ksh @@ -0,0 +1,67 @@ +#!/usr/bin/ksh +# +# +# 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 2021 Toomas Soome <tsoome@me.com> +# + +: "${FILEDIR:=/opt/util-tests/tests/files}" + +[[ -d "$FILEDIR" ]] || fail "no files directory $FILEDIR" + +typeset -i fail=0 + +function fail { + echo "FAIL $@" + ((fail++)) +} + +function pass { + echo "PASS $@" +} + +function pkg_test { + TD=$(mktemp -d -t) + + if [[ ! -d "$TD" ]]; then + fail "couldn't create test directory $TD" + return + fi + + echo "PKG=svr4pkg" > $TD/pkginfo + echo "NAME=\"svr4pkg test package\"" >> $TD/pkginfo + echo "ARCH=sparc,i386" >> $TD/pkginfo + echo "VERSION=1.0" >> $TD/pkginfo + echo "CATEGORY=application" >> $TD/pkginfo + echo "BASEDIR=/opt" >> $TD/pkginfo + + (cd $FILEDIR; /usr/bin/pkgproto svr4pkg) > $TD/prototype || \ + fail "pkgproto svr4pkg" + echo "i pkginfo=$TD/pkginfo" >> $TD/prototype + /usr/bin/pkgmk -f $TD/prototype -r $FILEDIR -d $TD || \ + fail "pkgmk svr4pkg" + /usr/bin/pkgtrans -s $TD $TD/svr4pkg.pkg svr4pkg || \ + fail "pkgtrans to stream format" + + mkdir -p $TD/root/opt + /usr/sbin/pkgadd -d $TD -R $TD/root svr4pkg || fail "pkgadd svr4pkg" + /usr/bin/pkginfo -R $TD/root svr4pkg || fail "pkginfo svr4pkg" + /usr/sbin/pkgrm -n -R $TD/root svr4pkg || fail "pkgrm svr4pkg" + + rm -rf "$TD" +} + +pkg_test + +(( fail > 0 )) && exit -1 +exit 0 diff --git a/usr/src/test/zfs-tests/tests/functional/cli_root/zfs_mount/zfs_mount_all_mountpoints.ksh b/usr/src/test/zfs-tests/tests/functional/cli_root/zfs_mount/zfs_mount_all_mountpoints.ksh index 3e6a24bbcd..faeae4227a 100644 --- a/usr/src/test/zfs-tests/tests/functional/cli_root/zfs_mount/zfs_mount_all_mountpoints.ksh +++ b/usr/src/test/zfs-tests/tests/functional/cli_root/zfs_mount/zfs_mount_all_mountpoints.ksh @@ -109,6 +109,8 @@ function cleanup_all export __ZFS_POOL_RESTRICT="$TESTPOOL" log_must zfs $unmountall unset __ZFS_POOL_RESTRICT + # make sure we leave $TESTPOOL mounted + log_must zfs mount $TESTPOOL for fs in ${filesystems[@]}; do cleanup_filesystem "$TESTPOOL" "$fs" diff --git a/usr/src/test/zfs-tests/tests/functional/rename_dirs/rename_dirs_001_pos.ksh b/usr/src/test/zfs-tests/tests/functional/rename_dirs/rename_dirs_001_pos.ksh index b02e67cc06..d7b6de1a2e 100644 --- a/usr/src/test/zfs-tests/tests/functional/rename_dirs/rename_dirs_001_pos.ksh +++ b/usr/src/test/zfs-tests/tests/functional/rename_dirs/rename_dirs_001_pos.ksh @@ -33,7 +33,7 @@ # # DESCRIPTION: -# Create two directory trees in ZFS filesystem, and concurently rename +# Create two directory trees in ZFS filesystem, and concurrently rename # directory across the two trees. ZFS should be able to handle the race # situation. # @@ -58,14 +58,14 @@ log_onexit cleanup cd $TESTDIR mkdir -p 1/2/3/4/5 a/b/c/d/e -$RENAME_DIRS & +rename_dir & -sleep 500 +sleep 10 typeset -i retval=1 -pgrep $RENAME_DIRS >/dev/null 2>&1 +pgrep -x rename_dir >/dev/null 2>&1 retval=$? if (( $retval == 0 )); then - pkill -9 $RENAME_DIRS >/dev/null 2>&1 + pkill -9 -x rename_dir >/dev/null 2>&1 fi log_pass "ZFS handle race directory rename operation as expected." diff --git a/usr/src/uts/common/fs/zfs/arc.c b/usr/src/uts/common/fs/zfs/arc.c index cc5143e4df..1034481117 100644 --- a/usr/src/uts/common/fs/zfs/arc.c +++ b/usr/src/uts/common/fs/zfs/arc.c @@ -751,7 +751,13 @@ static uint8_t l2arc_thread_exit; static kmutex_t l2arc_rebuild_thr_lock; static kcondvar_t l2arc_rebuild_thr_cv; -static abd_t *arc_get_data_abd(arc_buf_hdr_t *, uint64_t, void *); +enum arc_hdr_alloc_flags { + ARC_HDR_ALLOC_RDATA = 0x1, + ARC_HDR_DO_ADAPT = 0x2, +}; + + +static abd_t *arc_get_data_abd(arc_buf_hdr_t *, uint64_t, void *, boolean_t); typedef enum arc_fill_flags { ARC_FILL_LOCKED = 1 << 0, /* hdr lock is held */ ARC_FILL_COMPRESSED = 1 << 1, /* fill with compressed data */ @@ -761,12 +767,12 @@ typedef enum arc_fill_flags { } arc_fill_flags_t; static void *arc_get_data_buf(arc_buf_hdr_t *, uint64_t, void *); -static void arc_get_data_impl(arc_buf_hdr_t *, uint64_t, void *); +static void arc_get_data_impl(arc_buf_hdr_t *, uint64_t, void *, boolean_t); static void arc_free_data_abd(arc_buf_hdr_t *, abd_t *, uint64_t, void *); static void arc_free_data_buf(arc_buf_hdr_t *, void *, uint64_t, void *); static void arc_free_data_impl(arc_buf_hdr_t *hdr, uint64_t size, void *tag); static void arc_hdr_free_pabd(arc_buf_hdr_t *, boolean_t); -static void arc_hdr_alloc_pabd(arc_buf_hdr_t *, boolean_t); +static void arc_hdr_alloc_pabd(arc_buf_hdr_t *, int); static void arc_access(arc_buf_hdr_t *, kmutex_t *); static boolean_t arc_is_overflowing(); static void arc_buf_watch(arc_buf_t *); @@ -1711,7 +1717,7 @@ arc_hdr_decrypt(arc_buf_hdr_t *hdr, spa_t *spa, const zbookmark_phys_t *zb) ASSERT(HDR_EMPTY_OR_LOCKED(hdr)); ASSERT(HDR_ENCRYPTED(hdr)); - arc_hdr_alloc_pabd(hdr, B_FALSE); + arc_hdr_alloc_pabd(hdr, ARC_HDR_DO_ADAPT); ret = spa_do_crypt_abd(B_FALSE, spa, zb, hdr->b_crypt_hdr.b_ot, B_FALSE, bswap, hdr->b_crypt_hdr.b_salt, hdr->b_crypt_hdr.b_iv, @@ -1738,7 +1744,7 @@ arc_hdr_decrypt(arc_buf_hdr_t *hdr, spa_t *spa, const zbookmark_phys_t *zb) * and then loan a buffer from it, rather than allocating a * linear buffer and wrapping it in an abd later. */ - cabd = arc_get_data_abd(hdr, arc_hdr_size(hdr), hdr); + cabd = arc_get_data_abd(hdr, arc_hdr_size(hdr), hdr, B_TRUE); tmp = abd_borrow_buf(cabd, arc_hdr_size(hdr)); ret = zio_decompress_data(HDR_GET_COMPRESS(hdr), @@ -3022,9 +3028,11 @@ arc_buf_destroy_impl(arc_buf_t *buf) } static void -arc_hdr_alloc_pabd(arc_buf_hdr_t *hdr, boolean_t alloc_rdata) +arc_hdr_alloc_pabd(arc_buf_hdr_t *hdr, int alloc_flags) { uint64_t size; + boolean_t alloc_rdata = ((alloc_flags & ARC_HDR_ALLOC_RDATA) != 0); + boolean_t do_adapt = ((alloc_flags & ARC_HDR_DO_ADAPT) != 0); ASSERT3U(HDR_GET_LSIZE(hdr), >, 0); ASSERT(HDR_HAS_L1HDR(hdr)); @@ -3034,12 +3042,14 @@ arc_hdr_alloc_pabd(arc_buf_hdr_t *hdr, boolean_t alloc_rdata) if (alloc_rdata) { size = HDR_GET_PSIZE(hdr); ASSERT3P(hdr->b_crypt_hdr.b_rabd, ==, NULL); - hdr->b_crypt_hdr.b_rabd = arc_get_data_abd(hdr, size, hdr); + hdr->b_crypt_hdr.b_rabd = arc_get_data_abd(hdr, size, hdr, + do_adapt); ASSERT3P(hdr->b_crypt_hdr.b_rabd, !=, NULL); } else { size = arc_hdr_size(hdr); ASSERT3P(hdr->b_l1hdr.b_pabd, ==, NULL); - hdr->b_l1hdr.b_pabd = arc_get_data_abd(hdr, size, hdr); + hdr->b_l1hdr.b_pabd = arc_get_data_abd(hdr, size, hdr, + do_adapt); ASSERT3P(hdr->b_l1hdr.b_pabd, !=, NULL); } @@ -3092,6 +3102,7 @@ arc_hdr_alloc(uint64_t spa, int32_t psize, int32_t lsize, arc_buf_contents_t type, boolean_t alloc_rdata) { arc_buf_hdr_t *hdr; + int flags = ARC_HDR_DO_ADAPT; VERIFY(type == ARC_BUFC_DATA || type == ARC_BUFC_METADATA); if (protected) { @@ -3099,6 +3110,7 @@ arc_hdr_alloc(uint64_t spa, int32_t psize, int32_t lsize, } else { hdr = kmem_cache_alloc(hdr_full_cache, KM_PUSHPAGE); } + flags |= alloc_rdata ? ARC_HDR_ALLOC_RDATA : 0; ASSERT(HDR_EMPTY(hdr)); ASSERT3P(hdr->b_l1hdr.b_freeze_cksum, ==, NULL); ASSERT3P(hdr->b_l1hdr.b_thawed, ==, NULL); @@ -3122,7 +3134,7 @@ arc_hdr_alloc(uint64_t spa, int32_t psize, int32_t lsize, * the compressed or uncompressed data depending on the block * it references and compressed arc enablement. */ - arc_hdr_alloc_pabd(hdr, alloc_rdata); + arc_hdr_alloc_pabd(hdr, flags); ASSERT(zfs_refcount_is_zero(&hdr->b_l1hdr.b_refcnt)); return (hdr); @@ -4896,11 +4908,12 @@ arc_is_overflowing(void) } static abd_t * -arc_get_data_abd(arc_buf_hdr_t *hdr, uint64_t size, void *tag) +arc_get_data_abd(arc_buf_hdr_t *hdr, uint64_t size, void *tag, + boolean_t do_adapt) { arc_buf_contents_t type = arc_buf_type(hdr); - arc_get_data_impl(hdr, size, tag); + arc_get_data_impl(hdr, size, tag, do_adapt); if (type == ARC_BUFC_METADATA) { return (abd_alloc(size, B_TRUE)); } else { @@ -4914,7 +4927,7 @@ arc_get_data_buf(arc_buf_hdr_t *hdr, uint64_t size, void *tag) { arc_buf_contents_t type = arc_buf_type(hdr); - arc_get_data_impl(hdr, size, tag); + arc_get_data_impl(hdr, size, tag, B_TRUE); if (type == ARC_BUFC_METADATA) { return (zio_buf_alloc(size)); } else { @@ -4930,12 +4943,14 @@ arc_get_data_buf(arc_buf_hdr_t *hdr, uint64_t size, void *tag) * limit, we'll only signal the reclaim thread and continue on. */ static void -arc_get_data_impl(arc_buf_hdr_t *hdr, uint64_t size, void *tag) +arc_get_data_impl(arc_buf_hdr_t *hdr, uint64_t size, void *tag, + boolean_t do_adapt) { arc_state_t *state = hdr->b_l1hdr.b_state; arc_buf_contents_t type = arc_buf_type(hdr); - arc_adapt(size, state); + if (do_adapt) + arc_adapt(size, state); /* * If arc_size is currently overflowing, and has grown past our @@ -5758,6 +5773,7 @@ top: boolean_t devw = B_FALSE; uint64_t size; abd_t *hdr_abd; + int alloc_flags = encrypted_read ? ARC_HDR_ALLOC_RDATA : 0; if (hdr == NULL) { /* this block is not in the cache */ @@ -5824,8 +5840,9 @@ top: * do this after we've called arc_access() to * avoid hitting an assert in remove_reference(). */ + arc_adapt(arc_hdr_size(hdr), hdr->b_l1hdr.b_state); arc_access(hdr, hash_lock); - arc_hdr_alloc_pabd(hdr, encrypted_read); + arc_hdr_alloc_pabd(hdr, alloc_flags); } if (encrypted_read) { @@ -6225,7 +6242,7 @@ arc_release(arc_buf_t *buf, void *tag) if (arc_can_share(hdr, lastbuf)) { arc_share_buf(hdr, lastbuf); } else { - arc_hdr_alloc_pabd(hdr, B_FALSE); + arc_hdr_alloc_pabd(hdr, ARC_HDR_DO_ADAPT); abd_copy_from_buf(hdr->b_l1hdr.b_pabd, buf->b_data, psize); } @@ -6448,7 +6465,7 @@ arc_write_ready(zio_t *zio) if (ARC_BUF_ENCRYPTED(buf)) { ASSERT3U(psize, >, 0); ASSERT(ARC_BUF_COMPRESSED(buf)); - arc_hdr_alloc_pabd(hdr, B_TRUE); + arc_hdr_alloc_pabd(hdr, ARC_HDR_DO_ADAPT|ARC_HDR_ALLOC_RDATA); abd_copy(hdr->b_crypt_hdr.b_rabd, zio->io_abd, psize); } else if (zfs_abd_scatter_enabled || !arc_can_share(hdr, buf)) { /* @@ -6458,16 +6475,17 @@ arc_write_ready(zio_t *zio) */ if (BP_IS_ENCRYPTED(bp)) { ASSERT3U(psize, >, 0); - arc_hdr_alloc_pabd(hdr, B_TRUE); + arc_hdr_alloc_pabd(hdr, + ARC_HDR_DO_ADAPT|ARC_HDR_ALLOC_RDATA); abd_copy(hdr->b_crypt_hdr.b_rabd, zio->io_abd, psize); } else if (arc_hdr_get_compress(hdr) != ZIO_COMPRESS_OFF && !ARC_BUF_COMPRESSED(buf)) { ASSERT3U(psize, >, 0); - arc_hdr_alloc_pabd(hdr, B_FALSE); + arc_hdr_alloc_pabd(hdr, ARC_HDR_DO_ADAPT); abd_copy(hdr->b_l1hdr.b_pabd, zio->io_abd, psize); } else { ASSERT3U(zio->io_orig_size, ==, arc_hdr_size(hdr)); - arc_hdr_alloc_pabd(hdr, B_FALSE); + arc_hdr_alloc_pabd(hdr, ARC_HDR_DO_ADAPT); abd_copy_from_buf(hdr->b_l1hdr.b_pabd, buf->b_data, arc_buf_size(buf)); } @@ -7804,7 +7822,8 @@ l2arc_untransform(zio_t *zio, l2arc_read_callback_t *cb) * until arc_read_done(). */ if (BP_IS_ENCRYPTED(bp)) { - abd_t *eabd = arc_get_data_abd(hdr, arc_hdr_size(hdr), hdr); + abd_t *eabd = arc_get_data_abd(hdr, arc_hdr_size(hdr), hdr, + B_TRUE); zio_crypt_decode_params_bp(bp, salt, iv); zio_crypt_decode_mac_bp(bp, mac); @@ -7840,7 +7859,8 @@ l2arc_untransform(zio_t *zio, l2arc_read_callback_t *cb) */ if (HDR_GET_COMPRESS(hdr) != ZIO_COMPRESS_OFF && !HDR_COMPRESSION_ENABLED(hdr)) { - abd_t *cabd = arc_get_data_abd(hdr, arc_hdr_size(hdr), hdr); + abd_t *cabd = arc_get_data_abd(hdr, arc_hdr_size(hdr), hdr, + B_TRUE); void *tmp = abd_borrow_buf(cabd, arc_hdr_size(hdr)); ret = zio_decompress_data(HDR_GET_COMPRESS(hdr), diff --git a/usr/src/uts/common/io/nxge/npi/npi_mac.c b/usr/src/uts/common/io/nxge/npi/npi_mac.c index 8d808577f9..d36f9d913f 100644 --- a/usr/src/uts/common/io/nxge/npi/npi_mac.c +++ b/usr/src/uts/common/io/nxge/npi/npi_mac.c @@ -1014,6 +1014,7 @@ npi_mac_port_attr(npi_handle_t handle, io_op_t op, uint8_t portn, min_fsize = (val & XMAC_MIN_TX_FRM_SZ_MASK) >> XMAC_MIN_TX_FRM_SZ_SHIFT; XMAC_REG_RD(handle, portn, XMAC_MAX_REG, &val); + max_fsize = val & XMAC_MAX_FRM_SZ_MASK; attrp->odata[0] = min_fsize; attrp->odata[1] = max_fsize; } diff --git a/usr/src/uts/common/io/nxge/npi/npi_rxdma.c b/usr/src/uts/common/io/nxge/npi/npi_rxdma.c index f9151782c0..35f1dc77bf 100644 --- a/usr/src/uts/common/io/nxge/npi/npi_rxdma.c +++ b/usr/src/uts/common/io/nxge/npi/npi_rxdma.c @@ -260,6 +260,9 @@ npi_rxdma_cfg_logical_page(npi_handle_t handle, uint8_t rdc, uint64_t value_offset, reloc_offset, mask_offset; uint64_t valid_offset; + value_offset = 0; + reloc_offset = 0; + mask_offset = 0; ASSERT(RXDMA_CHANNEL_VALID(rdc)); if (!RXDMA_CHANNEL_VALID(rdc)) { NPI_ERROR_MSG((handle.function, NPI_ERR_CTL, diff --git a/usr/src/uts/common/io/nxge/npi/npi_txc.c b/usr/src/uts/common/io/nxge/npi/npi_txc.c index aa38ed6544..481d26ce4c 100644 --- a/usr/src/uts/common/io/nxge/npi/npi_txc.c +++ b/usr/src/uts/common/io/nxge/npi/npi_txc.c @@ -23,8 +23,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <npi_txc.h> /* @@ -941,12 +939,9 @@ npi_txc_ro_ecc_state_clr(npi_handle_t handle, uint8_t port) * NPI_FAILURE - * NPI_TXC_PORT_INVALID */ -#ifdef lint -/*ARGSUSED*/ -#endif npi_status_t npi_txc_sf_states_get(npi_handle_t handle, uint8_t port, - txc_sf_states_t *states) + txc_sf_states_t *states) { txc_sfecc_st_t ecc; txc_sf_data0_t d0; @@ -955,6 +950,12 @@ npi_txc_sf_states_get(npi_handle_t handle, uint8_t port, txc_sf_data3_t d3; txc_sf_data4_t d4; + d0.value = 0; + d1.value = 0; + d2.value = 0; + d3.value = 0; + d4.value = 0; + ASSERT(IS_PORT_NUM_VALID(port)); TXC_FZC_CNTL_REG_READ64(handle, TXC_SFECC_ST_REG, port, &ecc.value); diff --git a/usr/src/uts/common/io/nxge/nxge_fflp.c b/usr/src/uts/common/io/nxge/nxge_fflp.c index 109aa99b3d..cb6eb78b15 100644 --- a/usr/src/uts/common/io/nxge/nxge_fflp.c +++ b/usr/src/uts/common/io/nxge/nxge_fflp.c @@ -906,47 +906,45 @@ static void nxge_fill_tcam_entry_udp(p_nxge_t nxgep, flow_spec_t *flow_spec, tcam_entry_t *tcam_ptr) { - udpip4_spec_t *fspec_key; - udpip4_spec_t *fspec_mask; - - fspec_key = (udpip4_spec_t *)&flow_spec->uh.udpip4spec; - fspec_mask = (udpip4_spec_t *)&flow_spec->um.udpip4spec; - TCAM_IPV4_ADDR(tcam_ptr->ip4_dest_key, fspec_key->ip4dst); - TCAM_IPV4_ADDR(tcam_ptr->ip4_dest_mask, fspec_mask->ip4dst); - TCAM_IPV4_ADDR(tcam_ptr->ip4_src_key, fspec_key->ip4src); - TCAM_IPV4_ADDR(tcam_ptr->ip4_src_mask, fspec_mask->ip4src); +#define fspec_key (flow_spec->uh.udpip4spec) +#define fspec_mask (flow_spec->um.udpip4spec) + + TCAM_IPV4_ADDR(tcam_ptr->ip4_dest_key, fspec_key.ip4dst); + TCAM_IPV4_ADDR(tcam_ptr->ip4_dest_mask, fspec_mask.ip4dst); + TCAM_IPV4_ADDR(tcam_ptr->ip4_src_key, fspec_key.ip4src); + TCAM_IPV4_ADDR(tcam_ptr->ip4_src_mask, fspec_mask.ip4src); TCAM_IP_PORTS(tcam_ptr->ip4_port_key, - fspec_key->pdst, fspec_key->psrc); + fspec_key.pdst, fspec_key.psrc); TCAM_IP_PORTS(tcam_ptr->ip4_port_mask, - fspec_mask->pdst, fspec_mask->psrc); + fspec_mask.pdst, fspec_mask.psrc); TCAM_IP_CLASS(tcam_ptr->ip4_class_key, tcam_ptr->ip4_class_mask, TCAM_CLASS_UDP_IPV4); TCAM_IP_PROTO(tcam_ptr->ip4_proto_key, tcam_ptr->ip4_proto_mask, IPPROTO_UDP); - tcam_ptr->ip4_tos_key = fspec_key->tos; - tcam_ptr->ip4_tos_mask = fspec_mask->tos; + tcam_ptr->ip4_tos_key = fspec_key.tos; + tcam_ptr->ip4_tos_mask = fspec_mask.tos; +#undef fspec_key +#undef fspec_mask } static void nxge_fill_tcam_entry_udp_ipv6(p_nxge_t nxgep, flow_spec_t *flow_spec, tcam_entry_t *tcam_ptr) { - udpip6_spec_t *fspec_key; - udpip6_spec_t *fspec_mask; p_nxge_class_pt_cfg_t p_class_cfgp; +#define fspec_key (flow_spec->uh.udpip6spec) +#define fspec_mask (flow_spec->um.udpip6spec) - fspec_key = (udpip6_spec_t *)&flow_spec->uh.udpip6spec; - fspec_mask = (udpip6_spec_t *)&flow_spec->um.udpip6spec; p_class_cfgp = (p_nxge_class_pt_cfg_t)&nxgep->class_config; if (p_class_cfgp->class_cfg[TCAM_CLASS_UDP_IPV6] & NXGE_CLASS_TCAM_USE_SRC_ADDR) { - TCAM_IPV6_ADDR(tcam_ptr->ip6_ip_addr_key, fspec_key->ip6src); - TCAM_IPV6_ADDR(tcam_ptr->ip6_ip_addr_mask, fspec_mask->ip6src); + TCAM_IPV6_ADDR(tcam_ptr->ip6_ip_addr_key, fspec_key.ip6src); + TCAM_IPV6_ADDR(tcam_ptr->ip6_ip_addr_mask, fspec_mask.ip6src); } else { - TCAM_IPV6_ADDR(tcam_ptr->ip6_ip_addr_key, fspec_key->ip6dst); - TCAM_IPV6_ADDR(tcam_ptr->ip6_ip_addr_mask, fspec_mask->ip6dst); + TCAM_IPV6_ADDR(tcam_ptr->ip6_ip_addr_key, fspec_key.ip6dst); + TCAM_IPV6_ADDR(tcam_ptr->ip6_ip_addr_mask, fspec_mask.ip6dst); } TCAM_IP_CLASS(tcam_ptr->ip6_class_key, @@ -954,11 +952,13 @@ nxge_fill_tcam_entry_udp_ipv6(p_nxge_t nxgep, flow_spec_t *flow_spec, TCAM_IP_PROTO(tcam_ptr->ip6_nxt_hdr_key, tcam_ptr->ip6_nxt_hdr_mask, IPPROTO_UDP); TCAM_IP_PORTS(tcam_ptr->ip6_port_key, - fspec_key->pdst, fspec_key->psrc); + fspec_key.pdst, fspec_key.psrc); TCAM_IP_PORTS(tcam_ptr->ip6_port_mask, - fspec_mask->pdst, fspec_mask->psrc); - tcam_ptr->ip6_tos_key = fspec_key->tos; - tcam_ptr->ip6_tos_mask = fspec_mask->tos; + fspec_mask.pdst, fspec_mask.psrc); + tcam_ptr->ip6_tos_key = fspec_key.tos; + tcam_ptr->ip6_tos_mask = fspec_mask.tos; +#undef fspec_key +#undef fspec_mask } /* ARGSUSED */ @@ -966,26 +966,25 @@ static void nxge_fill_tcam_entry_tcp(p_nxge_t nxgep, flow_spec_t *flow_spec, tcam_entry_t *tcam_ptr) { - tcpip4_spec_t *fspec_key; - tcpip4_spec_t *fspec_mask; - - fspec_key = (tcpip4_spec_t *)&flow_spec->uh.tcpip4spec; - fspec_mask = (tcpip4_spec_t *)&flow_spec->um.tcpip4spec; +#define fspec_key (flow_spec->uh.tcpip4spec) +#define fspec_mask (flow_spec->um.tcpip4spec) - TCAM_IPV4_ADDR(tcam_ptr->ip4_dest_key, fspec_key->ip4dst); - TCAM_IPV4_ADDR(tcam_ptr->ip4_dest_mask, fspec_mask->ip4dst); - TCAM_IPV4_ADDR(tcam_ptr->ip4_src_key, fspec_key->ip4src); - TCAM_IPV4_ADDR(tcam_ptr->ip4_src_mask, fspec_mask->ip4src); + TCAM_IPV4_ADDR(tcam_ptr->ip4_dest_key, fspec_key.ip4dst); + TCAM_IPV4_ADDR(tcam_ptr->ip4_dest_mask, fspec_mask.ip4dst); + TCAM_IPV4_ADDR(tcam_ptr->ip4_src_key, fspec_key.ip4src); + TCAM_IPV4_ADDR(tcam_ptr->ip4_src_mask, fspec_mask.ip4src); TCAM_IP_PORTS(tcam_ptr->ip4_port_key, - fspec_key->pdst, fspec_key->psrc); + fspec_key.pdst, fspec_key.psrc); TCAM_IP_PORTS(tcam_ptr->ip4_port_mask, - fspec_mask->pdst, fspec_mask->psrc); + fspec_mask.pdst, fspec_mask.psrc); TCAM_IP_CLASS(tcam_ptr->ip4_class_key, tcam_ptr->ip4_class_mask, TCAM_CLASS_TCP_IPV4); TCAM_IP_PROTO(tcam_ptr->ip4_proto_key, tcam_ptr->ip4_proto_mask, IPPROTO_TCP); - tcam_ptr->ip4_tos_key = fspec_key->tos; - tcam_ptr->ip4_tos_mask = fspec_mask->tos; + tcam_ptr->ip4_tos_key = fspec_key.tos; + tcam_ptr->ip4_tos_mask = fspec_mask.tos; +#undef fspec_key +#undef fspec_mask } /* ARGSUSED */ @@ -993,47 +992,43 @@ static void nxge_fill_tcam_entry_sctp(p_nxge_t nxgep, flow_spec_t *flow_spec, tcam_entry_t *tcam_ptr) { - tcpip4_spec_t *fspec_key; - tcpip4_spec_t *fspec_mask; - - fspec_key = (tcpip4_spec_t *)&flow_spec->uh.tcpip4spec; - fspec_mask = (tcpip4_spec_t *)&flow_spec->um.tcpip4spec; +#define fspec_key (flow_spec->uh.tcpip4spec) +#define fspec_mask (flow_spec->um.tcpip4spec) - TCAM_IPV4_ADDR(tcam_ptr->ip4_dest_key, fspec_key->ip4dst); - TCAM_IPV4_ADDR(tcam_ptr->ip4_dest_mask, fspec_mask->ip4dst); - TCAM_IPV4_ADDR(tcam_ptr->ip4_src_key, fspec_key->ip4src); - TCAM_IPV4_ADDR(tcam_ptr->ip4_src_mask, fspec_mask->ip4src); + TCAM_IPV4_ADDR(tcam_ptr->ip4_dest_key, fspec_key.ip4dst); + TCAM_IPV4_ADDR(tcam_ptr->ip4_dest_mask, fspec_mask.ip4dst); + TCAM_IPV4_ADDR(tcam_ptr->ip4_src_key, fspec_key.ip4src); + TCAM_IPV4_ADDR(tcam_ptr->ip4_src_mask, fspec_mask.ip4src); TCAM_IP_CLASS(tcam_ptr->ip4_class_key, tcam_ptr->ip4_class_mask, TCAM_CLASS_SCTP_IPV4); TCAM_IP_PROTO(tcam_ptr->ip4_proto_key, tcam_ptr->ip4_proto_mask, IPPROTO_SCTP); TCAM_IP_PORTS(tcam_ptr->ip4_port_key, - fspec_key->pdst, fspec_key->psrc); + fspec_key.pdst, fspec_key.psrc); TCAM_IP_PORTS(tcam_ptr->ip4_port_mask, - fspec_mask->pdst, fspec_mask->psrc); - tcam_ptr->ip4_tos_key = fspec_key->tos; - tcam_ptr->ip4_tos_mask = fspec_mask->tos; + fspec_mask.pdst, fspec_mask.psrc); + tcam_ptr->ip4_tos_key = fspec_key.tos; + tcam_ptr->ip4_tos_mask = fspec_mask.tos; +#undef fspec_key +#undef fspec_mask } static void nxge_fill_tcam_entry_tcp_ipv6(p_nxge_t nxgep, flow_spec_t *flow_spec, tcam_entry_t *tcam_ptr) { - tcpip6_spec_t *fspec_key; - tcpip6_spec_t *fspec_mask; p_nxge_class_pt_cfg_t p_class_cfgp; - - fspec_key = (tcpip6_spec_t *)&flow_spec->uh.tcpip6spec; - fspec_mask = (tcpip6_spec_t *)&flow_spec->um.tcpip6spec; +#define fspec_key (flow_spec->uh.tcpip6spec) +#define fspec_mask (flow_spec->um.tcpip6spec) p_class_cfgp = (p_nxge_class_pt_cfg_t)&nxgep->class_config; if (p_class_cfgp->class_cfg[TCAM_CLASS_UDP_IPV6] & NXGE_CLASS_TCAM_USE_SRC_ADDR) { - TCAM_IPV6_ADDR(tcam_ptr->ip6_ip_addr_key, fspec_key->ip6src); - TCAM_IPV6_ADDR(tcam_ptr->ip6_ip_addr_mask, fspec_mask->ip6src); + TCAM_IPV6_ADDR(tcam_ptr->ip6_ip_addr_key, fspec_key.ip6src); + TCAM_IPV6_ADDR(tcam_ptr->ip6_ip_addr_mask, fspec_mask.ip6src); } else { - TCAM_IPV6_ADDR(tcam_ptr->ip6_ip_addr_key, fspec_key->ip6dst); - TCAM_IPV6_ADDR(tcam_ptr->ip6_ip_addr_mask, fspec_mask->ip6dst); + TCAM_IPV6_ADDR(tcam_ptr->ip6_ip_addr_key, fspec_key.ip6dst); + TCAM_IPV6_ADDR(tcam_ptr->ip6_ip_addr_mask, fspec_mask.ip6dst); } TCAM_IP_CLASS(tcam_ptr->ip6_class_key, @@ -1041,32 +1036,32 @@ nxge_fill_tcam_entry_tcp_ipv6(p_nxge_t nxgep, flow_spec_t *flow_spec, TCAM_IP_PROTO(tcam_ptr->ip6_nxt_hdr_key, tcam_ptr->ip6_nxt_hdr_mask, IPPROTO_TCP); TCAM_IP_PORTS(tcam_ptr->ip6_port_key, - fspec_key->pdst, fspec_key->psrc); + fspec_key.pdst, fspec_key.psrc); TCAM_IP_PORTS(tcam_ptr->ip6_port_mask, - fspec_mask->pdst, fspec_mask->psrc); - tcam_ptr->ip6_tos_key = fspec_key->tos; - tcam_ptr->ip6_tos_mask = fspec_mask->tos; + fspec_mask.pdst, fspec_mask.psrc); + tcam_ptr->ip6_tos_key = fspec_key.tos; + tcam_ptr->ip6_tos_mask = fspec_mask.tos; +#undef fspec_key +#undef fspec_mask } static void nxge_fill_tcam_entry_sctp_ipv6(p_nxge_t nxgep, flow_spec_t *flow_spec, tcam_entry_t *tcam_ptr) { - tcpip6_spec_t *fspec_key; - tcpip6_spec_t *fspec_mask; p_nxge_class_pt_cfg_t p_class_cfgp; +#define fspec_key (flow_spec->uh.tcpip6spec) +#define fspec_mask (flow_spec->um.tcpip6spec) - fspec_key = (tcpip6_spec_t *)&flow_spec->uh.tcpip6spec; - fspec_mask = (tcpip6_spec_t *)&flow_spec->um.tcpip6spec; p_class_cfgp = (p_nxge_class_pt_cfg_t)&nxgep->class_config; if (p_class_cfgp->class_cfg[TCAM_CLASS_UDP_IPV6] & NXGE_CLASS_TCAM_USE_SRC_ADDR) { - TCAM_IPV6_ADDR(tcam_ptr->ip6_ip_addr_key, fspec_key->ip6src); - TCAM_IPV6_ADDR(tcam_ptr->ip6_ip_addr_mask, fspec_mask->ip6src); + TCAM_IPV6_ADDR(tcam_ptr->ip6_ip_addr_key, fspec_key.ip6src); + TCAM_IPV6_ADDR(tcam_ptr->ip6_ip_addr_mask, fspec_mask.ip6src); } else { - TCAM_IPV6_ADDR(tcam_ptr->ip6_ip_addr_key, fspec_key->ip6dst); - TCAM_IPV6_ADDR(tcam_ptr->ip6_ip_addr_mask, fspec_mask->ip6dst); + TCAM_IPV6_ADDR(tcam_ptr->ip6_ip_addr_key, fspec_key.ip6dst); + TCAM_IPV6_ADDR(tcam_ptr->ip6_ip_addr_mask, fspec_mask.ip6dst); } TCAM_IP_CLASS(tcam_ptr->ip6_class_key, @@ -1074,11 +1069,13 @@ nxge_fill_tcam_entry_sctp_ipv6(p_nxge_t nxgep, flow_spec_t *flow_spec, TCAM_IP_PROTO(tcam_ptr->ip6_nxt_hdr_key, tcam_ptr->ip6_nxt_hdr_mask, IPPROTO_SCTP); TCAM_IP_PORTS(tcam_ptr->ip6_port_key, - fspec_key->pdst, fspec_key->psrc); + fspec_key.pdst, fspec_key.psrc); TCAM_IP_PORTS(tcam_ptr->ip6_port_mask, - fspec_mask->pdst, fspec_mask->psrc); - tcam_ptr->ip6_tos_key = fspec_key->tos; - tcam_ptr->ip6_tos_mask = fspec_mask->tos; + fspec_mask.pdst, fspec_mask.psrc); + tcam_ptr->ip6_tos_key = fspec_key.tos; + tcam_ptr->ip6_tos_mask = fspec_mask.tos; +#undef fspec_key +#undef fspec_mask } /* ARGSUSED */ @@ -1086,19 +1083,16 @@ static void nxge_fill_tcam_entry_ah_esp(p_nxge_t nxgep, flow_spec_t *flow_spec, tcam_entry_t *tcam_ptr) { - ahip4_spec_t *fspec_key; - ahip4_spec_t *fspec_mask; - - fspec_key = (ahip4_spec_t *)&flow_spec->uh.ahip4spec; - fspec_mask = (ahip4_spec_t *)&flow_spec->um.ahip4spec; +#define fspec_key (flow_spec->uh.ahip4spec) +#define fspec_mask (flow_spec->um.ahip4spec) - TCAM_IPV4_ADDR(tcam_ptr->ip4_dest_key, fspec_key->ip4dst); - TCAM_IPV4_ADDR(tcam_ptr->ip4_dest_mask, fspec_mask->ip4dst); - TCAM_IPV4_ADDR(tcam_ptr->ip4_src_key, fspec_key->ip4src); - TCAM_IPV4_ADDR(tcam_ptr->ip4_src_mask, fspec_mask->ip4src); + TCAM_IPV4_ADDR(tcam_ptr->ip4_dest_key, fspec_key.ip4dst); + TCAM_IPV4_ADDR(tcam_ptr->ip4_dest_mask, fspec_mask.ip4dst); + TCAM_IPV4_ADDR(tcam_ptr->ip4_src_key, fspec_key.ip4src); + TCAM_IPV4_ADDR(tcam_ptr->ip4_src_mask, fspec_mask.ip4src); - tcam_ptr->ip4_port_key = fspec_key->spi; - tcam_ptr->ip4_port_mask = fspec_mask->spi; + tcam_ptr->ip4_port_key = fspec_key.spi; + tcam_ptr->ip4_port_mask = fspec_mask.spi; TCAM_IP_CLASS(tcam_ptr->ip4_class_key, tcam_ptr->ip4_class_mask, @@ -1111,29 +1105,28 @@ nxge_fill_tcam_entry_ah_esp(p_nxge_t nxgep, flow_spec_t *flow_spec, TCAM_IP_PROTO(tcam_ptr->ip4_proto_key, tcam_ptr->ip4_proto_mask, IPPROTO_ESP); } - tcam_ptr->ip4_tos_key = fspec_key->tos; - tcam_ptr->ip4_tos_mask = fspec_mask->tos; + tcam_ptr->ip4_tos_key = fspec_key.tos; + tcam_ptr->ip4_tos_mask = fspec_mask.tos; +#undef fspec_key +#undef fspec_mask } static void nxge_fill_tcam_entry_ah_esp_ipv6(p_nxge_t nxgep, flow_spec_t *flow_spec, tcam_entry_t *tcam_ptr) { - ahip6_spec_t *fspec_key; - ahip6_spec_t *fspec_mask; p_nxge_class_pt_cfg_t p_class_cfgp; - - fspec_key = (ahip6_spec_t *)&flow_spec->uh.ahip6spec; - fspec_mask = (ahip6_spec_t *)&flow_spec->um.ahip6spec; +#define fspec_key (flow_spec->uh.ahip6spec) +#define fspec_mask (flow_spec->um.ahip6spec) p_class_cfgp = (p_nxge_class_pt_cfg_t)&nxgep->class_config; if (p_class_cfgp->class_cfg[TCAM_CLASS_AH_ESP_IPV6] & NXGE_CLASS_TCAM_USE_SRC_ADDR) { - TCAM_IPV6_ADDR(tcam_ptr->ip6_ip_addr_key, fspec_key->ip6src); - TCAM_IPV6_ADDR(tcam_ptr->ip6_ip_addr_mask, fspec_mask->ip6src); + TCAM_IPV6_ADDR(tcam_ptr->ip6_ip_addr_key, fspec_key.ip6src); + TCAM_IPV6_ADDR(tcam_ptr->ip6_ip_addr_mask, fspec_mask.ip6src); } else { - TCAM_IPV6_ADDR(tcam_ptr->ip6_ip_addr_key, fspec_key->ip6dst); - TCAM_IPV6_ADDR(tcam_ptr->ip6_ip_addr_mask, fspec_mask->ip6dst); + TCAM_IPV6_ADDR(tcam_ptr->ip6_ip_addr_key, fspec_key.ip6dst); + TCAM_IPV6_ADDR(tcam_ptr->ip6_ip_addr_mask, fspec_mask.ip6dst); } TCAM_IP_CLASS(tcam_ptr->ip6_class_key, @@ -1146,10 +1139,12 @@ nxge_fill_tcam_entry_ah_esp_ipv6(p_nxge_t nxgep, flow_spec_t *flow_spec, TCAM_IP_PROTO(tcam_ptr->ip6_nxt_hdr_key, tcam_ptr->ip6_nxt_hdr_mask, IPPROTO_ESP); } - tcam_ptr->ip6_port_key = fspec_key->spi; - tcam_ptr->ip6_port_mask = fspec_mask->spi; - tcam_ptr->ip6_tos_key = fspec_key->tos; - tcam_ptr->ip6_tos_mask = fspec_mask->tos; + tcam_ptr->ip6_port_key = fspec_key.spi; + tcam_ptr->ip6_port_mask = fspec_mask.spi; + tcam_ptr->ip6_tos_key = fspec_key.tos; + tcam_ptr->ip6_tos_mask = fspec_mask.tos; +#undef fspec_key +#undef fspec_mask } /* ARGSUSED */ @@ -1157,30 +1152,29 @@ static void nxge_fill_tcam_entry_ip_usr(p_nxge_t nxgep, flow_spec_t *flow_spec, tcam_entry_t *tcam_ptr, tcam_class_t class) { - ip_user_spec_t *fspec_key; - ip_user_spec_t *fspec_mask; +#define fspec_key (flow_spec->uh.ip_usr_spec) +#define fspec_mask (flow_spec->um.ip_usr_spec) - fspec_key = (ip_user_spec_t *)&flow_spec->uh.ip_usr_spec; - fspec_mask = (ip_user_spec_t *)&flow_spec->um.ip_usr_spec; + if (fspec_key.ip_ver == FSPEC_IP4) { + TCAM_IPV4_ADDR(tcam_ptr->ip4_dest_key, fspec_key.ip4dst); + TCAM_IPV4_ADDR(tcam_ptr->ip4_dest_mask, fspec_mask.ip4dst); + TCAM_IPV4_ADDR(tcam_ptr->ip4_src_key, fspec_key.ip4src); + TCAM_IPV4_ADDR(tcam_ptr->ip4_src_mask, fspec_mask.ip4src); - if (fspec_key->ip_ver == FSPEC_IP4) { - TCAM_IPV4_ADDR(tcam_ptr->ip4_dest_key, fspec_key->ip4dst); - TCAM_IPV4_ADDR(tcam_ptr->ip4_dest_mask, fspec_mask->ip4dst); - TCAM_IPV4_ADDR(tcam_ptr->ip4_src_key, fspec_key->ip4src); - TCAM_IPV4_ADDR(tcam_ptr->ip4_src_mask, fspec_mask->ip4src); - - tcam_ptr->ip4_port_key = fspec_key->l4_4_bytes; - tcam_ptr->ip4_port_mask = fspec_mask->l4_4_bytes; + tcam_ptr->ip4_port_key = fspec_key.l4_4_bytes; + tcam_ptr->ip4_port_mask = fspec_mask.l4_4_bytes; TCAM_IP_CLASS(tcam_ptr->ip4_class_key, tcam_ptr->ip4_class_mask, class); - tcam_ptr->ip4_proto_key = fspec_key->proto; - tcam_ptr->ip4_proto_mask = fspec_mask->proto; + tcam_ptr->ip4_proto_key = fspec_key.proto; + tcam_ptr->ip4_proto_mask = fspec_mask.proto; - tcam_ptr->ip4_tos_key = fspec_key->tos; - tcam_ptr->ip4_tos_mask = fspec_mask->tos; + tcam_ptr->ip4_tos_key = fspec_key.tos; + tcam_ptr->ip4_tos_mask = fspec_mask.tos; } +#undef fspec_key +#undef fspec_mask } @@ -1297,20 +1291,21 @@ nxge_add_tcam_entry(p_nxge_t nxgep, flow_resource_t *flow_res) return (NXGE_ERROR); } + class = TCAM_CLASS_INVALID; if (flow_spec->flow_type == FSPEC_IP_USR) { int i; int add_usr_cls = 0; int ipv6 = 0; - ip_user_spec_t *uspec = &flow_spec->uh.ip_usr_spec; - ip_user_spec_t *umask = &flow_spec->um.ip_usr_spec; nxge_usr_l3_cls_t *l3_ucls_p; +#define uspec (flow_spec->uh.ip_usr_spec) +#define umask (flow_spec->um.ip_usr_spec) MUTEX_ENTER(&hw_p->nxge_tcam_lock); for (i = 0; i < NXGE_L3_PROG_CLS; i++) { l3_ucls_p = &hw_p->tcam_l3_prog_cls[i]; if (l3_ucls_p->valid && l3_ucls_p->tcam_ref_cnt) { - if (uspec->proto == l3_ucls_p->pid) { + if (uspec.proto == l3_ucls_p->pid) { class = l3_ucls_p->cls; l3_ucls_p->tcam_ref_cnt++; add_usr_cls = 1; @@ -1334,11 +1329,11 @@ nxge_add_tcam_entry(p_nxge_t nxgep, flow_resource_t *flow_res) default: break; } - if (uspec->ip_ver == FSPEC_IP6) + if (uspec.ip_ver == FSPEC_IP6) ipv6 = 1; rs = npi_fflp_cfg_ip_usr_cls_set(handle, - (tcam_class_t)class, uspec->tos, - umask->tos, uspec->proto, ipv6); + (tcam_class_t)class, uspec.tos, + umask.tos, uspec.proto, ipv6); if (rs != NPI_SUCCESS) goto fail; @@ -1348,23 +1343,23 @@ nxge_add_tcam_entry(p_nxge_t nxgep, flow_resource_t *flow_res) goto fail; l3_ucls_p->cls = class; - l3_ucls_p->pid = uspec->proto; + l3_ucls_p->pid = uspec.proto; l3_ucls_p->tcam_ref_cnt++; l3_ucls_p->valid = 1; add_usr_cls = 1; break; } else if (l3_ucls_p->tcam_ref_cnt == 0 && - uspec->proto == l3_ucls_p->pid) { + uspec.proto == l3_ucls_p->pid) { /* * The class has already been programmed, * probably for flow hash */ class = l3_ucls_p->cls; - if (uspec->ip_ver == FSPEC_IP6) + if (uspec.ip_ver == FSPEC_IP6) ipv6 = 1; rs = npi_fflp_cfg_ip_usr_cls_set(handle, - (tcam_class_t)class, uspec->tos, - umask->tos, uspec->proto, ipv6); + (tcam_class_t)class, uspec.tos, + umask.tos, uspec.proto, ipv6); if (rs != NPI_SUCCESS) goto fail; @@ -1373,7 +1368,7 @@ nxge_add_tcam_entry(p_nxge_t nxgep, flow_resource_t *flow_res) if (rs != NPI_SUCCESS) goto fail; - l3_ucls_p->pid = uspec->proto; + l3_ucls_p->pid = uspec.proto; l3_ucls_p->tcam_ref_cnt++; add_usr_cls = 1; break; @@ -1382,10 +1377,12 @@ nxge_add_tcam_entry(p_nxge_t nxgep, flow_resource_t *flow_res) if (!add_usr_cls) { NXGE_ERROR_MSG((nxgep, NXGE_ERR_CTL, "nxge_add_tcam_entry: Could not find/insert class" - "for pid %d", uspec->proto)); + "for pid %d", uspec.proto)); goto fail; } MUTEX_EXIT(&hw_p->nxge_tcam_lock); +#undef uspec +#undef umask } switch (flow_spec->flow_type) { @@ -2440,8 +2437,8 @@ nxge_get_tcam_entry(p_nxge_t nxgep, flow_resource_t *fs) tcam_flow_spec_t *tcam_ep; tcam_entry_t *tp; flow_spec_t *fspec; - tcpip4_spec_t *fspec_key; - tcpip4_spec_t *fspec_mask; +#define fspec_key (fspec->uh.tcpip4spec) +#define fspec_mask (fspec->um.tcpip4spec) index = nxge_tcam_get_index(nxgep, (uint16_t)fs->location); tcam_ep = &nxgep->classifier.tcam_entries[index]; @@ -2467,14 +2464,12 @@ nxge_get_tcam_entry(p_nxge_t nxgep, flow_resource_t *fs) case TCAM_CLASS_UDP_IPV4: case TCAM_CLASS_AH_ESP_IPV4: case TCAM_CLASS_SCTP_IPV4: - fspec_key = (tcpip4_spec_t *)&fspec->uh.tcpip4spec; - fspec_mask = (tcpip4_spec_t *)&fspec->um.tcpip4spec; - FSPEC_IPV4_ADDR(fspec_key->ip4dst, tp->ip4_dest_key); - FSPEC_IPV4_ADDR(fspec_mask->ip4dst, tp->ip4_dest_mask); - FSPEC_IPV4_ADDR(fspec_key->ip4src, tp->ip4_src_key); - FSPEC_IPV4_ADDR(fspec_mask->ip4src, tp->ip4_src_mask); - fspec_key->tos = tp->ip4_tos_key; - fspec_mask->tos = tp->ip4_tos_mask; + FSPEC_IPV4_ADDR(fspec_key.ip4dst, tp->ip4_dest_key); + FSPEC_IPV4_ADDR(fspec_mask.ip4dst, tp->ip4_dest_mask); + FSPEC_IPV4_ADDR(fspec_key.ip4src, tp->ip4_src_key); + FSPEC_IPV4_ADDR(fspec_mask.ip4src, tp->ip4_src_mask); + fspec_key.tos = tp->ip4_tos_key; + fspec_mask.tos = tp->ip4_tos_mask; break; default: break; @@ -2484,9 +2479,9 @@ nxge_get_tcam_entry(p_nxge_t nxgep, flow_resource_t *fs) case TCAM_CLASS_TCP_IPV4: case TCAM_CLASS_UDP_IPV4: case TCAM_CLASS_SCTP_IPV4: - FSPEC_IP_PORTS(fspec_key->pdst, fspec_key->psrc, + FSPEC_IP_PORTS(fspec_key.pdst, fspec_key.psrc, tp->ip4_port_key); - FSPEC_IP_PORTS(fspec_mask->pdst, fspec_mask->psrc, + FSPEC_IP_PORTS(fspec_mask.pdst, fspec_mask.psrc, tp->ip4_port_mask); break; case TCAM_CLASS_AH_ESP_IPV4: @@ -2512,6 +2507,8 @@ nxge_get_tcam_entry(p_nxge_t nxgep, flow_resource_t *fs) } else { fs->channel_cookie = tp->match_action.bits.ldw.offset; } +#undef fspec_key +#undef fspec_mask } void @@ -2666,6 +2663,7 @@ nxge_add_iptun_class(p_nxge_t nxgep, iptun_cfg_t *iptunp, MUTEX_ENTER(&hw_p->nxge_tcam_lock); /* Get an user programmable class ID */ + class = TCAM_CLASS_INVALID; for (i = 0; i < NXGE_L3_PROG_CLS; i++) { if (hw_p->tcam_l3_prog_cls[i].valid == 0) { /* todo add new usr class reg */ @@ -2855,7 +2853,10 @@ nxge_get_iptun_class(p_nxge_t nxgep, iptun_cfg_t *iptunp, uint8_t cls_id) npi_handle_t handle = nxgep->npi_reg_handle; npi_status_t rs = NPI_SUCCESS; flow_key_cfg_t cfg; - + uint8_t l4b0_val; + uint8_t l4b0_mask; + uint8_t l4b23_sel; + uint16_t l4b23_val; /* check to see that this is a valid class ID */ if (!nxge_is_iptun_cls_present(nxgep, cls_id, &i)) @@ -2866,8 +2867,15 @@ nxge_get_iptun_class(p_nxge_t nxgep, iptun_cfg_t *iptunp, uint8_t cls_id) pid = nxgep->nxge_hw_p->tcam_l3_prog_cls[i].pid; rs = npi_fflp_cfg_ip_usr_cls_get_iptun(handle, (tcam_class_t)cls_id, - &iptunp->l4b0_val, &iptunp->l4b0_mask, &iptunp->l4b23_val, - &iptunp->l4b23_sel); + &l4b0_val, &l4b0_mask, &l4b23_val, &l4b23_sel); + if (rs != NPI_SUCCESS) + goto fail; + + iptunp->l4b0_val = l4b0_val; + iptunp->l4b0_mask = l4b0_mask; + iptunp->l4b23_val = l4b23_val; + iptunp->l4b23_sel = l4b23_sel; + if (rs != NPI_SUCCESS) goto fail; diff --git a/usr/src/uts/common/io/nxge/nxge_fflp_hash.c b/usr/src/uts/common/io/nxge/nxge_fflp_hash.c index a1a88e4b21..50f57b282e 100644 --- a/usr/src/uts/common/io/nxge/nxge_fflp_hash.c +++ b/usr/src/uts/common/io/nxge/nxge_fflp_hash.c @@ -22,7 +22,6 @@ * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" #include <sys/types.h> #include <nxge_fflp_hash.h> @@ -366,6 +365,7 @@ nxge_compute_h1_table1(uint32_t crcin, uint32_t *flow, uint32_t length) buf = (uint8_t *)flow; tmp = crcin; + crch1 = 0; for (i = 0; i < length; i++) { crch1 = COMPUTE_H1_BYTE(tmp, buf[i]); tmp = crch1; diff --git a/usr/src/uts/common/io/nxge/nxge_hio.c b/usr/src/uts/common/io/nxge/nxge_hio.c index a3369c70d3..481ec51a79 100644 --- a/usr/src/uts/common/io/nxge/nxge_hio.c +++ b/usr/src/uts/common/io/nxge/nxge_hio.c @@ -204,10 +204,7 @@ nxge_hio_uninit(nxge_t *nxge) * Any domain */ int -nxge_dci_map( - nxge_t *nxge, - vpc_type_t type, - int index) +nxge_dci_map(nxge_t *nxge, vpc_type_t type, int index) { nxge_grp_set_t *set; int dc; @@ -219,6 +216,8 @@ nxge_dci_map( case VP_BOUND_RX: set = &nxge->rx_set; break; + default: + return (-1); } for (dc = 0; dc < NXGE_MAX_TDCS; dc++) { @@ -427,7 +426,7 @@ nxge_grp_dc_add( { nxge_hio_data_t *nhd = (nxge_hio_data_t *)nxge->nxge_hw_p->hio; nxge_hio_dc_t *dc; - nxge_grp_set_t *set; + nxge_grp_set_t *set = NULL; nxge_status_t status = NXGE_OK; int error = 0; @@ -541,10 +540,7 @@ nxge_grp_dc_add( } void -nxge_grp_dc_remove( - nxge_t *nxge, - vpc_type_t type, - int channel) +nxge_grp_dc_remove(nxge_t *nxge, vpc_type_t type, int channel) { nxge_hio_data_t *nhd = (nxge_hio_data_t *)nxge->nxge_hw_p->hio; nxge_hio_dc_t *dc; diff --git a/usr/src/uts/common/io/nxge/nxge_hw.c b/usr/src/uts/common/io/nxge/nxge_hw.c index 449b285639..5123454fad 100644 --- a/usr/src/uts/common/io/nxge/nxge_hw.c +++ b/usr/src/uts/common/io/nxge/nxge_hw.c @@ -187,9 +187,8 @@ nxge_hw_init_niu_common(p_nxge_t nxgep) NXGE_DEBUG_MSG((nxgep, DDI_CTL, "<== nxge_hw_init_niu_common")); } -/* ARGSUSED */ uint_t -nxge_intr(void *arg1, void *arg2) +nxge_intr(char *arg1, char *arg2) { p_nxge_ldv_t ldvp = (p_nxge_ldv_t)arg1; p_nxge_t nxgep = (p_nxge_t)arg2; diff --git a/usr/src/uts/common/io/nxge/nxge_intr.c b/usr/src/uts/common/io/nxge/nxge_intr.c index 2e73677ca5..4e5e97354e 100644 --- a/usr/src/uts/common/io/nxge/nxge_intr.c +++ b/usr/src/uts/common/io/nxge/nxge_intr.c @@ -41,8 +41,8 @@ */ /* The following function may be found in nxge_[t|r]xdma.c */ -extern uint_t nxge_tx_intr(void *, void *); -extern uint_t nxge_rx_intr(void *, void *); +extern uint_t nxge_tx_intr(char *, char *); +extern uint_t nxge_rx_intr(char *, char *); /* * Local prototypes @@ -75,8 +75,7 @@ nxge_intr_add( nxge_intr_t *interrupts; /* The global interrupt data. */ nxge_ldg_t *group; /* The logical device group data. */ nxge_ldv_t *ldvp; - - uint_t *inthandler; /* A parameter to ddi_intr_add_handler */ + ddi_intr_handler_t *inthandler; int vector; int status1, status2; @@ -94,9 +93,11 @@ nxge_intr_add( group = ldvp->ldgp; if (group->nldvs == 1) { - inthandler = (uint_t *)group->ldvp->ldv_intr_handler; + inthandler = group->ldvp->ldv_intr_handler; } else if (group->nldvs > 1) { - inthandler = (uint_t *)group->sys_intr_handler; + inthandler = group->sys_intr_handler; + } else { + inthandler = NULL; } interrupts = (nxge_intr_t *)&nxge->nxge_intr_type; @@ -104,7 +105,7 @@ nxge_intr_add( status1 = DDI_SUCCESS; if ((status2 = ddi_intr_add_handler(interrupts->htable[vector], - (ddi_intr_handler_t *)inthandler, group->ldvp, nxge)) + inthandler, group->ldvp, nxge)) != DDI_SUCCESS) { NXGE_ERROR_MSG((nxge, NXGE_ERR_CTL, "nxge_intr_add(%cDC %d): " "ddi_intr_add_handler(%d) returned %s", @@ -321,7 +322,7 @@ nxge_hio_intr_add( nxge_hio_dc_t *dc; /* The relevant DMA channel data structure. */ nxge_intr_t *interrupts; /* The global interrupt data. */ nxge_ldg_t *group; /* The logical device group data. */ - uint_t *inthandler; /* A parameter to ddi_intr_add_handler */ + ddi_intr_handler_t *inthandler; int vector; /* A shorthand variable */ int ddi_status; /* The response to ddi_intr_add_handler */ @@ -352,13 +353,15 @@ nxge_hio_intr_add( group = &nxge->ldgvp->ldgp[vector]; if (group->nldvs == 1) { - inthandler = (uint_t *)group->ldvp->ldv_intr_handler; + inthandler = group->ldvp->ldv_intr_handler; } else if (group->nldvs > 1) { - inthandler = (uint_t *)group->sys_intr_handler; + inthandler = group->sys_intr_handler; + } else { + inthandler = NULL; } if ((ddi_status = ddi_intr_add_handler(interrupts->htable[vector], - (ddi_intr_handler_t *)inthandler, group->ldvp, nxge)) + inthandler, group->ldvp, nxge)) != DDI_SUCCESS) { NXGE_ERROR_MSG((nxge, NXGE_ERR_CTL, "nxge_hio_intr_add(%cDC %d): " diff --git a/usr/src/uts/common/io/nxge/nxge_mac.c b/usr/src/uts/common/io/nxge/nxge_mac.c index d08c6d269f..f1cd6511c4 100644 --- a/usr/src/uts/common/io/nxge/nxge_mac.c +++ b/usr/src/uts/common/io/nxge/nxge_mac.c @@ -8475,10 +8475,16 @@ nxge_bcm5464_link_led_off(p_nxge_t nxgep) NXGE_DEBUG_MSG((nxgep, MIF_CTL, "==> nxge_bcm5464_link_led_off")); - if (nxgep->nxge_hw_p->platform_type == P_NEPTUNE_MARAMBA_P1) { + switch (nxgep->nxge_hw_p->platform_type) { + case P_NEPTUNE_MARAMBA_P1: xcvr_portn = MARAMBA_P1_CLAUSE22_PORT_ADDR_BASE; - } else if (nxgep->nxge_hw_p->platform_type == P_NEPTUNE_MARAMBA_P0) { + break; + case P_NEPTUNE_MARAMBA_P0: xcvr_portn = MARAMBA_P0_CLAUSE22_PORT_ADDR_BASE; + break; + default: + xcvr_portn = 0; + break; } /* * For Altas 4-1G copper, Xcvr port numbers are diff --git a/usr/src/uts/common/io/nxge/nxge_main.c b/usr/src/uts/common/io/nxge/nxge_main.c index cea5e125c9..441bbca23c 100644 --- a/usr/src/uts/common/io/nxge/nxge_main.c +++ b/usr/src/uts/common/io/nxge/nxge_main.c @@ -6056,7 +6056,7 @@ nxge_add_intrs_adv_type(p_nxge_t nxgep, uint32_t int_type) dev_info_t *dip = nxgep->dip; p_nxge_ldg_t ldgp; p_nxge_intr_t intrp; - uint_t *inthandler; + ddi_intr_handler_t *inthandler; void *arg1, *arg2; int behavior; int nintrs, navail, nrequest; @@ -6179,7 +6179,7 @@ nxge_add_intrs_adv_type(p_nxge_t nxgep, uint32_t int_type) arg1 = ldgp->ldvp; arg2 = nxgep; if (ldgp->nldvs == 1) { - inthandler = (uint_t *)ldgp->ldvp->ldv_intr_handler; + inthandler = ldgp->ldvp->ldv_intr_handler; NXGE_DEBUG_MSG((nxgep, INT_CTL, "nxge_add_intrs_adv_type: " "arg1 0x%x arg2 0x%x: " @@ -6187,7 +6187,7 @@ nxge_add_intrs_adv_type(p_nxge_t nxgep, uint32_t int_type) arg1, arg2, x, ldgp->intdata)); } else if (ldgp->nldvs > 1) { - inthandler = (uint_t *)ldgp->sys_intr_handler; + inthandler = ldgp->sys_intr_handler; NXGE_DEBUG_MSG((nxgep, INT_CTL, "nxge_add_intrs_adv_type: " "arg1 0x%x arg2 0x%x: " @@ -6195,6 +6195,8 @@ nxge_add_intrs_adv_type(p_nxge_t nxgep, uint32_t int_type) "(entry %d intdata 0x%x)\n", arg1, arg2, ldgp->nldvs, x, ldgp->intdata)); + } else { + inthandler = NULL; } NXGE_DEBUG_MSG((nxgep, INT_CTL, @@ -6202,8 +6204,7 @@ nxge_add_intrs_adv_type(p_nxge_t nxgep, uint32_t int_type) "htable 0x%llx", x, intrp->htable[x])); if ((ddi_status = ddi_intr_add_handler(intrp->htable[x], - (ddi_intr_handler_t *)inthandler, arg1, arg2)) - != DDI_SUCCESS) { + inthandler, arg1, arg2)) != DDI_SUCCESS) { NXGE_ERROR_MSG((nxgep, NXGE_ERR_CTL, "==> nxge_add_intrs_adv_type: failed #%d " "status 0x%x", x, ddi_status)); @@ -6250,7 +6251,7 @@ nxge_add_intrs_adv_type_fix(p_nxge_t nxgep, uint32_t int_type) dev_info_t *dip = nxgep->dip; p_nxge_ldg_t ldgp; p_nxge_intr_t intrp; - uint_t *inthandler; + ddi_intr_handler_t *inthandler; void *arg1, *arg2; int behavior; int nintrs, navail; @@ -6346,7 +6347,7 @@ nxge_add_intrs_adv_type_fix(p_nxge_t nxgep, uint32_t int_type) arg1 = ldgp->ldvp; arg2 = nxgep; if (ldgp->nldvs == 1) { - inthandler = (uint_t *)ldgp->ldvp->ldv_intr_handler; + inthandler = ldgp->ldvp->ldv_intr_handler; NXGE_DEBUG_MSG((nxgep, INT_CTL, "nxge_add_intrs_adv_type_fix: " "1-1 int handler(%d) ldg %d ldv %d " @@ -6354,18 +6355,19 @@ nxge_add_intrs_adv_type_fix(p_nxge_t nxgep, uint32_t int_type) x, ldgp->ldg, ldgp->ldvp->ldv, arg1, arg2)); } else if (ldgp->nldvs > 1) { - inthandler = (uint_t *)ldgp->sys_intr_handler; + inthandler = ldgp->sys_intr_handler; NXGE_DEBUG_MSG((nxgep, INT_CTL, "nxge_add_intrs_adv_type_fix: " "shared ldv %d int handler(%d) ldv %d ldg %d" "arg1 0x%016llx arg2 0x%016llx\n", x, ldgp->nldvs, ldgp->ldg, ldgp->ldvp->ldv, arg1, arg2)); + } else { + inthandler = NULL; } if ((ddi_status = ddi_intr_add_handler(intrp->htable[x], - (ddi_intr_handler_t *)inthandler, arg1, arg2)) - != DDI_SUCCESS) { + inthandler, arg1, arg2)) != DDI_SUCCESS) { NXGE_ERROR_MSG((nxgep, NXGE_ERR_CTL, "==> nxge_add_intrs_adv_type_fix: failed #%d " "status 0x%x", x, ddi_status)); diff --git a/usr/src/uts/common/io/nxge/nxge_ndd.c b/usr/src/uts/common/io/nxge/nxge_ndd.c index 71d68b56c2..3243bbdba9 100644 --- a/usr/src/uts/common/io/nxge/nxge_ndd.c +++ b/usr/src/uts/common/io/nxge/nxge_ndd.c @@ -1804,6 +1804,7 @@ nxge_param_set_ip_usr(p_nxge_t nxgep, queue_t *q, } /* do the actual hw setup with cfg_value. */ + status = 0; if (cfg_it == B_TRUE) { class = mi_strtol(pa->name, &end, 10); status = nxge_fflp_ip_usr_class_config(nxgep, class, pa->value); @@ -1813,7 +1814,6 @@ nxge_param_set_ip_usr(p_nxge_t nxgep, queue_t *q, return (status); } -/* ARGSUSED */ static int nxge_class_name_2value(p_nxge_t nxgep, char *name) { @@ -1830,10 +1830,9 @@ nxge_class_name_2value(p_nxge_t nxgep, char *name) return (-1); } -/* ARGSUSED */ int -nxge_param_set_ip_opt(p_nxge_t nxgep, queue_t *q, - mblk_t *mp, char *value, caddr_t cp) +nxge_param_set_ip_opt(p_nxge_t nxgep, queue_t *q __unused, + mblk_t *mp __unused, char *value, caddr_t cp) { char *end; uint32_t status, cfg_value; diff --git a/usr/src/uts/common/io/nxge/nxge_rxdma.c b/usr/src/uts/common/io/nxge/nxge_rxdma.c index 7c06b90705..85ad031e85 100644 --- a/usr/src/uts/common/io/nxge/nxge_rxdma.c +++ b/usr/src/uts/common/io/nxge/nxge_rxdma.c @@ -1233,6 +1233,7 @@ nxge_rxdma_hw_mode(p_nxge_t nxgep, boolean_t enable) return (0); } + rs = 0; for (rdc = 0; rdc < NXGE_MAX_RDCS; rdc++) { if ((1 << rdc) & set->owned.map) { rx_rbr_ring_t *ring = @@ -1755,7 +1756,7 @@ nxge_freeb(p_rx_msg_t rx_msg_p) } uint_t -nxge_rx_intr(void *arg1, void *arg2) +nxge_rx_intr(char *arg1, char *arg2) { p_nxge_ldv_t ldvp = (p_nxge_ldv_t)arg1; p_nxge_t nxgep = (p_nxge_t)arg2; @@ -4156,6 +4157,8 @@ nxge_rxdma_hw_start(p_nxge_t nxgep, int channel) rx_mbox_areas_p = nxgep->rx_mbox_areas_p; if (rx_mbox_areas_p) { rx_mbox_p = rx_mbox_areas_p->rxmbox_areas; + } else { + rx_mbox_p = NULL; } i = channel; diff --git a/usr/src/uts/common/io/nxge/nxge_send.c b/usr/src/uts/common/io/nxge/nxge_send.c index ff410e3ba7..94553c6352 100644 --- a/usr/src/uts/common/io/nxge/nxge_send.c +++ b/usr/src/uts/common/io/nxge/nxge_send.c @@ -141,10 +141,10 @@ nxge_start(p_nxge_t nxgep, p_tx_ring_t tx_ring_p, p_mblk_t mp) nxge_os_dma_handle_t tx_desc_dma_handle; p_tx_desc_t tx_desc_p; p_tx_msg_t tx_msg_ring; - p_tx_msg_t tx_msg_p; + p_tx_msg_t tx_msg_p = NULL; tx_desc_t tx_desc, *tmp_desc_p; tx_desc_t sop_tx_desc, *sop_tx_desc_p; - p_tx_pkt_header_t hdrp; + p_tx_pkt_header_t hdrp = NULL; tx_pkt_hdr_all_t tmp_hdrp; p_tx_pkt_hdr_all_t pkthdrp; uint8_t npads = 0; @@ -196,7 +196,7 @@ nxge_start(p_nxge_t nxgep, p_tx_ring_t tx_ring_p, p_mblk_t mp) boolean_t is_lso = B_FALSE; boolean_t lso_again; int cur_index_lso; - p_mblk_t nmp_lso_save; + p_mblk_t nmp_lso_save = NULL; uint32_t lso_ngathers; boolean_t lso_tail_wrap = B_FALSE; diff --git a/usr/src/uts/common/io/nxge/nxge_txc.c b/usr/src/uts/common/io/nxge/nxge_txc.c index 7f9e34dbfa..c143866574 100644 --- a/usr/src/uts/common/io/nxge/nxge_txc.c +++ b/usr/src/uts/common/io/nxge/nxge_txc.c @@ -373,10 +373,10 @@ nxge_txc_handle_sys_errors(p_nxge_t nxgep) default: return (NXGE_ERROR); } - NXGE_ERROR_MSG((nxgep, NXGE_ERR_CTL, - " nxge_txc_handle_sys_errors: errored port %d", - err_portn)); if (my_err) { + NXGE_ERROR_MSG((nxgep, NXGE_ERR_CTL, + " nxge_txc_handle_sys_errors: errored port %d", + err_portn)); status = nxge_txc_handle_port_errors(nxgep, err_status); } diff --git a/usr/src/uts/common/io/nxge/nxge_txdma.c b/usr/src/uts/common/io/nxge/nxge_txdma.c index 74495f9f8a..00a509a191 100644 --- a/usr/src/uts/common/io/nxge/nxge_txdma.c +++ b/usr/src/uts/common/io/nxge/nxge_txdma.c @@ -1123,7 +1123,7 @@ nxge_txdma_reclaim(p_nxge_t nxgep, p_tx_ring_t tx_ring_p, int nmblks) * Any domain */ uint_t -nxge_tx_intr(void *arg1, void *arg2) +nxge_tx_intr(char *arg1, char *arg2) { p_nxge_ldv_t ldvp = (p_nxge_ldv_t)arg1; p_nxge_t nxgep = (p_nxge_t)arg2; @@ -1334,6 +1334,7 @@ nxge_txdma_hw_mode(p_nxge_t nxgep, boolean_t enable) } /* Enable or disable all of the TDCs owned by us. */ + rs = 0; handle = NXGE_DEV_NPI_HANDLE(nxgep); for (tdc = 0; tdc < NXGE_MAX_TDCS; tdc++) { if ((1 << tdc) & set->owned.map) { @@ -2533,11 +2534,11 @@ nxge_map_txdma_channel_buf_ring(p_nxge_t nxgep, uint16_t channel, p_nxge_dma_common_t dmap; nxge_os_dma_handle_t tx_buf_dma_handle; p_tx_ring_t tx_ring_p; - p_tx_msg_t tx_msg_ring; + p_tx_msg_t tx_msg_ring = NULL; nxge_status_t status = NXGE_OK; int ddi_status = DDI_SUCCESS; - int i, j, index; - uint32_t size, bsize; + int i, j, index = 0; + uint32_t size = 0, bsize; uint32_t nblocks, nmsgs; char qname[TASKQ_NAMELEN]; @@ -3337,6 +3338,7 @@ nxge_txdma_fatal_err_recover( /* Restart TXDMA channel */ + tx_mbox_p = NULL; if (!isLDOMguest(nxgep)) { tx_mbox_p = nxge_txdma_get_mbox(nxgep, channel); @@ -3424,7 +3426,7 @@ nxge_tx_port_fatal_err_recover(p_nxge_t nxgep) tx_mbox_t *mailbox; npi_handle_t handle; - nxge_status_t status; + nxge_status_t status = NXGE_OK; npi_status_t rs; NXGE_DEBUG_MSG((nxgep, TX_CTL, "<== nxge_tx_port_fatal_err_recover")); diff --git a/usr/src/uts/common/io/nxge/nxge_virtual.c b/usr/src/uts/common/io/nxge/nxge_virtual.c index dddca37af4..7ee9a5634e 100644 --- a/usr/src/uts/common/io/nxge/nxge_virtual.c +++ b/usr/src/uts/common/io/nxge/nxge_virtual.c @@ -62,11 +62,11 @@ uint32_t nxge_groups_per_port = 2; extern uint32_t nxge_use_partition; extern uint32_t nxge_dma_obp_props_only; -extern uint_t nxge_rx_intr(void *, void *); -extern uint_t nxge_tx_intr(void *, void *); -extern uint_t nxge_mif_intr(void *, void *); -extern uint_t nxge_mac_intr(void *, void *); -extern uint_t nxge_syserr_intr(void *, void *); +extern uint_t nxge_rx_intr(char *, char *); +extern uint_t nxge_tx_intr(char *, char *); +extern uint_t nxge_mif_intr(char *, char *); +extern uint_t nxge_mac_intr(char *, char *); +extern uint_t nxge_syserr_intr(char *, char *); extern void *nxge_list; #define NXGE_SHARED_REG_SW_SIM @@ -1043,6 +1043,7 @@ nxge_cfg_verify_set_classify_prop(p_nxge_t nxgep, char *prop, uint_t prop_len; uint_t known_cfg_value; + new_value = 0; known_cfg_value = (uint_t)known_cfg; if (override == B_TRUE) { @@ -4026,6 +4027,7 @@ nxge_init_mmac(p_nxge_t nxgep, boolean_t compute_addrs) nxge_mmac_t *mmac_info; npi_mac_addr_t mac_addr; + alt_mac_ls4b = 0; func_num = nxgep->function_num; base_mmac_addr = (uint16_t *)&nxgep->factaddr; mmac_info = (nxge_mmac_t *)&nxgep->nxge_mmac_info; diff --git a/usr/src/uts/common/sys/auxv_SPARC.h b/usr/src/uts/common/sys/auxv_SPARC.h index b4adf1a16e..fd6d7c637b 100644 --- a/usr/src/uts/common/sys/auxv_SPARC.h +++ b/usr/src/uts/common/sys/auxv_SPARC.h @@ -45,6 +45,7 @@ extern "C" { #define AV_SPARC_VIS2 0x0040 /* VIS2 instruction set supported */ #define AV_SPARC_ASI_BLK_INIT 0x0080 /* ASI_BLK_INIT_xxx ASI */ #define AV_SPARC_FMAF 0x0100 /* Fused Multiply-Add */ +/* Bit 9 is not in use */ #define AV_SPARC_VIS3 0x0400 /* VIS3 instruction set extensions */ #define AV_SPARC_HPC 0x0800 /* High Performance Computing insns */ #define AV_SPARC_RANDOM 0x1000 /* random instruction */ @@ -52,11 +53,25 @@ extern "C" { #define AV_SPARC_FJFMAU 0x4000 /* Fujitsu Unfused Multiply-Add */ #define AV_SPARC_IMA 0x8000 /* Integer Multiply-add */ #define AV_SPARC_ASI_CACHE_SPARING 0x10000 +#define AV_SPARC_PAUSE 0x20000 /* pause instruction */ +#define AV_SPARC_CBCOND 0x40000 /* compare and branch instructions */ +#define AV_SPARC_AES 0x80000 /* AES instructions */ +#define AV_SPARC_DES 0x100000 /* DES instructions */ +#define AV_SPARC_KASUMI 0x200000 /* Kasumi instructions */ +#define AV_SPARC_CAMELLIA 0x400000 /* Camellia instructions */ +#define AV_SPARC_MD5 0x800000 /* MD5 instructions */ +#define AV_SPARC_SHA1 0x1000000 /* SHA1 instructions */ +#define AV_SPARC_SHA256 0x2000000 /* SHA256 instructions */ +#define AV_SPARC_SHA512 0x4000000 /* SHA512 instructions */ +#define AV_SPARC_MPMUL 0x8000000 /* multiple precision multiply */ +#define AV_SPARC_MONT 0x10000000 /* Montgomery mult/sqr instructions */ +#define AV_SPARC_CRC32C 0x20000000 /* CRC32C instructions */ #define FMT_AV_SPARC \ "\20" \ - "\21cspare" \ - "\20ima\17fjfmau\16trans\15random\14hpc\13vis3\12-\11fmaf" \ + "\36crc32c\35mont\34mpmul\33sha512\32sha256\31sha1" \ + "\30md5\27camellia\26kasumi\25des\24aes\23cbcond\22pause\21cspare" \ + "\20ima\17fjfmau\16trans\15random\14hpc\13vis3\12-\11fmaf" \ "\10ASIBlkInit\7vis2\6vis\5popc\4v8plus\3fsmuld\2div32\1mul32" /* diff --git a/usr/src/uts/common/sys/nxge/nxge_impl.h b/usr/src/uts/common/sys/nxge/nxge_impl.h index 429c906c5e..0f247df1a5 100644 --- a/usr/src/uts/common/sys/nxge/nxge_impl.h +++ b/usr/src/uts/common/sys/nxge/nxge_impl.h @@ -619,8 +619,8 @@ struct _nxge_dma_pool_t { */ typedef struct _nxge_ldg_t nxge_ldg_t, *p_nxge_ldg_t; typedef struct _nxge_ldv_t nxge_ldv_t, *p_nxge_ldv_t; -typedef uint_t (*nxge_sys_intr_t)(void *arg1, void *arg2); -typedef uint_t (*nxge_ldv_intr_t)(void *arg1, void *arg2); +typedef uint_t (*nxge_sys_intr_t)(char *arg1, char *arg2); +typedef uint_t (*nxge_ldv_intr_t)(char *arg1, char *arg2); /* * Each logical device Group (64) needs to have the following @@ -894,7 +894,7 @@ void nxge_hw_ioctl(p_nxge_t, queue_t *, mblk_t *, struct iocblk *); void nxge_loopback_ioctl(p_nxge_t, queue_t *, mblk_t *, struct iocblk *); nxge_status_t nxge_global_reset(p_nxge_t); -uint_t nxge_intr(void *, void *); +uint_t nxge_intr(char *, char *); void nxge_intr_enable(p_nxge_t); void nxge_intr_disable(p_nxge_t); void nxge_hw_blank(void *arg, time_t, uint_t); diff --git a/usr/src/uts/intel/ia32/os/fpu.c b/usr/src/uts/intel/ia32/os/fpu.c index cab812bcb8..d648e0552f 100644 --- a/usr/src/uts/intel/ia32/os/fpu.c +++ b/usr/src/uts/intel/ia32/os/fpu.c @@ -725,7 +725,8 @@ fp_save(struct fpu_ctx *fp) ASSERT(fp_kind != FP_NO); kpreempt_disable(); - if (!fp || fp->fpu_flags & FPU_VALID) { + if (!fp || fp->fpu_flags & FPU_VALID || + (fp->fpu_flags & FPU_EN) == 0) { kpreempt_enable(); return; } @@ -1336,8 +1337,11 @@ kernel_fpu_begin(kfpu_state_t *kfpu, uint_t flags) ASSERT(curthread->t_preempt > 0); ASSERT(kfpu == NULL); - if (pl != NULL && - (pl->lwp_pcb.pcb_fpu.fpu_flags & FPU_EN) != 0) { + if (pl != NULL) { + /* + * We might have already saved once so FPU_VALID could + * be set. This is handled in fp_save. + */ fp_save(&pl->lwp_pcb.pcb_fpu); pl->lwp_pcb.pcb_fpu.fpu_flags |= FPU_KERNEL; } @@ -1366,14 +1370,22 @@ kernel_fpu_begin(kfpu_state_t *kfpu, uint_t flags) } /* - * Not all kernel threads may have an active LWP. If they do, then we - * should go ahead and save the state. We must also note that this state - * is now being used by the kernel and therefore we do not need to save - * or restore the user state. + * Not all threads may have an active LWP. If they do and we're not + * going to re-use the LWP, then we should go ahead and save the state. + * We must also note that the fpu is now being used by the kernel and + * therefore we do not want to manage the fpu state via the user-level + * thread's context handlers. + * + * We might have already saved once (due to a prior use of the kernel + * FPU or another code path) so FPU_VALID could be set. This is handled + * by fp_save, as is the FPU_EN check. */ - if (pl != NULL && (pl->lwp_pcb.pcb_fpu.fpu_flags & FPU_EN) != 0) { - fp_save(&pl->lwp_pcb.pcb_fpu); + if (pl != NULL) { + kpreempt_disable(); + if ((flags & KFPU_USE_LWP) == 0) + fp_save(&pl->lwp_pcb.pcb_fpu); pl->lwp_pcb.pcb_fpu.fpu_flags |= FPU_KERNEL; + kpreempt_enable(); } /* @@ -1405,6 +1417,7 @@ kernel_fpu_begin(kfpu_state_t *kfpu, uint_t flags) fpinit(); pf->fpu_flags = FPU_EN | FPU_KERNEL; } else { + /* initialize the kfpu state */ kernel_fpu_ctx_restore(kfpu); } } @@ -1419,18 +1432,66 @@ kernel_fpu_end(kfpu_state_t *kfpu, uint_t flags) "without using it"); } + /* + * General comments on why the rest of this function is structured the + * way it is. Be aware that there is a lot of subtlety here. + * + * If a user-level thread ever uses the fpu while in the kernel, then + * we cannot call fpdisable since that does STTS. That will set the + * ts bit in %cr0 which will cause an exception if anything touches the + * fpu. However, the user-level context switch handler (fpsave_ctxt) + * needs to access the fpu to save the registers into the pcb. + * fpsave_ctxt relies on CLTS having been done to clear the ts bit in + * fprestore_ctxt when the thread context switched onto the CPU. + * + * Calling fpdisable only effects the current CPU's %cr0 register. + * + * During removectx and kpreempt_enable, we can voluntarily context + * switch, so the CPU we were on when we entered this function might + * not be the same one we're on when we return from removectx or end + * the function. Note there can be user-level context switch handlers + * still installed if this is a user-level thread. + * + * We also must be careful in the unlikely chance we're running in an + * interrupt thread, since we can't leave the CPU's %cr0 TS state set + * incorrectly for the "real" thread to resume on this CPU. + */ + if ((flags & KFPU_NO_STATE) == 0) { + kpreempt_disable(); + } else { + ASSERT(curthread->t_preempt > 0); + } + + curthread->t_flag &= ~T_KFPU; + + /* + * When we are ending things, we explicitly don't save the current + * kernel FPU state back to the temporary state. The kfpu API is not + * intended to be a permanent save location. + * + * If this is a user-level thread and we were to context switch + * before returning to user-land, fpsave_ctxt will be a no-op since we + * already saved the user-level FPU state the first time we run + * kernel_fpu_begin (i.e. we won't save the bad kernel fpu state over + * the user-level fpu state). The fpsave_ctxt functions only save if + * FPU_VALID is not already set. fp_save also set PCB_SET_UPDATE_FPU so + * fprestore_ctxt will be done in sys_rtt_common when the thread + * finally returns to user-land. + */ + + if ((curthread->t_procp->p_flag & SSYS) != 0 && + curthread->t_intr == NULL) { /* - * Disable preemption so that we don't swtch in the middle of - * removing the context handlers. We turn off T_KFPU first, - * since it is possible to voluntarily swtch during kmem_free - * while removing the context handlers. + * A kernel thread which is not an interrupt thread, so we + * STTS now. */ - kpreempt_disable(); - curthread->t_flag &= ~T_KFPU; + fpdisable(); + } + + if ((flags & KFPU_NO_STATE) == 0) { removectx(curthread, kfpu, kernel_fpu_ctx_save, kernel_fpu_ctx_restore, NULL, NULL, NULL, NULL); - kpreempt_enable(); if (kfpu != NULL) { if (kfpu->kfpu_curthread != curthread) { @@ -1441,20 +1502,11 @@ kernel_fpu_end(kfpu_state_t *kfpu, uint_t flags) kfpu->kfpu_curthread = NULL; } } - } else { - ASSERT(curthread->t_preempt > 0); - curthread->t_flag &= ~T_KFPU; + + kpreempt_enable(); } - /* - * When we are ending things, we explicitly don't save the current - * state back to the temporary state. The API is not intended to be a - * permanent save location. If this is a kernel thread we set TS, - * otherwise we restore the user state on the off chance that a - * context switch occurs before returning to user-land. - */ - if (curthread->t_lwp != NULL && - (curthread->t_lwp->lwp_pcb.pcb_fpu.fpu_flags & FPU_EN) != 0) { + if (curthread->t_lwp != NULL) { uint_t f; if (flags & KFPU_USE_LWP) { @@ -1463,41 +1515,5 @@ kernel_fpu_end(kfpu_state_t *kfpu, uint_t flags) f = FPU_KERNEL; } curthread->t_lwp->lwp_pcb.pcb_fpu.fpu_flags &= ~f; - /* - * Don't need to set PCB_SET_UPDATE_FPU here since we'll - * restore our fpu state below if we're a user-level thread. - */ - } - - /* - * If a user-level thread ever uses the fpu while in the kernel, then - * we cannot call fpdisable since that does STTS. That will set the - * ts bit in %cr0 which will cause an exception if anything touches the - * fpu. However, the user-level context switch handler (fpsave_ctxt) - * needs to access the fpu to save the registers into the pcb. - * fpsave_ctxt relies on CLTS having been done to clear the ts bit in - * fprestore_ctxt when the thread context switched onto the CPU. - */ - if ((curthread->t_procp->p_flag & SSYS) != 0 || - curthread->t_lwp == NULL || - (curthread->t_lwp->lwp_pcb.pcb_fpu.fpu_flags & FPU_EN) == 0) { - fpdisable(); - } else { - /* - * This is a user-level thread. If we were to context switch - * before returning to user-land, fpsave_ctxt could overwrite - * the valid user-level fpu data we previously saved in the - * pcb (the fp_save in kernel_fpu_begin). To avoid adding - * complexity to the context switch handlers to account for - * this case, we restore the user-level fpu registers here, - * since user-level thread usage of the kernel fpu tends to be - * uncommon. By restoring the fpu registers here, we avoid - * setting PCB_SET_UPDATE_FPU and having to handle this in - * sys_rtt_common. - * - * fprestore_ctxt checks FPU_VALID so we don't do that here. - */ - pcb_t *pcb = &curthread->t_lwp->lwp_pcb; - fprestore_ctxt(&pcb->pcb_fpu); } } diff --git a/usr/src/uts/sun/io/zs_async.c b/usr/src/uts/sun/io/zs_async.c index afdf563c4f..f3db9bb34f 100644 --- a/usr/src/uts/sun/io/zs_async.c +++ b/usr/src/uts/sun/io/zs_async.c @@ -445,8 +445,8 @@ int zsa_h_log_n[40]; static int zsa_open(queue_t *rq, dev_t *dev, int flag, int sflag, cred_t *cr); static int zsa_close(queue_t *q, int flag, cred_t *cr); -static void zsa_wput(queue_t *q, mblk_t *mp); -static void zsa_rsrv(queue_t *q); +static int zsa_wput(queue_t *q, mblk_t *mp); +static int zsa_rsrv(queue_t *q); static struct module_info asyncm_info = { 0, @@ -459,7 +459,7 @@ static struct module_info asyncm_info = { static struct qinit async_rinit = { putq, - (int (*)())zsa_rsrv, + zsa_rsrv, zsa_open, zsa_close, NULL, @@ -468,7 +468,7 @@ static struct qinit async_rinit = { }; static struct qinit async_winit = { - (int (*)())zsa_wput, + zsa_wput, NULL, NULL, NULL, @@ -1201,7 +1201,7 @@ out: * It expects that these functions are handled in upper module(s), * as we do in ldterm. */ -static void +static int zsa_wput(queue_t *q, mblk_t *mp) { struct asyncline *za; @@ -1609,12 +1609,13 @@ zsa_wput(queue_t *q, mblk_t *mp) freemsg(mp); break; } + return (0); } /* * zs read service procedure */ -static void +static int zsa_rsrv(queue_t *q) { struct asyncline *za; @@ -1627,6 +1628,7 @@ zsa_rsrv(queue_t *q) ZSSETSOFT(zs); mutex_exit(zs->zs_excl_hi); } + return (0); } /* diff --git a/usr/src/uts/sun4/io/su_driver.c b/usr/src/uts/sun4/io/su_driver.c index d2a5a22b18..9e87f4996c 100644 --- a/usr/src/uts/sun4/io/su_driver.c +++ b/usr/src/uts/sun4/io/su_driver.c @@ -202,8 +202,8 @@ int baudtable[] = { static int asyopen(queue_t *rq, dev_t *dev, int flag, int sflag, cred_t *cr); static int asyclose(queue_t *q, int flag, cred_t *cr); -static void asywput(queue_t *q, mblk_t *mp); -static void asyrsrv(queue_t *q); +static int asywput(queue_t *q, mblk_t *mp); +static int asyrsrv(queue_t *q); struct module_info asy_info = { 0, @@ -216,7 +216,7 @@ struct module_info asy_info = { static struct qinit asy_rint = { putq, - (int (*)())asyrsrv, + asyrsrv, asyopen, asyclose, NULL, @@ -225,7 +225,7 @@ static struct qinit asy_rint = { }; static struct qinit asy_wint = { - (int (*)())asywput, + asywput, NULL, NULL, NULL, @@ -382,7 +382,7 @@ asyprobe(dev_info_t *devi) static int asydetach(dev_info_t *devi, ddi_detach_cmd_t cmd) { - register int instance; + int instance; struct asycom *asy; struct asyncline *async; char name[16]; @@ -473,7 +473,7 @@ asydetach(dev_info_t *devi, ddi_detach_cmd_t cmd) static int asyattach(dev_info_t *devi, ddi_attach_cmd_t cmd) { - register int instance; + int instance; struct asycom *asy; struct asyncline *async; char name[40]; @@ -879,8 +879,8 @@ asyinfo(dev_info_t *dip, ddi_info_cmd_t infocmd, void *arg, void **result) { _NOTE(ARGUNUSED(dip)) - register dev_t dev = (dev_t)arg; - register int instance, error; + dev_t dev = (dev_t)arg; + int instance, error; struct asycom *asy; if ((instance = UNIT(dev)) > max_asy_instance) @@ -3257,7 +3257,7 @@ async_ioctl(struct asyncline *async, queue_t *wq, mblk_t *mp, boolean_t iswput) qreply(wq, mp); } -static void +static int asyrsrv(queue_t *q) { mblk_t *bp; @@ -3269,6 +3269,7 @@ asyrsrv(queue_t *q) putnext(q, bp); ASYSETSOFT(async->async_common); async->async_polltid = 0; + return (0); } /* @@ -3282,7 +3283,7 @@ asyrsrv(queue_t *q) * It expects that these functions are handled in upper module(s), * as we do in ldterm. */ -static void +static int asywput(queue_t *q, mblk_t *mp) { register struct asyncline *async; @@ -3333,7 +3334,7 @@ asywput(queue_t *q, mblk_t *mp) error = miocpullup(mp, sizeof (int)); if (error != 0) { miocnak(q, mp, 0, error); - return; + return (0); } if (*(int *)mp->b_cont->b_rptr != 0) { @@ -3497,6 +3498,7 @@ asywput(queue_t *q, mblk_t *mp) freemsg(mp); break; } + return (0); } /* |