bootstrap.h revision 1.4.6.2 1 1.4.6.2 rpaulo /* $NetBSD: bootstrap.h,v 1.4.6.2 2006/09/09 02:40:39 rpaulo Exp $ */
2 1.4.6.2 rpaulo
3 1.4.6.2 rpaulo /*-
4 1.4.6.2 rpaulo * Copyright (c) 1998 Michael Smith <msmith (at) freebsd.org>
5 1.4.6.2 rpaulo * All rights reserved.
6 1.4.6.2 rpaulo *
7 1.4.6.2 rpaulo * Redistribution and use in source and binary forms, with or without
8 1.4.6.2 rpaulo * modification, are permitted provided that the following conditions
9 1.4.6.2 rpaulo * are met:
10 1.4.6.2 rpaulo * 1. Redistributions of source code must retain the above copyright
11 1.4.6.2 rpaulo * notice, this list of conditions and the following disclaimer.
12 1.4.6.2 rpaulo * 2. Redistributions in binary form must reproduce the above copyright
13 1.4.6.2 rpaulo * notice, this list of conditions and the following disclaimer in the
14 1.4.6.2 rpaulo * documentation and/or other materials provided with the distribution.
15 1.4.6.2 rpaulo *
16 1.4.6.2 rpaulo * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17 1.4.6.2 rpaulo * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 1.4.6.2 rpaulo * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 1.4.6.2 rpaulo * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20 1.4.6.2 rpaulo * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 1.4.6.2 rpaulo * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 1.4.6.2 rpaulo * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 1.4.6.2 rpaulo * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 1.4.6.2 rpaulo * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 1.4.6.2 rpaulo * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 1.4.6.2 rpaulo * SUCH DAMAGE.
27 1.4.6.2 rpaulo *
28 1.4.6.2 rpaulo * $FreeBSD: src/sys/boot/common/bootstrap.h,v 1.38.6.1 2004/09/03 19:25:40 iedowse Exp $
29 1.4.6.2 rpaulo */
30 1.4.6.2 rpaulo
31 1.4.6.2 rpaulo #ifndef _BOOTSTRAP_H_
32 1.4.6.2 rpaulo #define _BOOTSTRAP_H_
33 1.4.6.2 rpaulo
34 1.4.6.2 rpaulo #include <sys/types.h>
35 1.4.6.2 rpaulo #include <sys/queue.h>
36 1.4.6.2 rpaulo
37 1.4.6.2 rpaulo /*
38 1.4.6.2 rpaulo * Generic device specifier; architecture-dependant
39 1.4.6.2 rpaulo * versions may be larger, but should be allowed to
40 1.4.6.2 rpaulo * overlap.
41 1.4.6.2 rpaulo */
42 1.4.6.2 rpaulo
43 1.4.6.2 rpaulo struct devdesc
44 1.4.6.2 rpaulo {
45 1.4.6.2 rpaulo struct devsw *d_dev;
46 1.4.6.2 rpaulo int d_type;
47 1.4.6.2 rpaulo #define DEVT_NONE 0
48 1.4.6.2 rpaulo #define DEVT_DISK 1
49 1.4.6.2 rpaulo #define DEVT_NET 2
50 1.4.6.2 rpaulo #define DEVT_CD 3
51 1.4.6.2 rpaulo };
52 1.4.6.2 rpaulo
53 1.4.6.2 rpaulo /* Commands and return values; nonzero return sets command_errmsg != NULL */
54 1.4.6.2 rpaulo typedef int (bootblk_cmd_t)(int argc, char *argv[]);
55 1.4.6.2 rpaulo extern char *command_errmsg;
56 1.4.6.2 rpaulo extern char command_errbuf[]; /* XXX blah, length */
57 1.4.6.2 rpaulo #define CMD_OK 0
58 1.4.6.2 rpaulo #define CMD_ERROR 1
59 1.4.6.2 rpaulo
60 1.4.6.2 rpaulo /* interp.c */
61 1.4.6.2 rpaulo void interact(void);
62 1.4.6.2 rpaulo int include(const char *filename);
63 1.4.6.2 rpaulo
64 1.4.6.2 rpaulo /* interp_backslash.c */
65 1.4.6.2 rpaulo char *backslash(char *str);
66 1.4.6.2 rpaulo
67 1.4.6.2 rpaulo /* interp_parse.c */
68 1.4.6.2 rpaulo int parse(int *argc, char ***argv, char *str);
69 1.4.6.2 rpaulo
70 1.4.6.2 rpaulo /* interp_forth.c */
71 1.4.6.2 rpaulo void bf_init(void);
72 1.4.6.2 rpaulo int bf_run(char *line);
73 1.4.6.2 rpaulo
74 1.4.6.2 rpaulo /* boot.c */
75 1.4.6.2 rpaulo int autoboot(int timeout, char *prompt);
76 1.4.6.2 rpaulo void autoboot_maybe(void);
77 1.4.6.2 rpaulo int getrootmount(char *rootdev);
78 1.4.6.2 rpaulo
79 1.4.6.2 rpaulo /* misc.c */
80 1.4.6.2 rpaulo char *unargv(int argc, char *argv[]);
81 1.4.6.2 rpaulo void hexdump(caddr_t region, size_t len);
82 1.4.6.2 rpaulo size_t strlenout(vaddr_t str);
83 1.4.6.2 rpaulo char *strdupout(vaddr_t str);
84 1.4.6.2 rpaulo void kern_bzero(vaddr_t dest, size_t len);
85 1.4.6.2 rpaulo int kern_pread(int fd, vaddr_t dest, size_t len, off_t off);
86 1.4.6.2 rpaulo void *alloc_pread(int fd, off_t off, size_t len);
87 1.4.6.2 rpaulo
88 1.4.6.2 rpaulo /* bcache.c */
89 1.4.6.2 rpaulo int bcache_init(u_int nblks, size_t bsize);
90 1.4.6.2 rpaulo void bcache_flush(void);
91 1.4.6.2 rpaulo int bcache_strategy(void *devdata, int unit, int rw, daddr_t blk,
92 1.4.6.2 rpaulo size_t size, char *buf, size_t *rsize);
93 1.4.6.2 rpaulo
94 1.4.6.2 rpaulo
95 1.4.6.2 rpaulo /* strdup.c */
96 1.4.6.2 rpaulo char *strdup(const char*);
97 1.4.6.2 rpaulo
98 1.4.6.2 rpaulo /*
99 1.4.6.2 rpaulo * Disk block cache
100 1.4.6.2 rpaulo */
101 1.4.6.2 rpaulo struct bcache_devdata
102 1.4.6.2 rpaulo {
103 1.4.6.2 rpaulo int (*dv_strategy)(void *devdata, int rw, daddr_t blk, size_t size, char *buf, size_t *rsize);
104 1.4.6.2 rpaulo void *dv_devdata;
105 1.4.6.2 rpaulo };
106 1.4.6.2 rpaulo
107 1.4.6.2 rpaulo /*
108 1.4.6.2 rpaulo * Modular console support.
109 1.4.6.2 rpaulo */
110 1.4.6.2 rpaulo struct console
111 1.4.6.2 rpaulo {
112 1.4.6.2 rpaulo const char *c_name;
113 1.4.6.2 rpaulo const char *c_desc;
114 1.4.6.2 rpaulo int c_flags;
115 1.4.6.2 rpaulo #define C_PRESENTIN (1<<0)
116 1.4.6.2 rpaulo #define C_PRESENTOUT (1<<1)
117 1.4.6.2 rpaulo #define C_ACTIVEIN (1<<2)
118 1.4.6.2 rpaulo #define C_ACTIVEOUT (1<<3)
119 1.4.6.2 rpaulo void (* c_probe)(struct console *cp); /* set c_flags to match hardware */
120 1.4.6.2 rpaulo int (* c_init)(int arg); /* reinit XXX may need more args */
121 1.4.6.2 rpaulo void (* c_out)(int c); /* emit c */
122 1.4.6.2 rpaulo int (* c_in)(void); /* wait for and return input */
123 1.4.6.2 rpaulo int (* c_ready)(void); /* return nonzer if input waiting */
124 1.4.6.2 rpaulo };
125 1.4.6.2 rpaulo extern struct console *consoles[];
126 1.4.6.2 rpaulo void cons_probe(void);
127 1.4.6.2 rpaulo
128 1.4.6.2 rpaulo /*
129 1.4.6.2 rpaulo * Plug-and-play enumerator/configurator interface.
130 1.4.6.2 rpaulo */
131 1.4.6.2 rpaulo struct pnphandler
132 1.4.6.2 rpaulo {
133 1.4.6.2 rpaulo const char *pp_name; /* handler/bus name */
134 1.4.6.2 rpaulo void (* pp_enumerate)(void); /* enumerate PnP devices, add to chain */
135 1.4.6.2 rpaulo };
136 1.4.6.2 rpaulo
137 1.4.6.2 rpaulo struct pnpident
138 1.4.6.2 rpaulo {
139 1.4.6.2 rpaulo char *id_ident; /* ASCII identifier, actual format varies with bus/handler */
140 1.4.6.2 rpaulo STAILQ_ENTRY(pnpident) id_link;
141 1.4.6.2 rpaulo };
142 1.4.6.2 rpaulo
143 1.4.6.2 rpaulo struct pnpinfo
144 1.4.6.2 rpaulo {
145 1.4.6.2 rpaulo char *pi_desc; /* ASCII description, optional */
146 1.4.6.2 rpaulo int pi_revision; /* optional revision (or -1) if not supported */
147 1.4.6.2 rpaulo char *pi_module; /* module/args nominated to handle device */
148 1.4.6.2 rpaulo int pi_argc; /* module arguments */
149 1.4.6.2 rpaulo char **pi_argv;
150 1.4.6.2 rpaulo struct pnphandler *pi_handler; /* handler which detected this device */
151 1.4.6.2 rpaulo STAILQ_HEAD(,pnpident) pi_ident; /* list of identifiers */
152 1.4.6.2 rpaulo STAILQ_ENTRY(pnpinfo) pi_link;
153 1.4.6.2 rpaulo };
154 1.4.6.2 rpaulo
155 1.4.6.2 rpaulo STAILQ_HEAD(pnpinfo_stql, pnpinfo);
156 1.4.6.2 rpaulo
157 1.4.6.2 rpaulo extern struct pnpinfo_stql pnp_devices;
158 1.4.6.2 rpaulo
159 1.4.6.2 rpaulo extern struct pnphandler *pnphandlers[]; /* provided by MD code */
160 1.4.6.2 rpaulo
161 1.4.6.2 rpaulo void pnp_addident(struct pnpinfo *pi, char *ident);
162 1.4.6.2 rpaulo struct pnpinfo *pnp_allocinfo(void);
163 1.4.6.2 rpaulo void pnp_freeinfo(struct pnpinfo *pi);
164 1.4.6.2 rpaulo void pnp_addinfo(struct pnpinfo *pi);
165 1.4.6.2 rpaulo char *pnp_eisaformat(u_int8_t *data);
166 1.4.6.2 rpaulo
167 1.4.6.2 rpaulo /*
168 1.4.6.2 rpaulo * < 0 - No ISA in system
169 1.4.6.2 rpaulo * == 0 - Maybe ISA, search for read data port
170 1.4.6.2 rpaulo * > 0 - ISA in system, value is read data port address
171 1.4.6.2 rpaulo */
172 1.4.6.2 rpaulo extern int isapnp_readport;
173 1.4.6.2 rpaulo
174 1.4.6.2 rpaulo struct preloaded_file;
175 1.4.6.2 rpaulo
176 1.4.6.2 rpaulo /*
177 1.4.6.2 rpaulo * Preloaded file information. Depending on type, file can contain
178 1.4.6.2 rpaulo * additional units called 'modules'.
179 1.4.6.2 rpaulo *
180 1.4.6.2 rpaulo * At least one file (the kernel) must be loaded in order to boot.
181 1.4.6.2 rpaulo * The kernel is always loaded first.
182 1.4.6.2 rpaulo *
183 1.4.6.2 rpaulo * String fields (m_name, m_type) should be dynamically allocated.
184 1.4.6.2 rpaulo */
185 1.4.6.2 rpaulo struct preloaded_file
186 1.4.6.2 rpaulo {
187 1.4.6.2 rpaulo char *f_name; /* file name */
188 1.4.6.2 rpaulo char *f_type; /* verbose file type, eg 'ELF kernel', 'pnptable', etc. */
189 1.4.6.2 rpaulo char *f_args; /* arguments for the file */
190 1.4.6.2 rpaulo int f_loader; /* index of the loader that read the file */
191 1.4.6.2 rpaulo vaddr_t f_addr; /* load address */
192 1.4.6.2 rpaulo size_t f_size; /* file size */
193 1.4.6.2 rpaulo struct preloaded_file *f_next; /* next file */
194 1.4.6.2 rpaulo u_long *marks; /* filled by loadfile() */
195 1.4.6.2 rpaulo };
196 1.4.6.2 rpaulo
197 1.4.6.2 rpaulo struct file_format
198 1.4.6.2 rpaulo {
199 1.4.6.2 rpaulo /* Load function must return EFTYPE if it can't handle the module supplied */
200 1.4.6.2 rpaulo int (* l_load)(char *filename, u_int64_t dest, struct preloaded_file **result);
201 1.4.6.2 rpaulo /* Only a loader that will load a kernel (first module) should have an exec handler */
202 1.4.6.2 rpaulo int (* l_exec)(struct preloaded_file *mp);
203 1.4.6.2 rpaulo };
204 1.4.6.2 rpaulo
205 1.4.6.2 rpaulo extern struct file_format *file_formats[]; /* supplied by consumer */
206 1.4.6.2 rpaulo extern struct preloaded_file *preloaded_files;
207 1.4.6.2 rpaulo
208 1.4.6.2 rpaulo int mod_load(char *name, int argc, char *argv[]);
209 1.4.6.2 rpaulo int mod_loadkld(const char *name, int argc, char *argv[]);
210 1.4.6.2 rpaulo
211 1.4.6.2 rpaulo struct preloaded_file *file_alloc(void);
212 1.4.6.2 rpaulo struct preloaded_file *file_findfile(char *name, char *type);
213 1.4.6.2 rpaulo
214 1.4.6.2 rpaulo void file_discard(struct preloaded_file *fp);
215 1.4.6.2 rpaulo
216 1.4.6.2 rpaulo int elf64_loadfile(char *filename, u_int64_t dest, struct preloaded_file **result);
217 1.4.6.2 rpaulo
218 1.4.6.2 rpaulo /*
219 1.4.6.2 rpaulo * Support for commands
220 1.4.6.2 rpaulo */
221 1.4.6.2 rpaulo struct bootblk_command
222 1.4.6.2 rpaulo {
223 1.4.6.2 rpaulo const char *c_name;
224 1.4.6.2 rpaulo const char *c_desc;
225 1.4.6.2 rpaulo bootblk_cmd_t *c_fn;
226 1.4.6.2 rpaulo };
227 1.4.6.2 rpaulo
228 1.4.6.2 rpaulo /* Prototypes for the command handlers within stand/common/ */
229 1.4.6.2 rpaulo
230 1.4.6.2 rpaulo /* command.c */
231 1.4.6.2 rpaulo
232 1.4.6.2 rpaulo int command_help(int argc, char *argv[]) ;
233 1.4.6.2 rpaulo int command_commandlist(int argc, char *argv[]);
234 1.4.6.2 rpaulo int command_show(int argc, char *argv[]);
235 1.4.6.2 rpaulo int command_set(int argc, char *argv[]);
236 1.4.6.2 rpaulo int command_unset(int argc, char *argv[]);
237 1.4.6.2 rpaulo int command_echo(int argc, char *argv[]);
238 1.4.6.2 rpaulo int command_read(int argc, char *argv[]);
239 1.4.6.2 rpaulo int command_more(int argc, char *argv[]);
240 1.4.6.2 rpaulo int command_lsdev(int argc, char *argv[]);
241 1.4.6.2 rpaulo
242 1.4.6.2 rpaulo /* bcache.c XXX: Fixme: Do we need the bcache ?*/
243 1.4.6.2 rpaulo /* int command_bcache(int argc, char *argv[]); */
244 1.4.6.2 rpaulo /* boot.c */
245 1.4.6.2 rpaulo int command_boot(int argc, char *argv[]);
246 1.4.6.2 rpaulo int command_autoboot(int argc, char *argv[]);
247 1.4.6.2 rpaulo /* fileload.c */
248 1.4.6.2 rpaulo int command_load(int argc, char *argv[]);
249 1.4.6.2 rpaulo int command_unload(int argc, char *argv[]);
250 1.4.6.2 rpaulo int command_lskern(int argc, char *argv[]);
251 1.4.6.2 rpaulo /* interp.c */
252 1.4.6.2 rpaulo int command_include(int argc, char *argv[]);
253 1.4.6.2 rpaulo /* ls.c */
254 1.4.6.2 rpaulo int command_ls(int argc, char *argv[]);
255 1.4.6.2 rpaulo
256 1.4.6.2 rpaulo #define COMMAND_SET(a, b, c, d) /* nothing */
257 1.4.6.2 rpaulo
258 1.4.6.2 rpaulo #define COMMON_COMMANDS \
259 1.4.6.2 rpaulo /* common.c */ \
260 1.4.6.2 rpaulo { "help", "detailed help", command_help }, \
261 1.4.6.2 rpaulo { "?", "list commands", command_commandlist }, \
262 1.4.6.2 rpaulo { "show", "show variable(s)", command_show }, \
263 1.4.6.2 rpaulo { "set", "set a variable", command_set }, \
264 1.4.6.2 rpaulo { "unset", "unset a variable", command_unset }, \
265 1.4.6.2 rpaulo { "echo", "echo arguments", command_echo }, \
266 1.4.6.2 rpaulo { "read", "read input from the terminal", command_read }, \
267 1.4.6.2 rpaulo { "more", "show contents of a file", command_more }, \
268 1.4.6.2 rpaulo { "lsdev", "list all devices", command_lsdev }, \
269 1.4.6.2 rpaulo \
270 1.4.6.2 rpaulo /* bcache.c XXX: Fixme: Do we need the bcache ? */ \
271 1.4.6.2 rpaulo \
272 1.4.6.2 rpaulo /* { "bcachestat", "get disk block cache stats", command_bcache }, */\
273 1.4.6.2 rpaulo \
274 1.4.6.2 rpaulo /* boot.c */ \
275 1.4.6.2 rpaulo \
276 1.4.6.2 rpaulo { "boot", "boot a file or loaded kernel", command_boot }, \
277 1.4.6.2 rpaulo { "autoboot", "boot automatically after a delay", command_autoboot }, \
278 1.4.6.2 rpaulo \
279 1.4.6.2 rpaulo /* fileload.c */ \
280 1.4.6.2 rpaulo \
281 1.4.6.2 rpaulo { "load", "load a kernel", command_load }, \
282 1.4.6.2 rpaulo { "unload", "unload all modules", command_unload }, \
283 1.4.6.2 rpaulo { "lskern", "list loaded kernel", command_lskern }, \
284 1.4.6.2 rpaulo \
285 1.4.6.2 rpaulo /* interp.c */ \
286 1.4.6.2 rpaulo \
287 1.4.6.2 rpaulo { "include", "read commands from a file", command_include }, \
288 1.4.6.2 rpaulo \
289 1.4.6.2 rpaulo /* ls.c */ \
290 1.4.6.2 rpaulo \
291 1.4.6.2 rpaulo { "ls", "list files", command_ls }
292 1.4.6.2 rpaulo
293 1.4.6.2 rpaulo extern struct bootblk_command commands[];
294 1.4.6.2 rpaulo
295 1.4.6.2 rpaulo
296 1.4.6.2 rpaulo /*
297 1.4.6.2 rpaulo * The intention of the architecture switch is to provide a convenient
298 1.4.6.2 rpaulo * encapsulation of the interface between the bootstrap MI and MD code.
299 1.4.6.2 rpaulo * MD code may selectively populate the switch at runtime based on the
300 1.4.6.2 rpaulo * actual configuration of the target system.
301 1.4.6.2 rpaulo */
302 1.4.6.2 rpaulo struct arch_switch
303 1.4.6.2 rpaulo {
304 1.4.6.2 rpaulo /* Automatically load modules as required by detected hardware */
305 1.4.6.2 rpaulo int (*arch_autoload)(void);
306 1.4.6.2 rpaulo /* Locate the device for (name), return pointer to tail in (*path) */
307 1.4.6.2 rpaulo int (*arch_getdev)(void **dev, const char *name, const char **path);
308 1.4.6.2 rpaulo /* Copy from local address space to module address space, similar to bcopy() */
309 1.4.6.2 rpaulo ssize_t (*arch_copyin)(const void *src, vaddr_t dest,
310 1.4.6.2 rpaulo const size_t len);
311 1.4.6.2 rpaulo /* Copy to local address space from module address space, similar to bcopy() */
312 1.4.6.2 rpaulo ssize_t (*arch_copyout)(const vaddr_t src, void *dest,
313 1.4.6.2 rpaulo const size_t len);
314 1.4.6.2 rpaulo /* Read from file to module address space, same semantics as read() */
315 1.4.6.2 rpaulo ssize_t (*arch_readin)(const int fd, vaddr_t dest,
316 1.4.6.2 rpaulo const size_t len);
317 1.4.6.2 rpaulo /* Perform ISA byte port I/O (only for systems with ISA) */
318 1.4.6.2 rpaulo int (*arch_isainb)(int port);
319 1.4.6.2 rpaulo void (*arch_isaoutb)(int port, int value);
320 1.4.6.2 rpaulo };
321 1.4.6.2 rpaulo extern struct arch_switch archsw;
322 1.4.6.2 rpaulo
323 1.4.6.2 rpaulo /* This must be provided by the MD code, but should it be in the archsw? */
324 1.4.6.2 rpaulo void delay(int delay);
325 1.4.6.2 rpaulo
326 1.4.6.2 rpaulo void dev_cleanup(void);
327 1.4.6.2 rpaulo
328 1.4.6.2 rpaulo time_t time(time_t *tloc);
329 1.4.6.2 rpaulo
330 1.4.6.2 rpaulo /* calloc.c */
331 1.4.6.2 rpaulo void *calloc(unsigned int, unsigned int);
332 1.4.6.2 rpaulo
333 1.4.6.2 rpaulo /* pager.c */
334 1.4.6.2 rpaulo extern void pager_open(void);
335 1.4.6.2 rpaulo extern void pager_close(void);
336 1.4.6.2 rpaulo extern int pager_output(const char *lines);
337 1.4.6.2 rpaulo extern int pager_file(const char *fname);
338 1.4.6.2 rpaulo
339 1.4.6.2 rpaulo /* environment.c */
340 1.4.6.2 rpaulo #define EV_DYNAMIC (1<<0) /* value was dynamically allocated, free if changed/unset */
341 1.4.6.2 rpaulo #define EV_VOLATILE (1<<1) /* value is volatile, make a copy of it */
342 1.4.6.2 rpaulo #define EV_NOHOOK (1<<2) /* don't call hook when setting */
343 1.4.6.2 rpaulo
344 1.4.6.2 rpaulo struct env_var;
345 1.4.6.2 rpaulo typedef char *(ev_format_t)(struct env_var *ev);
346 1.4.6.2 rpaulo typedef int (ev_sethook_t)(struct env_var *ev, int flags,
347 1.4.6.2 rpaulo const void *value);
348 1.4.6.2 rpaulo typedef int (ev_unsethook_t)(struct env_var *ev);
349 1.4.6.2 rpaulo
350 1.4.6.2 rpaulo struct env_var
351 1.4.6.2 rpaulo {
352 1.4.6.2 rpaulo char *ev_name;
353 1.4.6.2 rpaulo int ev_flags;
354 1.4.6.2 rpaulo void *ev_value;
355 1.4.6.2 rpaulo ev_sethook_t *ev_sethook;
356 1.4.6.2 rpaulo ev_unsethook_t *ev_unsethook;
357 1.4.6.2 rpaulo struct env_var *ev_next, *ev_prev;
358 1.4.6.2 rpaulo };
359 1.4.6.2 rpaulo extern struct env_var *environ;
360 1.4.6.2 rpaulo
361 1.4.6.2 rpaulo extern struct env_var *env_getenv(const char *name);
362 1.4.6.2 rpaulo extern int env_setenv(const char *name, int flags,
363 1.4.6.2 rpaulo const void *value, ev_sethook_t sethook,
364 1.4.6.2 rpaulo ev_unsethook_t unsethook);
365 1.4.6.2 rpaulo extern char *getenv(const char *name);
366 1.4.6.2 rpaulo extern int setenv(const char *name, const char *value,
367 1.4.6.2 rpaulo int overwrite);
368 1.4.6.2 rpaulo extern int putenv(const char *string);
369 1.4.6.2 rpaulo extern int unsetenv(const char *name);
370 1.4.6.2 rpaulo
371 1.4.6.2 rpaulo extern ev_sethook_t env_noset; /* refuse set operation */
372 1.4.6.2 rpaulo extern ev_unsethook_t env_nounset; /* refuse unset operation */
373 1.4.6.2 rpaulo
374 1.4.6.2 rpaulo
375 1.4.6.2 rpaulo
376 1.4.6.2 rpaulo /* FreeBSD wrappers */
377 1.4.6.2 rpaulo
378 1.4.6.2 rpaulo
379 1.4.6.2 rpaulo struct dirent *readdirfd(int); /* XXX move to stand.h */
380 1.4.6.2 rpaulo
381 1.4.6.2 rpaulo #define free(ptr) dealloc(ptr, 0) /* XXX UGLY HACK!!! This should work for just now though. See: libsa/alloc.c:free() */
382 1.4.6.2 rpaulo
383 1.4.6.2 rpaulo /* XXX Hack Hack Hack!!! Need to update stand.h with fs_ops->fo_readdir */
384 1.4.6.2 rpaulo #ifdef SKIFS /* defined via stand/ia64/ski/Makefile */
385 1.4.6.2 rpaulo #define FS_READDIR(f, dirptr) skifs_readdir(f, dirptr)
386 1.4.6.2 rpaulo #else
387 1.4.6.2 rpaulo #define FS_READDIR(f, dirptr) efifs_readdir(f, dirptr)
388 1.4.6.2 rpaulo #endif
389 1.4.6.2 rpaulo
390 1.4.6.2 rpaulo /* gets.c XXX move to libsa/ */
391 1.4.6.2 rpaulo
392 1.4.6.2 rpaulo extern int fgetstr(char *buf, int size, int fd);
393 1.4.6.2 rpaulo extern void ngets(char *, int);
394 1.4.6.2 rpaulo
395 1.4.6.2 rpaulo /* imports from stdlib, modified for sa */
396 1.4.6.2 rpaulo
397 1.4.6.2 rpaulo extern long strtol(const char *, char **, int);
398 1.4.6.2 rpaulo extern char *optarg; /* getopt(3) external variables */
399 1.4.6.2 rpaulo extern int optind, opterr, optopt, optreset;
400 1.4.6.2 rpaulo extern int getopt(int, char * const [], const char *);
401 1.4.6.2 rpaulo
402 1.4.6.2 rpaulo extern long strtol(const char *, char **, int);
403 1.4.6.2 rpaulo
404 1.4.6.2 rpaulo /* XXX: From <fcntl.h>. Its not very _STANDALONE friendly */
405 1.4.6.2 rpaulo /* open-only flags */
406 1.4.6.2 rpaulo #define O_RDONLY 0x00000000 /* open for reading only */
407 1.4.6.2 rpaulo #define O_WRONLY 0x00000001 /* open for writing only */
408 1.4.6.2 rpaulo #define O_RDWR 0x00000002 /* open for reading and writing */
409 1.4.6.2 rpaulo #define O_ACCMODE 0x00000003 /* mask for above modes */
410 1.4.6.2 rpaulo
411 1.4.6.2 rpaulo #define ELF64_KERNELTYPE "elf kernel"
412 1.4.6.2 rpaulo
413 1.4.6.2 rpaulo #endif /* _BOOTSTRAP_H_ */
414