From 29d0928cd7eb2c28187a0388c53a3f4f604c41e9 Mon Sep 17 00:00:00 2001 From: robertmh Date: Tue, 28 Aug 2007 10:18:10 +0000 Subject: [PATCH] 2007-08-28 Robert Millan * util/i386/get_disk_name.c: New. Implement grub_util_get_disk_name() to tell grub-mkdevicemap how to name devices. * util/ieee1275/get_disk_name.c: Likewise (using "ofpathname -a" feature). * conf/i386-efi.rmk (grub_mkdevicemap_SOURCES): Add util/i386/get_disk_name.c. * conf/i386-pc.rmk (grub_mkdevicemap_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_mkdevicemap_SOURCES): Add util/ieee1275/get_disk_name.c. * include/grub/util/misc.h: grub_util_get_disk_name() declaration. * DISTLIST: Add util/i386/get_disk_name.c and util/ieee1275/get_disk_name.c. * util/grub-mkdevicemap.c: Replace device naming logic with grub_util_get_disk_name() calls. --- ChangeLog | 21 +++++++++++++++++++++ DISTLIST | 2 ++ conf/i386-efi.rmk | 3 ++- conf/i386-pc.rmk | 3 ++- conf/powerpc-ieee1275.rmk | 3 ++- include/grub/util/misc.h | 1 + util/grub-mkdevicemap.c | 30 ++++++++++++++++++++++++------ 7 files changed, 54 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8f9ea8ce1..608cf6b28 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,24 @@ +2007-08-28 Robert Millan + + * util/i386/get_disk_name.c: New. Implement grub_util_get_disk_name() + to tell grub-mkdevicemap how to name devices. + * util/ieee1275/get_disk_name.c: Likewise (using "ofpathname -a" + feature). + + * conf/i386-efi.rmk (grub_mkdevicemap_SOURCES): Add + util/i386/get_disk_name.c. + * conf/i386-pc.rmk (grub_mkdevicemap_SOURCES): Likewise. + * conf/powerpc-ieee1275.rmk (grub_mkdevicemap_SOURCES): Add + util/ieee1275/get_disk_name.c. + + * include/grub/util/misc.h: grub_util_get_disk_name() declaration. + + * DISTLIST: Add util/i386/get_disk_name.c and + util/ieee1275/get_disk_name.c. + + * util/grub-mkdevicemap.c: Replace device naming logic with + grub_util_get_disk_name() calls. + 2007-08-20 Robert Millan * normal/menu.c (run_menu): Refer to seconds as "s" not "seconds" diff --git a/DISTLIST b/DISTLIST index fd667db8f..bd5c7cf43 100644 --- a/DISTLIST +++ b/DISTLIST @@ -285,11 +285,13 @@ util/grub.d/10_linux.in util/grub.d/README util/i386/efi/grub-install.in util/i386/efi/grub-mkimage.c +util/i386/get_disk_name.c util/i386/pc/grub-install.in util/i386/pc/grub-mkimage.c util/i386/pc/grub-setup.c util/i386/pc/misc.c util/i386/pc/grub-mkrescue.in +util/ieee1275/get_disk_name.c util/powerpc/ieee1275/grub-install.in util/powerpc/ieee1275/grub-mkimage.c util/powerpc/ieee1275/misc.c diff --git a/conf/i386-efi.rmk b/conf/i386-efi.rmk index 009dcc168..51d231fff 100644 --- a/conf/i386-efi.rmk +++ b/conf/i386-efi.rmk @@ -24,7 +24,8 @@ grub_mkimage_SOURCES = util/i386/efi/grub-mkimage.c util/misc.c \ # kern/fs.c kern/env.c fs/fshelp.c # For grub-mkdevicemap. -grub_mkdevicemap_SOURCES = util/grub-mkdevicemap.c util/misc.c +grub_mkdevicemap_SOURCES = util/grub-mkdevicemap.c util/misc.c \ + util/i386/get_disk_name.c # For grub-probe. grub_probe_DEPENDENCIES = grub_probe_init.h diff --git a/conf/i386-pc.rmk b/conf/i386-pc.rmk index 63474198c..e0ca6f523 100644 --- a/conf/i386-pc.rmk +++ b/conf/i386-pc.rmk @@ -72,7 +72,8 @@ grub_setup_SOURCES = util/i386/pc/grub-setup.c util/biosdisk.c \ util/raid.c util/lvm.c grub_setup_init.c # For grub-mkdevicemap. -grub_mkdevicemap_SOURCES = util/grub-mkdevicemap.c util/misc.c +grub_mkdevicemap_SOURCES = util/grub-mkdevicemap.c util/misc.c \ + util/i386/get_disk_name.c # For grub-probe. grub_probe_DEPENDENCIES = grub_probe_init.h diff --git a/conf/powerpc-ieee1275.rmk b/conf/powerpc-ieee1275.rmk index d09fff805..a03effca9 100644 --- a/conf/powerpc-ieee1275.rmk +++ b/conf/powerpc-ieee1275.rmk @@ -36,7 +36,8 @@ grub_mkimage_SOURCES = util/powerpc/ieee1275/grub-mkimage.c util/misc.c \ util/resolve.c # For grub-mkdevicemap. -grub_mkdevicemap_SOURCES = util/grub-mkdevicemap.c util/misc.c +grub_mkdevicemap_SOURCES = util/grub-mkdevicemap.c util/misc.c \ + util/ieee1275/get_disk_name.c # For grub-probe. grub_probe_DEPENDENCIES = grub_probe_init.h diff --git a/include/grub/util/misc.h b/include/grub/util/misc.h index fe86c1963..c9a8528c2 100644 --- a/include/grub/util/misc.h +++ b/include/grub/util/misc.h @@ -53,5 +53,6 @@ void grub_util_load_image (const char *path, char *buf); void grub_util_write_image (const char *img, size_t size, FILE *out); void grub_util_write_image_at (const void *img, size_t size, off_t offset, FILE *out); +char *grub_util_get_disk_name (int disk, char *name); #endif /* ! GRUB_UTIL_MISC_HEADER */ diff --git a/util/grub-mkdevicemap.c b/util/grub-mkdevicemap.c index b0d544849..1e7f77825 100644 --- a/util/grub-mkdevicemap.c +++ b/util/grub-mkdevicemap.c @@ -402,8 +402,11 @@ make_device_map (const char *device_map, int floppy_disks) if (realpath (discn, name)) { + char *p; strcat (name, "/disc"); - fprintf (fp, "(hd%d)\t%s\n", num_hd, name); + p = grub_util_get_disk_name (num_hd, name); + fprintf (fp, "(%s)\t%s\n", p, name); + free (p); } num_hd++; @@ -421,7 +424,10 @@ make_device_map (const char *device_map, int floppy_disks) get_ide_disk_name (name, i); if (check_device (name)) { - fprintf (fp, "(hd%d)\t%s\n", num_hd, name); + char *p; + p = grub_util_get_disk_name (num_hd, name); + fprintf (fp, "(%s)\t%s\n", p, name); + free (p); num_hd++; } } @@ -435,7 +441,10 @@ make_device_map (const char *device_map, int floppy_disks) get_ataraid_disk_name (name, i); if (check_device (name)) { - fprintf (fp, "(hd%d)\t%s\n", num_hd, name); + char *p; + p = grub_util_get_disk_name (num_hd, name); + fprintf (fp, "(%s)\t%s\n", p, name); + free (p); num_hd++; } } @@ -449,7 +458,10 @@ make_device_map (const char *device_map, int floppy_disks) get_scsi_disk_name (name, i); if (check_device (name)) { - fprintf (fp, "(hd%d)\t%s\n", num_hd, name); + char *p; + p = grub_util_get_disk_name (num_hd, name); + fprintf (fp, "(%s)\t%s\n", p, name); + free (p); num_hd++; } } @@ -472,7 +484,10 @@ make_device_map (const char *device_map, int floppy_disks) get_dac960_disk_name (name, controller, drive); if (check_device (name)) { - fprintf (fp, "(hd%d)\t%s\n", num_hd, name); + char *p; + p = grub_util_get_disk_name (num_hd, name); + fprintf (fp, "(%s)\t%s\n", p, name); + free (p); num_hd++; } } @@ -490,7 +505,10 @@ make_device_map (const char *device_map, int floppy_disks) get_i2o_disk_name (name, unit); if (check_device (name)) { - fprintf (fp, "(hd%d)\t%s\n", num_hd, name); + char *p; + p = grub_util_get_disk_name (num_hd, name); + fprintf (fp, "(%s)\t%s\n", p, name); + free (p); num_hd++; } }