diff options
author | Jerry Jelinek <jerry.jelinek@joyent.com> | 2019-03-05 12:39:53 +0000 |
---|---|---|
committer | Jerry Jelinek <jerry.jelinek@joyent.com> | 2019-03-05 12:39:53 +0000 |
commit | 49237ee3344e732e5033a18e165180546908237d (patch) | |
tree | 8a3fcbcb35b7c4bc64ac1cae9ce3fcf90276c311 /usr/src | |
parent | 31fd5d7bc7a22f5f61d4a1b782a407e05cf49ad1 (diff) | |
parent | 4976ccaaebae1e8ba213109839bf1b777ca7ac4f (diff) | |
download | illumos-joyent-49237ee3344e732e5033a18e165180546908237d.tar.gz |
[illumos-gate merge]
commit 4976ccaaebae1e8ba213109839bf1b777ca7ac4f
10465 loader: uboot cstyle cleanup
commit 322b93b95c6010b892ad50c1747f354287692d70
10463 loader: interp_forth.c cstyle cleanup
commit 86759c82cd4edf74a2d68314e94f68491103bd09
10461 loader: multiboot2.c cstyle cleanup
commit f058bc028c85a5b43c00e710a62da1a9679bdd17
10457 libstand: bzipfs.c cstyle cleanup
commit eba02b15d6b41ee3c53be5e158f549044c0d0d4f
10496 uts: NULL pointer error in ip_ndp.c
commit 88834f1b9a3f099fd1de381f0b32c6813f620123
10478 setup and cleanup for pool checkpoint tests doesn't run
commit dcdeca0a948b9d3139743db085d193c9db8ff2a3
10479 7290 broke slog_014_pos.ksh
commit 332b63531e8c203d2f4308b5979fae65f72169d6
10475 fix zfs-test cli_root/zpool_get zpool_get_002_pos test case
Diffstat (limited to 'usr/src')
-rw-r--r-- | usr/src/boot/lib/libstand/bzipfs.c | 547 | ||||
-rw-r--r-- | usr/src/boot/sys/boot/common/interp_forth.c | 395 | ||||
-rw-r--r-- | usr/src/boot/sys/boot/common/multiboot2.c | 105 | ||||
-rw-r--r-- | usr/src/boot/sys/boot/uboot/lib/copy.c | 16 | ||||
-rw-r--r-- | usr/src/boot/sys/boot/uboot/lib/net.c | 8 | ||||
-rw-r--r-- | usr/src/test/zfs-tests/runfiles/omnios.run | 3 | ||||
-rw-r--r-- | usr/src/test/zfs-tests/runfiles/openindiana.run | 3 | ||||
-rw-r--r-- | usr/src/test/zfs-tests/tests/functional/cli_root/zpool_get/zpool_get.cfg | 7 | ||||
-rw-r--r-- | usr/src/test/zfs-tests/tests/functional/slog/slog_014_pos.ksh | 1 | ||||
-rw-r--r-- | usr/src/uts/common/inet/ip/ip_ndp.c | 2 |
10 files changed, 557 insertions, 530 deletions
diff --git a/usr/src/boot/lib/libstand/bzipfs.c b/usr/src/boot/lib/libstand/bzipfs.c index d99014ade7..2e2a3d8963 100644 --- a/usr/src/boot/lib/libstand/bzipfs.c +++ b/usr/src/boot/lib/libstand/bzipfs.c @@ -1,4 +1,4 @@ -/* +/* * Copyright (c) 1998 Michael Smith. * Copyright (c) 2000 Maxim Sobolev * All rights reserved. @@ -37,71 +37,79 @@ #include <sys/unistd.h> struct open_file { - int f_flags; /* see F_* below */ - void *f_fsdata; /* file system specific data */ + int f_flags; /* see F_* below */ + void *f_fsdata; /* file system specific data */ }; -#define F_READ 0x0001 /* file opened for reading */ -#define EOFFSET (ELAST+8) /* relative seek not supported */ -static inline u_int min(u_int a, u_int b) { return(a < b ? a : b); } -#define panic(x, y) abort() +#define F_READ 0x0001 /* file opened for reading */ +#define EOFFSET (ELAST + 8) /* relative seek not supported */ +#define panic(x, y) abort() + +static inline uint_t +min(uint_t a, uint_t b) +{ + return (a < b ? a : b); +} #endif #include <sys/stat.h> #include <string.h> #include <bzlib.h> -#define BZ_BUFSIZE 2048 /* XXX larger? */ +#define BZ_BUFSIZE 2048 /* XXX larger? */ struct bz_file { - int bzf_rawfd; - bz_stream bzf_bzstream; - char bzf_buf[BZ_BUFSIZE]; - int bzf_endseen; + int bzf_rawfd; + bz_stream bzf_bzstream; + char bzf_buf[BZ_BUFSIZE]; + int bzf_endseen; }; -static int bzf_fill(struct bz_file *z); -static int bzf_open(const char *path, struct open_file *f); -static int bzf_close(struct open_file *f); -static int bzf_read(struct open_file *f, void *buf, size_t size, size_t *resid); -static off_t bzf_seek(struct open_file *f, off_t offset, int where); -static int bzf_stat(struct open_file *f, struct stat *sb); +static int bzf_fill(struct bz_file *); +static int bzf_open(const char *, struct open_file *); +static int bzf_close(struct open_file *); +static int bzf_read(struct open_file *, void *, size_t, size_t *); +static off_t bzf_seek(struct open_file *, off_t, int); +static int bzf_stat(struct open_file *, struct stat *); #ifndef REGRESSION struct fs_ops bzipfs_fsops = { - "bzip", - bzf_open, - bzf_close, - bzf_read, - null_write, - bzf_seek, - bzf_stat, - null_readdir + .fs_name = "bzip", + .fo_open = bzf_open, + .fo_close = bzf_close, + .fo_read = bzf_read, + .fo_write = null_write, + .fo_seek = bzf_seek, + .fo_stat = bzf_stat, + .fo_readdir = null_readdir }; #endif static int bzf_fill(struct bz_file *bzf) { - int result; - int req; - - req = BZ_BUFSIZE - bzf->bzf_bzstream.avail_in; - result = 0; - - /* If we need more */ - if (req > 0) { - /* move old data to bottom of buffer */ - if (req < BZ_BUFSIZE) - bcopy(bzf->bzf_buf + req, bzf->bzf_buf, BZ_BUFSIZE - req); - - /* read to fill buffer and update availibility data */ - result = read(bzf->bzf_rawfd, bzf->bzf_buf + bzf->bzf_bzstream.avail_in, req); - bzf->bzf_bzstream.next_in = bzf->bzf_buf; - if (result >= 0) - bzf->bzf_bzstream.avail_in += result; - } - return(result); + int result; + int req; + + req = BZ_BUFSIZE - bzf->bzf_bzstream.avail_in; + result = 0; + + /* If we need more */ + if (req > 0) { + /* move old data to bottom of buffer */ + if (req < BZ_BUFSIZE) { + bcopy(bzf->bzf_buf + req, bzf->bzf_buf, + BZ_BUFSIZE - req); + } + + /* read to fill buffer and update availibility data */ + result = read(bzf->bzf_rawfd, + bzf->bzf_buf + bzf->bzf_bzstream.avail_in, req); + bzf->bzf_bzstream.next_in = bzf->bzf_buf; + if (result >= 0) + bzf->bzf_bzstream.avail_in += result; + } + return (result); } /* @@ -112,10 +120,10 @@ bzf_fill(struct bz_file *bzf) static int get_byte(struct bz_file *bzf) { - if ((bzf->bzf_bzstream.avail_in == 0) && (bzf_fill(bzf) == -1)) - return(-1); - bzf->bzf_bzstream.avail_in--; - return(*(bzf->bzf_bzstream.next_in)++); + if ((bzf->bzf_bzstream.avail_in == 0) && (bzf_fill(bzf) == -1)) + return (-1); + bzf->bzf_bzstream.avail_in--; + return (*(bzf->bzf_bzstream.next_in)++); } static int bz_magic[3] = {'B', 'Z', 'h'}; /* bzip2 magic header */ @@ -123,265 +131,274 @@ static int bz_magic[3] = {'B', 'Z', 'h'}; /* bzip2 magic header */ static int check_header(struct bz_file *bzf) { - unsigned int len; - int c; - - /* Check the bzip2 magic header */ - for (len = 0; len < 3; len++) { - c = get_byte(bzf); - if (c != bz_magic[len]) { - return(1); + unsigned int len; + int c; + + /* Check the bzip2 magic header */ + for (len = 0; len < 3; len++) { + c = get_byte(bzf); + if (c != bz_magic[len]) { + return (1); + } } - } - /* Check that the block size is valid */ - c = get_byte(bzf); - if (c < '1' || c > '9') - return(1); + /* Check that the block size is valid */ + c = get_byte(bzf); + if (c < '1' || c > '9') + return (1); - /* Put back bytes that we've took from the input stream */ - bzf->bzf_bzstream.next_in -= 4; - bzf->bzf_bzstream.avail_in += 4; + /* Put back bytes that we've took from the input stream */ + bzf->bzf_bzstream.next_in -= 4; + bzf->bzf_bzstream.avail_in += 4; - return(0); + return (0); } - + static int bzf_open(const char *fname, struct open_file *f) { - static char *bzfname; - int rawfd; - struct bz_file *bzf; - char *cp; - int error; - struct stat sb; - - /* Have to be in "just read it" mode */ - if (f->f_flags != F_READ) - return(EPERM); - - /* If the name already ends in .gz or .bz2, ignore it */ - if ((cp = strrchr(fname, '.')) && (!strcmp(cp, ".gz") - || !strcmp(cp, ".bz2") || !strcmp(cp, ".split"))) - return(ENOENT); - - /* Construct new name */ - bzfname = malloc(strlen(fname) + 5); - if (bzfname == NULL) - return(ENOMEM); - sprintf(bzfname, "%s.bz2", fname); - - /* Try to open the compressed datafile */ - rawfd = open(bzfname, O_RDONLY); - free(bzfname); - if (rawfd == -1) - return(ENOENT); - - if (fstat(rawfd, &sb) < 0) { - printf("bzf_open: stat failed\n"); - close(rawfd); - return(ENOENT); - } - if (!S_ISREG(sb.st_mode)) { - printf("bzf_open: not a file\n"); - close(rawfd); - return(EISDIR); /* best guess */ - } - - /* Allocate a bz_file structure, populate it */ - bzf = malloc(sizeof(struct bz_file)); - if (bzf == NULL) - return(ENOMEM); - bzero(bzf, sizeof(struct bz_file)); - bzf->bzf_rawfd = rawfd; - - /* Verify that the file is bzipped */ - if (check_header(bzf)) { - close(bzf->bzf_rawfd); - free(bzf); - return(EFTYPE); - } + static char *bzfname; + int rawfd; + struct bz_file *bzf; + char *cp; + int error; + struct stat sb; + + /* Have to be in "just read it" mode */ + if (f->f_flags != F_READ) + return (EPERM); + + /* If the name already ends in .gz or .bz2, ignore it */ + if ((cp = strrchr(fname, '.')) && + ((strcmp(cp, ".gz") == 0) || + (strcmp(cp, ".bz2") == 0) || + (strcmp(cp, ".split") == 0))) + return (ENOENT); + + /* Construct new name */ + bzfname = malloc(strlen(fname) + 5); + if (bzfname == NULL) + return (ENOMEM); + sprintf(bzfname, "%s.bz2", fname); + + /* Try to open the compressed datafile */ + rawfd = open(bzfname, O_RDONLY); + free(bzfname); + if (rawfd == -1) + return (ENOENT); + + if (fstat(rawfd, &sb) < 0) { + printf("bzf_open: stat failed\n"); + close(rawfd); + return (ENOENT); + } + if (!S_ISREG(sb.st_mode)) { + printf("bzf_open: not a file\n"); + close(rawfd); + return (EISDIR); /* best guess */ + } - /* Initialise the inflation engine */ - if ((error = BZ2_bzDecompressInit(&(bzf->bzf_bzstream), 0, 1)) != BZ_OK) { - printf("bzf_open: BZ2_bzDecompressInit returned %d\n", error); - close(bzf->bzf_rawfd); - free(bzf); - return(EIO); - } + /* Allocate a bz_file structure, populate it */ + bzf = malloc(sizeof (struct bz_file)); + if (bzf == NULL) + return (ENOMEM); + bzero(bzf, sizeof (struct bz_file)); + bzf->bzf_rawfd = rawfd; + + /* Verify that the file is bzipped */ + if (check_header(bzf)) { + close(bzf->bzf_rawfd); + free(bzf); + return (EFTYPE); + } - /* Looks OK, we'll take it */ - f->f_fsdata = bzf; - return(0); + /* Initialise the inflation engine */ + error = BZ2_bzDecompressInit(&(bzf->bzf_bzstream), 0, 1); + if (error != BZ_OK) { + printf("bzf_open: BZ2_bzDecompressInit returned %d\n", error); + close(bzf->bzf_rawfd); + free(bzf); + return (EIO); + } + + /* Looks OK, we'll take it */ + f->f_fsdata = bzf; + return (0); } static int bzf_close(struct open_file *f) { - struct bz_file *bzf = (struct bz_file *)f->f_fsdata; - - BZ2_bzDecompressEnd(&(bzf->bzf_bzstream)); - close(bzf->bzf_rawfd); - free(bzf); - return(0); + struct bz_file *bzf = (struct bz_file *)f->f_fsdata; + + BZ2_bzDecompressEnd(&(bzf->bzf_bzstream)); + close(bzf->bzf_rawfd); + free(bzf); + return (0); } - -static int + +static int bzf_read(struct open_file *f, void *buf, size_t size, size_t *resid) { - struct bz_file *bzf = (struct bz_file *)f->f_fsdata; - int error; - - bzf->bzf_bzstream.next_out = buf; /* where and how much */ - bzf->bzf_bzstream.avail_out = size; - - while (bzf->bzf_bzstream.avail_out && bzf->bzf_endseen == 0) { - if ((bzf->bzf_bzstream.avail_in == 0) && (bzf_fill(bzf) == -1)) { - printf("bzf_read: fill error\n"); - return(EIO); - } - if (bzf->bzf_bzstream.avail_in == 0) { /* oops, unexpected EOF */ - printf("bzf_read: unexpected EOF\n"); - if (bzf->bzf_bzstream.avail_out == size) - return(EIO); - break; + struct bz_file *bzf = (struct bz_file *)f->f_fsdata; + int error; + + bzf->bzf_bzstream.next_out = buf; /* where and how much */ + bzf->bzf_bzstream.avail_out = size; + + while (bzf->bzf_bzstream.avail_out && bzf->bzf_endseen == 0) { + if ((bzf->bzf_bzstream.avail_in == 0) && + (bzf_fill(bzf) == -1)) { + printf("bzf_read: fill error\n"); + return (EIO); + } + if (bzf->bzf_bzstream.avail_in == 0) { + /* oops, unexpected EOF */ + printf("bzf_read: unexpected EOF\n"); + if (bzf->bzf_bzstream.avail_out == size) + return (EIO); + break; + } + + /* decompression pass */ + error = BZ2_bzDecompress(&bzf->bzf_bzstream); + if (error == BZ_STREAM_END) { /* EOF, all done */ + bzf->bzf_endseen = 1; + break; + } + if (error != BZ_OK) { /* argh, decompression error */ + printf("bzf_read: BZ2_bzDecompress returned %d\n", + error); + return (EIO); + } } - - error = BZ2_bzDecompress(&bzf->bzf_bzstream); /* decompression pass */ - if (error == BZ_STREAM_END) { /* EOF, all done */ - bzf->bzf_endseen = 1; - break; - } - if (error != BZ_OK) { /* argh, decompression error */ - printf("bzf_read: BZ2_bzDecompress returned %d\n", error); - return(EIO); - } - } - if (resid != NULL) - *resid = bzf->bzf_bzstream.avail_out; - return(0); + if (resid != NULL) + *resid = bzf->bzf_bzstream.avail_out; + return (0); } static int bzf_rewind(struct open_file *f) { - struct bz_file *bzf = (struct bz_file *)f->f_fsdata; - struct bz_file *bzf_tmp; - - /* - * Since bzip2 does not have an equivalent inflateReset function a crude - * one needs to be provided. The functions all called in such a way that - * at any time an error occurs a roll back can be done (effectively making - * this rewind 'atomic', either the reset occurs successfully or not at all, - * with no 'undefined' state happening). - */ - - /* Allocate a bz_file structure, populate it */ - bzf_tmp = malloc(sizeof(struct bz_file)); - if (bzf_tmp == NULL) - return(-1); - bzero(bzf_tmp, sizeof(struct bz_file)); - bzf_tmp->bzf_rawfd = bzf->bzf_rawfd; - - /* Initialise the inflation engine */ - if (BZ2_bzDecompressInit(&(bzf_tmp->bzf_bzstream), 0, 1) != BZ_OK) { - free(bzf_tmp); - return(-1); - } - - /* Seek back to the beginning of the file */ - if (lseek(bzf->bzf_rawfd, 0, SEEK_SET) == -1) { - BZ2_bzDecompressEnd(&(bzf_tmp->bzf_bzstream)); - free(bzf_tmp); - return(-1); - } - - /* Free old bz_file data */ - BZ2_bzDecompressEnd(&(bzf->bzf_bzstream)); - free(bzf); - - /* Use the new bz_file data */ - f->f_fsdata = bzf_tmp; - - return(0); + struct bz_file *bzf = (struct bz_file *)f->f_fsdata; + struct bz_file *bzf_tmp; + + /* + * Since bzip2 does not have an equivalent inflateReset function a crude + * one needs to be provided. The functions all called in such a way that + * at any time an error occurs a roll back can be done (effectively + * making this rewind 'atomic', either the reset occurs successfully + * or not at all, with no 'undefined' state happening). + */ + + /* Allocate a bz_file structure, populate it */ + bzf_tmp = malloc(sizeof (struct bz_file)); + if (bzf_tmp == NULL) + return (-1); + bzero(bzf_tmp, sizeof (struct bz_file)); + bzf_tmp->bzf_rawfd = bzf->bzf_rawfd; + + /* Initialise the inflation engine */ + if (BZ2_bzDecompressInit(&(bzf_tmp->bzf_bzstream), 0, 1) != BZ_OK) { + free(bzf_tmp); + return (-1); + } + + /* Seek back to the beginning of the file */ + if (lseek(bzf->bzf_rawfd, 0, SEEK_SET) == -1) { + BZ2_bzDecompressEnd(&(bzf_tmp->bzf_bzstream)); + free(bzf_tmp); + return (-1); + } + + /* Free old bz_file data */ + BZ2_bzDecompressEnd(&(bzf->bzf_bzstream)); + free(bzf); + + /* Use the new bz_file data */ + f->f_fsdata = bzf_tmp; + + return (0); } static off_t bzf_seek(struct open_file *f, off_t offset, int where) { - struct bz_file *bzf = (struct bz_file *)f->f_fsdata; - off_t target; - char discard[16]; - - switch (where) { - case SEEK_SET: - target = offset; - break; - case SEEK_CUR: - target = offset + bzf->bzf_bzstream.total_out_lo32; - break; - default: - errno = EINVAL; - return(-1); - } - - /* Can we get there from here? */ - if (target < bzf->bzf_bzstream.total_out_lo32 && bzf_rewind(f) != 0) { - errno = EOFFSET; - return -1; - } - - /* if bzf_rewind was called then bzf has changed */ - bzf = (struct bz_file *)f->f_fsdata; - - /* skip forwards if required */ - while (target > bzf->bzf_bzstream.total_out_lo32) { - errno = bzf_read(f, discard, min(sizeof(discard), - target - bzf->bzf_bzstream.total_out_lo32), NULL); - if (errno) - return(-1); - } - /* This is where we are (be honest if we overshot) */ - return(bzf->bzf_bzstream.total_out_lo32); + struct bz_file *bzf = (struct bz_file *)f->f_fsdata; + off_t target; + char discard[16]; + + switch (where) { + case SEEK_SET: + target = offset; + break; + case SEEK_CUR: + target = offset + bzf->bzf_bzstream.total_out_lo32; + break; + default: + errno = EINVAL; + return (-1); + } + + /* Can we get there from here? */ + if (target < bzf->bzf_bzstream.total_out_lo32 && bzf_rewind(f) != 0) { + errno = EOFFSET; + return (-1); + } + + /* if bzf_rewind was called then bzf has changed */ + bzf = (struct bz_file *)f->f_fsdata; + + /* skip forwards if required */ + while (target > bzf->bzf_bzstream.total_out_lo32) { + errno = bzf_read(f, discard, min(sizeof (discard), + target - bzf->bzf_bzstream.total_out_lo32), NULL); + if (errno) + return (-1); + } + /* This is where we are (be honest if we overshot) */ + return (bzf->bzf_bzstream.total_out_lo32); } static int bzf_stat(struct open_file *f, struct stat *sb) { - struct bz_file *bzf = (struct bz_file *)f->f_fsdata; - int result; + struct bz_file *bzf = (struct bz_file *)f->f_fsdata; + int result; - /* stat as normal, but indicate that size is unknown */ - if ((result = fstat(bzf->bzf_rawfd, sb)) == 0) - sb->st_size = -1; - return(result); + /* stat as normal, but indicate that size is unknown */ + if ((result = fstat(bzf->bzf_rawfd, sb)) == 0) + sb->st_size = -1; + return (result); } void bz_internal_error(int errorcode) { - panic("bzipfs: critical error %d in bzip2 library occured\n", errorcode); + panic("bzipfs: critical error %d in bzip2 library occured\n", + errorcode); } #ifdef REGRESSION /* Small test case, open and decompress test.bz2 */ -int main() +int +main() { - struct open_file f; - char buf[1024]; - size_t resid; - int err; - - memset(&f, '\0', sizeof(f)); - f.f_flags = F_READ; - err = bzf_open("test", &f); - if (err != 0) - exit(1); - do { - err = bzf_read(&f, buf, sizeof(buf), &resid); - } while (err == 0 && resid != sizeof(buf)); - - if (err != 0) - exit(2); - exit(0); + struct open_file f; + char buf[1024]; + size_t resid; + int err; + + memset(&f, '\0', sizeof (f)); + f.f_flags = F_READ; + err = bzf_open("test", &f); + if (err != 0) + exit(1); + do { + err = bzf_read(&f, buf, sizeof (buf), &resid); + } while (err == 0 && resid != sizeof (buf)); + + if (err != 0) + exit(2); + exit(0); } #endif diff --git a/usr/src/boot/sys/boot/common/interp_forth.c b/usr/src/boot/sys/boot/common/interp_forth.c index b3eebaede4..280bbee732 100644 --- a/usr/src/boot/sys/boot/common/interp_forth.c +++ b/usr/src/boot/sys/boot/common/interp_forth.c @@ -37,9 +37,9 @@ extern unsigned bootprog_rev; /* #define BFORTH_DEBUG */ #ifdef BFORTH_DEBUG -# define DEBUG(fmt, args...) printf("%s: " fmt "\n" , __func__ , ## args) +#define DEBUG(fmt, args...) printf("%s: " fmt "\n", __func__, ## args) #else -# define DEBUG(fmt, args...) +#define DEBUG(fmt, args...) #endif /* @@ -47,7 +47,7 @@ extern unsigned bootprog_rev; * elsewhere, possibly bootstrap.h. For now, just this code, used * just in this file, it is getting defined. */ -#define BF_PARSE 100 +#define BF_PARSE 100 /* * FreeBSD loader default dictionary cells @@ -71,94 +71,100 @@ ficlVm *bf_vm; static void bf_command(ficlVm *vm) { - char *name, *line, *tail, *cp; - size_t len; - struct bootblk_command **cmdp; - bootblk_cmd_t *cmd; - int nstrings, i; - int argc, result; - char **argv; - - /* Get the name of the current word */ - name = vm->runningWord->name; - - /* Find our command structure */ - cmd = NULL; - SET_FOREACH(cmdp, Xcommand_set) { - if (((*cmdp)->c_name != NULL) && !strcmp(name, (*cmdp)->c_name)) - cmd = (*cmdp)->c_fn; - } - if (cmd == NULL) - panic("callout for unknown command '%s'", name); - - /* Check whether we have been compiled or are being interpreted */ - if (ficlStackPopInteger(ficlVmGetDataStack(vm))) { + char *name, *line, *tail, *cp; + size_t len; + struct bootblk_command **cmdp; + bootblk_cmd_t *cmd; + int nstrings, i; + int argc, result; + char **argv; + + /* Get the name of the current word */ + name = vm->runningWord->name; + + /* Find our command structure */ + cmd = NULL; + SET_FOREACH(cmdp, Xcommand_set) { + if (((*cmdp)->c_name != NULL) && + strcmp(name, (*cmdp)->c_name) == 0) + cmd = (*cmdp)->c_fn; + } + if (cmd == NULL) + panic("callout for unknown command '%s'", name); + + /* Check whether we have been compiled or are being interpreted */ + if (ficlStackPopInteger(ficlVmGetDataStack(vm))) { + /* + * Get parameters from stack, in the format: + * an un ... a2 u2 a1 u1 n -- + * Where n is the number of strings, a/u are pairs of + * address/size for strings, and they will be concatenated + * in LIFO order. + */ + nstrings = ficlStackPopInteger(ficlVmGetDataStack(vm)); + for (i = 0, len = 0; i < nstrings; i++) { + ficlStack *stack = ficlVmGetDataStack(vm); + len += ficlStackFetch(stack, i * 2).i + 1; + } + line = malloc(strlen(name) + len + 1); + strcpy(line, name); + + if (nstrings) + for (i = 0; i < nstrings; i++) { + ficlStack *stack = ficlVmGetDataStack(vm); + + len = ficlStackPopInteger(stack); + cp = ficlStackPopPointer(stack); + strcat(line, " "); + strncat(line, cp, len); + } + } else { + /* Get remainder of invocation */ + tail = ficlVmGetInBuf(vm); + + len = 0; + cp = tail; + for (; cp != vm->tib.end && *cp != 0 && *cp != '\n'; cp++) + len++; + + line = malloc(strlen(name) + len + 2); + strcpy(line, name); + if (len > 0) { + strcat(line, " "); + strncat(line, tail, len); + ficlVmUpdateTib(vm, tail + len); + } + } + DEBUG("cmd '%s'", line); + + command_errmsg = command_errbuf; + command_errbuf[0] = 0; + if (!parse(&argc, &argv, line)) { + result = (cmd)(argc, argv); + free(argv); + } else { + result = BF_PARSE; + } + + switch (result) { + case CMD_CRIT: + printf("%s\n", command_errmsg); + command_errmsg = NULL; + break; + case CMD_FATAL: + panic("%s\n", command_errmsg); + } + + free(line); /* - * Get parameters from stack, in the format: - * an un ... a2 u2 a1 u1 n -- - * Where n is the number of strings, a/u are pairs of - * address/size for strings, and they will be concatenated - * in LIFO order. + * If there was error during nested ficlExec(), we may no longer have + * valid environment to return. Throw all exceptions from here. */ - nstrings = ficlStackPopInteger(ficlVmGetDataStack(vm)); - for (i = 0, len = 0; i < nstrings; i++) - len += ficlStackFetch(ficlVmGetDataStack(vm), i * 2).i + 1; - line = malloc(strlen(name) + len + 1); - strcpy(line, name); - - if (nstrings) - for (i = 0; i < nstrings; i++) { - len = ficlStackPopInteger(ficlVmGetDataStack(vm)); - cp = ficlStackPopPointer(ficlVmGetDataStack(vm)); - strcat(line, " "); - strncat(line, cp, len); - } - } else { - /* Get remainder of invocation */ - tail = ficlVmGetInBuf(vm); - - len = 0; - for (cp = tail; cp != vm->tib.end && *cp != 0 && *cp != '\n'; cp++) - len++; - - line = malloc(strlen(name) + len + 2); - strcpy(line, name); - if (len > 0) { - strcat(line, " "); - strncat(line, tail, len); - ficlVmUpdateTib(vm, tail + len); - } - } - DEBUG("cmd '%s'", line); - - command_errmsg = command_errbuf; - command_errbuf[0] = 0; - if (!parse(&argc, &argv, line)) { - result = (cmd)(argc, argv); - free(argv); - } else { - result = BF_PARSE; - } - - switch (result) { - case CMD_CRIT: - printf("%s\n", command_errmsg); - command_errmsg = NULL; - break; - case CMD_FATAL: - panic("%s\n", command_errmsg); - } - - free(line); - /* - * If there was error during nested ficlExec(), we may no longer have - * valid environment to return. Throw all exceptions from here. - */ - if (result != CMD_OK) - ficlVmThrow(vm, result); - - /* This is going to be thrown!!! */ - ficlStackPushInteger(ficlVmGetDataStack(vm),result); + if (result != CMD_OK) + ficlVmThrow(vm, result); + + /* This is going to be thrown!!! */ + ficlStackPushInteger(ficlVmGetDataStack(vm), result); } /* @@ -229,25 +235,25 @@ bf_command(ficlVm *vm) * (if you edit this definition, pay attention to trailing spaces after * each word -- I warned you! :-) ) */ -#define BUILTIN_CONSTRUCTOR \ +#define BUILTIN_CONSTRUCTOR \ ": builtin: " \ - ">in @ " /* save the tib index pointer */ \ - "' " /* get next word's xt */ \ - "swap >in ! " /* point again to next word */ \ - "create " /* create a new definition of the next word */ \ - ", " /* save previous definition's xt */ \ - "immediate " /* make the new definition an immediate word */ \ + ">in @ " /* save the tib index pointer */ \ + "' " /* get next word's xt */ \ + "swap >in ! " /* point again to next word */ \ + "create " /* create a new definition of the next word */ \ + ", " /* save previous definition's xt */ \ + "immediate " /* make the new definition an immediate word */ \ \ - "does> " /* Now, the *new* definition will: */ \ - "state @ if " /* if in compiling state: */ \ - "1 postpone literal " /* pass 1 flag to indicate compile */ \ - "@ compile, " /* compile in previous definition */ \ - "postpone throw " /* throw stack-returned result */ \ - "else " /* if in interpreting state: */ \ - "0 swap " /* pass 0 flag to indicate interpret */ \ - "@ execute " /* call previous definition */ \ - "throw " /* throw stack-returned result */ \ - "then ; " + "does> " /* Now, the *new* definition will: */ \ + "state @ if " /* if in compiling state: */ \ + "1 postpone literal " /* pass 1 flag to indicate compile */ \ + "@ compile, " /* compile in previous definition */ \ + "postpone throw " /* throw stack-returned result */ \ + "else " /* if in interpreting state: */ \ + "0 swap " /* pass 0 flag to indicate interpret */ \ + "@ execute " /* call previous definition */ \ + "throw " /* throw stack-returned result */ \ + "then ; " /* * Initialise the Forth interpreter, create all our commands as words. @@ -255,72 +261,73 @@ bf_command(ficlVm *vm) void bf_init(char *rc) { - struct bootblk_command **cmdp; - char create_buf[41]; /* 31 characters-long builtins */ - int fd, rv; - ficlDictionary *dict; - ficlDictionary *env; - - fsi = malloc(sizeof(ficlSystemInformation)); - ficlSystemInformationInitialize(fsi); - fsi->dictionarySize = BF_DICTSIZE; - - bf_sys = ficlSystemCreate(fsi); - bf_vm = ficlSystemCreateVm(bf_sys); - - /* Put all private definitions in a "builtins" vocabulary */ - rv = ficlVmEvaluate(bf_vm, "vocabulary builtins also builtins definitions"); - if (rv != FICL_VM_STATUS_OUT_OF_TEXT) { - panic("error interpreting forth: %d\n", rv); - } - - /* Builtin constructor word */ - rv = ficlVmEvaluate(bf_vm, BUILTIN_CONSTRUCTOR); - if (rv != FICL_VM_STATUS_OUT_OF_TEXT) { - panic("error interpreting forth: %d\n", rv); - } - - /* make all commands appear as Forth words */ - dict = ficlSystemGetDictionary(bf_sys); - SET_FOREACH(cmdp, Xcommand_set) { - ficlDictionaryAppendPrimitive(dict, (char *)(*cmdp)->c_name, - bf_command, FICL_WORD_DEFAULT); - rv = ficlVmEvaluate(bf_vm, "forth definitions builtins"); + struct bootblk_command **cmdp; + char create_buf[41]; /* 31 characters-long builtins */ + int fd, rv; + ficlDictionary *dict; + ficlDictionary *env; + + fsi = malloc(sizeof (ficlSystemInformation)); + ficlSystemInformationInitialize(fsi); + fsi->dictionarySize = BF_DICTSIZE; + + bf_sys = ficlSystemCreate(fsi); + bf_vm = ficlSystemCreateVm(bf_sys); + + /* Put all private definitions in a "builtins" vocabulary */ + rv = ficlVmEvaluate(bf_vm, + "vocabulary builtins also builtins definitions"); if (rv != FICL_VM_STATUS_OUT_OF_TEXT) { panic("error interpreting forth: %d\n", rv); } - sprintf(create_buf, "builtin: %s", (*cmdp)->c_name); - rv = ficlVmEvaluate(bf_vm, create_buf); + + /* Builtin constructor word */ + rv = ficlVmEvaluate(bf_vm, BUILTIN_CONSTRUCTOR); if (rv != FICL_VM_STATUS_OUT_OF_TEXT) { panic("error interpreting forth: %d\n", rv); } - rv = ficlVmEvaluate(bf_vm, "builtins definitions"); + + /* make all commands appear as Forth words */ + dict = ficlSystemGetDictionary(bf_sys); + SET_FOREACH(cmdp, Xcommand_set) { + ficlDictionaryAppendPrimitive(dict, (char *)(*cmdp)->c_name, + bf_command, FICL_WORD_DEFAULT); + rv = ficlVmEvaluate(bf_vm, "forth definitions builtins"); + if (rv != FICL_VM_STATUS_OUT_OF_TEXT) { + panic("error interpreting forth: %d\n", rv); + } + sprintf(create_buf, "builtin: %s", (*cmdp)->c_name); + rv = ficlVmEvaluate(bf_vm, create_buf); + if (rv != FICL_VM_STATUS_OUT_OF_TEXT) { + panic("error interpreting forth: %d\n", rv); + } + rv = ficlVmEvaluate(bf_vm, "builtins definitions"); + if (rv != FICL_VM_STATUS_OUT_OF_TEXT) { + panic("error interpreting forth: %d\n", rv); + } + } + rv = ficlVmEvaluate(bf_vm, "only forth definitions"); if (rv != FICL_VM_STATUS_OUT_OF_TEXT) { panic("error interpreting forth: %d\n", rv); } - } - rv = ficlVmEvaluate(bf_vm, "only forth definitions"); - if (rv != FICL_VM_STATUS_OUT_OF_TEXT) { - panic("error interpreting forth: %d\n", rv); - } - - /* - * Export some version numbers so that code can detect the loader/host - * version - */ - env = ficlSystemGetEnvironment(bf_sys); - ficlDictionarySetConstant(env, "loader_version", bootprog_rev); - - /* try to load and run init file if present */ - if (rc == NULL) - rc = "/boot/forth/boot.4th"; - if (*rc != '\0') { - fd = open(rc, O_RDONLY); - if (fd != -1) { - (void)ficlExecFD(bf_vm, fd); - close(fd); + + /* + * Export some version numbers so that code can detect the loader/host + * version + */ + env = ficlSystemGetEnvironment(bf_sys); + ficlDictionarySetConstant(env, "loader_version", bootprog_rev); + + /* try to load and run init file if present */ + if (rc == NULL) + rc = "/boot/forth/boot.4th"; + if (*rc != '\0') { + fd = open(rc, O_RDONLY); + if (fd != -1) { + (void) ficlExecFD(bf_vm, fd); + close(fd); + } } - } } /* @@ -329,39 +336,39 @@ bf_init(char *rc) int bf_run(char *line) { - int result; - ficlString s; - - FICL_STRING_SET_FROM_CSTRING(s, line); - result = ficlVmExecuteString(bf_vm, s); - - DEBUG("ficlExec '%s' = %d", line, result); - switch (result) { - case FICL_VM_STATUS_OUT_OF_TEXT: - case FICL_VM_STATUS_ABORTQ: - case FICL_VM_STATUS_QUIT: - case FICL_VM_STATUS_ERROR_EXIT: - break; - case FICL_VM_STATUS_USER_EXIT: - printf("No where to leave to!\n"); - break; - case FICL_VM_STATUS_ABORT: - printf("Aborted!\n"); - break; - case BF_PARSE: - printf("Parse error!\n"); - break; - default: - if (command_errmsg != NULL) { - printf("%s\n", command_errmsg); - command_errmsg = NULL; + int result; + ficlString s; + + FICL_STRING_SET_FROM_CSTRING(s, line); + result = ficlVmExecuteString(bf_vm, s); + + DEBUG("ficlExec '%s' = %d", line, result); + switch (result) { + case FICL_VM_STATUS_OUT_OF_TEXT: + case FICL_VM_STATUS_ABORTQ: + case FICL_VM_STATUS_QUIT: + case FICL_VM_STATUS_ERROR_EXIT: + break; + case FICL_VM_STATUS_USER_EXIT: + printf("No where to leave to!\n"); + break; + case FICL_VM_STATUS_ABORT: + printf("Aborted!\n"); + break; + case BF_PARSE: + printf("Parse error!\n"); + break; + default: + if (command_errmsg != NULL) { + printf("%s\n", command_errmsg); + command_errmsg = NULL; + } } - } - /* bye is same as reboot and will behave depending on platform */ - if (result == FICL_VM_STATUS_USER_EXIT) - bf_run("reboot"); - setenv("interpret", bf_vm->state ? "" : "ok", 1); + /* bye is same as reboot and will behave depending on platform */ + if (result == FICL_VM_STATUS_USER_EXIT) + bf_run("reboot"); + setenv("interpret", bf_vm->state ? "" : "ok", 1); - return (result); + return (result); } diff --git a/usr/src/boot/sys/boot/common/multiboot2.c b/usr/src/boot/sys/boot/common/multiboot2.c index 5b2cb9d397..aadf39a850 100644 --- a/usr/src/boot/sys/boot/common/multiboot2.c +++ b/usr/src/boot/sys/boot/common/multiboot2.c @@ -57,7 +57,7 @@ static void (*trampoline)(uint32_t, struct relocator *, uint64_t); #include "platform/acfreebsd.h" #include "acconfig.h" -#define ACPI_SYSTEM_XFACE +#define ACPI_SYSTEM_XFACE #include "actypes.h" #include "actbl.h" @@ -66,7 +66,7 @@ extern ACPI_TABLE_RSDP *rsdp; /* MB data heap pointer. */ static vm_offset_t last_addr; -static int multiboot2_loadfile(char *, u_int64_t, struct preloaded_file **); +static int multiboot2_loadfile(char *, uint64_t, struct preloaded_file **); static int multiboot2_exec(struct preloaded_file *); struct file_format multiboot2 = { multiboot2_loadfile, multiboot2_exec }; @@ -126,7 +126,7 @@ is_info_request_valid(multiboot_header_tag_information_request_t *rtag) } static int -multiboot2_loadfile(char *filename, u_int64_t dest, +multiboot2_loadfile(char *filename, uint64_t dest, struct preloaded_file **result) { int fd, error; @@ -539,12 +539,12 @@ update_cmdline(char *cl, bool mb2) } tmp = insert_cmdline(cl, propstr); - free(propstr); - if (tmp == NULL) + free(propstr); + if (tmp == NULL) return (cl); - free(cl); - cl = tmp; + free(cl); + cl = tmp; } if (ttymode != NULL) { char *propstr; @@ -554,11 +554,11 @@ update_cmdline(char *cl, bool mb2) return (cl); tmp = insert_cmdline(cl, propstr); - free(propstr); - if (tmp == NULL) + free(propstr); + if (tmp == NULL) return (cl); - free(cl); - cl = tmp; + free(cl); + cl = tmp; } return (cl); @@ -676,7 +676,7 @@ module_size(struct preloaded_file *fp) return (size); } -#if defined (EFI) +#if defined(EFI) /* * Calculate size for UEFI memory map tag. */ @@ -725,7 +725,7 @@ biossmap_size(struct preloaded_file *fp) if (md == NULL) return (0); - num = md->md_size / sizeof(struct bios_smap); /* number of entries */ + num = md->md_size / sizeof (struct bios_smap); /* number of entries */ return (sizeof (multiboot_tag_mmap_t) + num * sizeof (multiboot_mmap_entry_t)); } @@ -734,7 +734,7 @@ static size_t mbi_size(struct preloaded_file *fp, char *cmdline) { size_t size; -#if !defined (EFI) +#if !defined(EFI) extern multiboot_tag_framebuffer_t gfx_fb; #endif @@ -743,13 +743,13 @@ mbi_size(struct preloaded_file *fp, char *cmdline) size = roundup2(size, MULTIBOOT_TAG_ALIGN); size += sizeof (multiboot_tag_string_t) + strlen(bootprog_info) + 1; size = roundup2(size, MULTIBOOT_TAG_ALIGN); -#if !defined (EFI) +#if !defined(EFI) size += sizeof (multiboot_tag_basic_meminfo_t); size = roundup2(size, MULTIBOOT_TAG_ALIGN); #endif size += module_size(fp); size = roundup2(size, MULTIBOOT_TAG_ALIGN); -#if defined (EFI) +#if defined(EFI) size += sizeof (multiboot_tag_efi64_t); size = roundup2(size, MULTIBOOT_TAG_ALIGN); size += efimemmap_size(); @@ -764,7 +764,7 @@ mbi_size(struct preloaded_file *fp, char *cmdline) size += biossmap_size(fp); size = roundup2(size, MULTIBOOT_TAG_ALIGN); -#if !defined (EFI) +#if !defined(EFI) if (gfx_fb.framebuffer_common.framebuffer_type == MULTIBOOT_FRAMEBUFFER_TYPE_INDEXED) { size += sizeof (struct multiboot_tag_framebuffer_common); @@ -780,21 +780,21 @@ mbi_size(struct preloaded_file *fp, char *cmdline) #endif if (bootp_response != NULL) { - size += sizeof(multiboot_tag_network_t) + bootp_response_size; + size += sizeof (multiboot_tag_network_t) + bootp_response_size; size = roundup2(size, MULTIBOOT_TAG_ALIGN); } if (rsdp != NULL) { if (rsdp->Revision == 0) { size += sizeof (multiboot_tag_old_acpi_t) + - sizeof(ACPI_RSDP_COMMON); + sizeof (ACPI_RSDP_COMMON); } else { size += sizeof (multiboot_tag_new_acpi_t) + rsdp->Length; } size = roundup2(size, MULTIBOOT_TAG_ALIGN); } - size += sizeof(multiboot_tag_t); + size += sizeof (multiboot_tag_t); return (size); } @@ -811,7 +811,7 @@ multiboot2_exec(struct preloaded_file *fp) int rootfs = 0; size_t size; struct bios_smap *smap; -#if defined (EFI) +#if defined(EFI) multiboot_tag_module_t *module, *mp; EFI_MEMORY_DESCRIPTOR *map; UINTN map_size, desc_size; @@ -870,7 +870,7 @@ multiboot2_exec(struct preloaded_file *fp) for (mfp = fp; mfp->f_next != NULL; mfp = mfp->f_next) i++; -#if defined (EFI) +#if defined(EFI) /* We need space for kernel + MBI + # modules */ num = (EFI_PAGE_SIZE - offsetof(struct relocator, rel_chunklist)) / sizeof (struct chunk); @@ -904,7 +904,7 @@ multiboot2_exec(struct preloaded_file *fp) { multiboot_tag_string_t *tag; i = sizeof (multiboot_tag_string_t) + strlen(cmdline) + 1; - tag = (multiboot_tag_string_t *) mb_malloc(i); + tag = (multiboot_tag_string_t *)mb_malloc(i); tag->mb_type = MULTIBOOT_TAG_TYPE_CMDLINE; tag->mb_size = i; @@ -916,7 +916,7 @@ multiboot2_exec(struct preloaded_file *fp) { multiboot_tag_string_t *tag; i = sizeof (multiboot_tag_string_t) + strlen(bootprog_info) + 1; - tag = (multiboot_tag_string_t *) mb_malloc(i); + tag = (multiboot_tag_string_t *)mb_malloc(i); tag->mb_type = MULTIBOOT_TAG_TYPE_BOOT_LOADER_NAME; tag->mb_size = i; @@ -924,7 +924,7 @@ multiboot2_exec(struct preloaded_file *fp) strlen(bootprog_info) + 1); } -#if !defined (EFI) +#if !defined(EFI) /* Only set in case of BIOS. */ { multiboot_tag_basic_meminfo_t *tag; @@ -960,7 +960,7 @@ multiboot2_exec(struct preloaded_file *fp) * - Set the tmp to point to physical address of the first module. * - tmp != mfp->f_addr only in case of EFI. */ -#if defined (EFI) +#if defined(EFI) tmp = roundup2(load_addr + fp->f_size + 1, MULTIBOOT_MOD_ALIGN); module = (multiboot_tag_module_t *)last_addr; #endif @@ -990,7 +990,7 @@ multiboot2_exec(struct preloaded_file *fp) tag->mb_type = MULTIBOOT_TAG_TYPE_MODULE; tag->mb_size = sizeof (*tag) + num; -#if defined (EFI) +#if defined(EFI) /* * We can assign module addresses only after BS have been * switched off. @@ -1014,7 +1014,7 @@ multiboot2_exec(struct preloaded_file *fp) } smap = (struct bios_smap *)md->md_data; - num = md->md_size / sizeof(struct bios_smap); /* number of entries */ + num = md->md_size / sizeof (struct bios_smap); /* number of entries */ { multiboot_tag_mmap_t *tag; @@ -1042,24 +1042,22 @@ multiboot2_exec(struct preloaded_file *fp) if (bootp_response != NULL) { multiboot_tag_network_t *tag; tag = (multiboot_tag_network_t *) - mb_malloc(sizeof(*tag) + bootp_response_size); + mb_malloc(sizeof (*tag) + bootp_response_size); tag->mb_type = MULTIBOOT_TAG_TYPE_NETWORK; - tag->mb_size = sizeof(*tag) + bootp_response_size; + tag->mb_size = sizeof (*tag) + bootp_response_size; memcpy(tag->mb_dhcpack, bootp_response, bootp_response_size); } -#if !defined (EFI) - { - multiboot_tag_vbe_t *tag; - extern multiboot_tag_vbe_t vbestate; - - if (VBE_VALID_MODE(vbestate.vbe_mode)) { - tag = (multiboot_tag_vbe_t *)mb_malloc(sizeof(*tag)); - memcpy(tag, &vbestate, sizeof(*tag)); - tag->mb_type = MULTIBOOT_TAG_TYPE_VBE; - tag->mb_size = sizeof(*tag); - } +#if !defined(EFI) + multiboot_tag_vbe_t *tag; + extern multiboot_tag_vbe_t vbestate; + + if (VBE_VALID_MODE(vbestate.vbe_mode)) { + tag = (multiboot_tag_vbe_t *)mb_malloc(sizeof (*tag)); + memcpy(tag, &vbestate, sizeof (*tag)); + tag->mb_type = MULTIBOOT_TAG_TYPE_VBE; + tag->mb_size = sizeof (*tag); } #endif @@ -1083,7 +1081,7 @@ multiboot2_exec(struct preloaded_file *fp) } } -#if defined (EFI) +#if defined(EFI) #ifdef __LP64__ { multiboot_tag_efi64_t *tag; @@ -1110,9 +1108,9 @@ multiboot2_exec(struct preloaded_file *fp) if (have_framebuffer == true) { multiboot_tag_framebuffer_t *tag; extern multiboot_tag_framebuffer_t gfx_fb; -#if defined (EFI) +#if defined(EFI) - tag = (multiboot_tag_framebuffer_t *) mb_malloc(sizeof (*tag)); + tag = (multiboot_tag_framebuffer_t *)mb_malloc(sizeof (*tag)); memcpy(tag, &gfx_fb, sizeof (*tag)); tag->framebuffer_common.mb_type = MULTIBOOT_TAG_TYPE_FRAMEBUFFER; @@ -1132,7 +1130,7 @@ multiboot2_exec(struct preloaded_file *fp) size = sizeof (gfx_fb); } - tag = (multiboot_tag_framebuffer_t *) mb_malloc(size); + tag = (multiboot_tag_framebuffer_t *)mb_malloc(size); memcpy(tag, &gfx_fb, sizeof (*tag)); tag->framebuffer_common.mb_type = @@ -1148,7 +1146,7 @@ multiboot2_exec(struct preloaded_file *fp) #endif /* EFI */ } -#if defined (EFI) +#if defined(EFI) /* Leave EFI memmap last as we will also switch off the BS. */ { multiboot_tag_efi_mmap_t *tag; @@ -1175,7 +1173,7 @@ multiboot2_exec(struct preloaded_file *fp) } tag->mb_type = MULTIBOOT_TAG_TYPE_EFI_MMAP; tag->mb_size = sizeof (*tag) + map_size; - tag->mb_descr_size = (uint32_t) desc_size; + tag->mb_descr_size = (uint32_t)desc_size; /* * Find relocater pages. We assume we have free pages @@ -1216,16 +1214,17 @@ multiboot2_exec(struct preloaded_file *fp) */ { multiboot_tag_t *tag = (multiboot_tag_t *) - mb_malloc(sizeof(*tag)); + mb_malloc(sizeof (*tag)); tag->mb_type = MULTIBOOT_TAG_TYPE_END; - tag->mb_size = sizeof(*tag); + tag->mb_size = sizeof (*tag); } mbi->mbi_total_size = last_addr - (vm_offset_t)mbi; mbi->mbi_reserved = 0; -#if defined (EFI) - /* At this point we have load_addr pointing to kernel load +#if defined(EFI) + /* + * At this point we have load_addr pointing to kernel load * address, module list in MBI having physical addresses, * module list in fp having logical addresses and tmp pointing to * physical address for MBI. @@ -1268,7 +1267,7 @@ multiboot2_exec(struct preloaded_file *fp) chunk = &relocator->rel_chunklist[i++]; chunk->chunk_vaddr = (EFI_VIRTUAL_ADDRESS)(uintptr_t)mbi; chunk->chunk_paddr = efi_physaddr(module, tmp, map, - map_size / desc_size, desc_size, mbi->mbi_total_size); + map_size / desc_size, desc_size, mbi->mbi_total_size); chunk->chunk_size = mbi->mbi_total_size; STAILQ_INSERT_TAIL(head, chunk, chunk_next); @@ -1293,7 +1292,7 @@ multiboot2_exec(struct preloaded_file *fp) error: if (cmdline != NULL) free(cmdline); -#if defined (EFI) +#if defined(EFI) if (mbi != NULL) efi_free_loadaddr((vm_offset_t)mbi, EFI_SIZE_TO_PAGES(size)); #endif diff --git a/usr/src/boot/sys/boot/uboot/lib/copy.c b/usr/src/boot/sys/boot/uboot/lib/copy.c index 131b88d858..4cd17f62f3 100644 --- a/usr/src/boot/sys/boot/uboot/lib/copy.c +++ b/usr/src/boot/sys/boot/uboot/lib/copy.c @@ -1,6 +1,6 @@ -/*- +/* * Copyright (c) 1998 Michael Smith <msmith@freebsd.org> - * Copyright (c) 2007 Semihalf, Rafal Jaworowski <raj@semihalf.com> + * Copyright (c) 2007 Semihalf, Rafal Jaworowski <raj@semihalf.com> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -26,7 +26,6 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); #include <sys/param.h> #include <stand.h> @@ -37,7 +36,7 @@ __FBSDID("$FreeBSD$"); #include "libuboot.h" /* - * MD primitives supporting placement of module data + * MD primitives supporting placement of module data */ #ifdef __arm__ @@ -66,7 +65,7 @@ extern void _start(void); /* ubldr entry point address. */ * that each object begins on a page boundary. */ uint64_t -uboot_loadaddr(u_int type, void *data, uint64_t addr) +uboot_loadaddr(uint_t type, void *data, uint64_t addr) { struct sys_info *si; uint64_t sblock, eblock, subldr, eubldr; @@ -121,7 +120,8 @@ uboot_loadaddr(u_int type, void *data, uint64_t addr) } } else if (subldr < sblock && eubldr < eblock) { /* Loader is below or engulfs the sblock */ - this_block = (eubldr < sblock) ? sblock : eubldr; + this_block = (eubldr < sblock) ? + sblock : eubldr; this_size = eblock - this_block; } else { this_block = 0; @@ -136,13 +136,13 @@ uboot_loadaddr(u_int type, void *data, uint64_t addr) panic("Not enough DRAM to load kernel\n"); #if 0 printf("Loading kernel into region 0x%08jx-0x%08jx (%ju MiB)\n", - (uintmax_t)biggest_block, + (uintmax_t)biggest_block, (uintmax_t)biggest_block + biggest_size - 1, (uintmax_t)biggest_size / 1024 / 1024); #endif return (biggest_block); } - return roundup2(addr, PAGE_SIZE); + return (roundup2(addr, PAGE_SIZE)); } ssize_t diff --git a/usr/src/boot/sys/boot/uboot/lib/net.c b/usr/src/boot/sys/boot/uboot/lib/net.c index 1f15f3ce0e..667db42f7c 100644 --- a/usr/src/boot/sys/boot/uboot/lib/net.c +++ b/usr/src/boot/sys/boot/uboot/lib/net.c @@ -1,4 +1,4 @@ -/*- +/* * Copyright (c) 2000-2001 Benno Rice * Copyright (c) 2007 Semihalf, Rafal Jaworowski <raj@semihalf.com> * All rights reserved. @@ -118,7 +118,7 @@ get_env_net_params() */ if ((envstr = ub_env_get("rootpath")) == NULL) return; - strlcpy(rootpath, envstr, sizeof(rootpath)); + strlcpy(rootpath, envstr, sizeof (rootpath)); setenv("dhcp.root-path", rootpath, 0); /* @@ -155,7 +155,7 @@ get_env_net_params() */ serveraddr = INADDR_NONE; if ((envstr = ub_env_get("serverip")) != NULL) { - if ((serveraddr = inet_addr(envstr)) == INADDR_NONE) + if ((serveraddr = inet_addr(envstr)) == INADDR_NONE) printf("Could not parse serverip '%s'\n", envstr); } @@ -329,7 +329,7 @@ net_init(struct iodesc *desc, void *machdep_hint) /* Get MAC address */ di = ub_dev_get(sc->sc_handle); memcpy(desc->myea, di->di_net.hwaddr, 6); - if (memcmp (desc->myea, "\0\0\0\0\0\0", 6) == 0) { + if (memcmp(desc->myea, "\0\0\0\0\0\0", 6) == 0) { panic("%s%d: empty ethernet address!", nif->nif_driver->netif_bname, nif->nif_unit); } diff --git a/usr/src/test/zfs-tests/runfiles/omnios.run b/usr/src/test/zfs-tests/runfiles/omnios.run index a8bad95433..67e8792c8a 100644 --- a/usr/src/test/zfs-tests/runfiles/omnios.run +++ b/usr/src/test/zfs-tests/runfiles/omnios.run @@ -13,6 +13,7 @@ # Copyright (c) 2013, 2017 by Delphix. All rights reserved. # Copyright 2016, OmniTI Computer Consulting, Inc. All rights reserved. # Copyright 2018 Joyent, Inc. +# Copyright 2019 RackTop Systems. # [DEFAULT] @@ -456,8 +457,6 @@ tests = ['checkpoint_after_rewind', 'checkpoint_big_rewind', 'checkpoint_open', 'checkpoint_removal', 'checkpoint_rewind', 'checkpoint_ro_rewind', 'checkpoint_sm_scale', 'checkpoint_twice', 'checkpoint_vdev_add', 'checkpoint_zdb', 'checkpoint_zhack_feat'] -pre = -post = [/opt/zfs-tests/tests/functional/pool_names] tests = ['pool_names_001_pos', 'pool_names_002_neg'] diff --git a/usr/src/test/zfs-tests/runfiles/openindiana.run b/usr/src/test/zfs-tests/runfiles/openindiana.run index fc3131dc76..48c22fc801 100644 --- a/usr/src/test/zfs-tests/runfiles/openindiana.run +++ b/usr/src/test/zfs-tests/runfiles/openindiana.run @@ -13,6 +13,7 @@ # Copyright (c) 2012, 2017 by Delphix. All rights reserved. # Copyright 2016, OmniTI Computer Consulting, Inc. All rights reserved. # Copyright 2018 Joyent, Inc. +# Copyright 2019 RackTop Systems. # [DEFAULT] @@ -456,8 +457,6 @@ tests = ['checkpoint_after_rewind', 'checkpoint_big_rewind', 'checkpoint_open', 'checkpoint_removal', 'checkpoint_rewind', 'checkpoint_ro_rewind', 'checkpoint_sm_scale', 'checkpoint_twice', 'checkpoint_vdev_add', 'checkpoint_zdb', 'checkpoint_zhack_feat'] -pre = -post = [/opt/zfs-tests/tests/functional/pool_names] tests = ['pool_names_001_pos', 'pool_names_002_neg'] diff --git a/usr/src/test/zfs-tests/tests/functional/cli_root/zpool_get/zpool_get.cfg b/usr/src/test/zfs-tests/tests/functional/cli_root/zpool_get/zpool_get.cfg index 76b7a1582b..ebf4e77ba8 100644 --- a/usr/src/test/zfs-tests/tests/functional/cli_root/zpool_get/zpool_get.cfg +++ b/usr/src/test/zfs-tests/tests/functional/cli_root/zpool_get/zpool_get.cfg @@ -54,6 +54,8 @@ typeset -a properties=( "freeing" "fragmentation" "leaked" + "bootsize" + "checkpoint" "feature@async_destroy" "feature@empty_bpobj" "feature@lz4_compress" @@ -66,9 +68,12 @@ typeset -a properties=( "feature@bookmarks" "feature@filesystem_limits" "feature@large_blocks" + "feature@large_dnode" "feature@sha512" "feature@skein" "feature@edonr" "feature@device_removal" - "feature@large_dnode" + "feature@obsolete_counts" + "feature@zpool_checkpoint" + "feature@spacemap_v2" ) diff --git a/usr/src/test/zfs-tests/tests/functional/slog/slog_014_pos.ksh b/usr/src/test/zfs-tests/tests/functional/slog/slog_014_pos.ksh index 02e99fac45..9a2580d554 100644 --- a/usr/src/test/zfs-tests/tests/functional/slog/slog_014_pos.ksh +++ b/usr/src/test/zfs-tests/tests/functional/slog/slog_014_pos.ksh @@ -28,6 +28,7 @@ # # Copyright (c) 2013, 2018 by Delphix. All rights reserved. # Copyright 2019 Joyent, Inc. +# Copyright 2019 RackTop Systems. # . $STF_SUITE/tests/functional/slog/slog.kshlib diff --git a/usr/src/uts/common/inet/ip/ip_ndp.c b/usr/src/uts/common/inet/ip/ip_ndp.c index 2ab9c6fbca..3e5d2087a6 100644 --- a/usr/src/uts/common/inet/ip/ip_ndp.c +++ b/usr/src/uts/common/inet/ip/ip_ndp.c @@ -1219,7 +1219,7 @@ nce_graveyard_free(list_t *graveyard) } mutex_exit(&ill->ill_lock); if (!doit || taskq_dispatch(system_taskq, ncec_mcast_reap, - ill, TQ_NOSLEEP) == NULL) { + ill, TQ_NOSLEEP) == (taskqid_t)NULL) { mutex_enter(&ill->ill_lock); if (doit) { IP_STAT(ill->ill_ipst, ip_nce_mcast_reclaim_tqfail); |