Date: Tue, 26 Jan 2016 06:26:19 +0000 (UTC) From: Warner Losh <imp@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r294765 - in head/sys/boot: arm/at91/boot2 arm/ixp425/boot2 common efi/boot1 i386/boot2 i386/gptboot i386/zfsboot mips/beri/boot2 pc98/boot2 powerpc/boot1.chrp sparc64/boot1 Message-ID: <201601260626.u0Q6QJ0E003328@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: imp Date: Tue Jan 26 06:26:19 2016 New Revision: 294765 URL: https://svnweb.freebsd.org/changeset/base/294765 Log: Move all the separate copies of the same strings into paths.h. There's nothing machine specific about these. Differential Revision: https://reviews.freebsd.org/D5038 Added: head/sys/boot/common/paths.h (contents, props changed) Modified: head/sys/boot/arm/at91/boot2/boot2.c head/sys/boot/arm/ixp425/boot2/boot2.c head/sys/boot/efi/boot1/boot1.c head/sys/boot/i386/boot2/boot2.c head/sys/boot/i386/gptboot/gptboot.c head/sys/boot/i386/zfsboot/zfsboot.c head/sys/boot/mips/beri/boot2/boot2.c head/sys/boot/pc98/boot2/boot2.c head/sys/boot/powerpc/boot1.chrp/boot1.c head/sys/boot/sparc64/boot1/boot1.c Modified: head/sys/boot/arm/at91/boot2/boot2.c ============================================================================== --- head/sys/boot/arm/at91/boot2/boot2.c Tue Jan 26 06:05:55 2016 (r294764) +++ head/sys/boot/arm/at91/boot2/boot2.c Tue Jan 26 06:26:19 2016 (r294765) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2008 John Hay - * Copyright (c) 2006 Warner Losh + * Copyright (c) 2006 M Warner Losh <imp@freebsd.org> * Copyright (c) 1998 Robert Nordier * All rights reserved. * @@ -30,6 +30,7 @@ __FBSDID("$FreeBSD$"); #include "lib.h" #include "board.h" +#include "paths.h" #define RBX_ASKNAME 0x0 /* -a */ #define RBX_SINGLE 0x1 /* -s */ @@ -64,9 +65,7 @@ __FBSDID("$FreeBSD$"); OPT_SET(RBX_VERBOSE) | \ OPT_SET(RBX_GDB)) -#define PATH_DOTCONFIG "/boot.config" -#define PATH_CONFIG "/boot/config" -//#define PATH_KERNEL "/boot/kernel/kernel" +#undef PATH_KERNEL #define PATH_KERNEL "/boot/kernel/kernel.gz.tramp" extern uint32_t _end; Modified: head/sys/boot/arm/ixp425/boot2/boot2.c ============================================================================== --- head/sys/boot/arm/ixp425/boot2/boot2.c Tue Jan 26 06:05:55 2016 (r294764) +++ head/sys/boot/arm/ixp425/boot2/boot2.c Tue Jan 26 06:26:19 2016 (r294765) @@ -28,6 +28,7 @@ __FBSDID("$FreeBSD$"); #include <stdarg.h> #include "lib.h" +#include "paths.h" #define RBX_ASKNAME 0x0 /* -a */ #define RBX_SINGLE 0x1 /* -s */ @@ -62,10 +63,6 @@ __FBSDID("$FreeBSD$"); OPT_SET(RBX_VERBOSE) | \ OPT_SET(RBX_GDB)) -#define PATH_DOTCONFIG "/boot.config" -#define PATH_CONFIG "/boot/config" -#define PATH_KERNEL "/boot/kernel/kernel" - extern uint32_t _end; #define NOPT 6 Added: head/sys/boot/common/paths.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/boot/common/paths.h Tue Jan 26 06:26:19 2016 (r294765) @@ -0,0 +1,39 @@ +/*- + * Copyright (c) 2016 M. Warner Losh <imp@freebsd.org> + * All rights reserved. + * + * 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 AUTHORS 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 AUTHORS 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. + * + * $FreeBSD$ + */ + +#ifndef _PATHS_H_ +#define _PATHS_H_ + +#define PATH_DOTCONFIG "/boot.config" +#define PATH_CONFIG "/boot/config" +#define PATH_BOOT3 "/boot/loader" +#define PATH_LOADER "/boot/loader" +#define PATH_LOADER_EFI "/boot/loader.efi" +#define PATH_KERNEL "/boot/kernel/kernel" + +#endif /* _PATHS_H_ */ Modified: head/sys/boot/efi/boot1/boot1.c ============================================================================== --- head/sys/boot/efi/boot1/boot1.c Tue Jan 26 06:05:55 2016 (r294764) +++ head/sys/boot/efi/boot1/boot1.c Tue Jan 26 06:26:19 2016 (r294765) @@ -31,8 +31,7 @@ __FBSDID("$FreeBSD$"); #include <eficonsctl.h> #include "boot_module.h" - -#define _PATH_LOADER "/boot/loader.efi" +#include "paths.h" static const boot_module_t *boot_modules[] = { @@ -99,13 +98,13 @@ try_load(const boot_module_t *mod) EFI_LOADED_IMAGE *loaded_image; EFI_STATUS status; - status = mod->load(_PATH_LOADER, &dev, &buf, &bufsize); + status = mod->load(PATH_LOADER_EFI, &dev, &buf, &bufsize); if (status == EFI_NOT_FOUND) return; if (status != EFI_SUCCESS) { - printf("%s failed to load %s (%lu)\n", mod->name, _PATH_LOADER, - EFI_ERROR_CODE(status)); + printf("%s failed to load %s (%lu)\n", mod->name, + PATH_LOADER_EFI, EFI_ERROR_CODE(status)); return; } @@ -174,7 +173,7 @@ efi_main(EFI_HANDLE Ximage, EFI_SYSTEM_T conout->ClearScreen(conout); printf("\n>> FreeBSD EFI boot block\n"); - printf(" Loader path: %s\n\n", _PATH_LOADER); + printf(" Loader path: %s\n\n", PATH_LOADER_EFI); printf(" Initializing modules:"); for (i = 0; i < NUM_BOOT_MODULES; i++) { if (boot_modules[i] == NULL) Modified: head/sys/boot/i386/boot2/boot2.c ============================================================================== --- head/sys/boot/i386/boot2/boot2.c Tue Jan 26 06:05:55 2016 (r294764) +++ head/sys/boot/i386/boot2/boot2.c Tue Jan 26 06:26:19 2016 (r294765) @@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$"); #include "boot2.h" #include "lib.h" +#include "paths.h" /* Define to 0 to omit serial support */ #ifndef SERIAL @@ -87,11 +88,6 @@ __FBSDID("$FreeBSD$"); OPT_SET(RBX_GDB ) | OPT_SET(RBX_MUTE) | \ OPT_SET(RBX_PAUSE) | OPT_SET(RBX_DUAL)) -#define PATH_DOTCONFIG "/boot.config" -#define PATH_CONFIG "/boot/config" -#define PATH_BOOT3 "/boot/loader" -#define PATH_KERNEL "/boot/kernel/kernel" - #define ARGS 0x900 #define NOPT 14 #define NDEV 3 Modified: head/sys/boot/i386/gptboot/gptboot.c ============================================================================== --- head/sys/boot/i386/gptboot/gptboot.c Tue Jan 26 06:05:55 2016 (r294764) +++ head/sys/boot/i386/gptboot/gptboot.c Tue Jan 26 06:26:19 2016 (r294765) @@ -37,11 +37,7 @@ __FBSDID("$FreeBSD$"); #include "util.h" #include "cons.h" #include "gpt.h" - -#define PATH_DOTCONFIG "/boot.config" -#define PATH_CONFIG "/boot/config" -#define PATH_BOOT3 "/boot/loader" -#define PATH_KERNEL "/boot/kernel/kernel" +#include "paths.h" #define ARGS 0x900 #define NOPT 14 Modified: head/sys/boot/i386/zfsboot/zfsboot.c ============================================================================== --- head/sys/boot/i386/zfsboot/zfsboot.c Tue Jan 26 06:05:55 2016 (r294764) +++ head/sys/boot/i386/zfsboot/zfsboot.c Tue Jan 26 06:26:19 2016 (r294765) @@ -42,14 +42,10 @@ __FBSDID("$FreeBSD$"); #include "util.h" #include "cons.h" #include "bootargs.h" +#include "paths.h" #include "libzfs.h" -#define PATH_DOTCONFIG "/boot.config" -#define PATH_CONFIG "/boot/config" -#define PATH_BOOT3 "/boot/zfsloader" -#define PATH_KERNEL "/boot/kernel/kernel" - #define ARGS 0x900 #define NOPT 14 #define NDEV 3 Modified: head/sys/boot/mips/beri/boot2/boot2.c ============================================================================== --- head/sys/boot/mips/beri/boot2/boot2.c Tue Jan 26 06:05:55 2016 (r294764) +++ head/sys/boot/mips/beri/boot2/boot2.c Tue Jan 26 06:26:19 2016 (r294765) @@ -64,6 +64,8 @@ __FBSDID("$FreeBSD$"); #include <mips.h> #include <sdcard.h> +#include "paths.h" + static int beri_argc; static const char **beri_argv, **beri_envv; static uint64_t beri_memsize; @@ -108,11 +110,6 @@ static uint64_t beri_memsize; OPT_SET(RBX_GDB ) | OPT_SET(RBX_MUTE) | \ OPT_SET(RBX_PAUSE) | OPT_SET(RBX_DUAL)) -#define PATH_DOTCONFIG "/boot.config" -#define PATH_CONFIG "/boot/config" -#define PATH_BOOT3 "/boot/loader" -#define PATH_KERNEL "/boot/kernel/kernel" - #define ARGS 0x900 #define NOPT 14 #define MEM_BASE 0x12 Modified: head/sys/boot/pc98/boot2/boot2.c ============================================================================== --- head/sys/boot/pc98/boot2/boot2.c Tue Jan 26 06:05:55 2016 (r294764) +++ head/sys/boot/pc98/boot2/boot2.c Tue Jan 26 06:26:19 2016 (r294765) @@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$"); #include "boot2.h" #include "lib.h" +#include "paths.h" /* Define to 0 to omit serial support */ #ifndef SERIAL @@ -89,11 +90,6 @@ __FBSDID("$FreeBSD$"); OPT_SET(RBX_GDB ) | OPT_SET(RBX_MUTE) | \ OPT_SET(RBX_PAUSE) | OPT_SET(RBX_DUAL)) -#define PATH_DOTCONFIG "/boot.config" -#define PATH_CONFIG "/boot/config" -#define PATH_BOOT3 "/boot/loader" -#define PATH_KERNEL "/boot/kernel/kernel" - #define ARGS 0x900 #define NOPT 14 #define NDEV 3 Modified: head/sys/boot/powerpc/boot1.chrp/boot1.c ============================================================================== --- head/sys/boot/powerpc/boot1.chrp/boot1.c Tue Jan 26 06:05:55 2016 (r294764) +++ head/sys/boot/powerpc/boot1.chrp/boot1.c Tue Jan 26 06:26:19 2016 (r294765) @@ -23,8 +23,7 @@ __FBSDID("$FreeBSD$"); #include <machine/elf.h> #include <machine/stdarg.h> -#define _PATH_LOADER "/boot/loader" -#define _PATH_KERNEL "/boot/kernel/kernel" +#include "paths.h" #define BSIZEMAX 16384 @@ -396,7 +395,7 @@ main(int ac, char **av) char bootpath_full[255]; int i, len; - path = _PATH_LOADER; + path = PATH_LOADER; for (i = 0; i < ac; i++) { switch (av[i][0]) { case '-': Modified: head/sys/boot/sparc64/boot1/boot1.c ============================================================================== --- head/sys/boot/sparc64/boot1/boot1.c Tue Jan 26 06:05:55 2016 (r294764) +++ head/sys/boot/sparc64/boot1/boot1.c Tue Jan 26 06:26:19 2016 (r294765) @@ -24,8 +24,8 @@ __FBSDID("$FreeBSD$"); #include <machine/elf.h> #include <machine/stdarg.h> -#define _PATH_LOADER "/boot/loader" -#define _PATH_KERNEL "/boot/kernel/kernel" +#include "paths.h" + #define READ_BUF_SIZE 8192 typedef int putc_func_t(char c, void *arg); @@ -324,7 +324,7 @@ main(int ac, char **av) const char *path; int i; - path = _PATH_LOADER; + path = PATH_LOADER; for (i = 0; i < ac; i++) { switch (av[i][0]) { case '-':
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201601260626.u0Q6QJ0E003328>