summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJerry Jelinek <jerry.jelinek@joyent.com>2019-05-08 11:41:48 +0000
committerJerry Jelinek <jerry.jelinek@joyent.com>2019-05-08 11:41:48 +0000
commit43072118cd73b8e2ee400b0fff9d3c2c17c5d0ef (patch)
tree8eabaa72e265587701dd9170f2c6d5e7b3c195f7
parent66c8cdb14b0af20202102312be2839cccfcbe528 (diff)
parent0eb3364f7d9157494d68a9f390c120ca86e03be1 (diff)
downloadillumos-joyent-43072118cd73b8e2ee400b0fff9d3c2c17c5d0ef.tar.gz
[illumos-gate merge]
commit 0eb3364f7d9157494d68a9f390c120ca86e03be1 10921 mdb_nicenum() needs smatch fix commit 0384eafe3a68aa730dc01e59feac994868d42919 10906 loader: non-ANSI definition of function commit 1567de9ca59165ba548c38fbf32486335b19e58a 10920 lzcnt feature not properly identified on Intel systems
-rw-r--r--usr/src/boot/lib/libstand/closeall.c25
-rw-r--r--usr/src/boot/lib/libstand/dev.c15
-rw-r--r--usr/src/boot/lib/libstand/ether.c21
-rw-r--r--usr/src/boot/lib/libstand/fstat.c9
-rw-r--r--usr/src/boot/lib/libstand/in_cksum.c11
-rw-r--r--usr/src/boot/lib/libstand/inet_ntoa.c12
-rw-r--r--usr/src/boot/lib/libstand/ioctl.c22
-rw-r--r--usr/src/boot/lib/libstand/random.c12
-rw-r--r--usr/src/boot/lib/libstand/stat.c11
-rw-r--r--usr/src/boot/lib/libstand/strcasecmp.c22
-rw-r--r--usr/src/boot/lib/libstand/strdup.c16
-rw-r--r--usr/src/boot/lib/libstand/strtol.c18
-rw-r--r--usr/src/boot/lib/libstand/ufs.c160
-rw-r--r--usr/src/boot/sys/boot/efi/libefi/efinet.c14
-rw-r--r--usr/src/cmd/mdb/Makefile.mdb4
-rw-r--r--usr/src/cmd/mdb/common/mdb/mdb_modapi.c5
-rw-r--r--usr/src/uts/i86pc/os/cpuid.c2
17 files changed, 151 insertions, 228 deletions
diff --git a/usr/src/boot/lib/libstand/closeall.c b/usr/src/boot/lib/libstand/closeall.c
index a661426763..13ff905a7e 100644
--- a/usr/src/boot/lib/libstand/closeall.c
+++ b/usr/src/boot/lib/libstand/closeall.c
@@ -1,6 +1,6 @@
/* $NetBSD: closeall.c,v 1.1 1996/01/13 22:25:36 leo Exp $ */
-/*-
+/*
* Copyright (c) 1993
* The Regents of the University of California. All rights reserved.
*
@@ -15,7 +15,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -32,45 +32,44 @@
* SUCH DAMAGE.
*
* @(#)close.c 8.1 (Berkeley) 6/11/93
- *
+ *
*
* Copyright (c) 1989, 1990, 1991 Carnegie Mellon University
* All Rights Reserved.
*
* Author: Alessandro Forin
- *
+ *
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
- *
+ *
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
+ *
* Carnegie Mellon requests users of this software to return to
- *
+ *
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
- *
+ *
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
#include "stand.h"
void
-closeall()
+closeall(void)
{
int i;
- for (i = 0; i < SOPEN_MAX; i++)
- if (files[i].f_flags != 0)
- (void)close(i);
+ for (i = 0; i < SOPEN_MAX; i++)
+ if (files[i].f_flags != 0)
+ (void) close(i);
}
diff --git a/usr/src/boot/lib/libstand/dev.c b/usr/src/boot/lib/libstand/dev.c
index 482c082117..89d7867ec6 100644
--- a/usr/src/boot/lib/libstand/dev.c
+++ b/usr/src/boot/lib/libstand/dev.c
@@ -1,6 +1,6 @@
/* $NetBSD: dev.c,v 1.4 1994/10/30 21:48:23 cgd Exp $ */
-/*-
+/*
* Copyright (c) 1993
* The Regents of the University of California. All rights reserved.
*
@@ -12,7 +12,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -32,7 +32,6 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/reboot.h>
@@ -40,22 +39,18 @@ __FBSDID("$FreeBSD$");
#include "stand.h"
int
-nodev()
+nodev(void)
{
return (ENXIO);
}
void
-nullsys()
+nullsys(void)
{
}
-/* ARGSUSED */
int
-noioctl(f, cmd, data)
- struct open_file *f;
- u_long cmd;
- void *data;
+noioctl(struct open_file *f __unused, ulong_t cmd __unused, void *data __unused)
{
return (EINVAL);
}
diff --git a/usr/src/boot/lib/libstand/ether.c b/usr/src/boot/lib/libstand/ether.c
index 71d7f72876..798886ebb4 100644
--- a/usr/src/boot/lib/libstand/ether.c
+++ b/usr/src/boot/lib/libstand/ether.c
@@ -16,7 +16,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -59,22 +59,22 @@ sendether(struct iodesc *d, void *pkt, size_t len, uint8_t *dea, int etype)
struct ether_header *eh;
#ifdef ETHER_DEBUG
- if (debug)
+ if (debug)
printf("sendether: called\n");
#endif
eh = (struct ether_header *)pkt - 1;
- len += sizeof(*eh);
+ len += sizeof (*eh);
MACPY(d->myea, eh->ether_shost); /* by byte */
MACPY(dea, eh->ether_dhost); /* by byte */
eh->ether_type = htons(etype);
n = netif_put(d, eh, len);
- if (n == -1 || n < sizeof(*eh))
+ if (n == -1 || n < sizeof (*eh))
return (-1);
- n -= sizeof(*eh);
+ n -= sizeof (*eh);
return (n);
}
@@ -93,13 +93,13 @@ readether(struct iodesc *d, void **pkt, void **payload, time_t tleft,
void *ptr;
#ifdef ETHER_DEBUG
- if (debug)
+ if (debug)
printf("readether: called\n");
#endif
ptr = NULL;
n = netif_get(d, &ptr, tleft);
- if (n == -1 || n < sizeof(*eh)) {
+ if (n == -1 || n < sizeof (*eh)) {
free(ptr);
return (-1);
}
@@ -118,10 +118,10 @@ readether(struct iodesc *d, void **pkt, void **payload, time_t tleft,
}
*pkt = ptr;
- *payload = (void *)((uintptr_t)eh + sizeof(*eh));
+ *payload = (void *)((uintptr_t)eh + sizeof (*eh));
*etype = ntohs(eh->ether_type);
- n -= sizeof(*eh);
+ n -= sizeof (*eh);
return (n);
}
@@ -130,8 +130,7 @@ readether(struct iodesc *d, void **pkt, void **payload, time_t tleft,
*/
static char digits[] = "0123456789abcdef";
char *
-ether_sprintf(ap)
- u_char *ap;
+ether_sprintf(uchar_t *ap)
{
int i;
static char etherbuf[18];
diff --git a/usr/src/boot/lib/libstand/fstat.c b/usr/src/boot/lib/libstand/fstat.c
index 13bed08d08..3c33de0cc3 100644
--- a/usr/src/boot/lib/libstand/fstat.c
+++ b/usr/src/boot/lib/libstand/fstat.c
@@ -1,6 +1,6 @@
/* $NetBSD: fstat.c,v 1.1 1996/01/13 22:25:38 leo Exp $ */
-/*-
+/*
* Copyright (c) 1993
* The Regents of the University of California. All rights reserved.
*
@@ -12,7 +12,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -32,14 +32,11 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
#include "stand.h"
int
-fstat(fd, sb)
- int fd;
- struct stat *sb;
+fstat(int fd, struct stat *sb)
{
struct open_file *f = &files[fd];
diff --git a/usr/src/boot/lib/libstand/in_cksum.c b/usr/src/boot/lib/libstand/in_cksum.c
index e6051bf166..7551d65dbe 100644
--- a/usr/src/boot/lib/libstand/in_cksum.c
+++ b/usr/src/boot/lib/libstand/in_cksum.c
@@ -16,7 +16,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -36,7 +36,6 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
#include <sys/types.h>
#include <machine/endian.h>
@@ -50,12 +49,10 @@ __FBSDID("$FreeBSD$");
* In particular, it should not be this one.
*/
int
-in_cksum(p, len)
- void *p;
- int len;
+in_cksum(void *p, int len)
{
int sum = 0, oddbyte = 0, v = 0;
- u_char *cp = p;
+ uchar_t *cp = p;
/* we assume < 2^16 bytes being summed */
while (len > 0) {
@@ -65,7 +62,7 @@ in_cksum(p, len)
}
if (((long)cp & 1) == 0) {
while ((len -= 2) >= 0) {
- sum += *(u_short *)cp;
+ sum += *(ushort_t *)cp;
cp += 2;
}
} else {
diff --git a/usr/src/boot/lib/libstand/inet_ntoa.c b/usr/src/boot/lib/libstand/inet_ntoa.c
index 5bc8533541..7aa01c6124 100644
--- a/usr/src/boot/lib/libstand/inet_ntoa.c
+++ b/usr/src/boot/lib/libstand/inet_ntoa.c
@@ -10,7 +10,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -28,11 +28,6 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)inet_ntoa.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
#include <sys/socket.h>
@@ -45,11 +40,10 @@ static char sccsid[] = "@(#)inet_ntoa.c 8.1 (Berkeley) 6/4/93";
* to base 256 d.d.d.d representation.
*/
char *
-inet_ntoa(in)
- struct in_addr in;
+inet_ntoa(struct in_addr in)
{
static const char fmt[] = "%u.%u.%u.%u";
- static char ret[sizeof "255.255.255.255"];
+ static char ret[sizeof ("255.255.255.255")];
unsigned char *src = (unsigned char *) &in;
sprintf(ret, fmt, src[0], src[1], src[2], src[3]);
diff --git a/usr/src/boot/lib/libstand/ioctl.c b/usr/src/boot/lib/libstand/ioctl.c
index a4512af05e..557cddf3ef 100644
--- a/usr/src/boot/lib/libstand/ioctl.c
+++ b/usr/src/boot/lib/libstand/ioctl.c
@@ -1,6 +1,6 @@
/* $NetBSD: ioctl.c,v 1.4 1994/10/30 21:48:24 cgd Exp $ */
-/*-
+/*
* Copyright (c) 1993
* The Regents of the University of California. All rights reserved.
*
@@ -15,7 +15,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -32,44 +32,40 @@
* SUCH DAMAGE.
*
* @(#)ioctl.c 8.1 (Berkeley) 6/11/93
- *
+ *
*
* Copyright (c) 1989, 1990, 1991 Carnegie Mellon University
* All Rights Reserved.
*
* Author: Alessandro Forin
- *
+ *
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
- *
+ *
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
+ *
* Carnegie Mellon requests users of this software to return to
- *
+ *
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
- *
+ *
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
#include "stand.h"
int
-ioctl(fd, cmd, arg)
- int fd;
- u_long cmd;
- char *arg;
+ioctl(int fd, ulong_t cmd, char *arg)
{
struct open_file *f = &files[fd];
diff --git a/usr/src/boot/lib/libstand/random.c b/usr/src/boot/lib/libstand/random.c
index 4cd6dd4d4e..f50270fae3 100644
--- a/usr/src/boot/lib/libstand/random.c
+++ b/usr/src/boot/lib/libstand/random.c
@@ -1,4 +1,4 @@
-/*-
+/*
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
@@ -30,15 +30,13 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
#include <sys/types.h>
-static u_long randseed = 1;
+static ulong_t randseed = 1;
void
-srandom(seed)
- u_long seed;
+srandom(ulong_t seed)
{
randseed = seed;
}
@@ -48,8 +46,8 @@ srandom(seed)
* and whatever else we might use it for. The result is uniform on
* [0, 2^31 - 1].
*/
-u_long
-random()
+ulong_t
+random(void)
{
long x, hi, lo, t;
diff --git a/usr/src/boot/lib/libstand/stat.c b/usr/src/boot/lib/libstand/stat.c
index addee5d2f4..249c2086a6 100644
--- a/usr/src/boot/lib/libstand/stat.c
+++ b/usr/src/boot/lib/libstand/stat.c
@@ -1,6 +1,6 @@
/* $NetBSD: stat.c,v 1.4 1996/01/13 22:25:43 leo Exp $ */
-/*-
+/*
* Copyright (c) 1993
* The Regents of the University of California. All rights reserved.
*
@@ -12,7 +12,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -32,14 +32,11 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
#include "stand.h"
int
-stat(str, sb)
- const char *str;
- struct stat *sb;
+stat(const char *str, struct stat *sb)
{
int fd, rv;
@@ -47,6 +44,6 @@ stat(str, sb)
if (fd < 0)
return (-1);
rv = fstat(fd, sb);
- (void)close(fd);
+ (void) close(fd);
return (rv);
}
diff --git a/usr/src/boot/lib/libstand/strcasecmp.c b/usr/src/boot/lib/libstand/strcasecmp.c
index 7ef3f59d9d..8023f64705 100644
--- a/usr/src/boot/lib/libstand/strcasecmp.c
+++ b/usr/src/boot/lib/libstand/strcasecmp.c
@@ -28,23 +28,16 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
#include <sys/cdefs.h>
#include <string.h>
#include "stand.h"
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)strcasecmp.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-
int
-strcasecmp(s1, s2)
- const char *s1, *s2;
+strcasecmp(const char *s1, const char *s2)
{
- const u_char
- *us1 = (const u_char *)s1,
- *us2 = (const u_char *)s2;
+ const uchar_t *us1 = (const uchar_t *)s1;
+ const uchar_t *us2 = (const uchar_t *)s2;
while (tolower(*us1) == tolower(*us2++))
if (*us1++ == '\0')
@@ -53,14 +46,11 @@ strcasecmp(s1, s2)
}
int
-strncasecmp(s1, s2, n)
- const char *s1, *s2;
- size_t n;
+strncasecmp(const char *s1, const char *s2, size_t n)
{
if (n != 0) {
- const u_char
- *us1 = (const u_char *)s1,
- *us2 = (const u_char *)s2;
+ const uchar_t *us1 = (const uchar_t *)s1;
+ const uchar_t *us2 = (const uchar_t *)s2;
do {
if (tolower(*us1) != tolower(*us2++))
diff --git a/usr/src/boot/lib/libstand/strdup.c b/usr/src/boot/lib/libstand/strdup.c
index 45a541432c..c8342d3638 100644
--- a/usr/src/boot/lib/libstand/strdup.c
+++ b/usr/src/boot/lib/libstand/strdup.c
@@ -28,28 +28,22 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)strdup.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
#include "stand.h"
#include <stddef.h>
#include <string.h>
char *
-strdup(str)
- const char *str;
+strdup(const char *str)
{
size_t len;
char *copy = NULL;
if (str != NULL) {
- len = strlen(str) + 1;
- if ((copy = malloc(len)) == NULL)
- return (NULL);
- memcpy(copy, str, len);
+ len = strlen(str) + 1;
+ if ((copy = malloc(len)) == NULL)
+ return (NULL);
+ memcpy(copy, str, len);
}
return (copy);
}
diff --git a/usr/src/boot/lib/libstand/strtol.c b/usr/src/boot/lib/libstand/strtol.c
index be82fb1b67..e4eea2f9da 100644
--- a/usr/src/boot/lib/libstand/strtol.c
+++ b/usr/src/boot/lib/libstand/strtol.c
@@ -1,4 +1,4 @@
-/*-
+/*
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
*
@@ -28,11 +28,6 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)strtol.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
#include "stand.h"
#include <limits.h>
@@ -44,10 +39,7 @@ static char sccsid[] = "@(#)strtol.c 8.1 (Berkeley) 6/4/93";
* alphabets and digits are each contiguous.
*/
long
-strtol(nptr, endptr, base)
- const char *nptr;
- char **endptr;
- int base;
+strtol(const char *nptr, char **endptr, int base)
{
const char *s;
unsigned long acc;
@@ -57,9 +49,9 @@ strtol(nptr, endptr, base)
/* Be sensible about NULL strings */
if (nptr == NULL)
- nptr = "";
+ nptr = "";
s = nptr;
-
+
/*
* Skip white space and pick up leading +/- sign if any.
* If base is 0, allow 0x for hex and 0 for octal, else
@@ -102,7 +94,7 @@ strtol(nptr, endptr, base)
cutoff = neg ? -(unsigned long)LONG_MIN : LONG_MAX;
cutlim = cutoff % (unsigned long)base;
cutoff /= (unsigned long)base;
- for (acc = 0, any = 0;; c = *s++) {
+ for (acc = 0, any = 0; ; c = *s++) {
if (!isascii(c))
break;
if (isdigit(c))
diff --git a/usr/src/boot/lib/libstand/ufs.c b/usr/src/boot/lib/libstand/ufs.c
index e31d9d55c9..4144c59a1e 100644
--- a/usr/src/boot/lib/libstand/ufs.c
+++ b/usr/src/boot/lib/libstand/ufs.c
@@ -39,30 +39,30 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
- *
+ *
*
* Copyright (c) 1990, 1991 Carnegie Mellon University
* All Rights Reserved.
*
* Author: David Golub
- *
+ *
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
- *
+ *
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
+ *
* Carnegie Mellon requests users of this software to return to
- *
+ *
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
- *
+ *
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*/
@@ -82,14 +82,13 @@
#include "stand.h"
#include "string.h"
-static int ufs_open(const char *path, struct open_file *f);
-static int ufs_write(struct open_file *f, const void *buf, size_t size,
- size_t *resid);
-static int ufs_close(struct open_file *f);
-static int ufs_read(struct open_file *f, void *buf, size_t size, size_t *resid);
-static off_t ufs_seek(struct open_file *f, off_t offset, int where);
-static int ufs_stat(struct open_file *f, struct stat *sb);
-static int ufs_readdir(struct open_file *f, struct dirent *d);
+static int ufs_open(const char *, struct open_file *);
+static int ufs_write(struct open_file *, const void *, size_t, size_t *);
+static int ufs_close(struct open_file *);
+static int ufs_read(struct open_file *, void *, size_t, size_t *);
+static off_t ufs_seek(struct open_file *, off_t, int);
+static int ufs_stat(struct open_file *, struct stat *);
+static int ufs_readdir(struct open_file *, struct dirent *);
struct fs_ops ufs_fsops = {
"ufs",
@@ -113,18 +112,22 @@ struct file {
struct ufs2_dinode di2;
} f_di; /* copy of on-disk inode */
int f_nindir[NIADDR];
- /* number of blocks mapped by
- indirect block at level i */
- char *f_blk[NIADDR]; /* buffer for indirect block at
- level i */
- size_t f_blksize[NIADDR];
- /* size of buffer */
- ufs2_daddr_t f_blkno[NIADDR];/* disk address of block in buffer */
+ /*
+ * number of blocks mapped by
+ * indirect block at level i
+ */
+ char *f_blk[NIADDR];
+ /*
+ * buffer for indirect block at
+ * level i
+ */
+ size_t f_blksize[NIADDR]; /* size of buffer */
+ ufs2_daddr_t f_blkno[NIADDR]; /* disk address of block in buffer */
ufs2_daddr_t f_buf_blkno; /* block number of data block */
char *f_buf; /* buffer for data block */
size_t f_buf_size; /* size of data block */
};
-#define DIP(fp, field) \
+#define DIP(fp, field) \
((fp)->f_fs->fs_magic == FS_UFS1_MAGIC ? \
(fp)->f_di.di1.field : (fp)->f_di.di2.field)
@@ -138,9 +141,7 @@ static int search_directory(char *, struct open_file *, ino_t *);
* Read a new inode into a file structure.
*/
static int
-read_inode(inumber, f)
- ino_t inumber;
- struct open_file *f;
+read_inode(ino_t inumber, struct open_file *f)
{
struct file *fp = (struct file *)f->f_fsdata;
struct fs *fs = fp->f_fs;
@@ -149,7 +150,7 @@ read_inode(inumber, f)
int rc;
if (fs == NULL)
- panic("fs == NULL");
+ panic("fs == NULL");
/*
* Read inode and save it.
@@ -157,8 +158,8 @@ read_inode(inumber, f)
buf = malloc(fs->fs_bsize);
twiddle(1);
rc = (f->f_dev->dv_strategy)(f->f_devdata, F_READ,
- fsbtodb(fs, ino_to_fsba(fs, inumber)), fs->fs_bsize,
- buf, &rsize);
+ fsbtodb(fs, ino_to_fsba(fs, inumber)), fs->fs_bsize,
+ buf, &rsize);
if (rc)
goto out;
if (rsize != fs->fs_bsize) {
@@ -186,7 +187,7 @@ read_inode(inumber, f)
fp->f_seekp = 0;
out:
free(buf);
- return (rc);
+ return (rc);
}
/*
@@ -194,10 +195,8 @@ out:
* contains that block.
*/
static int
-block_map(f, file_block, disk_block_p)
- struct open_file *f;
- ufs2_daddr_t file_block;
- ufs2_daddr_t *disk_block_p; /* out */
+block_map(struct open_file *f, ufs2_daddr_t file_block,
+ ufs2_daddr_t *disk_block_p)
{
struct file *fp = (struct file *)f->f_fsdata;
struct fs *fs = fp->f_fs;
@@ -262,15 +261,15 @@ block_map(f, file_block, disk_block_p)
}
if (fp->f_blkno[level] != ind_block_num) {
- if (fp->f_blk[level] == (char *)0)
+ if (fp->f_blk[level] == NULL)
fp->f_blk[level] =
- malloc(fs->fs_bsize);
+ malloc(fs->fs_bsize);
twiddle(1);
rc = (f->f_dev->dv_strategy)(f->f_devdata, F_READ,
- fsbtodb(fp->f_fs, ind_block_num),
- fs->fs_bsize,
- fp->f_blk[level],
- &fp->f_blksize[level]);
+ fsbtodb(fp->f_fs, ind_block_num),
+ fs->fs_bsize,
+ fp->f_blk[level],
+ &fp->f_blksize[level]);
if (rc)
return (rc);
if (fp->f_blksize[level] != fs->fs_bsize)
@@ -299,10 +298,7 @@ block_map(f, file_block, disk_block_p)
* Write a portion of a file from an internal buffer.
*/
static int
-buf_write_file(f, buf_p, size_p)
- struct open_file *f;
- const char *buf_p;
- size_t *size_p; /* out */
+buf_write_file(struct open_file *f, const char *buf_p, size_t *size_p)
{
struct file *fp = (struct file *)f->f_fsdata;
struct fs *fs = fp->f_fs;
@@ -323,7 +319,7 @@ buf_write_file(f, buf_p, size_p)
if (rc)
return (rc);
- if (disk_block == 0)
+ if (disk_block == 0)
/* Because we can't allocate space on the drive */
return (EFBIG);
@@ -333,7 +329,7 @@ buf_write_file(f, buf_p, size_p)
*/
if (*size_p > DIP(fp, di_size) - fp->f_seekp)
*size_p = DIP(fp, di_size) - fp->f_seekp;
- if (*size_p > block_size - off)
+ if (*size_p > block_size - off)
*size_p = block_size - off;
/*
@@ -348,8 +344,8 @@ buf_write_file(f, buf_p, size_p)
twiddle(8);
rc = (f->f_dev->dv_strategy)(f->f_devdata, F_READ,
- fsbtodb(fs, disk_block),
- block_size, fp->f_buf, &fp->f_buf_size);
+ fsbtodb(fs, disk_block),
+ block_size, fp->f_buf, &fp->f_buf_size);
if (rc)
return (rc);
@@ -367,8 +363,8 @@ buf_write_file(f, buf_p, size_p)
twiddle(4);
rc = (f->f_dev->dv_strategy)(f->f_devdata, F_WRITE,
- fsbtodb(fs, disk_block),
- block_size, fp->f_buf, &fp->f_buf_size);
+ fsbtodb(fs, disk_block),
+ block_size, fp->f_buf, &fp->f_buf_size);
return (rc);
}
@@ -377,10 +373,7 @@ buf_write_file(f, buf_p, size_p)
* the location in the buffer and the amount in the buffer.
*/
static int
-buf_read_file(f, buf_p, size_p)
- struct open_file *f;
- char **buf_p; /* out */
- size_t *size_p; /* out */
+buf_read_file(struct open_file *f, char **buf_p, size_t *size_p)
{
struct file *fp = (struct file *)f->f_fsdata;
struct fs *fs = fp->f_fs;
@@ -408,8 +401,8 @@ buf_read_file(f, buf_p, size_p)
} else {
twiddle(4);
rc = (f->f_dev->dv_strategy)(f->f_devdata,
- F_READ, fsbtodb(fs, disk_block),
- block_size, fp->f_buf, &fp->f_buf_size);
+ F_READ, fsbtodb(fs, disk_block),
+ block_size, fp->f_buf, &fp->f_buf_size);
if (rc)
return (rc);
}
@@ -439,10 +432,7 @@ buf_read_file(f, buf_p, size_p)
* i_number.
*/
static int
-search_directory(name, f, inumber_p)
- char *name;
- struct open_file *f;
- ino_t *inumber_p; /* out */
+search_directory(char *name, struct open_file *f, ino_t *inumber_p)
{
struct file *fp = (struct file *)f->f_fsdata;
struct direct *dp;
@@ -467,7 +457,7 @@ search_directory(name, f, inumber_p)
goto next;
namlen = dp->d_namlen;
if (namlen == length &&
- !strcmp(name, dp->d_name)) {
+ strcmp(name, dp->d_name) == 0) {
/* found entry */
*inumber_p = dp->d_ino;
return (0);
@@ -486,9 +476,7 @@ static int sblock_try[] = SBLOCKSEARCH;
* Open a file.
*/
static int
-ufs_open(upath, f)
- const char *upath;
- struct open_file *f;
+ufs_open(const char *upath, struct open_file *f)
{
char *cp, *ncp;
int c;
@@ -503,8 +491,8 @@ ufs_open(upath, f)
char *path = NULL;
/* allocate file system specific data structure */
- fp = malloc(sizeof(struct file));
- bzero(fp, sizeof(struct file));
+ fp = malloc(sizeof (struct file));
+ bzero(fp, sizeof (struct file));
f->f_fsdata = (void *)fp;
/* allocate space and read super block */
@@ -521,11 +509,11 @@ ufs_open(upath, f)
if (rc)
goto out;
if ((fs->fs_magic == FS_UFS1_MAGIC ||
- (fs->fs_magic == FS_UFS2_MAGIC &&
- fs->fs_sblockloc == sblock_try[i])) &&
+ (fs->fs_magic == FS_UFS2_MAGIC &&
+ fs->fs_sblockloc == sblock_try[i])) &&
buf_size == SBLOCKSIZE &&
fs->fs_bsize <= MAXBSIZE &&
- fs->fs_bsize >= sizeof(struct fs))
+ fs->fs_bsize >= sizeof (struct fs))
break;
}
if (sblock_try[i] == -1) {
@@ -552,8 +540,8 @@ ufs_open(upath, f)
cp = path = strdup(upath);
if (path == NULL) {
- rc = ENOMEM;
- goto out;
+ rc = ENOMEM;
+ goto out;
}
while (*cp) {
@@ -629,7 +617,7 @@ ufs_open(upath, f)
cp = (caddr_t)(fp->f_di.di1.di_db);
else
cp = (caddr_t)(fp->f_di.di2.di_db);
- bcopy(cp, namebuf, (unsigned) link_len);
+ bcopy(cp, namebuf, (unsigned)link_len);
} else {
/*
* Read file for symbolic link
@@ -643,11 +631,11 @@ ufs_open(upath, f)
rc = block_map(f, (ufs2_daddr_t)0, &disk_block);
if (rc)
goto out;
-
+
twiddle(1);
rc = (f->f_dev->dv_strategy)(f->f_devdata,
- F_READ, fsbtodb(fs, disk_block),
- fs->fs_bsize, buf, &buf_size);
+ F_READ, fsbtodb(fs, disk_block),
+ fs->fs_bsize, buf, &buf_size);
if (rc)
goto out;
@@ -689,8 +677,7 @@ out:
}
static int
-ufs_close(f)
- struct open_file *f;
+ufs_close(struct open_file *f)
{
struct file *fp = (struct file *)f->f_fsdata;
int level;
@@ -715,11 +702,7 @@ ufs_close(f)
* Cross block boundaries when necessary.
*/
static int
-ufs_read(f, start, size, resid)
- struct open_file *f;
- void *start;
- size_t size;
- size_t *resid; /* out */
+ufs_read(struct open_file *f, void *start, size_t size, size_t *resid)
{
struct file *fp = (struct file *)f->f_fsdata;
size_t csize;
@@ -757,11 +740,7 @@ ufs_read(f, start, size, resid)
* extend the file.
*/
static int
-ufs_write(f, start, size, resid)
- struct open_file *f;
- const void *start;
- size_t size;
- size_t *resid; /* out */
+ufs_write(struct open_file *f, const void *start, size_t size, size_t *resid)
{
struct file *fp = (struct file *)f->f_fsdata;
size_t csize;
@@ -789,10 +768,7 @@ ufs_write(f, start, size, resid)
}
static off_t
-ufs_seek(f, offset, where)
- struct open_file *f;
- off_t offset;
- int where;
+ufs_seek(struct open_file *f, off_t offset, int where)
{
struct file *fp = (struct file *)f->f_fsdata;
@@ -814,9 +790,7 @@ ufs_seek(f, offset, where)
}
static int
-ufs_stat(f, sb)
- struct open_file *f;
- struct stat *sb;
+ufs_stat(struct open_file *f, struct stat *sb)
{
struct file *fp = (struct file *)f->f_fsdata;
diff --git a/usr/src/boot/sys/boot/efi/libefi/efinet.c b/usr/src/boot/sys/boot/efi/libefi/efinet.c
index c15364cb9d..bcbf88373d 100644
--- a/usr/src/boot/sys/boot/efi/libefi/efinet.c
+++ b/usr/src/boot/sys/boot/efi/libefi/efinet.c
@@ -1,4 +1,4 @@
-/*-
+/*
* Copyright (c) 2001 Doug Rabson
* Copyright (c) 2002, 2006 Marcel Moolenaar
* All rights reserved.
@@ -101,7 +101,7 @@ efinet_match(struct netif *nif, void *machdep_hint)
if (dev->d_unit == nif->nif_unit)
return (1);
- return(0);
+ return (0);
}
static int
@@ -194,7 +194,7 @@ efinet_init(struct iodesc *desc, void *machdep_hint)
}
h = nif->nif_driver->netif_ifs[nif->nif_unit].dif_private;
- status = BS->HandleProtocol(h, &sn_guid, (VOID **)&nif->nif_devdata);
+ status = BS->HandleProtocol(h, &sn_guid, (void **)&nif->nif_devdata);
if (status != EFI_SUCCESS) {
printf("net%d: cannot fetch interface data (status=%lu)\n",
nif->nif_unit, EFI_ERROR_CODE(status));
@@ -263,7 +263,7 @@ struct devsw efinet_dev = {
};
static int
-efinet_dev_init()
+efinet_dev_init(void)
{
struct netif_dif *dif;
struct netif_stats *stats;
@@ -293,7 +293,7 @@ efinet_dev_init()
return (ENOMEM);
}
nifs = 0;
- for (i = 0; i < sz / sizeof(EFI_HANDLE); i++) {
+ for (i = 0; i < sz / sizeof (EFI_HANDLE); i++) {
devpath = efi_lookup_devpath(handles[i]);
if (devpath == NULL)
continue;
@@ -330,8 +330,8 @@ efinet_dev_init()
if (err != 0)
goto done;
- efinetif.netif_ifs = calloc(nifs, sizeof(struct netif_dif));
- stats = calloc(nifs, sizeof(struct netif_stats));
+ efinetif.netif_ifs = calloc(nifs, sizeof (struct netif_dif));
+ stats = calloc(nifs, sizeof (struct netif_stats));
if (efinetif.netif_ifs == NULL || stats == NULL) {
free(efinetif.netif_ifs);
free(stats);
diff --git a/usr/src/cmd/mdb/Makefile.mdb b/usr/src/cmd/mdb/Makefile.mdb
index c235559ee5..5207c740f3 100644
--- a/usr/src/cmd/mdb/Makefile.mdb
+++ b/usr/src/cmd/mdb/Makefile.mdb
@@ -26,7 +26,7 @@
#
# Copyright 2011 Nexenta Systems, Inc. All rights reserved.
# Copyright (c) 2012 by Delphix. All rights reserved.
-# Copyright (c) 2012 Joyent, Inc. All rights reserved.
+# Copyright 2019 Joyent, Inc.
# Copyright 2018 Jason King
#
@@ -109,8 +109,6 @@ CERRWARN += -_gcc=-Wno-parentheses
CERRWARN += -_gcc=-Wno-unused-label
CERRWARN += -_gcc=-Wno-unused-variable
-SMOFF += all_func_returns
-
#
# -erroff=E_INCONS_ARG_DECL2 works around a problem where lint gets confused
# about how struct mdb_tgt_gregset is used in mdb_tgt_stack_f() and
diff --git a/usr/src/cmd/mdb/common/mdb/mdb_modapi.c b/usr/src/cmd/mdb/common/mdb/mdb_modapi.c
index fd47330ef6..133a32a889 100644
--- a/usr/src/cmd/mdb/common/mdb/mdb_modapi.c
+++ b/usr/src/cmd/mdb/common/mdb/mdb_modapi.c
@@ -23,6 +23,7 @@
* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013 by Delphix. All rights reserved.
* Copyright 2016 Nexenta Systems, Inc. All rights reserved.
+ * Copyright 2019 Joyent, Inc.
*/
#include <mdb/mdb_modapi.h>
@@ -92,11 +93,11 @@ mdb_nicenum(uint64_t num, char *buf)
} else if (n < 10 && (num & (num - 1)) != 0) {
(void) mdb_snprintfrac(buf, MDB_NICENUM_BUFLEN,
num, 1ULL << 10 * index, 2);
- strcat(buf, u);
+ (void) strcat(buf, u);
} else if (n < 100 && (num & (num - 1)) != 0) {
(void) mdb_snprintfrac(buf, MDB_NICENUM_BUFLEN,
num, 1ULL << 10 * index, 1);
- strcat(buf, u);
+ (void) strcat(buf, u);
} else {
(void) mdb_snprintf(buf, MDB_NICENUM_BUFLEN, "%llu%s",
(u_longlong_t)n, u);
diff --git a/usr/src/uts/i86pc/os/cpuid.c b/usr/src/uts/i86pc/os/cpuid.c
index 1bf09bcf08..2b4ed5c8f5 100644
--- a/usr/src/uts/i86pc/os/cpuid.c
+++ b/usr/src/uts/i86pc/os/cpuid.c
@@ -4588,6 +4588,8 @@ cpuid_pass4(cpu_t *cpu, uint_t *hwcap_out)
case X86_VENDOR_Intel:
if (*edx & CPUID_AMD_EDX_TSCP)
hwcap_flags |= AV_386_TSCP;
+ if (*ecx & CPUID_AMD_ECX_LZCNT)
+ hwcap_flags |= AV_386_AMD_LZCNT;
/*
* Aarrgh.
* Intel uses a different bit in the same word.