Don't use the C preprocessor to configure USERCONF. Instead, either do

or do not link in subr_userconf.c and x86_userconf.c.

Provide no-op stubs for userconf_bootinfo(), userconf_init(), and
userconf_prompt().

Delete all occurrences of #include "opt_userconf.h" as well as USERCONF
and __HAVE_USERCONF_BOOTINFO #ifdef'age.
This commit is contained in:
dyoung 2011-05-31 23:28:52 +00:00
parent 299044f0e0
commit 0840f9ccfc
8 changed files with 78 additions and 55 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: files.x86,v 1.67 2011/04/10 20:36:48 christos Exp $
# $NetBSD: files.x86,v 1.68 2011/05/31 23:28:52 dyoung Exp $
# options for MP configuration through the MP spec
defflag opt_mpbios.h MPBIOS MPVERBOSE MPDEBUG MPBIOS_SCANPCI
@ -85,6 +85,7 @@ file arch/x86/x86/sys_machdep.c
file arch/x86/x86/syscall.c
file arch/x86/x86/vm_machdep.c
file arch/x86/x86/x86_autoconf.c
file arch/x86/x86/x86_userconf.c userconf
file arch/x86/x86/x86_machdep.c
define lapic

View File

@ -1,4 +1,4 @@
/* $NetBSD: cpu.h,v 1.33 2011/05/26 04:25:28 uebayasi Exp $ */
/* $NetBSD: cpu.h,v 1.34 2011/05/31 23:28:52 dyoung Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@ -439,8 +439,6 @@ void x86_bus_space_mallocok(void);
#include <machine/psl.h> /* Must be after struct cpu_info declaration */
#define __HAVE_USERCONF_BOOTINFO
#endif /* _KERNEL || __KMEMUSER */
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: x86_machdep.c,v 1.49 2011/05/26 16:38:57 para Exp $ */
/* $NetBSD: x86_machdep.c,v 1.50 2011/05/31 23:28:53 dyoung Exp $ */
/*-
* Copyright (c) 2002, 2006, 2007 YAMAMOTO Takashi,
@ -31,12 +31,11 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: x86_machdep.c,v 1.49 2011/05/26 16:38:57 para Exp $");
__KERNEL_RCSID(0, "$NetBSD: x86_machdep.c,v 1.50 2011/05/31 23:28:53 dyoung Exp $");
#include "opt_modular.h"
#include "opt_physmem.h"
#include "opt_splash.h"
#include "opt_userconf.h"
#include <sys/types.h>
#include <sys/param.h>
@ -52,10 +51,6 @@ __KERNEL_RCSID(0, "$NetBSD: x86_machdep.c,v 1.49 2011/05/26 16:38:57 para Exp $"
#include <sys/sysctl.h>
#include <sys/extent.h>
#if defined(USERCONF)
#include <sys/userconf.h>
#endif /* defined(USERCONF) */
#include <x86/cpuvar.h>
#include <x86/cputypes.h>
#include <x86/machdep.h>
@ -182,28 +177,6 @@ module_init_md(void)
}
#endif /* MODULAR */
#if defined(USERCONF)
void
userconf_bootinfo(void)
{
struct btinfo_userconfcommands *biuc;
struct bi_userconfcommand *bi, *bimax;
biuc = lookup_bootinfo(BTINFO_USERCONFCOMMANDS);
if (biuc == NULL) {
aprint_debug("No bootinfo commands at boot\n");
return;
}
bi = (struct bi_userconfcommand *)((uint8_t *)biuc + sizeof(*biuc));
bimax = bi + biuc->num;
for (; bi < bimax; bi++) {
aprint_debug("Processing userconf command: %s\n", bi->text);
userconf_parse(bi->text);
}
}
#endif /* defined (USERCONF) */
void
cpu_need_resched(struct cpu_info *ci, int flags)
{

View File

@ -0,0 +1,61 @@
/* $NetBSD: x86_userconf.c,v 1.1 2011/05/31 23:28:53 dyoung Exp $ */
/*-
* Copyright (c) 2005, 2008, 2009, 2011 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Julio M. Merino Vidal.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: x86_userconf.c,v 1.1 2011/05/31 23:28:53 dyoung Exp $");
#include <sys/types.h>
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/userconf.h>
#include <machine/bootinfo.h>
void
userconf_bootinfo(void)
{
struct btinfo_userconfcommands *biuc;
struct bi_userconfcommand *bi, *bimax;
biuc = lookup_bootinfo(BTINFO_USERCONFCOMMANDS);
if (biuc == NULL) {
aprint_debug("No bootinfo commands at boot\n");
return;
}
bi = (struct bi_userconfcommand *)((uint8_t *)biuc + sizeof(*biuc));
bimax = bi + biuc->num;
for (; bi < bimax; bi++) {
aprint_debug("Processing userconf command: %s\n", bi->text);
userconf_parse(bi->text);
}
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: init_main.c,v 1.430 2011/05/26 04:25:26 uebayasi Exp $ */
/* $NetBSD: init_main.c,v 1.431 2011/05/31 23:28:53 dyoung Exp $ */
/*-
* Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@ -97,7 +97,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.430 2011/05/26 04:25:26 uebayasi Exp $");
__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.431 2011/05/31 23:28:53 dyoung Exp $");
#include "opt_ddb.h"
#include "opt_ipsec.h"
@ -240,12 +240,7 @@ __KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.430 2011/05/26 04:25:26 uebayasi Exp
struct timeval50 boottime50;
#endif
#ifdef _KERNEL_OPT
#include "opt_userconf.h"
#endif
#ifdef USERCONF
#include <sys/userconf.h>
#endif
extern struct lwp lwp0;
extern time_t rootfstime;
@ -728,11 +723,9 @@ configure(void)
drvctl_init();
#endif
#ifdef USERCONF
userconf_init();
if (boothowto & RB_USERCONF)
userconf_prompt();
#endif
if ((boothowto & (AB_SILENT|AB_VERBOSE)) == AB_SILENT) {
printf_nolog("Detecting hardware...");

View File

@ -1,4 +1,4 @@
/* $NetBSD: kern_stub.c,v 1.31 2011/04/27 00:00:46 joerg Exp $ */
/* $NetBSD: kern_stub.c,v 1.32 2011/05/31 23:28:53 dyoung Exp $ */
/*-
* Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
@ -62,7 +62,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: kern_stub.c,v 1.31 2011/04/27 00:00:46 joerg Exp $");
__KERNEL_RCSID(0, "$NetBSD: kern_stub.c,v 1.32 2011/05/31 23:28:53 dyoung Exp $");
#include "opt_ptrace.h"
#include "opt_ktrace.h"
@ -79,6 +79,7 @@ __KERNEL_RCSID(0, "$NetBSD: kern_stub.c,v 1.31 2011/04/27 00:00:46 joerg Exp $")
#include <sys/cpu.h>
#include <sys/module.h>
#include <sys/bus.h>
#include <sys/userconf.h>
bool default_bus_space_is_equal(bus_space_tag_t, bus_space_tag_t);
@ -130,6 +131,9 @@ __weak_alias(pci_chipset_tag_destroy, voidop);
__weak_alias(bus_space_tag_create, eopnotsupp);
__weak_alias(bus_space_tag_destroy, voidop);
__weak_alias(bus_space_is_equal, default_bus_space_is_equal);
__weak_alias(userconf_bootinfo, voidop);
__weak_alias(userconf_init, voidop);
__weak_alias(userconf_prompt, voidop);
__weak_alias(kobj_renamespace, nullop);

View File

@ -1,4 +1,4 @@
/* $NetBSD: subr_userconf.c,v 1.23 2011/05/26 04:25:27 uebayasi Exp $ */
/* $NetBSD: subr_userconf.c,v 1.24 2011/05/31 23:28:53 dyoung Exp $ */
/*
* Copyright (c) 1996 Mats O Jansson <moj@stacken.kth.se>
@ -29,9 +29,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: subr_userconf.c,v 1.23 2011/05/26 04:25:27 uebayasi Exp $");
#include "opt_userconf.h"
__KERNEL_RCSID(0, "$NetBSD: subr_userconf.c,v 1.24 2011/05/31 23:28:53 dyoung Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -95,9 +93,7 @@ userconf_init(void)
userconf_maxdev = i - 1;
userconf_totdev = i - 1;
#ifdef __HAVE_USERCONF_BOOTINFO
userconf_bootinfo();
#endif
}
static int

View File

@ -1,4 +1,4 @@
/* $NetBSD: userconf.h,v 1.6 2011/05/26 04:25:27 uebayasi Exp $ */
/* $NetBSD: userconf.h,v 1.7 2011/05/31 23:28:53 dyoung Exp $ */
/*-
* Copyright (c) 2001, 2009 The NetBSD Foundation, Inc.
@ -31,12 +31,9 @@
#include <sys/cpu.h>
void userconf_bootinfo(void);
void userconf_init(void);
void userconf_prompt(void);
int userconf_parse(char *);
#ifdef __HAVE_USERCONF_BOOTINFO
void userconf_bootinfo(void);
#endif
#endif /* !_SYS_USERCONF_H_ */