Date: Tue, 27 Mar 2018 18:30:25 +1100 (EST) From: Bruce Evans <brde@optusnet.com.au> To: Jeff Roberson <jeff@freebsd.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r331605 - head/sys/vm Message-ID: <20180327173756.A876@besplex.bde.org> In-Reply-To: <201803270327.w2R3R2f9030318@repo.freebsd.org> References: <201803270327.w2R3R2f9030318@repo.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 27 Mar 2018, Jeff Roberson wrote: > Log: > Move vm_ndomains to vm.h where it can be used with a single header include > rather than requiring a half-dozen. Many non-vm files may want to know > the number of valid domains. Shouldn't it go in vm_extern.h? What is the point of having vm_extern.h if you don't declare extern variables in it? Well, vm_extern.h contains (implicitly extern) prototypes but no externs variables , so the main style bugs are actually its name and having prototypes in vm.h instead if in vm_extern.h. Extern variables should probably go in vm_extern.h too, leaving only central type definitions and macros in vm.h, and vm_extern.h should have been named vm_var.h. There are mounds of other style bugs in vm.h and vm_extern.h. vm.h was almost correct in FreeBSD-4. Then it had no prototypes, no namespace pollution, and only minor style bugs like naming its include guard VM_H (which is not namespace pollution since VM_* is reserved for other reasons). > Modified: head/sys/vm/vm.h > ============================================================================== > --- head/sys/vm/vm.h Tue Mar 27 01:02:42 2018 (r331604) > +++ head/sys/vm/vm.h Tue Mar 27 03:27:02 2018 (r331605) > @@ -148,6 +148,8 @@ extern void vm_ksubmap_init(struct kva_md_info *); > > extern int old_mlock; This is especially gratuitous namespace pollution. The obj* names at least have something to do with vm. > > +extern int vm_ndomains; > + > struct ucred; > int swap_reserve(vm_ooffset_t incr); > int swap_reserve_by_cred(vm_ooffset_t incr, struct ucred *cred); swap_* also has something to do with vm, but needs a vm_ prefix more for exporting out of vm. Kernel prototypes don't belong here. One reason they are supposed to be in vm_extern.h is to keep them out of here so that userland can include this without getting kernel prototypes and/or so this file doesn't need so many ifdefs. Parameter names in prototypes are documented as being kernel style in style(9), but this is a bug in style(9). This is optional, and old vm prototypes in vm_extern.h don't do it. Bruce
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20180327173756.A876>