subr_boot.c (59588a546f55523d6fd37ab42eb08b719311d7d6) subr_boot.c (9d6ae1e3c26a0c3334a268b587f17dccb9a503d7)
1/*-
2 * SPDX-License-Identifier: BSD-2-Clause
3 *
4 * Copyright (c) 1998 Michael Smith <msmith@freebsd.org>
5 * All Rights Reserved.
6 * Copyright (c) 1998 Robert Nordier
7 * All Rights Reserved.
8 * Copyright (c) 2009, Oleksandr Tymoshenko <gonzo@FreeBSD.org>

--- 34 unchanged lines hidden (view full) ---

43#include <sys/param.h>
44#ifdef _KERNEL
45#include <sys/systm.h>
46#else
47#include <stand.h>
48#endif
49#include <sys/reboot.h>
50#include <sys/boot.h>
1/*-
2 * SPDX-License-Identifier: BSD-2-Clause
3 *
4 * Copyright (c) 1998 Michael Smith <msmith@freebsd.org>
5 * All Rights Reserved.
6 * Copyright (c) 1998 Robert Nordier
7 * All Rights Reserved.
8 * Copyright (c) 2009, Oleksandr Tymoshenko <gonzo@FreeBSD.org>

--- 34 unchanged lines hidden (view full) ---

43#include <sys/param.h>
44#ifdef _KERNEL
45#include <sys/systm.h>
46#else
47#include <stand.h>
48#endif
49#include <sys/reboot.h>
50#include <sys/boot.h>
51#include <sys/tslog.h>
51
52#ifdef _KERNEL
53#define SETENV(k, v) kern_setenv(k, v)
54#define GETENV(k) kern_getenv(k)
55#define FREE(v) freeenv(v)
56#else /* Boot loader */
57#define SETENV(k, v) setenv(k, v, 1)
58#define GETENV(k) getenv(k)

--- 31 unchanged lines hidden (view full) ---

90 * @brief convert the env vars in howto_names into a howto mask
91 */
92int
93boot_env_to_howto(void)
94{
95 int i, howto;
96 char *val;
97
52
53#ifdef _KERNEL
54#define SETENV(k, v) kern_setenv(k, v)
55#define GETENV(k) kern_getenv(k)
56#define FREE(v) freeenv(v)
57#else /* Boot loader */
58#define SETENV(k, v) setenv(k, v, 1)
59#define GETENV(k) getenv(k)

--- 31 unchanged lines hidden (view full) ---

91 * @brief convert the env vars in howto_names into a howto mask
92 */
93int
94boot_env_to_howto(void)
95{
96 int i, howto;
97 char *val;
98
99 TSENTER();
98 for (howto = 0, i = 0; howto_names[i].ev != NULL; i++) {
99 val = GETENV(howto_names[i].ev);
100 if (val != NULL && strcasecmp(val, "no") != 0)
101 howto |= howto_names[i].mask;
102 FREE(val);
103 }
100 for (howto = 0, i = 0; howto_names[i].ev != NULL; i++) {
101 val = GETENV(howto_names[i].ev);
102 if (val != NULL && strcasecmp(val, "no") != 0)
103 howto |= howto_names[i].mask;
104 FREE(val);
105 }
106 TSEXIT();
104 return (howto);
105}
106
107/**
108 * @brief Set env vars from howto_names based on howto passed in
109 */
110void
111boot_howto_to_env(int howto)

--- 76 unchanged lines hidden (view full) ---

188 * @brief breakup the command line into args, and pass to boot_parse_arg
189 */
190int
191boot_parse_cmdline_delim(char *cmdline, const char *delim)
192{
193 char *v;
194 int howto;
195
107 return (howto);
108}
109
110/**
111 * @brief Set env vars from howto_names based on howto passed in
112 */
113void
114boot_howto_to_env(int howto)

--- 76 unchanged lines hidden (view full) ---

191 * @brief breakup the command line into args, and pass to boot_parse_arg
192 */
193int
194boot_parse_cmdline_delim(char *cmdline, const char *delim)
195{
196 char *v;
197 int howto;
198
199 TSENTER();
196 howto = 0;
197 while ((v = strsep(&cmdline, delim)) != NULL) {
198 if (*v == '\0')
199 continue;
200 howto |= boot_parse_arg(v);
201 }
200 howto = 0;
201 while ((v = strsep(&cmdline, delim)) != NULL) {
202 if (*v == '\0')
203 continue;
204 howto |= boot_parse_arg(v);
205 }
206 TSEXIT();
202 return (howto);
203}
204
205/**
206 * @brief Simplified interface for common 'space or tab separated' args
207 */
208int
209boot_parse_cmdline(char *cmdline)

--- 18 unchanged lines hidden ---
207 return (howto);
208}
209
210/**
211 * @brief Simplified interface for common 'space or tab separated' args
212 */
213int
214boot_parse_cmdline(char *cmdline)

--- 18 unchanged lines hidden ---