+2007-06-13 Robert Millan <rmh@aybabtu.com>
+
+ * include/grub/util/misc.h: Define DEFAULT_DIRECTORY and
+ DEFAULT_DEVICE_MAP.
+ * util/grub-emu.c: Use above definitions from misc.h instead of
+ defining them.
+ * util/grub-mkdevicemap.c: Likewise.
+ * util/i386/pc/grub-setup.c: Likewise.
+ * util/grub-probe.c: Likewise.
+ (probe): Abort with grub_util_error() when either
+ grub_guess_root_device or grub_util_get_grub_dev fails.
+
2007-06-12 Robert Millan <rmh@aybabtu.com>
* normal/command.c (grub_command_execute): Use NULL rather than 0 for
#include <setjmp.h>
#include <unistd.h>
+#ifdef __NetBSD__
+/* NetBSD uses /boot for its boot block. */
+# define DEFAULT_DIRECTORY "/grub"
+#else
+# define DEFAULT_DIRECTORY "/boot/grub"
+#endif
+
+#define DEFAULT_DEVICE_MAP DEFAULT_DIRECTORY "/device.map"
+
extern char *progname;
extern int verbosity;
extern jmp_buf main_env;
#include <grub_modules_init.h>
-#ifdef __NetBSD__
-/* NetBSD uses /boot for its boot block. */
-# define DEFAULT_DIRECTORY "/grub"
-#else
-# define DEFAULT_DIRECTORY "/boot/grub"
-#endif
-
-#define DEFAULT_DEVICE_MAP DEFAULT_DIRECTORY "/device.map"
-
/* Used for going back to the main function. */
jmp_buf main_env;
#define _GNU_SOURCE 1
#include <getopt.h>
-#ifdef __NetBSD__
-/* NetBSD uses /boot for its boot block. */
-# define DEFAULT_DIRECTORY "/grub"
-#else
-# define DEFAULT_DIRECTORY "/boot/grub"
-#endif
-
-#define DEFAULT_DEVICE_MAP DEFAULT_DIRECTORY "/device.map"
-
#ifdef __linux__
# if !defined(__GLIBC__) || \
((__GLIBC__ < 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ < 1)))
#define _GNU_SOURCE 1
#include <getopt.h>
-#ifdef __NetBSD__
-/* NetBSD uses /boot for its boot block. */
-# define DEFAULT_DIRECTORY "/grub"
-#else
-# define DEFAULT_DIRECTORY "/boot/grub"
-#endif
-
-#define DEFAULT_DEVICE_MAP DEFAULT_DIRECTORY "/device.map"
-
#define PRINT_FS 0
#define PRINT_DRIVE 1
#define PRINT_DEVICE 2
device_name = grub_guess_root_device (path);
if (! device_name)
- {
- fprintf (stderr, "cannot find a device for %s.\n", path);
- goto end;
- }
+ grub_util_error ("cannot find a device for %s.\n", path);
if (print == PRINT_DEVICE)
{
drive_name = grub_util_get_grub_dev (device_name);
if (! drive_name)
- {
- fprintf (stderr, "cannot find a GRUB drive for %s.\n", device_name);
- goto end;
- }
+ grub_util_error ("cannot find a GRUB drive for %s.\n", device_name);
if (print == PRINT_DRIVE)
{
#define DEFAULT_BOOT_FILE "boot.img"
#define DEFAULT_CORE_FILE "core.img"
-#ifdef __NetBSD__
-/* NetBSD uses /boot for its boot block. */
-# define DEFAULT_DIRECTORY "/grub"
-#else
-# define DEFAULT_DIRECTORY "/boot/grub"
-#endif
-
-#define DEFAULT_DEVICE_MAP DEFAULT_DIRECTORY "/device.map"
-
/* This is the blocklist used in the diskboot image. */
struct boot_blocklist
{