2005-11-13 Marco Gerards <mgerards@xs4all.nl>

* geninit.sh: New file.

	* geninitheader.sh: Likewise.

	* commands/boot.c (grub_boot_init, grub_boot_fini): Removed.
	* commands/cat.c (grub_cat_init, grub_cat_fini): Likewise.
	* commands/cmp.c (grub_cmp_init, grub_cmp_fini): Likewise.
	* commands/configfile.c (grub_configfile_init)
	(grub_configfile_fini): Likewise.
	* commands/default.c (grub_default_init, grub_default_fini):
	Likewise.
	* commands/help.c (grub_help_init, grub_help_fini): Likewise.
	* commands/ls.c (grub_ls_init, grub_ls_fini): Likewise.
	* commands/search.c (grub_search_init, grub_search_fini): Likewise.
	* commands/terminal.c (grub_terminal_init, grub_terminal_fini):
	Likewise.
	* commands/test.c (grub_test_init, grub_test_fini): Likewise.
	* commands/timeout.c (grub_timeout_init, grub_timeout_fini):
	Likewise.
	* commands/i386/pc/halt.c (grub_halt_init, grub_halt_fini): Likewise.
	* commands/iee1275/halt.c (grub_halt_init, grub_halt_fini):
	Likewise.
	* commands/i386/pc/reboot.c (grub_reboot_init, grub_reboot_fini):
	Likewise.
	* commands/iee1275/reboot.c (grub_reboot_init, grub_reboot_fini):
	Likewise.
	* disk/loopback.c (grub_loop_init, grub_loop_fini): Likewise.
	* fs/affs.c (grub_affs_init, grub_affs_fini): Likewise.
	* fs/ext2.c (grub_ext2_init, grub_ext2_fini): Likewise.
	* fs/fat.c (grub_fat_init, grub_fat_fini): Likewise.
	* fs/hfs.c (grub_hfs_init, grub_hfs_fini): Likewise.
	* fs/iso9660.c (grub_iso9660_init, grub_iso9660_fini): Likewise.
	* fs/jfs.c (grub_jfs_init, grub_jfs_fini): Likewise.
	* fs/minix.c (grub_minix_init, grub_minix_fini): Likewise.
	* fs/sfs.c (grub_sfs_init, grub_sfs_fini): Likewise.
	* fs/ufs.c (grub_ufs_init, grub_ufs_fini): Likewise.
	* fs/xfs.c (grub_xfs_init, grub_xfs_fini): Likewise.
	* normal/main.c (grub_normal_init, grub_normal_fini): Likewise.
	* partmap/amiga.c (grub_amiga_partition_map_init)
	(grub_amiga_partition_map_fini): Likewise.
	* partmap/apple.c (grub_apple_partition_map_init)
	(grub_apple_partition_map_fini): Likewise.
	* partmap/pc.c (grub_pc_partition_map_init)
	(grub_pc_partition_map_fini): Likewise.
	* partmap/sun.c (grub_sun_partition_map_init,
	grub_sun_partition_map_fini): Likewise.
	* term/terminfo.c (grub_terminal_init, grub_terminal_fini):
	Likewise.

	* util/grub-emu.c: Include <grub_modules_init.h>.
	(main): Don't initialize and de-initialize any modules directly,
	use `grub_init_all' and `grub_fini_all' instead.

	* term/i386/pc/vesafb.c (grub_vesafb_init): Renamed to
	`grub_vesafb_mod_init'.
	(grub_vesafb_fini): Renamed to `grub_vesafb_mod_fini'.  Updated
	all users.
	* term/i386/pc/vga.c (grub_vga_init): Renamed to
	`grub_vga_mod_init'.  Updated all users.
	(grub_vga_fini): Renamed to `grub_vga_mod_fini'.

	* conf/i386-pc.rmk (grub_emu_SOURCES): Add `grub_emu_init.c'.
	(grub_modules_init.lst, grub_modules_init.h, grub_emu_init.c): New
	rules.

	* include/grub/dl.h (GRUB_MOD_INIT): Add argument `name'.
	Generate a function to initialize the module in utilities.
	Updated all callers.
	(GRUB_MOD_FINI): Add argument `name'.  Generate a function to
	initialize the module in utilities.  Updated all callers.
This commit is contained in:
marco_g 2005-11-13 15:47:09 +00:00
parent 9046bcf0e6
commit 6d099807fa
57 changed files with 414 additions and 663 deletions

View file

@ -1,3 +1,76 @@
2005-11-13 Marco Gerards <mgerards@xs4all.nl>
* geninit.sh: New file.
* geninitheader.sh: Likewise.
* commands/boot.c (grub_boot_init, grub_boot_fini): Removed.
* commands/cat.c (grub_cat_init, grub_cat_fini): Likewise.
* commands/cmp.c (grub_cmp_init, grub_cmp_fini): Likewise.
* commands/configfile.c (grub_configfile_init)
(grub_configfile_fini): Likewise.
* commands/default.c (grub_default_init, grub_default_fini):
Likewise.
* commands/help.c (grub_help_init, grub_help_fini): Likewise.
* commands/ls.c (grub_ls_init, grub_ls_fini): Likewise.
* commands/search.c (grub_search_init, grub_search_fini): Likewise.
* commands/terminal.c (grub_terminal_init, grub_terminal_fini):
Likewise.
* commands/test.c (grub_test_init, grub_test_fini): Likewise.
* commands/timeout.c (grub_timeout_init, grub_timeout_fini):
Likewise.
* commands/i386/pc/halt.c (grub_halt_init, grub_halt_fini): Likewise.
* commands/iee1275/halt.c (grub_halt_init, grub_halt_fini):
Likewise.
* commands/i386/pc/reboot.c (grub_reboot_init, grub_reboot_fini):
Likewise.
* commands/iee1275/reboot.c (grub_reboot_init, grub_reboot_fini):
Likewise.
* disk/loopback.c (grub_loop_init, grub_loop_fini): Likewise.
* fs/affs.c (grub_affs_init, grub_affs_fini): Likewise.
* fs/ext2.c (grub_ext2_init, grub_ext2_fini): Likewise.
* fs/fat.c (grub_fat_init, grub_fat_fini): Likewise.
* fs/hfs.c (grub_hfs_init, grub_hfs_fini): Likewise.
* fs/iso9660.c (grub_iso9660_init, grub_iso9660_fini): Likewise.
* fs/jfs.c (grub_jfs_init, grub_jfs_fini): Likewise.
* fs/minix.c (grub_minix_init, grub_minix_fini): Likewise.
* fs/sfs.c (grub_sfs_init, grub_sfs_fini): Likewise.
* fs/ufs.c (grub_ufs_init, grub_ufs_fini): Likewise.
* fs/xfs.c (grub_xfs_init, grub_xfs_fini): Likewise.
* normal/main.c (grub_normal_init, grub_normal_fini): Likewise.
* partmap/amiga.c (grub_amiga_partition_map_init)
(grub_amiga_partition_map_fini): Likewise.
* partmap/apple.c (grub_apple_partition_map_init)
(grub_apple_partition_map_fini): Likewise.
* partmap/pc.c (grub_pc_partition_map_init)
(grub_pc_partition_map_fini): Likewise.
* partmap/sun.c (grub_sun_partition_map_init,
grub_sun_partition_map_fini): Likewise.
* term/terminfo.c (grub_terminal_init, grub_terminal_fini):
Likewise.
* util/grub-emu.c: Include <grub_modules_init.h>.
(main): Don't initialize and de-initialize any modules directly,
use `grub_init_all' and `grub_fini_all' instead.
* term/i386/pc/vesafb.c (grub_vesafb_init): Renamed to
`grub_vesafb_mod_init'.
(grub_vesafb_fini): Renamed to `grub_vesafb_mod_fini'. Updated
all users.
* term/i386/pc/vga.c (grub_vga_init): Renamed to
`grub_vga_mod_init'. Updated all users.
(grub_vga_fini): Renamed to `grub_vga_mod_fini'.
* conf/i386-pc.rmk (grub_emu_SOURCES): Add `grub_emu_init.c'.
(grub_modules_init.lst, grub_modules_init.h, grub_emu_init.c): New
rules.
* include/grub/dl.h (GRUB_MOD_INIT): Add argument `name'.
Generate a function to initialize the module in utilities.
Updated all callers.
(GRUB_MOD_FINI): Add argument `name'. Generate a function to
initialize the module in utilities. Updated all callers.
2005-11-09 Hollis Blanchard <hollis@penguinppc.org> 2005-11-09 Hollis Blanchard <hollis@penguinppc.org>
* term/ieee1275/ofconsole.c (grub_ofconsole_cls): Use both the ANSI * term/ieee1275/ofconsole.c (grub_ofconsole_cls): Use both the ANSI

View file

@ -38,29 +38,14 @@ grub_cmd_boot (struct grub_arg_list *state __attribute__ ((unused)),
#ifdef GRUB_UTIL GRUB_MOD_INIT(boot)
void
grub_boot_init (void)
{
grub_register_command ("boot", grub_cmd_boot, GRUB_COMMAND_FLAG_BOTH,
"boot", "Boot an operating system.", 0);
}
void
grub_boot_fini (void)
{
grub_unregister_command ("boot");
}
#else /* ! GRUB_UTIL */
GRUB_MOD_INIT
{ {
(void) mod; /* To stop warning. */ (void) mod; /* To stop warning. */
grub_register_command ("boot", grub_cmd_boot, GRUB_COMMAND_FLAG_BOTH, grub_register_command ("boot", grub_cmd_boot, GRUB_COMMAND_FLAG_BOTH,
"boot", "Boot an operating system.", 0); "boot", "Boot an operating system.", 0);
} }
GRUB_MOD_FINI GRUB_MOD_FINI(boot)
{ {
grub_unregister_command ("boot"); grub_unregister_command ("boot");
} }
#endif /* ! GRUB_UTIL */

View file

@ -70,29 +70,14 @@ grub_cmd_cat (struct grub_arg_list *state __attribute__ ((unused)),
} }
#ifdef GRUB_UTIL GRUB_MOD_INIT(cat)
void
grub_cat_init (void)
{
grub_register_command ("cat", grub_cmd_cat, GRUB_COMMAND_FLAG_BOTH,
"cat FILE", "Show the contents of a file.", 0);
}
void
grub_cat_fini (void)
{
grub_unregister_command ("cat");
}
#else /* ! GRUB_UTIL */
GRUB_MOD_INIT
{ {
(void) mod; /* To stop warning. */ (void) mod; /* To stop warning. */
grub_register_command ("cat", grub_cmd_cat, GRUB_COMMAND_FLAG_BOTH, grub_register_command ("cat", grub_cmd_cat, GRUB_COMMAND_FLAG_BOTH,
"cat FILE", "Show the contents of a file.", 0); "cat FILE", "Show the contents of a file.", 0);
} }
GRUB_MOD_FINI GRUB_MOD_FINI(cat)
{ {
grub_unregister_command ("cat"); grub_unregister_command ("cat");
} }
#endif /* ! GRUB_UTIL */

View file

@ -102,29 +102,14 @@ cleanup:
} }
#ifdef GRUB_UTIL GRUB_MOD_INIT(cmp)
void
grub_cmp_init (void)
{
grub_register_command ("cmp", grub_cmd_cmp, GRUB_COMMAND_FLAG_BOTH,
"cmp FILE1 FILE2", "Compare two files.", 0);
}
void
grub_cmp_fini (void)
{
grub_unregister_command ("cmp");
}
#else /* ! GRUB_UTIL */
GRUB_MOD_INIT
{ {
(void) mod; /* To stop warning. */ (void) mod; /* To stop warning. */
grub_register_command ("cmp", grub_cmd_cmp, GRUB_COMMAND_FLAG_BOTH, grub_register_command ("cmp", grub_cmd_cmp, GRUB_COMMAND_FLAG_BOTH,
"cmp FILE1 FILE2", "Compare two files.", 0); "cmp FILE1 FILE2", "Compare two files.", 0);
} }
GRUB_MOD_FINI GRUB_MOD_FINI(cmp)
{ {
grub_unregister_command ("cmp"); grub_unregister_command ("cmp");
} }
#endif /* ! GRUB_UTIL */

View file

@ -39,22 +39,7 @@ grub_cmd_configfile (struct grub_arg_list *state __attribute__ ((unused)),
} }
#ifdef GRUB_UTIL GRUB_MOD_INIT(configfile)
void
grub_configfile_init (void)
{
grub_register_command ("configfile", grub_cmd_configfile,
GRUB_COMMAND_FLAG_BOTH, "configfile FILE",
"Load another config file.", 0);
}
void
grub_configfile_fini (void)
{
grub_unregister_command ("configfile");
}
#else /* ! GRUB_UTIL */
GRUB_MOD_INIT
{ {
(void) mod; /* To stop warning. */ (void) mod; /* To stop warning. */
grub_register_command ("configfile", grub_cmd_configfile, grub_register_command ("configfile", grub_cmd_configfile,
@ -62,8 +47,7 @@ GRUB_MOD_INIT
"Load another config file.", 0); "Load another config file.", 0);
} }
GRUB_MOD_FINI GRUB_MOD_FINI(configfile)
{ {
grub_unregister_command ("configfile"); grub_unregister_command ("configfile");
} }
#endif /* ! GRUB_UTIL */

View file

@ -44,29 +44,14 @@ grub_cmd_default (struct grub_arg_list *state __attribute__ ((unused)),
#ifdef GRUB_UTIL GRUB_MOD_INIT(default)
void
grub_default_init (void)
{
grub_register_command ("default", grub_cmd_default, GRUB_COMMAND_FLAG_MENU,
"default ENTRY", "Set the default entry", 0);
}
void
grub_default_fini (void)
{
grub_unregister_command ("default");
}
#else /* ! GRUB_UTIL */
GRUB_MOD_INIT
{ {
(void)mod; /* To stop warning. */ (void)mod; /* To stop warning. */
grub_register_command ("default", grub_cmd_default, GRUB_COMMAND_FLAG_MENU, grub_register_command ("default", grub_cmd_default, GRUB_COMMAND_FLAG_MENU,
"default ENTRY", "Set the default entry", 0); "default ENTRY", "Set the default entry", 0);
} }
GRUB_MOD_FINI GRUB_MOD_FINI(default)
{ {
grub_unregister_command ("default"); grub_unregister_command ("default");
} }
#endif /* ! GRUB_UTIL */

View file

@ -94,29 +94,14 @@ grub_cmd_help (struct grub_arg_list *state __attribute__ ((unused)), int argc,
#ifdef GRUB_UTIL GRUB_MOD_INIT(help)
void
grub_help_init (void)
{
grub_register_command ("help", grub_cmd_help, GRUB_COMMAND_FLAG_CMDLINE,
"help [PATTERN ...]", "Show a help message.", 0);
}
void
grub_help_fini (void)
{
grub_unregister_command ("help");
}
#else /* ! GRUB_UTIL */
GRUB_MOD_INIT
{ {
(void)mod; /* To stop warning. */ (void)mod; /* To stop warning. */
grub_register_command ("help", grub_cmd_help, GRUB_COMMAND_FLAG_CMDLINE, grub_register_command ("help", grub_cmd_help, GRUB_COMMAND_FLAG_CMDLINE,
"help [PATTERN ...]", "Show a help message.", 0); "help [PATTERN ...]", "Show a help message.", 0);
} }
GRUB_MOD_FINI GRUB_MOD_FINI(help)
{ {
grub_unregister_command ("help"); grub_unregister_command ("help");
} }
#endif /* ! GRUB_UTIL */

View file

@ -44,22 +44,7 @@ grub_cmd_halt (struct grub_arg_list *state,
#ifdef GRUB_UTIL GRUB_MOD_INIT(halt)
void
grub_halt_init (void)
{
grub_register_command ("halt", grub_cmd_halt, GRUB_COMMAND_FLAG_BOTH,
"halt [OPTIONS...]",
"Halt the system, if possible using APM", options);
}
void
grub_halt_fini (void)
{
grub_unregister_command ("halt");
}
#else /* ! GRUB_UTIL */
GRUB_MOD_INIT
{ {
(void)mod; /* To stop warning. */ (void)mod; /* To stop warning. */
grub_register_command ("halt", grub_cmd_halt, GRUB_COMMAND_FLAG_BOTH, grub_register_command ("halt", grub_cmd_halt, GRUB_COMMAND_FLAG_BOTH,
@ -67,8 +52,7 @@ GRUB_MOD_INIT
"Halt the system, if possible using APM", options); "Halt the system, if possible using APM", options);
} }
GRUB_MOD_FINI GRUB_MOD_FINI(halt)
{ {
grub_unregister_command ("halt"); grub_unregister_command ("halt");
} }
#endif /* ! GRUB_UTIL */

View file

@ -35,29 +35,14 @@ grub_cmd_reboot (struct grub_arg_list *state __attribute__ ((unused)),
#ifdef GRUB_UTIL GRUB_MOD_INIT(reboot)
void
grub_reboot_init (void)
{
grub_register_command ("reboot", grub_cmd_reboot, GRUB_COMMAND_FLAG_BOTH,
"reboot", "Reboot the computer.", 0);
}
void
grub_reboot_fini (void)
{
grub_unregister_command ("reboot");
}
#else /* ! GRUB_UTIL */
GRUB_MOD_INIT
{ {
(void)mod; /* To stop warning. */ (void)mod; /* To stop warning. */
grub_register_command ("reboot", grub_cmd_reboot, GRUB_COMMAND_FLAG_BOTH, grub_register_command ("reboot", grub_cmd_reboot, GRUB_COMMAND_FLAG_BOTH,
"reboot", "Reboot the computer", 0); "reboot", "Reboot the computer", 0);
} }
GRUB_MOD_FINI GRUB_MOD_FINI(reboot)
{ {
grub_unregister_command ("reboot"); grub_unregister_command ("reboot");
} }
#endif /* ! GRUB_UTIL */

View file

@ -146,7 +146,7 @@ grub_cmd_vbeinfo (struct grub_arg_list *state __attribute__ ((unused)),
return 0; return 0;
} }
GRUB_MOD_INIT GRUB_MOD_INIT(vbeinfo)
{ {
(void) mod; /* To stop warning. */ (void) mod; /* To stop warning. */
grub_register_command ("vbeinfo", grub_register_command ("vbeinfo",
@ -157,7 +157,7 @@ GRUB_MOD_INIT
0); 0);
} }
GRUB_MOD_FINI GRUB_MOD_FINI(vbeinfo)
{ {
grub_unregister_command ("vbeinfo"); grub_unregister_command ("vbeinfo");
} }

View file

@ -163,7 +163,7 @@ grub_cmd_vbetest (struct grub_arg_list *state __attribute__ ((unused)),
return grub_errno; return grub_errno;
} }
GRUB_MOD_INIT GRUB_MOD_INIT(vbetest)
{ {
(void) mod; /* To stop warning. */ (void) mod; /* To stop warning. */
grub_register_command ("vbetest", grub_register_command ("vbetest",
@ -174,7 +174,7 @@ GRUB_MOD_INIT
0); 0);
} }
GRUB_MOD_FINI GRUB_MOD_FINI(vbetest)
{ {
grub_unregister_command ("vbetest"); grub_unregister_command ("vbetest");
} }

View file

@ -33,22 +33,7 @@ grub_cmd_halt (struct grub_arg_list *state __attribute__ ((unused)),
} }
#ifdef GRUB_UTIL GRUB_MOD_INIT(ieee1275_halt)
void
grub_halt_init (void)
{
grub_register_command ("halt", grub_cmd_halt, GRUB_COMMAND_FLAG_BOTH,
"halt", "halts the computer. This command does not"
" work on all firmware.", 0);
}
void
grub_halt_fini (void)
{
grub_unregister_command ("halt");
}
#else /* ! GRUB_UTIL */
GRUB_MOD_INIT
{ {
(void)mod; /* To stop warning. */ (void)mod; /* To stop warning. */
grub_register_command ("halt", grub_cmd_halt, GRUB_COMMAND_FLAG_BOTH, grub_register_command ("halt", grub_cmd_halt, GRUB_COMMAND_FLAG_BOTH,
@ -56,8 +41,7 @@ GRUB_MOD_INIT
" work on all firmware.", 0); " work on all firmware.", 0);
} }
GRUB_MOD_FINI GRUB_MOD_FINI(ieee1275_halt)
{ {
grub_unregister_command ("halt"); grub_unregister_command ("halt");
} }
#endif

View file

@ -33,29 +33,14 @@ grub_cmd_reboot (struct grub_arg_list *state __attribute__ ((unused)),
} }
#ifdef GRUB_UTIL GRUB_MOD_INIT(ieee1275_reboot)
void
grub_reboot_init (void)
{
grub_register_command ("reboot", grub_cmd_reboot, GRUB_COMMAND_FLAG_BOTH,
"reboot", "Reboot the computer", 0);
}
void
grub_reboot_fini (void)
{
grub_unregister_command ("reboot");
}
#else /* ! GRUB_UTIL */
GRUB_MOD_INIT
{ {
(void)mod; /* To stop warning. */ (void)mod; /* To stop warning. */
grub_register_command ("reboot", grub_cmd_reboot, GRUB_COMMAND_FLAG_BOTH, grub_register_command ("reboot", grub_cmd_reboot, GRUB_COMMAND_FLAG_BOTH,
"reboot", "Reboot the computer", 0); "reboot", "Reboot the computer", 0);
} }
GRUB_MOD_FINI GRUB_MOD_FINI(ieee1275_reboot)
{ {
grub_unregister_command ("reboot"); grub_unregister_command ("reboot");
} }
#endif

View file

@ -36,14 +36,14 @@ grub_cmd_suspend (struct grub_arg_list *state __attribute__ ((unused)),
} }
GRUB_MOD_INIT GRUB_MOD_INIT(ieee1275_suspend)
{ {
(void)mod; /* To stop warning. */ (void)mod; /* To stop warning. */
grub_register_command ("suspend", grub_cmd_suspend, GRUB_COMMAND_FLAG_BOTH, grub_register_command ("suspend", grub_cmd_suspend, GRUB_COMMAND_FLAG_BOTH,
"suspend", "Return to Open Firmware prompt", 0); "suspend", "Return to Open Firmware prompt", 0);
} }
GRUB_MOD_FINI GRUB_MOD_FINI(ieee1275_suspend)
{ {
grub_unregister_command ("suspend"); grub_unregister_command ("suspend");
} }

View file

@ -228,22 +228,7 @@ grub_cmd_ls (struct grub_arg_list *state, int argc, char **args)
return 0; return 0;
} }
#ifdef GRUB_UTIL GRUB_MOD_INIT(ls)
void
grub_ls_init (void)
{
grub_register_command ("ls", grub_cmd_ls, GRUB_COMMAND_FLAG_BOTH,
"ls [-l|-h|-a] [FILE]",
"List devices and files.", options);
}
void
grub_ls_fini (void)
{
grub_unregister_command ("ls");
}
#else /* ! GRUB_UTIL */
GRUB_MOD_INIT
{ {
(void)mod; /* To stop warning. */ (void)mod; /* To stop warning. */
grub_register_command ("ls", grub_cmd_ls, GRUB_COMMAND_FLAG_BOTH, grub_register_command ("ls", grub_cmd_ls, GRUB_COMMAND_FLAG_BOTH,
@ -251,8 +236,7 @@ GRUB_MOD_INIT
"List devices and files.", options); "List devices and files.", options);
} }
GRUB_MOD_FINI GRUB_MOD_FINI(ls)
{ {
grub_unregister_command ("ls"); grub_unregister_command ("ls");
} }
#endif /* ! GRUB_UTIL */

View file

@ -148,26 +148,7 @@ grub_cmd_search (struct grub_arg_list *state, int argc, char **args)
return grub_errno; return grub_errno;
} }
#ifdef GRUB_UTIL GRUB_MOD_INIT(search)
void
grub_search_init (void)
{
grub_register_command ("search", grub_cmd_search, GRUB_COMMAND_FLAG_BOTH,
"search [-f|-l|-s] NAME",
"Search devices by a file or a filesystem label."
" If --set is specified, the first device found is"
" set to a variable. If no variable name is"
" specified, \"root\" is used.",
options);
}
void
grub_search_fini (void)
{
grub_unregister_command ("search");
}
#else /* ! GRUB_UTIL */
GRUB_MOD_INIT
{ {
(void) mod; /* To stop warning. */ (void) mod; /* To stop warning. */
grub_register_command ("search", grub_cmd_search, GRUB_COMMAND_FLAG_BOTH, grub_register_command ("search", grub_cmd_search, GRUB_COMMAND_FLAG_BOTH,
@ -179,8 +160,7 @@ GRUB_MOD_INIT
options); options);
} }
GRUB_MOD_FINI GRUB_MOD_FINI(search)
{ {
grub_unregister_command ("search"); grub_unregister_command ("search");
} }
#endif /* ! GRUB_UTIL */

View file

@ -1,7 +1,7 @@
/* terminal.c - command to show and select a terminal */ /* terminal.c - command to show and select a terminal */
/* /*
* GRUB -- GRand Unified Bootloader * GRUB -- GRand Unified Bootloader
* Copyright (C) 2003 Free Software Foundation, Inc. * Copyright (C) 2003, 2005 Free Software Foundation, Inc.
* *
* GRUB is free software; you can redistribute it and/or modify * GRUB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -71,29 +71,14 @@ grub_cmd_terminal (struct grub_arg_list *state __attribute__ ((unused)),
} }
#ifdef GRUB_UTIL GRUB_MOD_INIT(terminal)
void
grub_terminal_init (void)
{
grub_register_command ("terminal", grub_cmd_terminal, GRUB_COMMAND_FLAG_BOTH,
"terminal [TERM...]", "Select a terminal.", 0);
}
void
grub_terminal_fini (void)
{
grub_unregister_command ("terminal");
}
#else /* ! GRUB_UTIL */
GRUB_MOD_INIT
{ {
(void)mod; /* To stop warning. */ (void)mod; /* To stop warning. */
grub_register_command ("terminal", grub_cmd_terminal, GRUB_COMMAND_FLAG_BOTH, grub_register_command ("terminal", grub_cmd_terminal, GRUB_COMMAND_FLAG_BOTH,
"terminal [TERM...]", "Select a terminal.", 0); "terminal [TERM...]", "Select a terminal.", 0);
} }
GRUB_MOD_FINI GRUB_MOD_FINI(terminal)
{ {
grub_unregister_command ("terminal"); grub_unregister_command ("terminal");
} }
#endif /* ! GRUB_UTIL */

View file

@ -55,24 +55,7 @@ grub_cmd_test (struct grub_arg_list *state __attribute__ ((unused)), int argc,
#ifdef GRUB_UTIL GRUB_MOD_INIT(test)
void
grub_test_init (void)
{
grub_register_command ("[", grub_cmd_test, GRUB_COMMAND_FLAG_CMDLINE,
"[ EXPRESSION ]", "Evaluate an expression", 0);
grub_register_command ("test", grub_cmd_test, GRUB_COMMAND_FLAG_CMDLINE,
"test EXPRESSION", "Evaluate an expression", 0);
}
void
grub_test_fini (void)
{
grub_unregister_command ("[");
grub_unregister_command ("test");
}
#else /* ! GRUB_UTIL */
GRUB_MOD_INIT
{ {
(void)mod; /* To stop warning. */ (void)mod; /* To stop warning. */
grub_register_command ("[", grub_cmd_test, GRUB_COMMAND_FLAG_CMDLINE, grub_register_command ("[", grub_cmd_test, GRUB_COMMAND_FLAG_CMDLINE,
@ -81,9 +64,8 @@ GRUB_MOD_INIT
"test EXPRESSION", "Evaluate an expression", 0); "test EXPRESSION", "Evaluate an expression", 0);
} }
GRUB_MOD_FINI GRUB_MOD_FINI(test)
{ {
grub_unregister_command ("["); grub_unregister_command ("[");
grub_unregister_command ("test"); grub_unregister_command ("test");
} }
#endif /* ! GRUB_UTIL */

View file

@ -42,29 +42,14 @@ grub_cmd_timeout (struct grub_arg_list *state __attribute__ ((unused)),
#ifdef GRUB_UTIL GRUB_MOD_INIT(timeout)
void
grub_timeout_init (void)
{
grub_register_command ("timeout", grub_cmd_timeout, GRUB_COMMAND_FLAG_MENU,
"timeout SECS", "Set the timeout", 0);
}
void
grub_timeout_fini (void)
{
grub_unregister_command ("timeout");
}
#else /* ! GRUB_UTIL */
GRUB_MOD_INIT
{ {
(void)mod; /* To stop warning. */ (void)mod; /* To stop warning. */
grub_register_command ("timeout", grub_cmd_timeout, GRUB_COMMAND_FLAG_MENU, grub_register_command ("timeout", grub_cmd_timeout, GRUB_COMMAND_FLAG_MENU,
"timeout SECS", "Set the timeout", 0); "timeout SECS", "Set the timeout", 0);
} }
GRUB_MOD_FINI GRUB_MOD_FINI(timeout)
{ {
grub_unregister_command ("timeout"); grub_unregister_command ("timeout");
} }
#endif /* ! GRUB_UTIL */

View file

@ -753,7 +753,7 @@ grub_probefs-fs_sfs.d: fs/sfs.c
# For grub-emu. # For grub-emu.
grub_emu_SOURCES = commands/boot.c commands/cat.c commands/cmp.c \ grub_emu_SOURCES = commands/boot.c commands/cat.c commands/cmp.c \
commands/configfile.c commands/default.c commands/help.c \ commands/configfile.c commands/default.c commands/help.c \
commands/terminal.c commands/ls.c commands/test.c \ commands/terminal.c commands/ls.c commands/test.c \
commands/search.c commands/timeout.c \ commands/search.c commands/timeout.c \
@ -772,11 +772,11 @@ grub_emu_SOURCES = commands/boot.c commands/cat.c commands/cmp.c \
partmap/amiga.c partmap/apple.c partmap/pc.c partmap/sun.c \ partmap/amiga.c partmap/apple.c partmap/pc.c partmap/sun.c \
util/console.c util/grub-emu.c util/misc.c \ util/console.c util/grub-emu.c util/misc.c \
util/i386/pc/biosdisk.c util/i386/pc/getroot.c \ util/i386/pc/biosdisk.c util/i386/pc/getroot.c \
util/i386/pc/misc.c util/i386/pc/misc.c grub_emu_init.c
CLEANFILES += grub-emu grub_emu-commands_boot.o grub_emu-commands_cat.o grub_emu-commands_cmp.o grub_emu-commands_configfile.o grub_emu-commands_default.o grub_emu-commands_help.o grub_emu-commands_terminal.o grub_emu-commands_ls.o grub_emu-commands_test.o grub_emu-commands_search.o grub_emu-commands_timeout.o grub_emu-commands_i386_pc_halt.o grub_emu-commands_i386_pc_reboot.o grub_emu-disk_loopback.o grub_emu-fs_affs.o grub_emu-fs_ext2.o grub_emu-fs_fat.o grub_emu-fs_fshelp.o grub_emu-fs_hfs.o grub_emu-fs_iso9660.o grub_emu-fs_jfs.o grub_emu-fs_minix.o grub_emu-fs_sfs.o grub_emu-fs_ufs.o grub_emu-fs_xfs.o grub_emu-io_gzio.o grub_emu-kern_device.o grub_emu-kern_disk.o grub_emu-kern_dl.o grub_emu-kern_env.o grub_emu-kern_err.o grub_emu-normal_execute.o grub_emu-kern_file.o grub_emu-kern_fs.o grub_emu-normal_lexer.o grub_emu-kern_loader.o grub_emu-kern_main.o grub_emu-kern_misc.o grub_emu-kern_parser.o grub_emu-grub_script_tab.o grub_emu-kern_partition.o grub_emu-kern_rescue.o grub_emu-kern_term.o grub_emu-normal_arg.o grub_emu-normal_cmdline.o grub_emu-normal_command.o grub_emu-normal_function.o grub_emu-normal_completion.o grub_emu-normal_context.o grub_emu-normal_main.o grub_emu-normal_menu.o grub_emu-normal_menu_entry.o grub_emu-normal_misc.o grub_emu-normal_script.o grub_emu-partmap_amiga.o grub_emu-partmap_apple.o grub_emu-partmap_pc.o grub_emu-partmap_sun.o grub_emu-util_console.o grub_emu-util_grub_emu.o grub_emu-util_misc.o grub_emu-util_i386_pc_biosdisk.o grub_emu-util_i386_pc_getroot.o grub_emu-util_i386_pc_misc.o CLEANFILES += grub-emu grub_emu-commands_boot.o grub_emu-commands_cat.o grub_emu-commands_cmp.o grub_emu-commands_configfile.o grub_emu-commands_default.o grub_emu-commands_help.o grub_emu-commands_terminal.o grub_emu-commands_ls.o grub_emu-commands_test.o grub_emu-commands_search.o grub_emu-commands_timeout.o grub_emu-commands_i386_pc_halt.o grub_emu-commands_i386_pc_reboot.o grub_emu-disk_loopback.o grub_emu-fs_affs.o grub_emu-fs_ext2.o grub_emu-fs_fat.o grub_emu-fs_fshelp.o grub_emu-fs_hfs.o grub_emu-fs_iso9660.o grub_emu-fs_jfs.o grub_emu-fs_minix.o grub_emu-fs_sfs.o grub_emu-fs_ufs.o grub_emu-fs_xfs.o grub_emu-io_gzio.o grub_emu-kern_device.o grub_emu-kern_disk.o grub_emu-kern_dl.o grub_emu-kern_env.o grub_emu-kern_err.o grub_emu-normal_execute.o grub_emu-kern_file.o grub_emu-kern_fs.o grub_emu-normal_lexer.o grub_emu-kern_loader.o grub_emu-kern_main.o grub_emu-kern_misc.o grub_emu-kern_parser.o grub_emu-grub_script_tab.o grub_emu-kern_partition.o grub_emu-kern_rescue.o grub_emu-kern_term.o grub_emu-normal_arg.o grub_emu-normal_cmdline.o grub_emu-normal_command.o grub_emu-normal_function.o grub_emu-normal_completion.o grub_emu-normal_context.o grub_emu-normal_main.o grub_emu-normal_menu.o grub_emu-normal_menu_entry.o grub_emu-normal_misc.o grub_emu-normal_script.o grub_emu-partmap_amiga.o grub_emu-partmap_apple.o grub_emu-partmap_pc.o grub_emu-partmap_sun.o grub_emu-util_console.o grub_emu-util_grub_emu.o grub_emu-util_misc.o grub_emu-util_i386_pc_biosdisk.o grub_emu-util_i386_pc_getroot.o grub_emu-util_i386_pc_misc.o grub_emu-grub_emu_init.o
MOSTLYCLEANFILES += grub_emu-commands_boot.d grub_emu-commands_cat.d grub_emu-commands_cmp.d grub_emu-commands_configfile.d grub_emu-commands_default.d grub_emu-commands_help.d grub_emu-commands_terminal.d grub_emu-commands_ls.d grub_emu-commands_test.d grub_emu-commands_search.d grub_emu-commands_timeout.d grub_emu-commands_i386_pc_halt.d grub_emu-commands_i386_pc_reboot.d grub_emu-disk_loopback.d grub_emu-fs_affs.d grub_emu-fs_ext2.d grub_emu-fs_fat.d grub_emu-fs_fshelp.d grub_emu-fs_hfs.d grub_emu-fs_iso9660.d grub_emu-fs_jfs.d grub_emu-fs_minix.d grub_emu-fs_sfs.d grub_emu-fs_ufs.d grub_emu-fs_xfs.d grub_emu-io_gzio.d grub_emu-kern_device.d grub_emu-kern_disk.d grub_emu-kern_dl.d grub_emu-kern_env.d grub_emu-kern_err.d grub_emu-normal_execute.d grub_emu-kern_file.d grub_emu-kern_fs.d grub_emu-normal_lexer.d grub_emu-kern_loader.d grub_emu-kern_main.d grub_emu-kern_misc.d grub_emu-kern_parser.d grub_emu-grub_script_tab.d grub_emu-kern_partition.d grub_emu-kern_rescue.d grub_emu-kern_term.d grub_emu-normal_arg.d grub_emu-normal_cmdline.d grub_emu-normal_command.d grub_emu-normal_function.d grub_emu-normal_completion.d grub_emu-normal_context.d grub_emu-normal_main.d grub_emu-normal_menu.d grub_emu-normal_menu_entry.d grub_emu-normal_misc.d grub_emu-normal_script.d grub_emu-partmap_amiga.d grub_emu-partmap_apple.d grub_emu-partmap_pc.d grub_emu-partmap_sun.d grub_emu-util_console.d grub_emu-util_grub_emu.d grub_emu-util_misc.d grub_emu-util_i386_pc_biosdisk.d grub_emu-util_i386_pc_getroot.d grub_emu-util_i386_pc_misc.d MOSTLYCLEANFILES += grub_emu-commands_boot.d grub_emu-commands_cat.d grub_emu-commands_cmp.d grub_emu-commands_configfile.d grub_emu-commands_default.d grub_emu-commands_help.d grub_emu-commands_terminal.d grub_emu-commands_ls.d grub_emu-commands_test.d grub_emu-commands_search.d grub_emu-commands_timeout.d grub_emu-commands_i386_pc_halt.d grub_emu-commands_i386_pc_reboot.d grub_emu-disk_loopback.d grub_emu-fs_affs.d grub_emu-fs_ext2.d grub_emu-fs_fat.d grub_emu-fs_fshelp.d grub_emu-fs_hfs.d grub_emu-fs_iso9660.d grub_emu-fs_jfs.d grub_emu-fs_minix.d grub_emu-fs_sfs.d grub_emu-fs_ufs.d grub_emu-fs_xfs.d grub_emu-io_gzio.d grub_emu-kern_device.d grub_emu-kern_disk.d grub_emu-kern_dl.d grub_emu-kern_env.d grub_emu-kern_err.d grub_emu-normal_execute.d grub_emu-kern_file.d grub_emu-kern_fs.d grub_emu-normal_lexer.d grub_emu-kern_loader.d grub_emu-kern_main.d grub_emu-kern_misc.d grub_emu-kern_parser.d grub_emu-grub_script_tab.d grub_emu-kern_partition.d grub_emu-kern_rescue.d grub_emu-kern_term.d grub_emu-normal_arg.d grub_emu-normal_cmdline.d grub_emu-normal_command.d grub_emu-normal_function.d grub_emu-normal_completion.d grub_emu-normal_context.d grub_emu-normal_main.d grub_emu-normal_menu.d grub_emu-normal_menu_entry.d grub_emu-normal_misc.d grub_emu-normal_script.d grub_emu-partmap_amiga.d grub_emu-partmap_apple.d grub_emu-partmap_pc.d grub_emu-partmap_sun.d grub_emu-util_console.d grub_emu-util_grub_emu.d grub_emu-util_misc.d grub_emu-util_i386_pc_biosdisk.d grub_emu-util_i386_pc_getroot.d grub_emu-util_i386_pc_misc.d grub_emu-grub_emu_init.d
grub-emu: grub_emu-commands_boot.o grub_emu-commands_cat.o grub_emu-commands_cmp.o grub_emu-commands_configfile.o grub_emu-commands_default.o grub_emu-commands_help.o grub_emu-commands_terminal.o grub_emu-commands_ls.o grub_emu-commands_test.o grub_emu-commands_search.o grub_emu-commands_timeout.o grub_emu-commands_i386_pc_halt.o grub_emu-commands_i386_pc_reboot.o grub_emu-disk_loopback.o grub_emu-fs_affs.o grub_emu-fs_ext2.o grub_emu-fs_fat.o grub_emu-fs_fshelp.o grub_emu-fs_hfs.o grub_emu-fs_iso9660.o grub_emu-fs_jfs.o grub_emu-fs_minix.o grub_emu-fs_sfs.o grub_emu-fs_ufs.o grub_emu-fs_xfs.o grub_emu-io_gzio.o grub_emu-kern_device.o grub_emu-kern_disk.o grub_emu-kern_dl.o grub_emu-kern_env.o grub_emu-kern_err.o grub_emu-normal_execute.o grub_emu-kern_file.o grub_emu-kern_fs.o grub_emu-normal_lexer.o grub_emu-kern_loader.o grub_emu-kern_main.o grub_emu-kern_misc.o grub_emu-kern_parser.o grub_emu-grub_script_tab.o grub_emu-kern_partition.o grub_emu-kern_rescue.o grub_emu-kern_term.o grub_emu-normal_arg.o grub_emu-normal_cmdline.o grub_emu-normal_command.o grub_emu-normal_function.o grub_emu-normal_completion.o grub_emu-normal_context.o grub_emu-normal_main.o grub_emu-normal_menu.o grub_emu-normal_menu_entry.o grub_emu-normal_misc.o grub_emu-normal_script.o grub_emu-partmap_amiga.o grub_emu-partmap_apple.o grub_emu-partmap_pc.o grub_emu-partmap_sun.o grub_emu-util_console.o grub_emu-util_grub_emu.o grub_emu-util_misc.o grub_emu-util_i386_pc_biosdisk.o grub_emu-util_i386_pc_getroot.o grub_emu-util_i386_pc_misc.o grub-emu: grub_emu-commands_boot.o grub_emu-commands_cat.o grub_emu-commands_cmp.o grub_emu-commands_configfile.o grub_emu-commands_default.o grub_emu-commands_help.o grub_emu-commands_terminal.o grub_emu-commands_ls.o grub_emu-commands_test.o grub_emu-commands_search.o grub_emu-commands_timeout.o grub_emu-commands_i386_pc_halt.o grub_emu-commands_i386_pc_reboot.o grub_emu-disk_loopback.o grub_emu-fs_affs.o grub_emu-fs_ext2.o grub_emu-fs_fat.o grub_emu-fs_fshelp.o grub_emu-fs_hfs.o grub_emu-fs_iso9660.o grub_emu-fs_jfs.o grub_emu-fs_minix.o grub_emu-fs_sfs.o grub_emu-fs_ufs.o grub_emu-fs_xfs.o grub_emu-io_gzio.o grub_emu-kern_device.o grub_emu-kern_disk.o grub_emu-kern_dl.o grub_emu-kern_env.o grub_emu-kern_err.o grub_emu-normal_execute.o grub_emu-kern_file.o grub_emu-kern_fs.o grub_emu-normal_lexer.o grub_emu-kern_loader.o grub_emu-kern_main.o grub_emu-kern_misc.o grub_emu-kern_parser.o grub_emu-grub_script_tab.o grub_emu-kern_partition.o grub_emu-kern_rescue.o grub_emu-kern_term.o grub_emu-normal_arg.o grub_emu-normal_cmdline.o grub_emu-normal_command.o grub_emu-normal_function.o grub_emu-normal_completion.o grub_emu-normal_context.o grub_emu-normal_main.o grub_emu-normal_menu.o grub_emu-normal_menu_entry.o grub_emu-normal_misc.o grub_emu-normal_script.o grub_emu-partmap_amiga.o grub_emu-partmap_apple.o grub_emu-partmap_pc.o grub_emu-partmap_sun.o grub_emu-util_console.o grub_emu-util_grub_emu.o grub_emu-util_misc.o grub_emu-util_i386_pc_biosdisk.o grub_emu-util_i386_pc_getroot.o grub_emu-util_i386_pc_misc.o grub_emu-grub_emu_init.o
$(BUILD_CC) -o $@ $^ $(BUILD_LDFLAGS) $(grub_emu_LDFLAGS) $(BUILD_CC) -o $@ $^ $(BUILD_LDFLAGS) $(grub_emu_LDFLAGS)
grub_emu-commands_boot.o: commands/boot.c grub_emu-commands_boot.o: commands/boot.c
@ -1291,9 +1291,26 @@ grub_emu-util_i386_pc_misc.d: util/i386/pc/misc.c
-include grub_emu-util_i386_pc_misc.d -include grub_emu-util_i386_pc_misc.d
grub_emu-grub_emu_init.o: grub_emu_init.c
$(BUILD_CC) -I. -I$(srcdir)/. $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
grub_emu-grub_emu_init.d: grub_emu_init.c
set -e; $(BUILD_CC) -I. -I$(srcdir)/. $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $< | sed 's,grub_emu_init\.o[ :]*,grub_emu-grub_emu_init.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
-include grub_emu-grub_emu_init.d
grub_emu_LDFLAGS = $(LIBCURSES) grub_emu_LDFLAGS = $(LIBCURSES)
grub_modules_init.lst: geninit.sh
(cd $(srcdir); grep -r --include="*.c" GRUB_MOD_INIT *) > $@
grub_modules_init.h: $(filter-out grub_emu_init.c,$(grub_emu_SOURCES)) geninitheader.sh grub_modules_init.lst
sh $(srcdir)/geninitheader.sh > $@
grub_emu_init.c: $(filter-out grub_emu_init.c,$(grub_emu_SOURCES)) geninit.sh grub_modules_init.lst grub_modules_init.h
sh $(srcdir)/geninit.sh $(filter %.c,$^) > $@
# For genmoddep. # For genmoddep.
genmoddep_SOURCES = util/genmoddep.c genmoddep_SOURCES = util/genmoddep.c
CLEANFILES += genmoddep genmoddep-util_genmoddep.o CLEANFILES += genmoddep genmoddep-util_genmoddep.o

View file

@ -85,7 +85,7 @@ grub_probefs_SOURCES = util/i386/pc/grub-probefs.c \
fs/xfs.c fs/affs.c fs/sfs.c fs/xfs.c fs/affs.c fs/sfs.c
# For grub-emu. # For grub-emu.
grub_emu_SOURCES = commands/boot.c commands/cat.c commands/cmp.c \ grub_emu_SOURCES = commands/boot.c commands/cat.c commands/cmp.c \
commands/configfile.c commands/default.c commands/help.c \ commands/configfile.c commands/default.c commands/help.c \
commands/terminal.c commands/ls.c commands/test.c \ commands/terminal.c commands/ls.c commands/test.c \
commands/search.c commands/timeout.c \ commands/search.c commands/timeout.c \
@ -104,10 +104,19 @@ grub_emu_SOURCES = commands/boot.c commands/cat.c commands/cmp.c \
partmap/amiga.c partmap/apple.c partmap/pc.c partmap/sun.c \ partmap/amiga.c partmap/apple.c partmap/pc.c partmap/sun.c \
util/console.c util/grub-emu.c util/misc.c \ util/console.c util/grub-emu.c util/misc.c \
util/i386/pc/biosdisk.c util/i386/pc/getroot.c \ util/i386/pc/biosdisk.c util/i386/pc/getroot.c \
util/i386/pc/misc.c util/i386/pc/misc.c grub_emu_init.c
grub_emu_LDFLAGS = $(LIBCURSES) grub_emu_LDFLAGS = $(LIBCURSES)
grub_modules_init.lst: geninit.sh
(cd $(srcdir); grep -r --include="*.c" GRUB_MOD_INIT *) > $@
grub_modules_init.h: $(filter-out grub_emu_init.c,$(grub_emu_SOURCES)) geninitheader.sh grub_modules_init.lst
sh $(srcdir)/geninitheader.sh > $@
grub_emu_init.c: $(filter-out grub_emu_init.c,$(grub_emu_SOURCES)) geninit.sh grub_modules_init.lst grub_modules_init.h
sh $(srcdir)/geninit.sh $(filter %.c,$^) > $@
# For genmoddep. # For genmoddep.
genmoddep_SOURCES = util/genmoddep.c genmoddep_SOURCES = util/genmoddep.c

View file

@ -89,11 +89,11 @@ grub_emu_SOURCES = commands/boot.c commands/cat.c commands/cmp.c \
partmap/amiga.c partmap/apple.c partmap/pc.c partmap/sun.c \ partmap/amiga.c partmap/apple.c partmap/pc.c partmap/sun.c \
util/console.c util/grub-emu.c util/misc.c \ util/console.c util/grub-emu.c util/misc.c \
util/i386/pc/biosdisk.c util/i386/pc/getroot.c \ util/i386/pc/biosdisk.c util/i386/pc/getroot.c \
util/powerpc/ieee1275/misc.c grub_script.tab.c util/powerpc/ieee1275/misc.c grub_script.tab.c grub_emu_init.c
CLEANFILES += grub-emu grub_emu-commands_boot.o grub_emu-commands_cat.o grub_emu-commands_cmp.o grub_emu-commands_configfile.o grub_emu-commands_default.o grub_emu-commands_help.o grub_emu-commands_search.o grub_emu-commands_terminal.o grub_emu-commands_test.o grub_emu-commands_ls.o grub_emu-commands_timeout.o grub_emu-commands_ieee1275_halt.o grub_emu-commands_ieee1275_reboot.o grub_emu-disk_loopback.o grub_emu-fs_affs.o grub_emu-fs_ext2.o grub_emu-fs_fat.o grub_emu-fs_fshelp.o grub_emu-fs_hfs.o grub_emu-fs_iso9660.o grub_emu-fs_jfs.o grub_emu-fs_minix.o grub_emu-fs_sfs.o grub_emu-fs_ufs.o grub_emu-fs_xfs.o grub_emu-io_gzio.o grub_emu-kern_device.o grub_emu-kern_disk.o grub_emu-kern_dl.o grub_emu-kern_env.o grub_emu-kern_err.o grub_emu-kern_file.o grub_emu-kern_fs.o grub_emu-kern_loader.o grub_emu-kern_main.o grub_emu-kern_misc.o grub_emu-kern_parser.o grub_emu-kern_partition.o grub_emu-kern_rescue.o grub_emu-kern_term.o grub_emu-normal_arg.o grub_emu-normal_cmdline.o grub_emu-normal_command.o grub_emu-normal_completion.o grub_emu-normal_context.o grub_emu-normal_execute.o grub_emu-normal_function.o grub_emu-normal_lexer.o grub_emu-normal_main.o grub_emu-normal_menu.o grub_emu-normal_menu_entry.o grub_emu-normal_misc.o grub_emu-normal_script.o grub_emu-partmap_amiga.o grub_emu-partmap_apple.o grub_emu-partmap_pc.o grub_emu-partmap_sun.o grub_emu-util_console.o grub_emu-util_grub_emu.o grub_emu-util_misc.o grub_emu-util_i386_pc_biosdisk.o grub_emu-util_i386_pc_getroot.o grub_emu-util_powerpc_ieee1275_misc.o grub_emu-grub_script_tab.o CLEANFILES += grub-emu grub_emu-commands_boot.o grub_emu-commands_cat.o grub_emu-commands_cmp.o grub_emu-commands_configfile.o grub_emu-commands_default.o grub_emu-commands_help.o grub_emu-commands_search.o grub_emu-commands_terminal.o grub_emu-commands_test.o grub_emu-commands_ls.o grub_emu-commands_timeout.o grub_emu-commands_ieee1275_halt.o grub_emu-commands_ieee1275_reboot.o grub_emu-disk_loopback.o grub_emu-fs_affs.o grub_emu-fs_ext2.o grub_emu-fs_fat.o grub_emu-fs_fshelp.o grub_emu-fs_hfs.o grub_emu-fs_iso9660.o grub_emu-fs_jfs.o grub_emu-fs_minix.o grub_emu-fs_sfs.o grub_emu-fs_ufs.o grub_emu-fs_xfs.o grub_emu-io_gzio.o grub_emu-kern_device.o grub_emu-kern_disk.o grub_emu-kern_dl.o grub_emu-kern_env.o grub_emu-kern_err.o grub_emu-kern_file.o grub_emu-kern_fs.o grub_emu-kern_loader.o grub_emu-kern_main.o grub_emu-kern_misc.o grub_emu-kern_parser.o grub_emu-kern_partition.o grub_emu-kern_rescue.o grub_emu-kern_term.o grub_emu-normal_arg.o grub_emu-normal_cmdline.o grub_emu-normal_command.o grub_emu-normal_completion.o grub_emu-normal_context.o grub_emu-normal_execute.o grub_emu-normal_function.o grub_emu-normal_lexer.o grub_emu-normal_main.o grub_emu-normal_menu.o grub_emu-normal_menu_entry.o grub_emu-normal_misc.o grub_emu-normal_script.o grub_emu-partmap_amiga.o grub_emu-partmap_apple.o grub_emu-partmap_pc.o grub_emu-partmap_sun.o grub_emu-util_console.o grub_emu-util_grub_emu.o grub_emu-util_misc.o grub_emu-util_i386_pc_biosdisk.o grub_emu-util_i386_pc_getroot.o grub_emu-util_powerpc_ieee1275_misc.o grub_emu-grub_script_tab.o grub_emu-grub_emu_init.o
MOSTLYCLEANFILES += grub_emu-commands_boot.d grub_emu-commands_cat.d grub_emu-commands_cmp.d grub_emu-commands_configfile.d grub_emu-commands_default.d grub_emu-commands_help.d grub_emu-commands_search.d grub_emu-commands_terminal.d grub_emu-commands_test.d grub_emu-commands_ls.d grub_emu-commands_timeout.d grub_emu-commands_ieee1275_halt.d grub_emu-commands_ieee1275_reboot.d grub_emu-disk_loopback.d grub_emu-fs_affs.d grub_emu-fs_ext2.d grub_emu-fs_fat.d grub_emu-fs_fshelp.d grub_emu-fs_hfs.d grub_emu-fs_iso9660.d grub_emu-fs_jfs.d grub_emu-fs_minix.d grub_emu-fs_sfs.d grub_emu-fs_ufs.d grub_emu-fs_xfs.d grub_emu-io_gzio.d grub_emu-kern_device.d grub_emu-kern_disk.d grub_emu-kern_dl.d grub_emu-kern_env.d grub_emu-kern_err.d grub_emu-kern_file.d grub_emu-kern_fs.d grub_emu-kern_loader.d grub_emu-kern_main.d grub_emu-kern_misc.d grub_emu-kern_parser.d grub_emu-kern_partition.d grub_emu-kern_rescue.d grub_emu-kern_term.d grub_emu-normal_arg.d grub_emu-normal_cmdline.d grub_emu-normal_command.d grub_emu-normal_completion.d grub_emu-normal_context.d grub_emu-normal_execute.d grub_emu-normal_function.d grub_emu-normal_lexer.d grub_emu-normal_main.d grub_emu-normal_menu.d grub_emu-normal_menu_entry.d grub_emu-normal_misc.d grub_emu-normal_script.d grub_emu-partmap_amiga.d grub_emu-partmap_apple.d grub_emu-partmap_pc.d grub_emu-partmap_sun.d grub_emu-util_console.d grub_emu-util_grub_emu.d grub_emu-util_misc.d grub_emu-util_i386_pc_biosdisk.d grub_emu-util_i386_pc_getroot.d grub_emu-util_powerpc_ieee1275_misc.d grub_emu-grub_script_tab.d MOSTLYCLEANFILES += grub_emu-commands_boot.d grub_emu-commands_cat.d grub_emu-commands_cmp.d grub_emu-commands_configfile.d grub_emu-commands_default.d grub_emu-commands_help.d grub_emu-commands_search.d grub_emu-commands_terminal.d grub_emu-commands_test.d grub_emu-commands_ls.d grub_emu-commands_timeout.d grub_emu-commands_ieee1275_halt.d grub_emu-commands_ieee1275_reboot.d grub_emu-disk_loopback.d grub_emu-fs_affs.d grub_emu-fs_ext2.d grub_emu-fs_fat.d grub_emu-fs_fshelp.d grub_emu-fs_hfs.d grub_emu-fs_iso9660.d grub_emu-fs_jfs.d grub_emu-fs_minix.d grub_emu-fs_sfs.d grub_emu-fs_ufs.d grub_emu-fs_xfs.d grub_emu-io_gzio.d grub_emu-kern_device.d grub_emu-kern_disk.d grub_emu-kern_dl.d grub_emu-kern_env.d grub_emu-kern_err.d grub_emu-kern_file.d grub_emu-kern_fs.d grub_emu-kern_loader.d grub_emu-kern_main.d grub_emu-kern_misc.d grub_emu-kern_parser.d grub_emu-kern_partition.d grub_emu-kern_rescue.d grub_emu-kern_term.d grub_emu-normal_arg.d grub_emu-normal_cmdline.d grub_emu-normal_command.d grub_emu-normal_completion.d grub_emu-normal_context.d grub_emu-normal_execute.d grub_emu-normal_function.d grub_emu-normal_lexer.d grub_emu-normal_main.d grub_emu-normal_menu.d grub_emu-normal_menu_entry.d grub_emu-normal_misc.d grub_emu-normal_script.d grub_emu-partmap_amiga.d grub_emu-partmap_apple.d grub_emu-partmap_pc.d grub_emu-partmap_sun.d grub_emu-util_console.d grub_emu-util_grub_emu.d grub_emu-util_misc.d grub_emu-util_i386_pc_biosdisk.d grub_emu-util_i386_pc_getroot.d grub_emu-util_powerpc_ieee1275_misc.d grub_emu-grub_script_tab.d grub_emu-grub_emu_init.d
grub-emu: grub_emu-commands_boot.o grub_emu-commands_cat.o grub_emu-commands_cmp.o grub_emu-commands_configfile.o grub_emu-commands_default.o grub_emu-commands_help.o grub_emu-commands_search.o grub_emu-commands_terminal.o grub_emu-commands_test.o grub_emu-commands_ls.o grub_emu-commands_timeout.o grub_emu-commands_ieee1275_halt.o grub_emu-commands_ieee1275_reboot.o grub_emu-disk_loopback.o grub_emu-fs_affs.o grub_emu-fs_ext2.o grub_emu-fs_fat.o grub_emu-fs_fshelp.o grub_emu-fs_hfs.o grub_emu-fs_iso9660.o grub_emu-fs_jfs.o grub_emu-fs_minix.o grub_emu-fs_sfs.o grub_emu-fs_ufs.o grub_emu-fs_xfs.o grub_emu-io_gzio.o grub_emu-kern_device.o grub_emu-kern_disk.o grub_emu-kern_dl.o grub_emu-kern_env.o grub_emu-kern_err.o grub_emu-kern_file.o grub_emu-kern_fs.o grub_emu-kern_loader.o grub_emu-kern_main.o grub_emu-kern_misc.o grub_emu-kern_parser.o grub_emu-kern_partition.o grub_emu-kern_rescue.o grub_emu-kern_term.o grub_emu-normal_arg.o grub_emu-normal_cmdline.o grub_emu-normal_command.o grub_emu-normal_completion.o grub_emu-normal_context.o grub_emu-normal_execute.o grub_emu-normal_function.o grub_emu-normal_lexer.o grub_emu-normal_main.o grub_emu-normal_menu.o grub_emu-normal_menu_entry.o grub_emu-normal_misc.o grub_emu-normal_script.o grub_emu-partmap_amiga.o grub_emu-partmap_apple.o grub_emu-partmap_pc.o grub_emu-partmap_sun.o grub_emu-util_console.o grub_emu-util_grub_emu.o grub_emu-util_misc.o grub_emu-util_i386_pc_biosdisk.o grub_emu-util_i386_pc_getroot.o grub_emu-util_powerpc_ieee1275_misc.o grub_emu-grub_script_tab.o grub-emu: grub_emu-commands_boot.o grub_emu-commands_cat.o grub_emu-commands_cmp.o grub_emu-commands_configfile.o grub_emu-commands_default.o grub_emu-commands_help.o grub_emu-commands_search.o grub_emu-commands_terminal.o grub_emu-commands_test.o grub_emu-commands_ls.o grub_emu-commands_timeout.o grub_emu-commands_ieee1275_halt.o grub_emu-commands_ieee1275_reboot.o grub_emu-disk_loopback.o grub_emu-fs_affs.o grub_emu-fs_ext2.o grub_emu-fs_fat.o grub_emu-fs_fshelp.o grub_emu-fs_hfs.o grub_emu-fs_iso9660.o grub_emu-fs_jfs.o grub_emu-fs_minix.o grub_emu-fs_sfs.o grub_emu-fs_ufs.o grub_emu-fs_xfs.o grub_emu-io_gzio.o grub_emu-kern_device.o grub_emu-kern_disk.o grub_emu-kern_dl.o grub_emu-kern_env.o grub_emu-kern_err.o grub_emu-kern_file.o grub_emu-kern_fs.o grub_emu-kern_loader.o grub_emu-kern_main.o grub_emu-kern_misc.o grub_emu-kern_parser.o grub_emu-kern_partition.o grub_emu-kern_rescue.o grub_emu-kern_term.o grub_emu-normal_arg.o grub_emu-normal_cmdline.o grub_emu-normal_command.o grub_emu-normal_completion.o grub_emu-normal_context.o grub_emu-normal_execute.o grub_emu-normal_function.o grub_emu-normal_lexer.o grub_emu-normal_main.o grub_emu-normal_menu.o grub_emu-normal_menu_entry.o grub_emu-normal_misc.o grub_emu-normal_script.o grub_emu-partmap_amiga.o grub_emu-partmap_apple.o grub_emu-partmap_pc.o grub_emu-partmap_sun.o grub_emu-util_console.o grub_emu-util_grub_emu.o grub_emu-util_misc.o grub_emu-util_i386_pc_biosdisk.o grub_emu-util_i386_pc_getroot.o grub_emu-util_powerpc_ieee1275_misc.o grub_emu-grub_script_tab.o grub_emu-grub_emu_init.o
$(BUILD_CC) -o $@ $^ $(BUILD_LDFLAGS) $(grub_emu_LDFLAGS) $(BUILD_CC) -o $@ $^ $(BUILD_LDFLAGS) $(grub_emu_LDFLAGS)
grub_emu-commands_boot.o: commands/boot.c grub_emu-commands_boot.o: commands/boot.c
@ -608,9 +608,26 @@ grub_emu-grub_script_tab.d: grub_script.tab.c
-include grub_emu-grub_script_tab.d -include grub_emu-grub_script_tab.d
grub_emu-grub_emu_init.o: grub_emu_init.c
$(BUILD_CC) -I. -I$(srcdir)/. $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
grub_emu-grub_emu_init.d: grub_emu_init.c
set -e; $(BUILD_CC) -I. -I$(srcdir)/. $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $< | sed 's,grub_emu_init\.o[ :]*,grub_emu-grub_emu_init.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
-include grub_emu-grub_emu_init.d
grub_emu_LDFLAGS = $(LIBCURSES) grub_emu_LDFLAGS = $(LIBCURSES)
grub_modules_init.lst: geninit.sh
(cd $(srcdir); grep -r --include="*.c" GRUB_MOD_INIT *) > $@
grub_modules_init.h: $(filter-out grub_emu_init.c,$(grub_emu_SOURCES)) geninitheader.sh grub_modules_init.lst
sh $(srcdir)/geninitheader.sh > $@
grub_emu_init.c: $(filter-out grub_emu_init.c,$(grub_emu_SOURCES)) geninit.sh grub_modules_init.lst
sh $(srcdir)/geninit.sh $(filter %.c,$^) > $@
grubof_SOURCES = kern/powerpc/ieee1275/crt0.S kern/powerpc/ieee1275/cmain.c \ grubof_SOURCES = kern/powerpc/ieee1275/crt0.S kern/powerpc/ieee1275/cmain.c \
kern/ieee1275/ieee1275.c kern/main.c kern/device.c \ kern/ieee1275/ieee1275.c kern/main.c kern/device.c \
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \ kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \

View file

@ -59,10 +59,19 @@ grub_emu_SOURCES = commands/boot.c commands/cat.c commands/cmp.c \
partmap/amiga.c partmap/apple.c partmap/pc.c partmap/sun.c \ partmap/amiga.c partmap/apple.c partmap/pc.c partmap/sun.c \
util/console.c util/grub-emu.c util/misc.c \ util/console.c util/grub-emu.c util/misc.c \
util/i386/pc/biosdisk.c util/i386/pc/getroot.c \ util/i386/pc/biosdisk.c util/i386/pc/getroot.c \
util/powerpc/ieee1275/misc.c grub_script.tab.c util/powerpc/ieee1275/misc.c grub_script.tab.c grub_emu_init.c
grub_emu_LDFLAGS = $(LIBCURSES) grub_emu_LDFLAGS = $(LIBCURSES)
grub_modules_init.lst: geninit.sh
(cd $(srcdir); grep -r --include="*.c" GRUB_MOD_INIT *) > $@
grub_modules_init.h: $(filter-out grub_emu_init.c,$(grub_emu_SOURCES)) geninitheader.sh grub_modules_init.lst
sh $(srcdir)/geninitheader.sh > $@
grub_emu_init.c: $(filter-out grub_emu_init.c,$(grub_emu_SOURCES)) geninit.sh grub_modules_init.lst grub_modules_init.h
sh $(srcdir)/geninit.sh $(filter %.c,$^) > $@
grubof_SOURCES = kern/powerpc/ieee1275/crt0.S kern/powerpc/ieee1275/cmain.c \ grubof_SOURCES = kern/powerpc/ieee1275/crt0.S kern/powerpc/ieee1275/cmain.c \
kern/ieee1275/ieee1275.c kern/main.c kern/device.c \ kern/ieee1275/ieee1275.c kern/main.c kern/device.c \
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \ kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \

View file

@ -240,24 +240,8 @@ static struct grub_disk_dev grub_loopback_dev =
}; };
#ifdef GRUB_UTIL
void
grub_loop_init (void)
{
grub_register_command ("loopback", grub_cmd_loopback, GRUB_COMMAND_FLAG_BOTH,
"loopback [-d|-p] DEVICENAME FILE",
"Make a device of a file.", options);
grub_disk_dev_register (&grub_loopback_dev);
}
void GRUB_MOD_INIT(loop)
grub_loop_fini (void)
{
grub_unregister_command ("loopback");
grub_disk_dev_unregister (&grub_loopback_dev);
}
#else /* ! GRUB_UTIL */
GRUB_MOD_INIT
{ {
(void)mod; /* To stop warning. */ (void)mod; /* To stop warning. */
grub_register_command ("loopback", grub_cmd_loopback, GRUB_COMMAND_FLAG_BOTH, grub_register_command ("loopback", grub_cmd_loopback, GRUB_COMMAND_FLAG_BOTH,
@ -266,9 +250,9 @@ GRUB_MOD_INIT
grub_disk_dev_register (&grub_loopback_dev); grub_disk_dev_register (&grub_loopback_dev);
} }
GRUB_MOD_FINI GRUB_MOD_FINI(loop)
{ {
grub_unregister_command ("loopback"); grub_unregister_command ("loopback");
grub_disk_dev_unregister (&grub_loopback_dev); grub_disk_dev_unregister (&grub_loopback_dev);
} }
#endif /* ! GRUB_UTIL */

View file

@ -232,7 +232,7 @@ font_command (struct grub_arg_list *state __attribute__ ((unused)),
return 0; return 0;
} }
GRUB_MOD_INIT GRUB_MOD_INIT(fontmanager)
{ {
(void) mod; /* Stop warning. */ (void) mod; /* Stop warning. */
grub_register_command ("font", font_command, GRUB_COMMAND_FLAG_BOTH, grub_register_command ("font", font_command, GRUB_COMMAND_FLAG_BOTH,
@ -240,7 +240,7 @@ GRUB_MOD_INIT
"Specify one or more font files to display.", 0); "Specify one or more font files to display.", 0);
} }
GRUB_MOD_FINI GRUB_MOD_FINI(fontmanager)
{ {
grub_unregister_command ("font"); grub_unregister_command ("font");
} }

View file

@ -553,27 +553,16 @@ static struct grub_fs grub_affs_fs =
.next = 0 .next = 0
}; };
#ifdef GRUB_UTIL GRUB_MOD_INIT(affs)
void
grub_affs_init (void)
{
grub_fs_register (&grub_affs_fs);
}
void
grub_affs_fini (void)
{
grub_fs_unregister (&grub_affs_fs);
}
#else /* ! GRUB_UTIL */
GRUB_MOD_INIT
{ {
grub_fs_register (&grub_affs_fs); grub_fs_register (&grub_affs_fs);
#ifndef GRUB_UTIL
my_mod = mod; my_mod = mod;
#endif
} }
GRUB_MOD_FINI GRUB_MOD_FINI(affs)
{ {
grub_fs_unregister (&grub_affs_fs); grub_fs_unregister (&grub_affs_fs);
} }
#endif /* ! GRUB_UTIL */

View file

@ -1,7 +1,7 @@
/* ext2.c - Second Extended filesystem */ /* ext2.c - Second Extended filesystem */
/* /*
* GRUB -- GRand Unified Bootloader * GRUB -- GRand Unified Bootloader
* Copyright (C) 2003, 2004 Free Software Foundation, Inc. * Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -633,27 +633,15 @@ static struct grub_fs grub_ext2_fs =
.next = 0 .next = 0
}; };
#ifdef GRUB_UTIL GRUB_MOD_INIT(ext2)
void
grub_ext2_init (void)
{
grub_fs_register (&grub_ext2_fs);
}
void
grub_ext2_fini (void)
{
grub_fs_unregister (&grub_ext2_fs);
}
#else /* ! GRUB_UTIL */
GRUB_MOD_INIT
{ {
grub_fs_register (&grub_ext2_fs); grub_fs_register (&grub_ext2_fs);
#ifndef GRUB_UTIL
my_mod = mod; my_mod = mod;
#endif
} }
GRUB_MOD_FINI GRUB_MOD_FINI(ext2)
{ {
grub_fs_unregister (&grub_ext2_fs); grub_fs_unregister (&grub_ext2_fs);
} }
#endif /* ! GRUB_UTIL */

View file

@ -808,27 +808,16 @@ static struct grub_fs grub_fat_fs =
.next = 0 .next = 0
}; };
#ifdef GRUB_UTIL GRUB_MOD_INIT(fat)
void
grub_fat_init (void)
{
grub_fs_register (&grub_fat_fs);
}
void
grub_fat_fini (void)
{
grub_fs_unregister (&grub_fat_fs);
}
#else /* ! GRUB_UTIL */
GRUB_MOD_INIT
{ {
grub_fs_register (&grub_fat_fs); grub_fs_register (&grub_fat_fs);
#ifndef GRUB_UTIL
my_mod = mod; my_mod = mod;
#endif
} }
GRUB_MOD_FINI GRUB_MOD_FINI(fat)
{ {
grub_fs_unregister (&grub_fat_fs); grub_fs_unregister (&grub_fat_fs);
} }
#endif /* ! GRUB_UTIL */

View file

@ -1,7 +1,7 @@
/* hfs.c - HFS. */ /* hfs.c - HFS. */
/* /*
* GRUB -- GRand Unified Bootloader * GRUB -- GRand Unified Bootloader
* Copyright (C) 2004 Free Software Foundation, Inc. * Copyright (C) 2004, 2005 Free Software Foundation, Inc.
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -875,27 +875,15 @@ static struct grub_fs grub_hfs_fs =
.next = 0 .next = 0
}; };
#ifdef GRUB_UTIL GRUB_MOD_INIT(hfs)
void
grub_hfs_init (void)
{
grub_fs_register (&grub_hfs_fs);
}
void
grub_hfs_fini (void)
{
grub_fs_unregister (&grub_hfs_fs);
}
#else /* ! GRUB_UTIL */
GRUB_MOD_INIT
{ {
grub_fs_register (&grub_hfs_fs); grub_fs_register (&grub_hfs_fs);
#ifndef GRUB_UTIL
my_mod = mod; my_mod = mod;
#endif
} }
GRUB_MOD_FINI GRUB_MOD_FINI(hfs)
{ {
grub_fs_unregister (&grub_hfs_fs); grub_fs_unregister (&grub_hfs_fs);
} }
#endif /* ! GRUB_UTIL */

View file

@ -2,7 +2,7 @@
SUSP, Rock Ridge. */ SUSP, Rock Ridge. */
/* /*
* GRUB -- GRand Unified Bootloader * GRUB -- GRand Unified Bootloader
* Copyright (C) 2004 Free Software Foundation, Inc. * Copyright (C) 2004, 2005 Free Software Foundation, Inc.
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -764,27 +764,15 @@ static struct grub_fs grub_iso9660_fs =
.next = 0 .next = 0
}; };
#ifdef GRUB_UTIL GRUB_MOD_INIT(iso9660)
void
grub_iso9660_init (void)
{
grub_fs_register (&grub_iso9660_fs);
}
void
grub_iso9660_fini (void)
{
grub_fs_unregister (&grub_iso9660_fs);
}
#else /* ! GRUB_UTIL */
GRUB_MOD_INIT
{ {
grub_fs_register (&grub_iso9660_fs); grub_fs_register (&grub_iso9660_fs);
#ifndef GRUB_UTIL
my_mod = mod; my_mod = mod;
#endif
} }
GRUB_MOD_FINI GRUB_MOD_FINI(iso9660)
{ {
grub_fs_unregister (&grub_iso9660_fs); grub_fs_unregister (&grub_iso9660_fs);
} }
#endif /* ! GRUB_UTIL */

View file

@ -1,7 +1,7 @@
/* jfs.c - JFS. */ /* jfs.c - JFS. */
/* /*
* GRUB -- GRand Unified Bootloader * GRUB -- GRand Unified Bootloader
* Copyright (C) 2004 Free Software Foundation, Inc. * Copyright (C) 2004, 2005 Free Software Foundation, Inc.
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -870,27 +870,15 @@ static struct grub_fs grub_jfs_fs =
.next = 0 .next = 0
}; };
#ifdef GRUB_UTIL GRUB_MOD_INIT(jfs)
void
grub_jfs_init (void)
{
grub_fs_register (&grub_jfs_fs);
}
void
grub_jfs_fini (void)
{
grub_fs_unregister (&grub_jfs_fs);
}
#else /* ! GRUB_UTIL */
GRUB_MOD_INIT
{ {
grub_fs_register (&grub_jfs_fs); grub_fs_register (&grub_jfs_fs);
#ifndef GRUB_UTIL
my_mod = mod; my_mod = mod;
#endif
} }
GRUB_MOD_FINI GRUB_MOD_FINI(jfs)
{ {
grub_fs_unregister (&grub_jfs_fs); grub_fs_unregister (&grub_jfs_fs);
} }
#endif /* ! GRUB_UTIL */

View file

@ -597,27 +597,15 @@ static struct grub_fs grub_minix_fs =
.next = 0 .next = 0
}; };
#ifdef GRUB_UTIL GRUB_MOD_INIT(minix)
void
grub_minix_init (void)
{
grub_fs_register (&grub_minix_fs);
}
void
grub_minix_fini (void)
{
grub_fs_unregister (&grub_minix_fs);
}
#else /* ! GRUB_UTIL */
GRUB_MOD_INIT
{ {
grub_fs_register (&grub_minix_fs); grub_fs_register (&grub_minix_fs);
#ifndef GRUB_UTIL
my_mod = mod; my_mod = mod;
#endif
} }
GRUB_MOD_FINI GRUB_MOD_FINI(minix)
{ {
grub_fs_unregister (&grub_minix_fs); grub_fs_unregister (&grub_minix_fs);
} }
#endif /* ! GRUB_UTIL */

View file

@ -605,27 +605,15 @@ static struct grub_fs grub_sfs_fs =
.next = 0 .next = 0
}; };
#ifdef GRUB_UTIL GRUB_MOD_INIT(sfs)
void
grub_sfs_init (void)
{
grub_fs_register (&grub_sfs_fs);
}
void
grub_sfs_fini (void)
{
grub_fs_unregister (&grub_sfs_fs);
}
#else /* ! GRUB_UTIL */
GRUB_MOD_INIT
{ {
grub_fs_register (&grub_sfs_fs); grub_fs_register (&grub_sfs_fs);
#ifndef GRUB_UTIL
my_mod = mod; my_mod = mod;
#endif
} }
GRUB_MOD_FINI GRUB_MOD_FINI(sfs)
{ {
grub_fs_unregister (&grub_sfs_fs); grub_fs_unregister (&grub_sfs_fs);
} }
#endif /* ! GRUB_UTIL */

View file

@ -1,7 +1,7 @@
/* ufs.c - Unix File System */ /* ufs.c - Unix File System */
/* /*
* GRUB -- GRand Unified Bootloader * GRUB -- GRand Unified Bootloader
* Copyright (C) 2004 Free Software Foundation, Inc. * Copyright (C) 2004, 2005 Free Software Foundation, Inc.
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -668,27 +668,16 @@ static struct grub_fs grub_ufs_fs =
.next = 0 .next = 0
}; };
#ifdef GRUB_UTIL GRUB_MOD_INIT(ufs)
void
grub_ufs_init (void)
{
grub_fs_register (&grub_ufs_fs);
}
void
grub_ufs_fini (void)
{
grub_fs_unregister (&grub_ufs_fs);
}
#else /* ! GRUB_UTIL */
GRUB_MOD_INIT
{ {
grub_fs_register (&grub_ufs_fs); grub_fs_register (&grub_ufs_fs);
#ifndef GRUB_UTIL
my_mod = mod; my_mod = mod;
#endif
} }
GRUB_MOD_FINI GRUB_MOD_FINI(ufs)
{ {
grub_fs_unregister (&grub_ufs_fs); grub_fs_unregister (&grub_ufs_fs);
} }
#endif /* ! GRUB_UTIL */

View file

@ -689,27 +689,16 @@ static struct grub_fs grub_xfs_fs =
.next = 0 .next = 0
}; };
#ifdef GRUB_UTIL GRUB_MOD_INIT(xfs)
void
grub_xfs_init (void)
{
grub_fs_register (&grub_xfs_fs);
}
void
grub_xfs_fini (void)
{
grub_fs_unregister (&grub_xfs_fs);
}
#else /* ! GRUB_UTIL */
GRUB_MOD_INIT
{ {
grub_fs_register (&grub_xfs_fs); grub_fs_register (&grub_xfs_fs);
#ifndef GRUB_UTIL
my_mod = mod; my_mod = mod;
#endif
} }
GRUB_MOD_FINI GRUB_MOD_FINI(xfs)
{ {
grub_fs_unregister (&grub_xfs_fs); grub_fs_unregister (&grub_xfs_fs);
} }
#endif /* ! GRUB_UTIL */

70
geninit.sh Normal file
View file

@ -0,0 +1,70 @@
#! /bin/sh
#
# Copyright (C) 2002, 2005 Free Software Foundation, Inc.
#
# This gensymlist.sh is free software; the author
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
cat <<EOF
/* This file is automatically generated by gensymlist.sh. DO NOT EDIT! */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002, 2005 Free Software Foundation, Inc.
*
* GRUB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <grub_modules_init.h>
EOF
cat <<EOF
void
grub_init_all (void)
{
EOF
(
cat grub_modules_init.lst
for i in $*; do
echo $i':'
done
) | sort -r | uniq -d -W1 -t':' | sed -n '/GRUB_MOD_INIT *([a-zA-Z0-9_]*)/{s/.*GRUB_MOD_INIT *(\([a-zA-Z0-9_]*\)).*/ grub_\1_init ();/;p;}'
cat <<EOF
}
EOF
cat <<EOF
void
grub_fini_all (void)
{
EOF
(
cat grub_modules_init.lst
for i in $*; do
echo $i':'
done
) | sort -r | uniq -d -W1 -t':' | sed -n '/GRUB_MOD_INIT *([a-zA-Z0-9_]*)/{s/.*GRUB_MOD_INIT *(\([a-zA-Z0-9_]*\)).*/ grub_\1_fini ();/;p;}'
cat <<EOF
}
EOF

43
geninitheader.sh Normal file
View file

@ -0,0 +1,43 @@
#! /bin/sh
#
# Copyright (C) 2005 Free Software Foundation, Inc.
#
# This gensymlist.sh is free software; the author
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
cat <<EOF
/* This file is automatically generated by gensymlist.sh. DO NOT EDIT! */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2005 Free Software Foundation, Inc.
*
* GRUB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
EOF
cat <<EOF
void grub_init_all (void);
void grub_fini_all (void);
EOF
cat grub_modules_init.lst | grep -v '^#' | sed -n '/GRUB_MOD_INIT *([a-zA-Z0-9_]*)/{s/.*GRUB_MOD_INIT *(\([a-zA-Z0-9_]*\)).*/void grub_\1_init (void);/;p;}'
cat grub_modules_init.lst | grep -v '^#' | sed -n '/GRUB_MOD_INIT *([a-zA-Z0-9_]*)/{s/.*GRUB_MOD_INIT *(\([a-zA-Z0-9_]*\)).*/void grub_\1_fini (void);/;p;}'

View file

@ -35,14 +35,14 @@ grub_cmd_hello (struct grub_arg_list *state __attribute__ ((unused)),
return 0; return 0;
} }
GRUB_MOD_INIT GRUB_MOD_INIT(hello)
{ {
(void)mod; /* To stop warning. */ (void)mod; /* To stop warning. */
grub_register_command ("hello", grub_cmd_hello, GRUB_COMMAND_FLAG_BOTH, grub_register_command ("hello", grub_cmd_hello, GRUB_COMMAND_FLAG_BOTH,
"hello", "Say hello", 0); "hello", "Say hello", 0);
} }
GRUB_MOD_FINI GRUB_MOD_FINI(hello)
{ {
grub_unregister_command ("hello"); grub_unregister_command ("hello");
} }

View file

@ -25,13 +25,19 @@
#include <grub/err.h> #include <grub/err.h>
#include <grub/types.h> #include <grub/types.h>
#define GRUB_MOD_INIT \ #define GRUB_MOD_INIT(name) \
static void grub_mod_init (grub_dl_t mod) __attribute__ ((used)); \ static void grub_mod_init (grub_dl_t mod) __attribute__ ((used)); \
void grub_##name##_init (void); \
void \
grub_##name##_init (void) { grub_mod_init (0); } \
static void \ static void \
grub_mod_init (grub_dl_t mod) grub_mod_init (grub_dl_t mod)
#define GRUB_MOD_FINI \ #define GRUB_MOD_FINI(name) \
static void grub_mod_fini (void) __attribute__ ((used)); \ static void grub_mod_fini (void) __attribute__ ((used)); \
void grub_##name##_fini (void); \
void \
grub_##name##_fini (void) { grub_mod_fini (); } \
static void \ static void \
grub_mod_fini (void) grub_mod_fini (void)

View file

@ -145,7 +145,7 @@ grub_rescue_cmd_chainloader (int argc, char *argv[])
static const char loader_name[] = "chainloader"; static const char loader_name[] = "chainloader";
GRUB_MOD_INIT GRUB_MOD_INIT(chainloader)
{ {
grub_rescue_register_command (loader_name, grub_rescue_register_command (loader_name,
grub_rescue_cmd_chainloader, grub_rescue_cmd_chainloader,
@ -153,7 +153,7 @@ GRUB_MOD_INIT
my_mod = mod; my_mod = mod;
} }
GRUB_MOD_FINI GRUB_MOD_FINI(chainloader)
{ {
grub_rescue_unregister_command (loader_name); grub_rescue_unregister_command (loader_name);
} }

View file

@ -42,7 +42,7 @@ chainloader_command (struct grub_arg_list *state,
return grub_errno; return grub_errno;
} }
GRUB_MOD_INIT GRUB_MOD_INIT(chainloader_normal)
{ {
(void) mod; /* To stop warning. */ (void) mod; /* To stop warning. */
grub_register_command ("chainloader", chainloader_command, grub_register_command ("chainloader", chainloader_command,
@ -51,7 +51,7 @@ GRUB_MOD_INIT
"Prepare to boot another boot loader.", options); "Prepare to boot another boot loader.", options);
} }
GRUB_MOD_FINI GRUB_MOD_FINI(chainloader_normal)
{ {
grub_unregister_command ("chainloader"); grub_unregister_command ("chainloader");
} }

View file

@ -368,7 +368,7 @@ grub_rescue_cmd_initrd (int argc, char *argv[])
} }
GRUB_MOD_INIT GRUB_MOD_INIT(linux)
{ {
grub_rescue_register_command ("linux", grub_rescue_register_command ("linux",
grub_rescue_cmd_linux, grub_rescue_cmd_linux,
@ -379,7 +379,7 @@ GRUB_MOD_INIT
my_mod = mod; my_mod = mod;
} }
GRUB_MOD_FINI GRUB_MOD_FINI(linux)
{ {
grub_rescue_unregister_command ("linux"); grub_rescue_unregister_command ("linux");
grub_rescue_unregister_command ("initrd"); grub_rescue_unregister_command ("initrd");

View file

@ -40,7 +40,7 @@ grub_normal_initrd_command (struct grub_arg_list *state __attribute__ ((unused))
return grub_errno; return grub_errno;
} }
GRUB_MOD_INIT GRUB_MOD_INIT(linux_normal)
{ {
(void) mod; /* To stop warning. */ (void) mod; /* To stop warning. */
grub_register_command ("linux", grub_normal_linux_command, grub_register_command ("linux", grub_normal_linux_command,
@ -54,7 +54,7 @@ GRUB_MOD_INIT
"Load an initrd.", 0); "Load an initrd.", 0);
} }
GRUB_MOD_FINI GRUB_MOD_FINI(linux_normal)
{ {
grub_unregister_command ("linux"); grub_unregister_command ("linux");
grub_unregister_command ("initrd"); grub_unregister_command ("initrd");

View file

@ -435,7 +435,7 @@ grub_rescue_cmd_module (int argc, char *argv[])
} }
GRUB_MOD_INIT GRUB_MOD_INIT(multiboot)
{ {
grub_rescue_register_command ("multiboot", grub_rescue_cmd_multiboot, grub_rescue_register_command ("multiboot", grub_rescue_cmd_multiboot,
"load a multiboot kernel"); "load a multiboot kernel");
@ -444,7 +444,7 @@ GRUB_MOD_INIT
my_mod = mod; my_mod = mod;
} }
GRUB_MOD_FINI GRUB_MOD_FINI(multiboot)
{ {
grub_rescue_unregister_command ("multiboot"); grub_rescue_unregister_command ("multiboot");
grub_rescue_unregister_command ("module"); grub_rescue_unregister_command ("module");

View file

@ -40,7 +40,7 @@ grub_normal_cmd_module (struct grub_arg_list *state __attribute__ ((unused)),
return grub_errno; return grub_errno;
} }
GRUB_MOD_INIT GRUB_MOD_INIT(multiboot_normal)
{ {
(void) mod; /* To stop warning. */ (void) mod; /* To stop warning. */
grub_register_command ("multiboot", grub_normal_cmd_multiboot, grub_register_command ("multiboot", grub_normal_cmd_multiboot,
@ -54,7 +54,7 @@ GRUB_MOD_INIT
"Load a Multiboot module.", 0); "Load a Multiboot module.", 0);
} }
GRUB_MOD_FINI GRUB_MOD_FINI(multiboot_normal)
{ {
grub_unregister_command ("multiboot"); grub_unregister_command ("multiboot");
grub_unregister_command ("module"); grub_unregister_command ("module");

View file

@ -307,7 +307,7 @@ grub_rescue_cmd_initrd (int argc, char *argv[])
GRUB_MOD_INIT GRUB_MOD_INIT(linux)
{ {
grub_rescue_register_command ("linux", grub_rescue_cmd_linux, grub_rescue_register_command ("linux", grub_rescue_cmd_linux,
"load a linux kernel"); "load a linux kernel");
@ -316,7 +316,7 @@ GRUB_MOD_INIT
my_mod = mod; my_mod = mod;
} }
GRUB_MOD_FINI GRUB_MOD_FINI(linux)
{ {
grub_rescue_unregister_command ("linux"); grub_rescue_unregister_command ("linux");
grub_rescue_unregister_command ("initrd"); grub_rescue_unregister_command ("initrd");

View file

@ -43,7 +43,7 @@ grub_cmd_initrd (struct grub_arg_list *state __attribute__ ((unused)),
return GRUB_ERR_NONE; return GRUB_ERR_NONE;
} }
GRUB_MOD_INIT GRUB_MOD_INIT(linux_normal)
{ {
(void) mod; (void) mod;
grub_register_command ("linux", grub_cmd_linux, GRUB_COMMAND_FLAG_BOTH, grub_register_command ("linux", grub_cmd_linux, GRUB_COMMAND_FLAG_BOTH,
@ -54,7 +54,7 @@ GRUB_MOD_INIT
"Loads initrd", options); "Loads initrd", options);
} }
GRUB_MOD_FINI GRUB_MOD_FINI(linux_normal)
{ {
grub_unregister_command ("linux"); grub_unregister_command ("linux");
grub_unregister_command ("initrd"); grub_unregister_command ("initrd");

View file

@ -519,33 +519,11 @@ grub_rescue_cmd_normal (int argc, char *argv[])
grub_enter_normal_mode (argv[0]); grub_enter_normal_mode (argv[0]);
} }
#ifdef GRUB_UTIL GRUB_MOD_INIT(normal)
void
grub_normal_init (void)
{
grub_set_history (GRUB_DEFAULT_HISTORY_SIZE);
/* Register a command "normal" for the rescue mode. */
grub_rescue_register_command ("normal", grub_rescue_cmd_normal,
"enter normal mode");
/* This registers some built-in commands. */
grub_command_init ();
}
void
grub_normal_fini (void)
{
grub_set_history (0);
grub_rescue_unregister_command ("normal");
}
#else /* ! GRUB_UTIL */
GRUB_MOD_INIT
{ {
/* Normal mode shouldn't be unloaded. */ /* Normal mode shouldn't be unloaded. */
grub_dl_ref (mod); if (mod)
grub_dl_ref (mod);
grub_set_history (GRUB_DEFAULT_HISTORY_SIZE); grub_set_history (GRUB_DEFAULT_HISTORY_SIZE);
@ -557,9 +535,9 @@ GRUB_MOD_INIT
grub_command_init (); grub_command_init ();
} }
GRUB_MOD_FINI GRUB_MOD_FINI(normal)
{ {
grub_set_history (0); grub_set_history (0);
grub_rescue_unregister_command ("normal"); grub_rescue_unregister_command ("normal");
} }
#endif /* ! GRUB_UTIL */

View file

@ -1,7 +1,7 @@
/* amiga.c - Read amiga partition tables (RDB). */ /* amiga.c - Read amiga partition tables (RDB). */
/* /*
* GRUB -- GRand Unified Bootloader * GRUB -- GRand Unified Bootloader
* Copyright (C) 2002, 2004 Free Software Foundation, Inc. * Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -211,27 +211,15 @@ static struct grub_partition_map grub_amiga_partition_map =
.get_name = amiga_partition_map_get_name .get_name = amiga_partition_map_get_name
}; };
#ifdef GRUB_UTIL GRUB_MOD_INIT(amiga_partition_map)
void
grub_amiga_partition_map_init (void)
{
grub_partition_map_register (&grub_amiga_partition_map);
}
void
grub_amiga_partition_map_fini (void)
{
grub_partition_map_unregister (&grub_amiga_partition_map);
}
#else
GRUB_MOD_INIT
{ {
grub_partition_map_register (&grub_amiga_partition_map); grub_partition_map_register (&grub_amiga_partition_map);
#ifndef GRUB_UTIL
my_mod = mod; my_mod = mod;
#endif
} }
GRUB_MOD_FINI GRUB_MOD_FINI(amiga_partition_map)
{ {
grub_partition_map_unregister (&grub_amiga_partition_map); grub_partition_map_unregister (&grub_amiga_partition_map);
} }
#endif

View file

@ -1,7 +1,7 @@
/* apple.c - Read macintosh partition tables. */ /* apple.c - Read macintosh partition tables. */
/* /*
* GRUB -- GRand Unified Bootloader * GRUB -- GRand Unified Bootloader
* Copyright (C) 2002, 2004 Free Software Foundation, Inc. * Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -220,27 +220,16 @@ static struct grub_partition_map grub_apple_partition_map =
.get_name = apple_partition_map_get_name .get_name = apple_partition_map_get_name
}; };
#ifdef GRUB_UTIL GRUB_MOD_INIT(apple_partition_map)
void
grub_apple_partition_map_init (void)
{
grub_partition_map_register (&grub_apple_partition_map);
}
void
grub_apple_partition_map_fini (void)
{
grub_partition_map_unregister (&grub_apple_partition_map);
}
#else
GRUB_MOD_INIT
{ {
grub_partition_map_register (&grub_apple_partition_map); grub_partition_map_register (&grub_apple_partition_map);
#ifndef GRUB_UTIL
my_mod = mod; my_mod = mod;
#endif
} }
GRUB_MOD_FINI GRUB_MOD_FINI(apple_partition_map)
{ {
grub_partition_map_unregister (&grub_apple_partition_map); grub_partition_map_unregister (&grub_apple_partition_map);
} }
#endif

View file

@ -296,27 +296,15 @@ static struct grub_partition_map grub_pc_partition_map =
.get_name = pc_partition_map_get_name .get_name = pc_partition_map_get_name
}; };
#ifdef GRUB_UTIL GRUB_MOD_INIT(pc_partition_map)
void
grub_pc_partition_map_init (void)
{
grub_partition_map_register (&grub_pc_partition_map);
}
void
grub_pc_partition_map_fini (void)
{
grub_partition_map_unregister (&grub_pc_partition_map);
}
#else
GRUB_MOD_INIT
{ {
grub_partition_map_register (&grub_pc_partition_map); grub_partition_map_register (&grub_pc_partition_map);
#ifndef GRUB_UTIL
my_mod = mod; my_mod = mod;
#endif
} }
GRUB_MOD_FINI GRUB_MOD_FINI(pc_partition_map)
{ {
grub_partition_map_unregister (&grub_pc_partition_map); grub_partition_map_unregister (&grub_pc_partition_map);
} }
#endif

View file

@ -192,27 +192,16 @@ static struct grub_partition_map grub_sun_partition_map =
.get_name = sun_partition_map_get_name .get_name = sun_partition_map_get_name
}; };
#ifdef GRUB_UTIL GRUB_MOD_INIT(sun_partition_map)
void
grub_sun_partition_map_init (void)
{
grub_partition_map_register (&grub_sun_partition_map);
}
void
grub_sun_partition_map_fini (void)
{
grub_partition_map_unregister (&grub_sun_partition_map);
}
#else
GRUB_MOD_INIT
{ {
grub_partition_map_register (&grub_sun_partition_map); grub_partition_map_register (&grub_sun_partition_map);
#ifndef GRUB_UTIL
my_mod = mod; my_mod = mod;
#endif
} }
GRUB_MOD_FINI GRUB_MOD_FINI(sun_partition_map)
{ {
grub_partition_map_unregister (&grub_sun_partition_map); grub_partition_map_unregister (&grub_sun_partition_map);
} }
#endif

View file

@ -616,7 +616,7 @@ grub_cmd_serial (struct grub_arg_list *state,
return hwiniterr; return hwiniterr;
} }
GRUB_MOD_INIT GRUB_MOD_INIT(serial)
{ {
(void) mod; /* To stop warning. */ (void) mod; /* To stop warning. */
grub_register_command ("serial", grub_cmd_serial, GRUB_COMMAND_FLAG_BOTH, grub_register_command ("serial", grub_cmd_serial, GRUB_COMMAND_FLAG_BOTH,
@ -629,7 +629,7 @@ GRUB_MOD_INIT
serial_settings.stop_bits = UART_1_STOP_BIT; serial_settings.stop_bits = UART_1_STOP_BIT;
} }
GRUB_MOD_FINI GRUB_MOD_FINI(serial)
{ {
grub_unregister_command ("serial"); grub_unregister_command ("serial");
if (registered == 1) /* Unregister terminal only if registered. */ if (registered == 1) /* Unregister terminal only if registered. */

View file

@ -142,7 +142,7 @@ grub_virtual_screen_setup (grub_uint32_t width,
} }
static grub_err_t static grub_err_t
grub_vesafb_init (void) grub_vesafb_mod_init (void)
{ {
grub_uint32_t use_mode = GRUB_VBE_DEFAULT_VIDEO_MODE; grub_uint32_t use_mode = GRUB_VBE_DEFAULT_VIDEO_MODE;
struct grub_vbe_info_block controller_info; struct grub_vbe_info_block controller_info;
@ -200,7 +200,7 @@ grub_vesafb_init (void)
} }
static grub_err_t static grub_err_t
grub_vesafb_fini (void) grub_vesafb_mod_fini (void)
{ {
grub_virtual_screen_free (); grub_virtual_screen_free ();
@ -589,8 +589,8 @@ grub_vesafb_setcursor (int on)
static struct grub_term grub_vesafb_term = static struct grub_term grub_vesafb_term =
{ {
.name = "vesafb", .name = "vesafb",
.init = grub_vesafb_init, .init = grub_vesafb_mod_init,
.fini = grub_vesafb_fini, .fini = grub_vesafb_mod_fini,
.putchar = grub_vesafb_putchar, .putchar = grub_vesafb_putchar,
.getcharwidth = grub_vesafb_getcharwidth, .getcharwidth = grub_vesafb_getcharwidth,
.checkkey = grub_console_checkkey, .checkkey = grub_console_checkkey,
@ -606,13 +606,13 @@ static struct grub_term grub_vesafb_term =
.next = 0 .next = 0
}; };
GRUB_MOD_INIT GRUB_MOD_INIT(vesafb)
{ {
my_mod = mod; my_mod = mod;
grub_term_register (&grub_vesafb_term); grub_term_register (&grub_vesafb_term);
} }
GRUB_MOD_FINI GRUB_MOD_FINI(vesafb)
{ {
grub_term_unregister (&grub_vesafb_term); grub_term_unregister (&grub_vesafb_term);
} }

View file

@ -173,7 +173,7 @@ set_start_address (unsigned int start)
} }
static grub_err_t static grub_err_t
grub_vga_init (void) grub_vga_mod_init (void)
{ {
vga_font = grub_vga_get_font (); vga_font = grub_vga_get_font ();
text_mode = grub_vga_set_mode (0x10); text_mode = grub_vga_set_mode (0x10);
@ -188,7 +188,7 @@ grub_vga_init (void)
} }
static grub_err_t static grub_err_t
grub_vga_fini (void) grub_vga_mod_fini (void)
{ {
set_map_mask (saved_map_mask); set_map_mask (saved_map_mask);
grub_vga_set_mode (text_mode); grub_vga_set_mode (text_mode);
@ -578,8 +578,8 @@ grub_vga_setcursor (int on)
static struct grub_term grub_vga_term = static struct grub_term grub_vga_term =
{ {
.name = "vga", .name = "vga",
.init = grub_vga_init, .init = grub_vga_mod_init,
.fini = grub_vga_fini, .fini = grub_vga_mod_fini,
.putchar = grub_vga_putchar, .putchar = grub_vga_putchar,
.getcharwidth = grub_vga_getcharwidth, .getcharwidth = grub_vga_getcharwidth,
.checkkey = grub_console_checkkey, .checkkey = grub_console_checkkey,
@ -595,13 +595,15 @@ static struct grub_term grub_vga_term =
.next = 0 .next = 0
}; };
GRUB_MOD_INIT GRUB_MOD_INIT(vga)
{ {
#ifndef GRUB_UTIL
my_mod = mod; my_mod = mod;
#endif
grub_term_register (&grub_vga_term); grub_term_register (&grub_vga_term);
} }
GRUB_MOD_FINI GRUB_MOD_FINI(vga)
{ {
grub_term_unregister (&grub_vga_term); grub_term_unregister (&grub_vga_term);
} }

View file

@ -174,7 +174,7 @@ grub_cmd_terminfo (struct grub_arg_list *state __attribute__ ((unused)),
return grub_terminfo_set_current (args[0]); return grub_terminfo_set_current (args[0]);
} }
GRUB_MOD_INIT GRUB_MOD_INIT(terminfo)
{ {
(void) mod; /* To stop warning. */ (void) mod; /* To stop warning. */
grub_register_command ("terminfo", grub_cmd_terminfo, GRUB_COMMAND_FLAG_BOTH, grub_register_command ("terminfo", grub_cmd_terminfo, GRUB_COMMAND_FLAG_BOTH,
@ -182,7 +182,7 @@ GRUB_MOD_INIT
grub_terminfo_set_current ("vt100"); grub_terminfo_set_current ("vt100");
} }
GRUB_MOD_FINI GRUB_MOD_FINI(terminfo)
{ {
grub_unregister_command ("terminfo"); grub_unregister_command ("terminfo");
} }

View file

@ -39,6 +39,8 @@
#include <grub/env.h> #include <grub/env.h>
#include <grub/partition.h> #include <grub/partition.h>
#include <grub_modules_init.h>
#ifdef __NetBSD__ #ifdef __NetBSD__
/* NetBSD uses /boot for its boot block. */ /* NetBSD uses /boot for its boot block. */
# define DEFAULT_DIRECTORY "/grub" # define DEFAULT_DIRECTORY "/grub"
@ -189,74 +191,14 @@ main (int argc, char *argv[])
/* XXX: This is a bit unportable. */ /* XXX: This is a bit unportable. */
grub_util_biosdisk_init (args.dev_map); grub_util_biosdisk_init (args.dev_map);
grub_pc_partition_map_init ();
grub_amiga_partition_map_init ();
grub_apple_partition_map_init ();
grub_sun_partition_map_init ();
/* Initialize the default modules. */ grub_init_all ();
grub_iso9660_init ();
grub_xfs_init ();
grub_fat_init ();
grub_ext2_init ();
grub_ufs_init ();
grub_minix_init ();
grub_hfs_init ();
grub_jfs_init ();
grub_xfs_init ();
grub_sfs_init ();
grub_affs_init ();
grub_ls_init ();
grub_boot_init ();
grub_cmp_init ();
grub_cat_init ();
grub_terminal_init ();
grub_loop_init ();
grub_help_init ();
grub_halt_init ();
grub_reboot_init ();
grub_default_init ();
grub_timeout_init ();
grub_configfile_init ();
grub_search_init ();
grub_test_init ();
/* XXX: Should normal mode be started by default? */
grub_normal_init ();
/* Start GRUB! */ /* Start GRUB! */
if (setjmp (main_env) == 0) if (setjmp (main_env) == 0)
grub_main (); grub_main ();
grub_test_fini (); grub_fini_all ();
grub_search_fini ();
grub_configfile_fini ();
grub_timeout_fini ();
grub_default_fini ();
grub_reboot_fini ();
grub_halt_fini ();
grub_help_fini ();
grub_loop_fini ();
grub_util_biosdisk_fini ();
grub_normal_fini ();
grub_affs_fini ();
grub_sfs_fini ();
grub_xfs_fini ();
grub_ufs_fini ();
grub_ext2_fini ();
grub_minix_fini ();
grub_hfs_fini ();
grub_jfs_fini ();
grub_fat_fini ();
grub_xfs_fini ();
grub_boot_fini ();
grub_cmp_fini ();
grub_cat_fini ();
grub_terminal_fini ();
grub_amiga_partition_map_fini ();
grub_pc_partition_map_fini ();
grub_apple_partition_map_fini ();
grub_sun_partition_map_fini ();
grub_machine_fini (); grub_machine_fini ();