From owner-svn-src-all@FreeBSD.ORG Sat Dec 27 21:47:48 2008 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 BB7B21065673; Sat, 27 Dec 2008 21:47:47 +0000 (UTC) (envelope-from antoine.brodin.freebsd@gmail.com) Received: from mail-bw0-f19.google.com (mail-bw0-f19.google.com [209.85.218.19]) by mx1.freebsd.org (Postfix) with ESMTP id 6B2308FC12; Sat, 27 Dec 2008 21:47:46 +0000 (UTC) (envelope-from antoine.brodin.freebsd@gmail.com) Received: by bwz12 with SMTP id 12so11482602bwz.19 for ; Sat, 27 Dec 2008 13:47:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:sender :to:subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references :x-google-sender-auth; bh=nqdDrYBr+kO4t05EsCMnhImjzRATS1MYDlQ8inxSFBE=; b=sai7vKO+N6isPVbvs/wTI/qGAsg+9xsF7bL2N1i5gZoH+TNVHGs1y3RB0l90ya0pDv kDHuEF9eeSt2qvU3H7r+5r2IxMFe9OH73zVw9y1ky0EXFVQ2ORBO+FqOklMWuVvmqbI8 vgrVl28Hry8bFBM4DpAnU2b0zjI2bluoBN3aY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references:x-google-sender-auth; b=hC44pU/2h9eL6kIxaMbETgoih7ZOad7jSX1UVYOZwjRUH9NPgNz7nj5RURcqJ7WtOt HVe1iDZRRK07hziU4OctNzay4NHIqMLq5IAkkcejflDRBU5RayotiE5VXM9aaqm9lM4Z Z5Fxoo7n6rYXkmc67m5WnnZwV0gc4hZvotKRM= Received: by 10.181.208.8 with SMTP id k8mr4528925bkq.128.1230414465247; Sat, 27 Dec 2008 13:47:45 -0800 (PST) Received: by 10.181.9.17 with HTTP; Sat, 27 Dec 2008 13:47:45 -0800 (PST) Message-ID: Date: Sat, 27 Dec 2008 22:47:45 +0100 From: "Antoine Brodin" Sender: antoine.brodin.freebsd@gmail.com To: ivoras@freebsd.org In-Reply-To: <9bbcef730812271319g60e190acj4a68ee419edc7277@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <200812171957.mBHJvCO2013765@svn.freebsd.org> <9bbcef730812271319g60e190acj4a68ee419edc7277@mail.gmail.com> X-Google-Sender-Auth: df4211453d1076a5 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@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: Sat, 27 Dec 2008 21:47:48 -0000 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