Date: Sat, 27 Dec 2008 14:38:45 -0800 From: Garrett Cooper <yanefbsd@gmail.com> To: Antoine Brodin <antoine@freebsd.org> Cc: "svn-src-head@freebsd.org" <svn-src-head@freebsd.org>, "svn-src-all@freebsd.org" <svn-src-all@freebsd.org>, "src-committers@freebsd.org" <src-committers@freebsd.org>, "ivoras@freebsd.org" <ivoras@freebsd.org> Subject: Re: svn commit: r186252 - head/sys/kern Message-ID: <9A8DD0DB-F5B1-4978-B4DB-5D7974F93DC3@gmail.com> In-Reply-To: <f19c444a0812271347p2aa102aq7cc4c6a40e8ce81b@mail.gmail.com> References: <200812171957.mBHJvCO2013765@svn.freebsd.org> <f19c444a0812270942m39d35ba8teb54943a7f76e@mail.gmail.com> <9bbcef730812271319g60e190acj4a68ee419edc7277@mail.gmail.com> <f19c444a0812271347p2aa102aq7cc4c6a40e8ce81b@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Dec 27, 2008, at 13:47, "Antoine Brodin" <antoine@freebsd.org> wrote: > On Sat, Dec 27, 2008 at 10:19 PM, <ivoras@freebsd.org> wrote: >> On 27/12/2008, Antoine Brodin <antoine@freebsd.org> wrote: >>> On Wed, Dec 17, 2008 at 8:57 PM, Ivan Voras <ivoras@freebsd.org> >>> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?9A8DD0DB-F5B1-4978-B4DB-5D7974F93DC3>