grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Generic halt and reboot commands (was: Re: grub2 efi patches)


From: Alexandre Boeglin
Subject: Re: Generic halt and reboot commands (was: Re: grub2 efi patches)
Date: Sun, 10 Feb 2008 20:54:08 +0100
User-agent: Mutt/1.5.17+20080114 (2008-01-14)

Le dim 10 fév 2008 à 17:56:12 +0100, Robert Millan a écrit :
> On Sun, Feb 10, 2008 at 05:37:27PM +0100, Alexandre Boeglin wrote:
> > 
> > * commands/halt.c: ... to here.
> >   Add some precompiler directive to include the correct header for each
> >   machine.
> 
> Can we simplify this?  Since grub_halt() is put in kernel anyway, why not
> always export it from kernel.h ?

Well, efi, for instance, is not machine dependant, and so the header is not
located in include/grub/i386/efi but in include/grub/efi

> Also, could you provide the diff after you have issued
> "mv commands/ieee1275/halt.c commands/halt.c" or so?  That will make it much
> easier to read than comparing files by hand.

Ok, here are the diffs.

================================================================================
--- grub2_commit/commands/ieee1275/halt.c       2007-07-22 01:32:19.000000000 
+0200
+++ grub2_clean/commands/halt.c 2008-02-10 17:07:47.847689750 +0100
@@ -19,8 +19,13 @@
 
 #include <grub/normal.h>
 #include <grub/dl.h>
-#include <grub/misc.h>
+#include <grub/machine/machine.h>
+
+#ifdef GRUB_MACHINE_IEEE1275
 #include <grub/machine/kernel.h>
+#elif defined GRUB_MACHINE_EFI
+#include <grub/efi/efi.h>
+#endif
 
 static grub_err_t
 grub_cmd_halt (struct grub_arg_list *state __attribute__ ((unused)),
@@ -32,7 +37,7 @@ grub_cmd_halt (struct grub_arg_list *sta
 }
 
 

-GRUB_MOD_INIT(ieee1275_halt)
+GRUB_MOD_INIT(halt)
 {
   (void)mod;                   /* To stop warning. */
   grub_register_command ("halt", grub_cmd_halt, GRUB_COMMAND_FLAG_BOTH,
@@ -40,7 +45,7 @@ GRUB_MOD_INIT(ieee1275_halt)
                         " work on all firmware.", 0);
 }
 
-GRUB_MOD_FINI(ieee1275_halt)
+GRUB_MOD_FINI(halt)
 {
   grub_unregister_command ("halt");
 }
================================================================================
--- grub2_commit/commands/ieee1275/reboot.c     2007-07-22 01:32:20.000000000 
+0200
+++ grub2_clean/commands/reboot.c       2008-02-10 17:04:14.486355500 +0100
@@ -19,8 +19,16 @@
 
 #include <grub/normal.h>
 #include <grub/dl.h>
-#include <grub/misc.h>
+#include <grub/machine/machine.h>
+
+#ifdef GRUB_MACHINE_IEEE1275
 #include <grub/machine/kernel.h>
+#elif defined GRUB_MACHINE_EFI
+#include <grub/efi/efi.h>
+#elif defined GRUB_MACHINE_PCBIOS
+#include <grub/machine/init.h>
+#endif
+
 
 static grub_err_t
 grub_cmd_reboot (struct grub_arg_list *state __attribute__ ((unused)),
@@ -32,14 +40,14 @@ grub_cmd_reboot (struct grub_arg_list *s
 }
 
 

-GRUB_MOD_INIT(ieee1275_reboot)
+GRUB_MOD_INIT(reboot)
 {
   (void)mod;                   /* To stop warning. */
   grub_register_command ("reboot", grub_cmd_reboot, GRUB_COMMAND_FLAG_BOTH,
                         "reboot", "Reboot the computer", 0);
 }
 
-GRUB_MOD_FINI(ieee1275_reboot)
+GRUB_MOD_FINI(reboot)
 {
   grub_unregister_command ("reboot");
 }
================================================================================
--- grub2_commit/commands/i386/pc/reboot.c      2007-07-22 01:32:19.000000000 
+0200
+++ grub2_clean/commands/reboot.c       2008-02-10 17:04:14.486355500 +0100
@@ -19,20 +19,26 @@
 
 #include <grub/normal.h>
 #include <grub/dl.h>
-#include <grub/arg.h>
+#include <grub/machine/machine.h>
+
+#ifdef GRUB_MACHINE_IEEE1275
+#include <grub/machine/kernel.h>
+#elif defined GRUB_MACHINE_EFI
+#include <grub/efi/efi.h>
+#elif defined GRUB_MACHINE_PCBIOS
 #include <grub/machine/init.h>
+#endif
+
 
 static grub_err_t
 grub_cmd_reboot (struct grub_arg_list *state __attribute__ ((unused)),
                 int argc __attribute__ ((unused)),
                 char **args __attribute__ ((unused)))
-
 {
   grub_reboot ();
   return 0;
 }
 
-
 

 GRUB_MOD_INIT(reboot)
 {
================================================================================




reply via email to

[Prev in Thread] Current Thread [Next in Thread]