diff options
author | Roland McGrath <roland@gnu.org> | 2001-08-17 04:47:44 +0000 |
---|---|---|
committer | Roland McGrath <roland@gnu.org> | 2001-08-17 04:47:44 +0000 |
commit | cc94c82e35667c170c5a0640c073195ec83fe79f (patch) | |
tree | 92c8bb20ccc6b26b59536d4520cc8fdc0b7fe861 /boot/boot_script.h | |
parent | f3c7d9e469562b01696506e7c142a3da4d9465ae (diff) | |
download | hurd-cc94c82e35667c170c5a0640c073195ec83fe79f.tar.gz hurd-cc94c82e35667c170c5a0640c073195ec83fe79f.tar.bz2 hurd-cc94c82e35667c170c5a0640c073195ec83fe79f.zip |
2001-08-16 Roland McGrath <roland@frob.com>
* boot_script.h (struct cmd): Change `task' member type to `task_t'.
(boot_script_task_create, boot_script_task_resume,
boot_script_prompt_task_resume, boot_script_free_task): Declare new
functions that callers must define.
* userland-boot.c: Define those.
* boot_script.c (create_task, resume_task, prompt_resume_task): Use
those instead of direct Mach calls.
(free_cmd): Likewise.
(read_file): Function removed.
(builtin_symbols): Remove the "read-file" element.
* boot_script.h (boot_script_malloc, boot_script_free): Declare new
functions that callers must define.
* boot_script.c: All uses of malloc/free changed to use those instead.
* userland-boot.c: New file. Defines them using malloc/free.
* Makefile (SRCS, OBJS): Add it.
* boot.c (boot_script_malloc, boot_script_free): Old cruft functions
removed.
* boot_script.c (boot_script_parse_line): Take new first argument HOOK.
Store it in CMD->hook.
(main): Update caller.
(boot_script_exec): Pass CMD->hook as 1st arg to boot_script_exec_cmd.
(boot_script_exec_cmd): Take new first argument HOOK.
* boot.c (boot_script_exec_cmd): Likewise.
* boot_script.h (struct cmd): New member `void *hook'.
Update decls for HOOK arguments added.
Diffstat (limited to 'boot/boot_script.h')
-rw-r--r-- | boot/boot_script.h | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/boot/boot_script.h b/boot/boot_script.h index d2db1a14..6a30f09f 100644 --- a/boot/boot_script.h +++ b/boot/boot_script.h @@ -22,11 +22,14 @@ /* This structure describes a command. */ struct cmd { + /* Cookie passed in to boot_script_parse_line. */ + void *hook; + /* Path of executable. */ char *path; /* Task port. */ - mach_port_t task; + task_t task; /* Argument list. */ struct arg **args; @@ -48,19 +51,35 @@ struct cmd }; +/* The user must define these functions, we work like malloc and free. */ +void *boot_script_malloc (size_t); +void boot_script_free (void *, size_t); + /* The user must define this function. Load the image of the executable specified by PATH in TASK. Create a thread in TASK and point it at the executable's entry point. Initialize TASK's stack with argument vector ARGV of length ARGC whose strings are STRINGS. STRINGS has length STRINGLEN. Return 0 for success, non-zero otherwise. */ -int boot_script_exec_cmd (mach_port_t task, char *path, int argc, +int boot_script_exec_cmd (void *hook, + mach_port_t task, char *path, int argc, char **argv, char *strings, int stringlen); /* The user must define this function. Load the contents of FILE into a fresh anonymous memory object and return the memory object port. */ mach_port_t boot_script_read_file (const char *file); +/* The user must define this functions to perform the corresponding + Mach task manipulations. */ +int boot_script_task_create (struct cmd *); /* task_create + task_suspend */ +int boot_script_task_resume (struct cmd *); +int boot_script_prompt_task_resume (struct cmd *); + +/* The user must define this function to clean up the `task_t' + returned by boot_script_task_create. */ +void boot_script_free_task (task_t task, int aborting); + + /* Parse the command line LINE. This causes the command line to be converted into an internal format. Returns 0 for success, non-zero otherwise. @@ -68,7 +87,7 @@ mach_port_t boot_script_read_file (const char *file); NOTE: The parser writes into the line so it must not be a string constant. It is also the responsibility of the caller not to deallocate the line across calls to the parser. */ -int boot_script_parse_line (char *cmdline); +int boot_script_parse_line (void *hook, char *cmdline); /* Execute the command lines prevously parsed. Returns 0 for success, non-zero otherwise. */ |