From owner-svn-src-all@freebsd.org Tue Mar 27 07:30:35 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 24BA0F594A1; Tue, 27 Mar 2018 07:30:35 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail109.syd.optusnet.com.au (mail109.syd.optusnet.com.au [211.29.132.80]) by mx1.freebsd.org (Postfix) with ESMTP id 97188734FD; Tue, 27 Mar 2018 07:30:34 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail109.syd.optusnet.com.au (Postfix) with ESMTPS id 843A3D76207; Tue, 27 Mar 2018 18:30:26 +1100 (AEDT) Date: Tue, 27 Mar 2018 18:30:25 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Jeff Roberson cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r331605 - head/sys/vm In-Reply-To: <201803270327.w2R3R2f9030318@repo.freebsd.org> Message-ID: <20180327173756.A876@besplex.bde.org> References: <201803270327.w2R3R2f9030318@repo.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=VJytp5HX c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=0HglesBrfFw4nKaTcNAA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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, 27 Mar 2018 07:30:35 -0000 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