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 _______________________________________________ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"