From owner-svn-src-all@FreeBSD.ORG Tue Nov 12 20:13:11 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9E292F96; Tue, 12 Nov 2013 20:13:11 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 8CE1E2294; Tue, 12 Nov 2013 20:13:11 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rACKDBuE090545; Tue, 12 Nov 2013 20:13:11 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id rACKDBTx090543; Tue, 12 Nov 2013 20:13:11 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201311122013.rACKDBTx090543@svn.freebsd.org> From: Sergey Kandaurov Date: Tue, 12 Nov 2013 20:13:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r258069 - in head/sys: kern sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Nov 2013 20:13:11 -0000 Author: pluknet Date: Tue Nov 12 20:13:10 2013 New Revision: 258069 URL: http://svnweb.freebsd.org/changeset/base/258069 Log: Add VM_LAST, a special last element in enum VM_GUEST and use it in CTASSERT to ensure that vm_guest range is covered by vm_guest_sysctl_names. Suggested by: mjg Modified: head/sys/kern/subr_param.c head/sys/sys/systm.h Modified: head/sys/kern/subr_param.c ============================================================================== --- head/sys/kern/subr_param.c Tue Nov 12 20:00:51 2013 (r258068) +++ head/sys/kern/subr_param.c Tue Nov 12 20:13:10 2013 (r258069) @@ -156,6 +156,7 @@ static const char *const vm_guest_sysctl "hv", NULL }; +CTASSERT(nitems(vm_guest_sysctl_names) - 1 == VM_LAST); #ifndef XEN static const char *const vm_bnames[] = { Modified: head/sys/sys/systm.h ============================================================================== --- head/sys/sys/systm.h Tue Nov 12 20:00:51 2013 (r258068) +++ head/sys/sys/systm.h Tue Nov 12 20:13:10 2013 (r258069) @@ -72,7 +72,8 @@ extern int vm_guest; /* Running as virt * ever implemented (e.g. vendor-specific paravirtualization features). * Keep in sync with vm_guest_sysctl_names[]. */ -enum VM_GUEST { VM_GUEST_NO = 0, VM_GUEST_VM, VM_GUEST_XEN, VM_GUEST_HV }; +enum VM_GUEST { VM_GUEST_NO = 0, VM_GUEST_VM, VM_GUEST_XEN, VM_GUEST_HV, + VM_LAST }; #if defined(WITNESS) || defined(INVARIANTS) void kassert_panic(const char *fmt, ...) __printflike(1, 2);