From nobody Fri Mar 03 16:13:51 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PStM36JKLz3w4jG; Fri, 3 Mar 2023 16:13:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PStM35hqCz3Qm3; Fri, 3 Mar 2023 16:13:51 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677860031; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=5X+oEGwhdLOnp3WhkUnXE/EQV9MO+IhbZeOU2wUecWw=; b=Zq36qVmpCc8YYGLIroa3Yjqlq2QIxm2OtxEct3NREcDuT3SHHFwQXft0UYM3Vg1qdprNSI I+9sOtl4EIOFw7+/E0vFn3//BUr9g0/Whq7g3IybzF4fKNz/ljsKdo0ZamLhW41AKPe3Aa 40/GBSA1ttondbplDGNAbufVrL8bWwFcGCrYjkFGH3x1y8KXByZNrmf/oYVB9+nUzxvTrm xJYUEAnNp569Nd6iP47uLZU6KPxBeAk6zVnHWLpH0Y9DcJG9oNKXgekoOwEHc6sLN1JTE6 zLI3ltHTlDN6aq4eaO+UChH4APkLZ/CN/U1SSgHia6iXlMNaBi6jhCxjhqQAZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677860031; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=5X+oEGwhdLOnp3WhkUnXE/EQV9MO+IhbZeOU2wUecWw=; b=Wpeh12d65yNtv2Inm2lHCGtlTlgFAwGPgyapXHj7/wDO7bSjlAg0x3PT6TPrM0//o4aLi6 9I7JbZwrH4kJS0//fw4KCk+oukSGSvXaXlZ4iW0Bu6qYuR71OSXrpdgtje6Va9egPIaA3+ v7gBPocvzteCnUh+H0PSXP9q9tSOEIXCjIvK3IROiQUm4/iCvXm7Rp+SfXwr2Eg8mNPwqZ D8u0b0KFgvBOfyFvix7QwXg4qw8kGObKBe7DD/0jRt/StYZXxcf3SXa7YUcvfPlg8zuWda 09UE2eiL46q6+9E4mnmm2W4FSE2wqBNVB5wCloQBSTEatg4kdISLiN+GFrwqCg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1677860031; a=rsa-sha256; cv=none; b=k2/xipCy2HhXe3jReDvcwDJ1vT9SE0jejzPPLoyfuxbhMBJXMsY1Rr1rXzfR5v22IpFpVl dvchGpoZLmbW5N5xXiwpFx9SzOj2HFPL2xLY1m1DExKWPENmbEaVZWDVmId+JfLEmeASqq 7muJUzQV+MIH0eKdQE4OSvA6hcYfwNOCvucTypBp8PWAbnv9478RyE9KTY5KP8Z8WLpOeK X6QNm8sVhjfrnYMuTVyPpHfu5IDGA9u6gh1CjBnE1mJGM/skMo1HxTbBMgDxT3GzjcSqUU uGhkzRbITyXCNs+NbWwLgFyA73F6ecxB46Jj5LtyuK5gSofz/ewjzjliV/Q7qQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PStM34dHfz149T; Fri, 3 Mar 2023 16:13:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 323GDpR4000435; Fri, 3 Mar 2023 16:13:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 323GDpge000434; Fri, 3 Mar 2023 16:13:51 GMT (envelope-from git) Date: Fri, 3 Mar 2023 16:13:51 GMT Message-Id: <202303031613.323GDpge000434@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: ad43dd69cec7 - main - bhyveload: Address compiler warnings and bump WARNS List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ad43dd69cec7b568846b45ff990da6dc86e58467 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=ad43dd69cec7b568846b45ff990da6dc86e58467 commit ad43dd69cec7b568846b45ff990da6dc86e58467 Author: Mark Johnston AuthorDate: 2023-03-03 14:52:17 +0000 Commit: Mark Johnston CommitDate: 2023-03-03 16:13:22 +0000 bhyveload: Address compiler warnings and bump WARNS Mostly sprinkle __unused. Also duplicate strings passed to addenv() so that constant string literals can be passed. No functional change intended. Reviewed by: corvink, rew, jhb MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D38840 --- usr.sbin/bhyveload/Makefile | 2 -- usr.sbin/bhyveload/bhyveload.c | 68 ++++++++++++++++++++++-------------------- 2 files changed, 36 insertions(+), 34 deletions(-) diff --git a/usr.sbin/bhyveload/Makefile b/usr.sbin/bhyveload/Makefile index 48bed64c26e4..59672cca47b5 100644 --- a/usr.sbin/bhyveload/Makefile +++ b/usr.sbin/bhyveload/Makefile @@ -7,8 +7,6 @@ PACKAGE= bhyve LIBADD= vmmapi -WARNS?= 3 - CFLAGS+=-I${SRCTOP}/stand/userboot .include diff --git a/usr.sbin/bhyveload/bhyveload.c b/usr.sbin/bhyveload/bhyveload.c index 1a24b5f0044a..09a9653ece34 100644 --- a/usr.sbin/bhyveload/bhyveload.c +++ b/usr.sbin/bhyveload/bhyveload.c @@ -118,7 +118,7 @@ static void cb_exit(void *arg, int v); */ static void -cb_putc(void *arg, int ch) +cb_putc(void *arg __unused, int ch) { char c = ch; @@ -126,7 +126,7 @@ cb_putc(void *arg, int ch) } static int -cb_getc(void *arg) +cb_getc(void *arg __unused) { char c; @@ -136,7 +136,7 @@ cb_getc(void *arg) } static int -cb_poll(void *arg) +cb_poll(void *arg __unused) { int n; @@ -160,7 +160,7 @@ struct cb_file { }; static int -cb_open(void *arg, const char *filename, void **hp) +cb_open(void *arg __unused, const char *filename, void **hp) { struct cb_file *cf; char path[PATH_MAX]; @@ -202,7 +202,7 @@ out: } static int -cb_close(void *arg, void *h) +cb_close(void *arg __unused, void *h) { struct cb_file *cf = h; @@ -216,7 +216,7 @@ cb_close(void *arg, void *h) } static int -cb_isdir(void *arg, void *h) +cb_isdir(void *arg __unused, void *h) { struct cb_file *cf = h; @@ -224,7 +224,7 @@ cb_isdir(void *arg, void *h) } static int -cb_read(void *arg, void *h, void *buf, size_t size, size_t *resid) +cb_read(void *arg __unused, void *h, void *buf, size_t size, size_t *resid) { struct cb_file *cf = h; ssize_t sz; @@ -239,8 +239,8 @@ cb_read(void *arg, void *h, void *buf, size_t size, size_t *resid) } static int -cb_readdir(void *arg, void *h, uint32_t *fileno_return, uint8_t *type_return, - size_t *namelen_return, char *name) +cb_readdir(void *arg __unused, void *h, uint32_t *fileno_return, + uint8_t *type_return, size_t *namelen_return, char *name) { struct cb_file *cf = h; struct dirent *dp; @@ -266,7 +266,7 @@ cb_readdir(void *arg, void *h, uint32_t *fileno_return, uint8_t *type_return, } static int -cb_seek(void *arg, void *h, uint64_t offset, int whence) +cb_seek(void *arg __unused, void *h, uint64_t offset, int whence) { struct cb_file *cf = h; @@ -278,7 +278,7 @@ cb_seek(void *arg, void *h, uint64_t offset, int whence) } static int -cb_stat(void *arg, void *h, struct stat *sbp) +cb_stat(void *arg __unused, void *h, struct stat *sbp) { struct cb_file *cf = h; @@ -299,7 +299,7 @@ cb_stat(void *arg, void *h, struct stat *sbp) */ static int -cb_diskread(void *arg, int unit, uint64_t from, void *to, size_t size, +cb_diskread(void *arg __unused, int unit, uint64_t from, void *to, size_t size, size_t *resid) { ssize_t n; @@ -314,8 +314,8 @@ cb_diskread(void *arg, int unit, uint64_t from, void *to, size_t size, } static int -cb_diskwrite(void *arg, int unit, uint64_t offset, void *src, size_t size, - size_t *resid) +cb_diskwrite(void *arg __unused, int unit, uint64_t offset, void *src, + size_t size, size_t *resid) { ssize_t n; @@ -329,7 +329,7 @@ cb_diskwrite(void *arg, int unit, uint64_t offset, void *src, size_t size, } static int -cb_diskioctl(void *arg, int unit, u_long cmd, void *data) +cb_diskioctl(void *arg __unused, int unit, u_long cmd, void *data) { struct stat sb; @@ -359,7 +359,7 @@ cb_diskioctl(void *arg, int unit, u_long cmd, void *data) * Guest virtual machine i/o callbacks */ static int -cb_copyin(void *arg, const void *from, uint64_t to, size_t size) +cb_copyin(void *arg __unused, const void *from, uint64_t to, size_t size) { char *ptr; @@ -374,7 +374,7 @@ cb_copyin(void *arg, const void *from, uint64_t to, size_t size) } static int -cb_copyout(void *arg, uint64_t from, void *to, size_t size) +cb_copyout(void *arg __unused, uint64_t from, void *to, size_t size) { char *ptr; @@ -389,7 +389,7 @@ cb_copyout(void *arg, uint64_t from, void *to, size_t size) } static void -cb_setreg(void *arg, int r, uint64_t v) +cb_setreg(void *arg __unused, int r, uint64_t v) { int error; enum vm_reg_name vmreg; @@ -418,7 +418,7 @@ cb_setreg(void *arg, int r, uint64_t v) } static void -cb_setmsr(void *arg, int r, uint64_t v) +cb_setmsr(void *arg __unused, int r, uint64_t v) { int error; enum vm_reg_name vmreg; @@ -446,7 +446,7 @@ cb_setmsr(void *arg, int r, uint64_t v) } static void -cb_setcr(void *arg, int r, uint64_t v) +cb_setcr(void *arg __unused, int r, uint64_t v) { int error; enum vm_reg_name vmreg; @@ -481,7 +481,7 @@ cb_setcr(void *arg, int r, uint64_t v) } static void -cb_setgdt(void *arg, uint64_t base, size_t size) +cb_setgdt(void *arg __unused, uint64_t base, size_t size) { int error; @@ -495,7 +495,7 @@ cb_setgdt(void *arg, uint64_t base, size_t size) } static void -cb_exec(void *arg, uint64_t rip) +cb_exec(void *arg __unused, uint64_t rip) { int error; @@ -518,14 +518,14 @@ cb_exec(void *arg, uint64_t rip) */ static void -cb_delay(void *arg, int usec) +cb_delay(void *arg __unused, int usec) { usleep(usec); } static void -cb_exit(void *arg, int v) +cb_exit(void *arg __unused, int v) { tcsetattr(consout_fd, TCSAFLUSH, &oldterm); @@ -533,7 +533,7 @@ cb_exit(void *arg, int v) } static void -cb_getmem(void *arg, uint64_t *ret_lowmem, uint64_t *ret_highmem) +cb_getmem(void *arg __unused, uint64_t *ret_lowmem, uint64_t *ret_highmem) { *ret_lowmem = vm_get_lowmem_size(ctx); @@ -548,17 +548,21 @@ struct env { static SLIST_HEAD(envhead, env) envhead; static void -addenv(char *str) +addenv(const char *str) { struct env *env; env = malloc(sizeof(struct env)); - env->str = str; + if (env == NULL) + err(EX_OSERR, "malloc"); + env->str = strdup(str); + if (env->str == NULL) + err(EX_OSERR, "strdup"); SLIST_INSERT_HEAD(&envhead, env, next); } static char * -cb_getenv(void *arg, int num) +cb_getenv(void *arg __unused, int num) { int i; struct env *env; @@ -574,22 +578,22 @@ cb_getenv(void *arg, int num) } static int -cb_vm_set_register(void *arg, int vcpu, int reg, uint64_t val) +cb_vm_set_register(void *arg __unused, int vcpu, int reg, uint64_t val) { return (vm_set_register(ctx, vcpu, reg, val)); } static int -cb_vm_set_desc(void *arg, int vcpu, int reg, uint64_t base, u_int limit, - u_int access) +cb_vm_set_desc(void *arg __unused, int vcpu, int reg, uint64_t base, + u_int limit, u_int access) { return (vm_set_desc(ctx, vcpu, reg, base, limit, access)); } static void -cb_swap_interpreter(void *arg, const char *interp_req) +cb_swap_interpreter(void *arg __unused, const char *interp_req) { /*