From owner-svn-src-all@FreeBSD.ORG Tue Jan 20 19:43:53 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C1357106566B; Tue, 20 Jan 2009 19:43:53 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 8FF6F8FC18; Tue, 20 Jan 2009 19:43:53 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (pool-98-109-39-197.nwrknj.fios.verizon.net [98.109.39.197]) by cyrus.watson.org (Postfix) with ESMTPSA id 23EC846B38; Tue, 20 Jan 2009 14:43:53 -0500 (EST) Received: from localhost (john@localhost [127.0.0.1]) (authenticated bits=0) by server.baldwin.cx (8.14.3/8.14.3) with ESMTP id n0KJhaUs026295; Tue, 20 Jan 2009 14:43:47 -0500 (EST) (envelope-from jhb@freebsd.org) From: John Baldwin To: "Antoine Brodin" Date: Tue, 20 Jan 2009 10:29:14 -0500 User-Agent: KMail/1.9.7 References: <200812171957.mBHJvCO2013765@svn.freebsd.org> <9bbcef730812271319g60e190acj4a68ee419edc7277@mail.gmail.com> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200901201029.14971.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [127.0.0.1]); Tue, 20 Jan 2009 14:43:47 -0500 (EST) X-Virus-Scanned: ClamAV 0.94.2/8881/Tue Jan 20 09:48:51 2009 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-4.1 required=4.2 tests=ALL_TRUSTED,AWL,BAYES_00, DATE_IN_PAST_03_06 autolearn=ham version=3.1.3 X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on server.baldwin.cx 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-all@freebsd.org X-Mailman-Version: 2.1.5 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, 20 Jan 2009 19:43:54 -0000 On Saturday 27 December 2008 4:47:45 pm 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. The definition of enum values is well defined in C. Thus, one should not be explicitly initializing all the values, and using > to compare enum values is perfectly acceptable. -- John Baldwin