From owner-svn-src-head@FreeBSD.ORG Sat Dec 27 22:38:57 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 79454106564A; Sat, 27 Dec 2008 22:38:57 +0000 (UTC) (envelope-from yanefbsd@gmail.com) Received: from yx-out-2324.google.com (yx-out-2324.google.com [74.125.44.28]) by mx1.freebsd.org (Postfix) with ESMTP id D3BD68FC0C; Sat, 27 Dec 2008 22:38:56 +0000 (UTC) (envelope-from yanefbsd@gmail.com) Received: by yx-out-2324.google.com with SMTP id 8so2175384yxb.13 for ; Sat, 27 Dec 2008 14:38:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:references:message-id:from:to :in-reply-to:content-type:content-transfer-encoding:x-mailer :mime-version:subject:date:cc; bh=3ul4nnHwYOQYPyTH76APFAUNZTVVOEIrh5q6vo7kZi8=; b=XuxFeD0s2FJiuHBPxn0u9zuC1rEN2Lj7dneltLtF1S3u2zqTC/xF3QZa+MqDAt0zhH BazknOX7JiCWhGXF2RQlOlIl7uO19ThLPqKJvR2CYL9bmM22WZljL1MIFkr7u2YrSkT+ nh63D2kO3r1CcAaQ+IN4wYLDsQsLf1Pos9zig= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=references:message-id:from:to:in-reply-to:content-type :content-transfer-encoding:x-mailer:mime-version:subject:date:cc; b=m0DzAyb8TPzyeROTY7O9cyeClYu1YNMZKbSGsWAm9K8XWZY/YJ365OzE4e3+X8awjn oU5PBNfQqDwow7D/jyF0Yv0WeeYdnKrN3dfBKETZ938sOcpRLqBEcl0TcecjvdHx8x2Q HCQnOr/GDeChAjmDx72OHy6NmRcGQqJdf9ZEQ= Received: by 10.100.127.18 with SMTP id z18mr6992029anc.6.1230417536203; Sat, 27 Dec 2008 14:38:56 -0800 (PST) Received: from ?10.94.212.171? ([32.159.67.242]) by mx.google.com with ESMTPS id b29sm16393795ana.53.2008.12.27.14.38.52 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sat, 27 Dec 2008 14:38:55 -0800 (PST) References: <200812171957.mBHJvCO2013765@svn.freebsd.org> <9bbcef730812271319g60e190acj4a68ee419edc7277@mail.gmail.com> Message-Id: <9A8DD0DB-F5B1-4978-B4DB-5D7974F93DC3@gmail.com> From: Garrett Cooper To: Antoine Brodin In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit X-Mailer: iPhone Mail (5F136) Mime-Version: 1.0 (iPhone Mail 5F136) Date: Sat, 27 Dec 2008 14:38:45 -0800 Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" , "ivoras@freebsd.org" Subject: Re: svn commit: r186252 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Dec 2008 22:38:57 -0000 On Dec 27, 2008, at 13:47, "Antoine Brodin" wrote: > On Sat, Dec 27, 2008 at 10:19 PM, wrote: >> On 27/12/2008, Antoine Brodin wrote: >>> On Wed, Dec 17, 2008 at 8:57 PM, Ivan Voras >>> wrote: >> >>> Modified: head/sys/kern/subr_param.c >>> [snip] >>>> +enum VM_GUEST { VM_GUEST_NO, VM_GUEST_VM, VM_GUEST_XEN }; >>>> + >>> [snip] >>>> - hz = detect_virtual() ? HZ_VM : HZ; >>>> + hz = vm_guest > VM_GUEST_NO ? HZ_VM : HZ; >>> [snip] >>> >>> Hi Ivan, >>> >>> Could you change VM_GUEST_NO / VM_GUEST_VM / VM_GUEST_XEN to a >>> #define >>> or explicitly initialize them? >>> The magnitude comparison between vm_guest and VM_GUEST_NO looks like >>> gratuitous obfuscation. >> >> I think that the "enum" type is very well defined and its behaviour >> widely known so it is not necessary to break it into #defines. Would >> you be happy if I explicitly initalized the first member of the enum >> to signify its values are important? >> >> enum VM_GUEST { VM_GUEST_NO = 0, VM_GUEST_VM, VM_GUEST_XEN }; >> > > I would be happy if you initialized explicitly the 3 values. > You use these values as an index in the vm_guest_sysctl_names array > and you compare them in init_param1() so I think it's better to be > explicit. > > Cheers, > > Antoine Ivan's suggestion explicitly defines the first value and implicitly defines the next couple indices. Is there really anything more you're looking for in terms of coverage? -Garrett