svn commit: r246301 - head/sys/kern

Bruce Evans brde at optusnet.com.au
Mon Feb 4 05:16:41 UTC 2013


On Sun, 3 Feb 2013, Marius Strobl wrote:

> Log:
>  Further improve r242655 and supply VM_{MIN,MAX}_KERNEL_ADDRESS as constant
>  values to SYSCTL_ULONG(9) where possible.
>
>  Submitted by:	bde

> Modified: head/sys/kern/kern_malloc.c
> ==============================================================================
> --- head/sys/kern/kern_malloc.c	Sun Feb  3 21:30:29 2013	(r246300)
> +++ head/sys/kern/kern_malloc.c	Sun Feb  3 21:43:55 2013	(r246301)
> @@ -186,15 +186,16 @@ struct {
>  */
> static uma_zone_t mt_zone;
>
> -static vm_offset_t vm_min_kernel_address = VM_MIN_KERNEL_ADDRESS;
> -SYSCTL_ULONG(_vm, OID_AUTO, min_kernel_address, CTLFLAG_RD,
> -    &vm_min_kernel_address, 0, "Min kernel address");
> +SYSCTL_ULONG(_vm, OID_AUTO, min_kernel_address, CTLFLAG_RD, NULL,
> +    VM_MIN_KERNEL_ADDRESS, "Min kernel address");

SYSCTL_*() (except SYSCTL_PROC()) is conventionally split after
CTLFLAG* (to highlight the usual value pointer).  This does a
different splitting, presumably to highlight the value non-pointer.
I'm not sure that that is maintainable.  The convention for the
usual case is often not followed.

>
> +SYSCTL_ULONG(_vm, OID_AUTO, max_kernel_address, CTLFLAG_RD,
> #ifndef __sparc64__
> -static vm_offset_t vm_max_kernel_address = VM_MAX_KERNEL_ADDRESS;
> +    NULL, VM_MAX_KERNEL_ADDRESS,
> +#else
> +    &vm_max_kernel_address, 0,
> #endif
> -SYSCTL_ULONG(_vm, OID_AUTO, max_kernel_address, CTLFLAG_RD,
> -    &vm_max_kernel_address, 0, "Max kernel address");
> +    "Max kernel address");

I barely remember mentioning that.

MD macros in general could in theory be any expression (say a function
call), but if these ones were non-constant expressions then they
wouldn't have worked in the old code either.

Bruce


More information about the svn-src-head mailing list