diff options
Diffstat (limited to 'usr/src')
25 files changed, 226 insertions, 148 deletions
diff --git a/usr/src/boot/lib/libstand/stand.h b/usr/src/boot/lib/libstand/stand.h index 915302b0f5..5039803d6d 100644 --- a/usr/src/boot/lib/libstand/stand.h +++ b/usr/src/boot/lib/libstand/stand.h @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD$ - * From $NetBSD: stand.h,v 1.22 1997/06/26 19:17:40 drochner Exp $ + * From $NetBSD: stand.h,v 1.22 1997/06/26 19:17:40 drochner Exp $ */ /* @@ -131,7 +131,7 @@ extern struct fs_ops pkgfs_fsops; #define SEEK_CUR 1 /* set file offset to current plus offset */ #define SEEK_END 2 /* set file offset to EOF plus offset */ -/* +/* * Device switch */ struct devsw { @@ -167,7 +167,6 @@ extern int errno; */ struct devdesc { struct devsw *d_dev; - int d_type; int d_unit; void *d_opendata; }; @@ -286,7 +285,7 @@ extern struct dirent *readdirfd(int); extern void srandom(u_long seed); extern u_long random(void); - + /* imports from stdlib, locally modified */ extern long strtol(const char *, char **, int); extern unsigned long strtoul(const char *, char **, int); @@ -374,9 +373,9 @@ extern int null_stat(struct open_file *f, struct stat *sb); extern int null_readdir(struct open_file *f, struct dirent *d); -/* - * Machine dependent functions and data, must be provided or stubbed by - * the consumer +/* + * Machine dependent functions and data, must be provided or stubbed by + * the consumer */ extern int getchar(void); extern int ischar(void); diff --git a/usr/src/boot/sys/boot/common/multiboot2.c b/usr/src/boot/sys/boot/common/multiboot2.c index 0e3b7bbaa3..86b09a850a 100644 --- a/usr/src/boot/sys/boot/common/multiboot2.c +++ b/usr/src/boot/sys/boot/common/multiboot2.c @@ -597,7 +597,7 @@ mb_kernel_cmdline(struct preloaded_file *fp, struct devdesc *rootdev, else mb2 = true; - if (rootdev->d_type == DEVT_ZFS) + if (rootdev->d_dev->dv_type == DEVT_ZFS) zfs_root = true; /* If we have fstype set in env, reset zfs_root if needed. */ diff --git a/usr/src/boot/sys/boot/efi/libefi/devicename.c b/usr/src/boot/sys/boot/efi/libefi/devicename.c index c1c38c7a61..34062f2f25 100644 --- a/usr/src/boot/sys/boot/efi/libefi/devicename.c +++ b/usr/src/boot/sys/boot/efi/libefi/devicename.c @@ -158,7 +158,6 @@ efi_parsedev(struct devdesc **dev, const char *devspec, const char **path) } idev->d_dev = dv; - idev->d_type = dv->dv_type; if (dev != NULL) *dev = idev; @@ -177,7 +176,7 @@ efi_fmtdev(void *vdev) struct devdesc *dev = (struct devdesc *)vdev; static char buf[SPECNAMELEN + 1]; - switch (dev->d_type) { + switch (dev->d_dev->dv_type) { case DEVT_NONE: strlcpy(buf, "(no device)", sizeof (buf)); break; diff --git a/usr/src/boot/sys/boot/efi/loader/main.c b/usr/src/boot/sys/boot/efi/loader/main.c index 547418679a..dbc915d7ec 100644 --- a/usr/src/boot/sys/boot/efi/loader/main.c +++ b/usr/src/boot/sys/boot/efi/loader/main.c @@ -137,7 +137,7 @@ has_keyboard(void) } else if (DevicePathType(path) == MESSAGING_DEVICE_PATH && DevicePathSubType(path) == MSG_USB_CLASS_DP) { USB_CLASS_DEVICE_PATH *usb; - + usb = (USB_CLASS_DEVICE_PATH *)(void *)path; if (usb->DeviceClass == 3 && /* HID */ usb->DeviceSubClass == 1 && /* Boot devices */ @@ -161,7 +161,6 @@ set_devdesc_currdev(struct devsw *dev, int unit) char *devname; currdev.d_dev = dev; - currdev.d_type = currdev.d_dev->dv_type; currdev.d_unit = unit; devname = efi_fmtdev(&currdev); @@ -188,7 +187,6 @@ find_currdev(EFI_LOADED_IMAGE *img) currdev.dd.d_dev = &zfs_dev; currdev.dd.d_unit = 0; - currdev.dd.d_type = currdev.dd.d_dev->dv_type; currdev.pool_guid = pool_guid; currdev.root_guid = 0; devname = efi_fmtdev(&currdev); @@ -206,7 +204,6 @@ find_currdev(EFI_LOADED_IMAGE *img) struct disk_devdesc currdev; currdev.dd.d_dev = &efipart_hddev; - currdev.dd.d_type = currdev.dd.d_dev->dv_type; currdev.dd.d_unit = dp->pd_unit; currdev.d_slice = -1; currdev.d_partition = -1; @@ -890,7 +887,7 @@ command_chain(int argc, char *argv[]) struct disk_devdesc *d_dev; pdinfo_t *hd, *pd; - switch (dev->d_type) { + switch (dev->d_dev->dv_type) { case DEVT_ZFS: z_dev = (struct zfs_devdesc *)dev; loaded_image->DeviceHandle = diff --git a/usr/src/boot/sys/boot/i386/gptzfsboot/zfsboot.c b/usr/src/boot/sys/boot/i386/gptzfsboot/zfsboot.c index 8abf4f0b2f..89eb2281a4 100644 --- a/usr/src/boot/sys/boot/i386/gptzfsboot/zfsboot.c +++ b/usr/src/boot/sys/boot/i386/gptzfsboot/zfsboot.c @@ -182,7 +182,7 @@ main(void) /* * zfs_fmtdev() can be called only after dv_init */ - if (bdev != NULL && bdev->dd.d_type == DEVT_ZFS) { + if (bdev != NULL && bdev->dd.d_dev->dv_type == DEVT_ZFS) { /* set up proper device name string for ZFS */ strncpy(boot_devname, zfs_fmtdev(bdev), sizeof (boot_devname)); } @@ -373,7 +373,7 @@ load(void) bootinfo.bi_esymtab = VTOP(p); bootinfo.bi_kernelname = VTOP(kname); - if (bdev->dd.d_type == DEVT_ZFS) { + if (bdev->dd.d_dev->dv_type == DEVT_ZFS) { zfsargs.size = sizeof(zfsargs); zfsargs.pool = bdev->d_kind.zfs.pool_guid; zfsargs.root = bdev->d_kind.zfs.root_guid; @@ -409,12 +409,12 @@ mount_root(char *arg) if (bdev != NULL) free(bdev); bdev = ddesc; - if (bdev->dd.d_type == DEVT_DISK) { + if (bdev->dd.d_dev->dv_type == DEVT_DISK) { if (bdev->d_kind.biosdisk.partition == -1) part = 0xff; else part = bdev->d_kind.biosdisk.partition; - bootdev = MAKEBOOTDEV(dev_maj[bdev->dd.d_type], + bootdev = MAKEBOOTDEV(dev_maj[bdev->dd.d_dev->dv_type], bdev->d_kind.biosdisk.slice + 1, bdev->dd.d_unit, part); bootinfo.bi_bios_dev = bd_unit2bios(bdev->dd.d_unit); @@ -638,7 +638,6 @@ probe_partition(void *arg, const char *partname, if (pool_guid != 0 && bdev == NULL) { bdev = malloc(sizeof (struct i386_devdesc)); bzero(bdev, sizeof (struct i386_devdesc)); - bdev->dd.d_type = DEVT_ZFS; bdev->dd.d_dev = &zfs_dev; bdev->d_kind.zfs.pool_guid = pool_guid; diff --git a/usr/src/boot/sys/boot/i386/libi386/biosdisk.c b/usr/src/boot/sys/boot/i386/libi386/biosdisk.c index 100fa0b481..a1854f8ff6 100644 --- a/usr/src/boot/sys/boot/i386/libi386/biosdisk.c +++ b/usr/src/boot/sys/boot/i386/libi386/biosdisk.c @@ -361,7 +361,6 @@ bd_open(struct open_file *f, ...) * would overflow so it should be safe to perform here. */ disk.dd.d_dev = dev->dd.d_dev; - disk.dd.d_type = dev->dd.d_type; disk.dd.d_unit = dev->dd.d_unit; disk.d_slice = -1; disk.d_partition = -1; @@ -749,7 +748,7 @@ bd_getdev(struct i386_devdesc *d) { struct disk_devdesc *dev; int biosdev; - int major; + int major; int rootdev; char *nip, *cp; int i, unit; diff --git a/usr/src/boot/sys/boot/i386/libi386/bootinfo32.c b/usr/src/boot/sys/boot/i386/libi386/bootinfo32.c index 3386fd777f..fd54ac4be5 100644 --- a/usr/src/boot/sys/boot/i386/libi386/bootinfo32.c +++ b/usr/src/boot/sys/boot/i386/libi386/bootinfo32.c @@ -148,8 +148,8 @@ bi_load32(char *args, int *howtop, int *bootdevp, vm_offset_t *bip, vm_offset_t howto = bi_getboothowto(args); - /* - * Allow the environment variable 'rootdev' to override the supplied device + /* + * Allow the environment variable 'rootdev' to override the supplied device * This should perhaps go to MI code and/or have $rootdev tested/set by * MI code before launching the kernel. */ @@ -168,7 +168,7 @@ bi_load32(char *args, int *howtop, int *bootdevp, vm_offset_t *bip, vm_offset_t /* XXX - use a default bootdev of 0. Is this ok??? */ bootdevnr = 0; - switch(rootdev->dd.d_type) { + switch(rootdev->dd.d_dev->dv_type) { case DEVT_CD: /* Pass in BIOS device number. */ bi.bi_bios_dev = bc_unit2bios(rootdev->dd.d_unit); @@ -187,7 +187,7 @@ bi_load32(char *args, int *howtop, int *bootdevp, vm_offset_t *bip, vm_offset_t default: printf("WARNING - don't know how to boot from device type %d\n", - rootdev->dd.d_type); + rootdev->dd.d_dev->dv_type); } if (bootdevnr == -1) { printf("root device %s invalid\n", i386_fmtdev(rootdev)); diff --git a/usr/src/boot/sys/boot/i386/libi386/devicename.c b/usr/src/boot/sys/boot/i386/libi386/devicename.c index fb676ab7a5..8a6daf6ad7 100644 --- a/usr/src/boot/sys/boot/i386/libi386/devicename.c +++ b/usr/src/boot/sys/boot/i386/libi386/devicename.c @@ -158,7 +158,6 @@ i386_parsedev(struct i386_devdesc **dev, const char *devspec, const char **path) } idev->dd.d_dev = dv; - idev->dd.d_type = dv->dv_type; if (dev != NULL) *dev = idev; @@ -178,7 +177,7 @@ i386_fmtdev(void *vdev) struct i386_devdesc *dev = (struct i386_devdesc *)vdev; static char buf[SPECNAMELEN + 1]; - switch (dev->dd.d_type) { + switch (dev->dd.d_dev->dv_type) { case DEVT_NONE: strlcpy(buf, "(no device)", sizeof (buf)); break; diff --git a/usr/src/boot/sys/boot/i386/loader/main.c b/usr/src/boot/sys/boot/i386/loader/main.c index 577e186c4c..be24ca4acf 100644 --- a/usr/src/boot/sys/boot/i386/loader/main.c +++ b/usr/src/boot/sys/boot/i386/loader/main.c @@ -287,13 +287,12 @@ extract_currdev(void) if ((biosdev == 0) && (B_TYPE(initial_bootdev) != 2)) /* biosdev doesn't match major */ biosdev = 0x80 + B_UNIT(initial_bootdev); /* assume harddisk */ } - new_currdev.dd.d_type = new_currdev.dd.d_dev->dv_type; /* * If we are booting off of a BIOS disk and we didn't succeed in determining * which one we booted off of, just use disk0: as a reasonable default. */ - if ((new_currdev.dd.d_type == biosdisk.dv_type) && + if ((new_currdev.dd.d_dev->dv_type == biosdisk.dv_type) && ((new_currdev.dd.d_unit = bd_bios2unit(biosdev)) == -1)) { printf("Can't work out which disk we are booting from.\n" "Guessed BIOS device 0x%x not found by probes, defaulting to disk0:\n", biosdev); diff --git a/usr/src/boot/sys/boot/ofw/libofw/devicename.c b/usr/src/boot/sys/boot/ofw/libofw/devicename.c index 62076c9c1d..af06dafd9d 100644 --- a/usr/src/boot/sys/boot/ofw/libofw/devicename.c +++ b/usr/src/boot/sys/boot/ofw/libofw/devicename.c @@ -34,7 +34,7 @@ static int ofw_parsedev(struct ofw_devdesc **, const char *, const char **); -/* +/* * Point (dev) at an allocated device specifier for the device matching the * path in (devspec). If it contains an explicit device specification, * use that. If not, use the default device. @@ -49,7 +49,7 @@ ofw_getdev(void **vdev, const char *devspec, const char **path) * If it looks like this is just a path and no * device, go with the current device. */ - if ((devspec == NULL) || + if ((devspec == NULL) || ((strchr(devspec, '@') == NULL) && (strchr(devspec, ':') == NULL))) { @@ -58,7 +58,7 @@ ofw_getdev(void **vdev, const char *devspec, const char **path) *path = devspec; return(rv); } - + /* * Try to parse the device name off the beginning of the devspec */ @@ -113,8 +113,7 @@ found: } strcpy(idev->d_path, name); idev->dd.d_dev = dv; - idev->dd.d_type = dv->dv_type; - if (idev->dd.d_type == DEVT_ZFS) { + if (dv->dv_type == DEVT_ZFS) { p = devspec + strlen(dv->dv_name); err = zfs_parsedev((struct zfs_devdesc *)idev, p, path); if (err != 0) { diff --git a/usr/src/boot/sys/boot/sparc64/loader/main.c b/usr/src/boot/sys/boot/sparc64/loader/main.c index cee45a234c..88c06bcf74 100644 --- a/usr/src/boot/sys/boot/sparc64/loader/main.c +++ b/usr/src/boot/sys/boot/sparc64/loader/main.c @@ -809,7 +809,6 @@ sparc64_zfs_probe(void) zfs_currdev.pool_guid = guid; zfs_currdev.root_guid = 0; zfs_currdev.dd.d_dev = &zfs_dev; - zfs_currdev.dd.d_type = zfs_currdev.dd.d_dev->dv_type; } } #endif /* LOADER_ZFS_SUPPORT */ diff --git a/usr/src/boot/sys/boot/uboot/common/main.c b/usr/src/boot/sys/boot/uboot/common/main.c index 9de0e7b4df..a312fca0ec 100644 --- a/usr/src/boot/sys/boot/uboot/common/main.c +++ b/usr/src/boot/sys/boot/uboot/common/main.c @@ -47,7 +47,7 @@ int devs_no; uintptr_t uboot_heap_start; uintptr_t uboot_heap_end; -struct device_type { +struct device_type { const char *name; int type; } device_types[] = { @@ -267,7 +267,7 @@ get_load_device(int *type, int *unit, int *slice, int *partition) } p = endp; - + /* No partition specification. */ if (*p == '\0') return; @@ -298,7 +298,7 @@ get_load_device(int *type, int *unit, int *slice, int *partition) *unit = -1; *slice = 0; *partition = -1; -} +} static void print_disk_probe_info() @@ -454,7 +454,6 @@ main(void) printf("Found U-Boot device: %s\n", devsw[i]->dv_name); currdev.dd.d_dev = devsw[i]; - currdev.dd.d_type = currdev.d_dev->dv_type; currdev.dd.d_unit = 0; if ((load_type == -1 || (load_type & DEV_TYP_STOR)) && @@ -533,7 +532,7 @@ command_devinfo(int argc, char *argv[]) command_errmsg = "no U-Boot devices found!?"; return (CMD_ERROR); } - + printf("U-Boot devices:\n"); for (i = 0; i < devs_no; i++) { ub_dump_di(i); @@ -577,7 +576,7 @@ handle_uboot_env_var(enum ubenv_action action, const char * var) * import the uboot variable ubname into the loader variable ldname, * otherwise the historical behavior is to import to uboot.ubname. */ - if (action == UBENV_IMPORT) { + if (action == UBENV_IMPORT) { len = strcspn(var, "="); if (len == 0) { printf("name cannot start with '=': '%s'\n", var); diff --git a/usr/src/boot/sys/boot/uboot/lib/devicename.c b/usr/src/boot/sys/boot/uboot/lib/devicename.c index 9f4bb679d9..4d3350e78c 100644 --- a/usr/src/boot/sys/boot/uboot/lib/devicename.c +++ b/usr/src/boot/sys/boot/uboot/lib/devicename.c @@ -146,7 +146,6 @@ uboot_parsedev(struct uboot_devdesc **dev, const char *devspec, goto fail; } idev->dd.d_dev = dv; - idev->dd.d_type = dv->dv_type; if (dev == NULL) { free(idev); } else { @@ -166,7 +165,7 @@ uboot_fmtdev(void *vdev) struct uboot_devdesc *dev = (struct uboot_devdesc *)vdev; static char buf[128]; - switch(dev->dd.d_type) { + switch(dev->dd.d_dev->dv_type) { case DEVT_NONE: strcpy(buf, "(no device)"); break; diff --git a/usr/src/boot/sys/boot/userboot/userboot/devicename.c b/usr/src/boot/sys/boot/userboot/userboot/devicename.c index c20187b198..79aeff4bb9 100644 --- a/usr/src/boot/sys/boot/userboot/userboot/devicename.c +++ b/usr/src/boot/sys/boot/userboot/userboot/devicename.c @@ -39,7 +39,7 @@ static int userboot_parsedev(struct disk_devdesc **dev, const char *devspec, const char **path); -/* +/* * Point (dev) at an allocated device specifier for the device matching the * path in (devspec). If it contains an explicit device specification, * use that. If not, use the default device. @@ -49,13 +49,13 @@ userboot_getdev(void **vdev, const char *devspec, const char **path) { struct disk_devdesc **dev = (struct disk_devdesc **)vdev; int rv; - + /* * If it looks like this is just a path and no * device, go with the current device. */ - if ((devspec == NULL) || - (devspec[0] == '/') || + if ((devspec == NULL) || + (devspec[0] == '/') || (strchr(devspec, ':') == NULL)) { if (((rv = userboot_parsedev(dev, getenv("currdev"), NULL)) == 0) && @@ -63,7 +63,7 @@ userboot_getdev(void **vdev, const char *devspec, const char **path) *path = devspec; return(rv); } - + /* * Try to parse the device name off the beginning of the devspec */ @@ -82,7 +82,7 @@ userboot_getdev(void **vdev, const char *devspec, const char **path) * For disk-type devices, the syntax is: * * disk<unit>[s<slice>][<partition>]: - * + * */ static int userboot_parsedev(struct disk_devdesc **dev, const char *devspec, const char **path) @@ -109,7 +109,7 @@ userboot_parsedev(struct disk_devdesc **dev, const char *devspec, const char **p idev = malloc(sizeof(struct disk_devdesc)); err = 0; np = (devspec + strlen(dv->dv_name)); - + switch(dv->dv_type) { case DEVT_NONE: /* XXX what to do here? Do we care? */ break; @@ -158,7 +158,6 @@ userboot_parsedev(struct disk_devdesc **dev, const char *devspec, const char **p goto fail; } idev->dd.d_dev = dv; - idev->dd.d_type = dv->dv_type; if (dev == NULL) { free(idev); } else { @@ -178,7 +177,7 @@ userboot_fmtdev(void *vdev) struct disk_devdesc *dev = (struct disk_devdesc *)vdev; static char buf[128]; /* XXX device length constant? */ - switch(dev->dd.d_type) { + switch(dev->dd.d_dev->dv_type) { case DEVT_NONE: strcpy(buf, "(no device)"); break; diff --git a/usr/src/boot/sys/boot/userboot/userboot/main.c b/usr/src/boot/sys/boot/userboot/userboot/main.c index 5abd95b5cf..781eece576 100644 --- a/usr/src/boot/sys/boot/userboot/userboot/main.c +++ b/usr/src/boot/sys/boot/userboot/userboot/main.c @@ -142,7 +142,7 @@ loader_main(struct loader_callbacks *cb, void *arg, int version, int ndisks) } /* - * Set the 'current device' by (if possible) recovering the boot device as + * Set the 'current device' by (if possible) recovering the boot device as * supplied by the initial bootstrap. */ static void @@ -169,7 +169,6 @@ extract_currdev(void) if (userboot_disk_maxunit > 0) { dev.dd.d_dev = &userboot_disk; - dev.dd.d_type = dev.dd.d_dev->dv_type; dev.dd.d_unit = 0; dev.d_slice = 0; dev.d_partition = 0; @@ -183,7 +182,6 @@ extract_currdev(void) } } else { dev.dd.d_dev = &host_dev; - dev.dd.d_type = dev.dd.d_dev->dv_type; dev.dd.d_unit = 0; } diff --git a/usr/src/boot/sys/boot/zfs/zfs.c b/usr/src/boot/sys/boot/zfs/zfs.c index d5e932ff0d..493ebd7e57 100644 --- a/usr/src/boot/sys/boot/zfs/zfs.c +++ b/usr/src/boot/sys/boot/zfs/zfs.c @@ -692,7 +692,6 @@ zfs_parsedev(struct zfs_devdesc *dev, const char *devspec, const char **path) if (path != NULL) *path = (*end == '\0') ? end : end + 1; dev->dd.d_dev = &zfs_dev; - dev->dd.d_type = zfs_dev.dv_type; return (0); } @@ -707,7 +706,7 @@ zfs_bootfs(void *zdev) int n; buf[0] = '\0'; - if (dev->dd.d_type != DEVT_ZFS) + if (dev->dd.d_dev->dv_type != DEVT_ZFS) return (buf); spa = spa_find_by_guid(dev->pool_guid); @@ -762,7 +761,7 @@ zfs_fmtdev(void *vdev) spa_t *spa; buf[0] = '\0'; - if (dev->dd.d_type != DEVT_ZFS) + if (dev->dd.d_dev->dv_type != DEVT_ZFS) return (buf); if (dev->pool_guid == 0) { @@ -960,7 +959,7 @@ zfs_set_env(void) ctr++; continue; } - + snprintf(envname, sizeof(envname), "bootenvmenu_caption[%d]", zfs_env_index); snprintf(envval, sizeof(envval), "%s", zfs_be->name); rv = setenv(envname, envval, 1); @@ -993,7 +992,7 @@ zfs_set_env(void) } } - + for (; zfs_env_index <= ZFS_BE_LAST; zfs_env_index++) { snprintf(envname, sizeof(envname), "bootenvmenu_caption[%d]", zfs_env_index); (void)unsetenv(envname); diff --git a/usr/src/cmd/logadm/conf.c b/usr/src/cmd/logadm/conf.c index aa877d3dd2..25bcc4f63d 100644 --- a/usr/src/cmd/logadm/conf.c +++ b/usr/src/cmd/logadm/conf.c @@ -22,6 +22,7 @@ /* * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2013, Joyent, Inc. All rights reserved. + * Copyright 2018 Sebastian Wiedenroth */ /* @@ -82,6 +83,7 @@ struct confinfo { }; #define CONFF_DELETED 1 /* entry should be deleted on write back */ +#define CONFF_TSONLY 2 /* entry should only be in timestamps file */ static struct confinfo *Confinfo; /* the entries in the config file */ static struct confinfo *Confinfolast; /* end of list */ @@ -178,6 +180,7 @@ conf_scan(const char *fname, char *buf, int buflen, int timescan) { int ret = 1; int lineno = 0; + int flags = 0; char *line; char *eline; char *ebuf; @@ -298,7 +301,11 @@ conf_scan(const char *fname, char *buf, int buflen, int timescan) * the case where the logname is not the same as * the log file name. */ - fillconflist(lineno, entry, opts, comment, 0); + flags = 0; + if (cp == NULL) + flags = CONFF_TSONLY; + fillconflist(lineno, entry, opts, comment, + flags); } LOCAL_ERR_END } @@ -655,9 +662,6 @@ conf_print(FILE *cstream, FILE *tstream) if (cp->cf_flags & CONFF_DELETED) continue; if (cp->cf_entry) { - opts_printword(cp->cf_entry, cstream); - if (cp->cf_opts) - opts_print(cp->cf_opts, cstream, exclude_opts); /* output timestamps to tstream */ if (tstream != NULL && (timestamp = opts_optarg(cp->cf_opts, "P")) != NULL) { @@ -666,6 +670,12 @@ conf_print(FILE *cstream, FILE *tstream) opts_printword(timestamp, tstream); (void) fprintf(tstream, "\n"); } + if (cp->cf_flags & CONFF_TSONLY) + continue; + + opts_printword(cp->cf_entry, cstream); + if (cp->cf_opts) + opts_print(cp->cf_opts, cstream, exclude_opts); } if (cp->cf_com) { if (cp->cf_entry) diff --git a/usr/src/cmd/logadm/lut.c b/usr/src/cmd/logadm/lut.c index 090c47054d..419d27a903 100644 --- a/usr/src/cmd/logadm/lut.c +++ b/usr/src/cmd/logadm/lut.c @@ -38,8 +38,6 @@ * was needed by logadm for options processing. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <stdio.h> #include <strings.h> #include "err.h" @@ -170,8 +168,6 @@ lut_free(struct lut *root, void (*callback)(void *rhs)) void printer(const char *lhs, void *rhs, void *arg) { - struct lut *root = (struct lut *)arg; - printf("<%s> <%s> (<%s>)\n", lhs, (char *)rhs, (char *)lut_lookup(arg, lhs)); } diff --git a/usr/src/cmd/logadm/tester b/usr/src/cmd/logadm/tester index b65d13d155..89dd978448 100644 --- a/usr/src/cmd/logadm/tester +++ b/usr/src/cmd/logadm/tester @@ -90,7 +90,9 @@ umask 002; "logadm18", "logadm19", "logadm20", - "logadm21" + "logadm21", + "logadm22", + "logadm23" ); use Getopt::Std; @@ -2128,7 +2130,87 @@ EOF set_file('runtest', <<"EOF"); # test "logadm21" $envsetup -$bindir/logadm -f logadm.conf 2>std.err +$bindir/logadm -f logadm.conf -F /dev/null 2>std.err exit 0 EOF } + +############################################################################# +# +# logadm22 - test for keeping timestamps in timestamps file on -w +# +############################################################################# + +sub logadm22 { + set_file('logadm.conf', <<'EOF'); +wildcard_test -A 3d dir1/*.log +regular_test -A 3d dir2/test.log +EOF + +set_file('logadm.conf.expect', <<'EOF'); +wildcard_test -A 3d dir1/*.log +regular_test -A 3d dir2/test.log +dir3/test.log -A 3d +EOF + + set_file('logadm.timestamps', <<'EOF'); +# This file holds internal data for logadm(1M). +# Do not edit. +dir1/foo.log -P 'Thu Nov 1 16:56:42 2001' +dir2/test.log -P 'Thu Nov 1 16:56:42 2001' +EOF + system("/bin/cp logadm.timestamps logadm.timestamps.expect"); + + set_file('checktest', <<'EOF'); +[ -s std.err ] && { cat std.err; exit 1; } +/bin/diff logadm.conf.expect logadm.conf || exit 1 +/bin/diff logadm.timestamps.expect logadm.timestamps || exit 1 +EOF + + set_file('runtest', <<"EOF"); +# test "logadm22" +$envsetup +$bindir/logadm -f logadm.conf -F logadm.timestamps -w dir3/test.log -A 3d 2>std.err +exit 0 +EOF + +} + +############################################################################# +# +# logadm23 - test for keeping timestamps in timestamps file on -r +# +############################################################################# + +sub logadm23 { + set_file('logadm.conf', <<'EOF'); +wildcard_test -A 3d dir1/*.log +regular_test -A 3d dir2/test.log +EOF + +set_file('logadm.conf.expect', <<'EOF'); +wildcard_test -A 3d dir1/*.log +EOF + + set_file('logadm.timestamps', <<'EOF'); +# This file holds internal data for logadm(1M). +# Do not edit. +dir1/foo.log -P 'Thu Nov 1 16:56:42 2001' +dir2/test.log -P 'Thu Nov 1 16:56:42 2001' +EOF + system("/bin/cp logadm.timestamps logadm.timestamps.expect"); + + set_file('checktest', <<'EOF'); +[ -s std.err ] && { cat std.err; exit 1; } +/bin/diff logadm.conf.expect logadm.conf || exit 1 +/bin/diff logadm.timestamps.expect logadm.timestamps || exit 1 +EOF + + set_file('runtest', <<"EOF"); +# test "logadm23" +$envsetup +$bindir/logadm -f logadm.conf -F logadm.timestamps -r regular_test 2>std.err +exit 0 +EOF + +} diff --git a/usr/src/lib/sasl_plugins/digestmd5/digestmd5.c b/usr/src/lib/sasl_plugins/digestmd5/digestmd5.c index 6939e33363..4bac87c182 100644 --- a/usr/src/lib/sasl_plugins/digestmd5/digestmd5.c +++ b/usr/src/lib/sasl_plugins/digestmd5/digestmd5.c @@ -1261,7 +1261,7 @@ static int init_uef(context_t *text, CK_OBJECT_CLASS class = CKO_SECRET_KEY; CK_BBOOL true = TRUE; static CK_MECHANISM mechanism = {CKM_RC4, NULL, 0}; - unsigned char keybuf[24]; + unsigned char keybuf[24]; CK_ATTRIBUTE template[] = { {CKA_CLASS, NULL, sizeof (class)}, {CKA_KEY_TYPE, NULL, sizeof (keyType)}, @@ -1410,7 +1410,7 @@ free_uef(context_t *text) uef_context_t *dec_context = (uef_context_t *)text->cipher_dec_context; CK_RV rv; - unsigned char buf[1]; + unsigned char buf[1]; CK_ULONG ulLen = 0; @@ -1419,7 +1419,7 @@ free_uef(context_t *text) if (rv != CKR_OK) { #ifdef DEBUG text->utils->log(text->utils->conn, SASL_LOG_DEBUG, - "C_EncryptFinal failed:0x%.8X\n", rv); + "C_EncryptFinal failed:0x%.8X\n", rv); #endif } rv = C_DestroyObject(enc_context->hSession, enc_context->hKey); @@ -5091,6 +5091,7 @@ digestmd5_client_mech_step(void *conn_context, } /* fall through and respond to challenge */ + /* FALLTHROUGH */ case 3: if (serverin && !strncasecmp(serverin, "rspauth=", 8)) { @@ -5121,6 +5122,7 @@ digestmd5_client_mech_step(void *conn_context, text->realm = text->nonce = text->cnonce = NULL; #endif /* _SUN_SDK_ */ ctext->cipher = NULL; + /* FALLTHROUGH */ case 2: return digestmd5_client_mech_step2(ctext, params, @@ -5173,7 +5175,7 @@ static sasl_client_plug_t digestmd5_client_plugins[] = SASL_SEC_NOPLAINTEXT | SASL_SEC_NOANONYMOUS | SASL_SEC_MUTUAL_AUTH, /* security_flags */ - SASL_FEAT_ALLOWS_PROXY, /* features */ + SASL_FEAT_ALLOWS_PROXY, /* features */ NULL, /* required_prompts */ NULL, /* glob_context */ &digestmd5_client_mech_new, /* mech_new */ @@ -5306,7 +5308,7 @@ getSlotID(const sasl_utils_t *utils, CK_MECHANISM_TYPE mech_type, if (rv != CKR_OK) { #ifdef DEBUG utils->log(utils->conn, SASL_LOG_DEBUG, - "C_GetMechanismList returned 0x%.8X count:%d\n", rv, + "C_GetMechanismList returned 0x%.8X count:%d\n", rv, ulMechTypeCount); #endif utils->free(pMechTypeList); diff --git a/usr/src/lib/sasl_plugins/login/login.c b/usr/src/lib/sasl_plugins/login/login.c index 64ba6ca83f..1f021da4ca 100644 --- a/usr/src/lib/sasl_plugins/login/login.c +++ b/usr/src/lib/sasl_plugins/login/login.c @@ -10,7 +10,7 @@ * based on PLAIN, by Tim Martin <tmartin@andrew.cmu.edu> * $Id: login.c,v 1.25 2003/02/13 19:56:04 rjs3 Exp $ */ -/* +/* * Copyright (c) 1998-2003 Carnegie Mellon University. All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -18,7 +18,7 @@ * are met: * * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. + * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in @@ -28,7 +28,7 @@ * 3. The name "Carnegie Mellon University" must not be used to * endorse or promote products derived from this software without * prior written permission. For permission or any other legal - * details, please contact + * details, please contact * Office of Technology Transfer * Carnegie Mellon University * 5000 Forbes Avenue @@ -80,27 +80,27 @@ typedef struct context { size_t username_len; } server_context_t; -static int login_server_mech_new(void *glob_context __attribute__((unused)), +static int login_server_mech_new(void *glob_context __attribute__((unused)), sasl_server_params_t *sparams, const char *challenge __attribute__((unused)), unsigned challen __attribute__((unused)), void **conn_context) { server_context_t *text; - + /* holds state are in */ text = sparams->utils->malloc(sizeof(server_context_t)); if (text == NULL) { MEMERROR( sparams->utils ); return SASL_NOMEM; } - + memset(text, 0, sizeof(server_context_t)); - + text->state = 1; - + *conn_context = text; - + return SASL_OK; } @@ -116,10 +116,10 @@ static int login_server_mech_step(void *conn_context, sasl_out_params_t *oparams) { server_context_t *text = (server_context_t *) conn_context; - + *serverout = NULL; *serveroutlen = 0; - + switch (text->state) { case 1: @@ -129,14 +129,14 @@ static int login_server_mech_step(void *conn_context, /* In this case fall through to state 2 */ if (clientinlen == 0) { /* demand username */ - + *serveroutlen = strlen(USERNAME_CHALLENGE); *serverout = USERNAME_CHALLENGE; return SASL_CONTINUE; } - - + /* FALLTHROUGH */ + case 2: /* Catch really long usernames */ if (clientinlen > 1024) { @@ -148,7 +148,7 @@ static int login_server_mech_step(void *conn_context, #endif /* _SUN_SDK_ */ return SASL_BADPROT; } - + /* get username */ text->username = params->utils->malloc(sizeof(sasl_secret_t) + clientinlen + 1); @@ -156,24 +156,24 @@ static int login_server_mech_step(void *conn_context, MEMERROR( params->utils ); return SASL_NOMEM; } - + strncpy(text->username, clientin, clientinlen); text->username_len = clientinlen; text->username[clientinlen] = '\0'; - + /* demand password */ *serveroutlen = strlen(PASSWORD_CHALLENGE); *serverout = PASSWORD_CHALLENGE; - + text->state = 3; - + return SASL_CONTINUE; - - + + case 3: { sasl_secret_t *password; int result; - + /* Catch really long passwords */ if (clientinlen > 1024) { #ifdef _SUN_SDK_ @@ -185,7 +185,7 @@ static int login_server_mech_step(void *conn_context, #endif /* _SUN_SDK_ */ return SASL_BADPROT; } - + /* get password */ password = params->utils->malloc(sizeof(sasl_secret_t) + clientinlen + 1); @@ -193,7 +193,7 @@ static int login_server_mech_step(void *conn_context, MEMERROR(params->utils); return SASL_NOMEM; } - + strncpy((char *)password->data, clientin, clientinlen); password->data[clientinlen] = '\0'; password->len = clientinlen; @@ -207,27 +207,27 @@ static int login_server_mech_step(void *conn_context, _plug_free_secret(params->utils, &password); return result; } - + /* verify_password - return sasl_ok on success */ result = params->utils->checkpass(params->utils->conn, oparams->authid, oparams->alen, (char *)password->data, password->len); - + if (result != SASL_OK) { _plug_free_secret(params->utils, &password); return result; } - + if (params->transition) { params->transition(params->utils->conn, (char *)password->data, password->len); } - + _plug_free_secret(params->utils, &password); - + *serverout = NULL; *serveroutlen = 0; - + oparams->doneflag = 1; oparams->mech_ssf = 0; oparams->maxoutbuf = 0; @@ -236,7 +236,7 @@ static int login_server_mech_step(void *conn_context, oparams->decode_context = NULL; oparams->decode = NULL; oparams->param_version = 0; - + return SASL_OK; } @@ -246,7 +246,7 @@ static int login_server_mech_step(void *conn_context, "Invalid LOGIN server step %d\n", text->state); return SASL_FAIL; } - + return SASL_FAIL; /* should never get here */ } @@ -254,15 +254,15 @@ static void login_server_mech_dispose(void *conn_context, const sasl_utils_t *utils) { server_context_t *text = (server_context_t *) conn_context; - + if (!text) return; - + if (text->username) utils->free(text->username); - + utils->free(text); } -static sasl_server_plug_t login_server_plugins[] = +static sasl_server_plug_t login_server_plugins[] = { { "LOGIN", /* mech_name */ @@ -292,11 +292,11 @@ int login_server_plug_init(sasl_utils_t *utils, SETERROR(utils, "LOGIN version mismatch"); return SASL_BADVERS; } - + *out_version = SASL_SERVER_PLUG_VERSION; *pluglist = login_server_plugins; - *plugcount = 1; - + *plugcount = 1; + return SASL_OK; } @@ -317,20 +317,20 @@ static int login_client_mech_new(void *glob_context __attribute__((unused)), void **conn_context) { client_context_t *text; - + /* holds state are in */ text = params->utils->malloc(sizeof(client_context_t)); if (text == NULL) { MEMERROR(params->utils); return SASL_NOMEM; } - + memset(text, 0, sizeof(client_context_t)); - + text->state = 1; - + *conn_context = text; - + return SASL_OK; } @@ -344,10 +344,10 @@ static int login_client_mech_step(void *conn_context, sasl_out_params_t *oparams) { client_context_t *text = (client_context_t *) conn_context; - + *clientout = NULL; *clientoutlen = 0; - + switch (text->state) { case 1: { @@ -355,7 +355,7 @@ static int login_client_mech_step(void *conn_context, int auth_result = SASL_OK; int pass_result = SASL_OK; int result; - + /* check if sec layer strong enough */ if (params->props.min_ssf > params->external_ssf) { #ifdef _INTEGRATED_SOLARIS_ @@ -366,7 +366,7 @@ static int login_client_mech_step(void *conn_context, #endif /* _INTEGRATED_SOLARIS_ */ return SASL_TOOWEAK; } - + /* try to get the userid */ /* Note: we want to grab the authname and not the userid, which is * who we AUTHORIZE as, and will be the same as the authname @@ -374,26 +374,26 @@ static int login_client_mech_step(void *conn_context, */ if (oparams->user == NULL) { auth_result = _plug_get_authid(params->utils, &user, prompt_need); - + if ((auth_result != SASL_OK) && (auth_result != SASL_INTERACT)) return auth_result; } - + /* try to get the password */ if (text->password == NULL) { pass_result = _plug_get_password(params->utils, &text->password, &text->free_password, prompt_need); - + if ((pass_result != SASL_OK) && (pass_result != SASL_INTERACT)) return pass_result; } - + /* free prompts we got */ if (prompt_need && *prompt_need) { params->utils->free(*prompt_need); *prompt_need = NULL; } - + /* if there are prompts not filled in */ if ((auth_result == SASL_INTERACT) || (pass_result == SASL_INTERACT)) { /* make the prompt list */ @@ -420,19 +420,19 @@ static int login_client_mech_step(void *conn_context, NULL, NULL, NULL); #endif /* _INTEGRATED_SOLARIS_ */ if (result != SASL_OK) return result; - + return SASL_INTERACT; } - + if (!text->password) { PARAMERROR(params->utils); return SASL_BADPARAM; } - + result = params->canon_user(params->utils->conn, user, 0, SASL_CU_AUTHID | SASL_CU_AUTHZID, oparams); if (result != SASL_OK) return result; - + /* server should have sent request for username - we ignore it */ if (!serverin) { #ifdef _SUN_SDK_ @@ -444,17 +444,17 @@ static int login_client_mech_step(void *conn_context, #endif /* _SUN_SDK_ */ return SASL_BADPROT; } - + if (!clientout) { PARAMERROR( params->utils ); return SASL_BADPARAM; } - + if (clientoutlen) *clientoutlen = oparams->alen; *clientout = oparams->authid; - + text->state = 2; - + return SASL_CONTINUE; } @@ -470,15 +470,15 @@ static int login_client_mech_step(void *conn_context, #endif /* _SUN_SDK_ */ return SASL_BADPROT; } - + if (!clientout) { PARAMERROR(params->utils); return SASL_BADPARAM; } - + if (clientoutlen) *clientoutlen = text->password->len; *clientout = (char *)text->password->data; - + /* set oparams */ oparams->doneflag = 1; oparams->mech_ssf = 0; @@ -488,7 +488,7 @@ static int login_client_mech_step(void *conn_context, oparams->decode_context = NULL; oparams->decode = NULL; oparams->param_version = 0; - + return SASL_OK; default: @@ -504,19 +504,19 @@ static void login_client_mech_dispose(void *conn_context, const sasl_utils_t *utils) { client_context_t *text = (client_context_t *) conn_context; - + if (!text) return; - + /* free sensitive info */ if (text->free_password) _plug_free_secret(utils, &(text->password)); #ifdef _INTEGRATED_SOLARIS_ convert_prompt(utils, &text->h, NULL); #endif /* _INTEGRATED_SOLARIS_ */ - + utils->free(text); } -static sasl_client_plug_t login_client_plugins[] = +static sasl_client_plug_t login_client_plugins[] = { { "LOGIN", /* mech_name */ @@ -545,10 +545,10 @@ int login_client_plug_init(sasl_utils_t *utils, SETERROR(utils, "Version mismatch in LOGIN"); return SASL_BADVERS; } - + *out_version = SASL_CLIENT_PLUG_VERSION; *pluglist = login_client_plugins; *plugcount = 1; - + return SASL_OK; } diff --git a/usr/src/uts/common/io/e1000api/e1000_82575.c b/usr/src/uts/common/io/e1000api/e1000_82575.c index aef2642a52..77aca650e0 100644 --- a/usr/src/uts/common/io/e1000api/e1000_82575.c +++ b/usr/src/uts/common/io/e1000api/e1000_82575.c @@ -1679,7 +1679,7 @@ static s32 e1000_setup_serdes_link_82575(struct e1000_hw *hw) case E1000_CTRL_EXT_LINK_MODE_1000BASE_KX: /* disable PCS autoneg and support parallel detect only */ pcs_autoneg = FALSE; - /* fall through to default case */ + /* FALLTHROUGH */ default: if (hw->mac.type == e1000_82575 || hw->mac.type == e1000_82576) { @@ -1806,6 +1806,7 @@ static s32 e1000_get_media_type_82575(struct e1000_hw *hw) break; } /* fall through for I2C based SGMII */ + /* FALLTHROUGH */ case E1000_CTRL_EXT_LINK_MODE_PCIE_SERDES: /* read media type from SFP EEPROM */ ret_val = e1000_set_sfp_media_type_82575(hw); diff --git a/usr/src/uts/common/io/e1000api/e1000_mbx.c b/usr/src/uts/common/io/e1000api/e1000_mbx.c index 34649bf739..bedd015075 100644 --- a/usr/src/uts/common/io/e1000api/e1000_mbx.c +++ b/usr/src/uts/common/io/e1000api/e1000_mbx.c @@ -778,6 +778,7 @@ s32 e1000_init_mbx_params_pf(struct e1000_hw *hw) mbx->stats.reqs = 0; mbx->stats.acks = 0; mbx->stats.rsts = 0; + /* FALLTHROUGH */ default: return E1000_SUCCESS; } diff --git a/usr/src/uts/common/io/e1000api/e1000_phy.c b/usr/src/uts/common/io/e1000api/e1000_phy.c index 9684b43f55..491eeb5c8d 100644 --- a/usr/src/uts/common/io/e1000api/e1000_phy.c +++ b/usr/src/uts/common/io/e1000api/e1000_phy.c @@ -1297,6 +1297,7 @@ s32 e1000_copper_link_setup_m88_gen2(struct e1000_hw *hw) phy_data |= M88E1000_PSCR_AUTO_X_1000T; break; } + /* FALLTHROUGH */ case 0: default: phy_data |= M88E1000_PSCR_AUTO_X_MODE; diff --git a/usr/src/uts/common/io/e1000api/e1000_vf.c b/usr/src/uts/common/io/e1000api/e1000_vf.c index 4af985b87b..b88c75d77b 100644 --- a/usr/src/uts/common/io/e1000api/e1000_vf.c +++ b/usr/src/uts/common/io/e1000api/e1000_vf.c @@ -487,8 +487,10 @@ s32 e1000_promisc_set_vf(struct e1000_hw *hw, enum e1000_promisc_type type) break; case e1000_promisc_enabled: msgbuf |= E1000_VF_SET_PROMISC_MULTICAST; + /* FALLTHROUGH */ case e1000_promisc_unicast: msgbuf |= E1000_VF_SET_PROMISC_UNICAST; + /* FALLTHROUGH */ case e1000_promisc_disabled: break; default: |
