From owner-dev-commits-src-branches@freebsd.org Mon Aug 2 19:01:29 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 11EB16792C8; Mon, 2 Aug 2021 19:01:29 +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 4GdnRD6jR3z4qsf; Mon, 2 Aug 2021 19:01:28 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 C4AC1249C9; Mon, 2 Aug 2021 19:01:28 +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 172J1SOj088596; Mon, 2 Aug 2021 19:01:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 172J1SI6088577; Mon, 2 Aug 2021 19:01:28 GMT (envelope-from git) Date: Mon, 2 Aug 2021 19:01:28 GMT Message-Id: <202108021901.172J1SI6088577@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 225d3b0771d8 - stable/13 - libvmmapi: Fix warnings and stop overridding WARNS 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 225d3b0771d895a7b101e9349cf607ed86c06f6a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Aug 2021 19:01:29 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=225d3b0771d895a7b101e9349cf607ed86c06f6a commit 225d3b0771d895a7b101e9349cf607ed86c06f6a Author: Mark Johnston AuthorDate: 2021-07-26 20:40:16 +0000 Commit: Mark Johnston CommitDate: 2021-08-02 19:01:02 +0000 libvmmapi: Fix warnings and stop overridding WARNS - Avoid shadowing the global optarg. - Sprinkle __unused. - Cast nitems() to int. - Fix sign in vm_copy_setup(). Reviewed by: grehan Sponsored by: The FreeBSD Foundation (cherry picked from commit 45cd18ec73dcd262612898bf1a263cacde17d348) --- lib/libvmmapi/Makefile | 2 -- lib/libvmmapi/vmmapi.c | 34 +++++++++++++++++----------------- 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/lib/libvmmapi/Makefile b/lib/libvmmapi/Makefile index bf17566a0d7d..9c410833e09c 100644 --- a/lib/libvmmapi/Makefile +++ b/lib/libvmmapi/Makefile @@ -5,8 +5,6 @@ LIB= vmmapi SRCS= vmmapi.c vmmapi_freebsd.c INCS= vmmapi.h -WARNS?= 2 - LIBADD= util CFLAGS+= -I${.CURDIR} diff --git a/lib/libvmmapi/vmmapi.c b/lib/libvmmapi/vmmapi.c index 5810274c9a73..0543c92f4300 100644 --- a/lib/libvmmapi/vmmapi.c +++ b/lib/libvmmapi/vmmapi.c @@ -111,7 +111,7 @@ vm_create(const char *name) /* Try to load vmm(4) module before creating a guest. */ if (modfind("vmm") < 0) kldload("vmm"); - return (CREATE((char *)name)); + return (CREATE(name)); } struct vmctx * @@ -153,14 +153,14 @@ vm_destroy(struct vmctx *vm) } int -vm_parse_memsize(const char *optarg, size_t *ret_memsize) +vm_parse_memsize(const char *opt, size_t *ret_memsize) { char *endptr; size_t optval; int error; - optval = strtoul(optarg, &endptr, 0); - if (*optarg != '\0' && *endptr == '\0') { + optval = strtoul(opt, &endptr, 0); + if (*opt != '\0' && *endptr == '\0') { /* * For the sake of backward compatibility if the memory size * specified on the command line is less than a megabyte then @@ -171,7 +171,7 @@ vm_parse_memsize(const char *optarg, size_t *ret_memsize) *ret_memsize = optval; error = 0; } else - error = expand_number(optarg, ret_memsize); + error = expand_number(opt, ret_memsize); return (error); } @@ -729,7 +729,7 @@ vm_inject_exception(struct vmctx *ctx, int vcpu, int vector, int errcode_valid, } int -vm_apicid2vcpu(struct vmctx *ctx, int apicid) +vm_apicid2vcpu(struct vmctx *ctx __unused, int apicid) { /* * The apic id associated with the 'vcpu' has the same numerical value @@ -907,7 +907,7 @@ vm_capability_name2type(const char *capname) { int i; - for (i = 0; i < nitems(capstrmap); i++) { + for (i = 0; i < (int)nitems(capstrmap); i++) { if (strcmp(capstrmap[i], capname) == 0) return (i); } @@ -918,7 +918,7 @@ vm_capability_name2type(const char *capname) const char * vm_capability_type2name(int type) { - if (type >= 0 && type < nitems(capstrmap)) + if (type >= 0 && type < (int)nitems(capstrmap)) return (capstrmap[type]); return (NULL); @@ -1366,8 +1366,8 @@ vm_copy_setup(struct vmctx *ctx, int vcpu, struct vm_guest_paging *paging, int *fault) { void *va; - uint64_t gpa; - int error, i, n, off; + uint64_t gpa, off; + int error, i, n; for (i = 0; i < iovcnt; i++) { iov[i].iov_base = 0; @@ -1381,7 +1381,7 @@ vm_copy_setup(struct vmctx *ctx, int vcpu, struct vm_guest_paging *paging, return (error); off = gpa & PAGE_MASK; - n = min(len, PAGE_SIZE - off); + n = MIN(len, PAGE_SIZE - off); va = vm_map_gpa(ctx, gpa, n); if (va == NULL) @@ -1399,14 +1399,14 @@ vm_copy_setup(struct vmctx *ctx, int vcpu, struct vm_guest_paging *paging, } void -vm_copy_teardown(struct vmctx *ctx, int vcpu, struct iovec *iov, int iovcnt) +vm_copy_teardown(struct vmctx *ctx __unused, int vcpu __unused, + struct iovec *iov __unused, int iovcnt __unused) { - - return; } void -vm_copyin(struct vmctx *ctx, int vcpu, struct iovec *iov, void *vp, size_t len) +vm_copyin(struct vmctx *ctx __unused, int vcpu __unused, struct iovec *iov, + void *vp, size_t len) { const char *src; char *dst; @@ -1426,8 +1426,8 @@ vm_copyin(struct vmctx *ctx, int vcpu, struct iovec *iov, void *vp, size_t len) } void -vm_copyout(struct vmctx *ctx, int vcpu, const void *vp, struct iovec *iov, - size_t len) +vm_copyout(struct vmctx *ctx __unused, int vcpu __unused, const void *vp, + struct iovec *iov, size_t len) { const char *src; char *dst;