All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] grub-probefs --root-device
@ 2006-09-22 16:33 Robert Millan
  2006-09-22 21:12 ` Robert Millan
  2006-09-23  3:20 ` Yoshinori K. Okuji
  0 siblings, 2 replies; 16+ messages in thread
From: Robert Millan @ 2006-09-22 16:33 UTC (permalink / raw)
  To: grub-devel

[-- Attachment #1: Type: text/plain, Size: 626 bytes --]


This would be very useful to get rid of ugly kludges in Debian, such as this
one:
  http://svn.debian.org/wsvn/pkg-grub/grub2/trunk/debian/update-grub?op=file&rev=0&sc=0
  (look for convert() here)

Fortunately grub-probefs is already doing what we need, we just need a way to
tell it to print the information.

2006-09-22  Robert Millan  <rmh@aybabtu.com>

	* util/i386/pc/grub-probefs.c: Add -r|--root-device option (print
	guessed root device and exit).

-- 
Robert Millan

My spam trap is honeypot@aybabtu.com.  Note: this address is only intended for
spam harvesters.  Writing to it will get you added to my black list.

[-- Attachment #2: print_root.diff --]
[-- Type: text/plain, Size: 1644 bytes --]

2006-09-22  Robert Millan  <rmh@aybabtu.com>

	* util/i386/pc/grub-probefs.c: Add -r|--root-device option (print
	guessed root device and exit).

Index: util/i386/pc/grub-probefs.c
===================================================================
RCS file: /sources/grub/grub2/util/i386/pc/grub-probefs.c,v
retrieving revision 1.3
diff -u -r1.3 grub-probefs.c
--- util/i386/pc/grub-probefs.c	23 Apr 2006 13:37:36 -0000	1.3
+++ util/i386/pc/grub-probefs.c	22 Sep 2006 16:05:08 -0000
@@ -47,6 +47,8 @@
 
 #define DEFAULT_DEVICE_MAP	DEFAULT_DIRECTORY "/device.map"
 
+int print_root = 0;
+
 void
 grub_putchar (int c)
 {
@@ -84,6 +86,12 @@
       return;
     }
 
+  if (print_root)
+    {
+      printf ("(%s)\n", device_name);
+      return;
+    }
+
   grub_util_info ("opening %s", device_name);
   dev = grub_device_open (device_name);
   if (! dev)
@@ -121,6 +129,7 @@
 Probe a filesystem module for a given path.\n\
 \n\
   -m, --device-map=FILE     use FILE as the device map [default=%s]\n\
+  -r, --root-device         print guessed root device and exit\n\
   -h, --help                display this message and exit\n\
   -V, --version             print version information and exit\n\
   -v, --verbose             print verbose messages\n\
@@ -143,7 +152,7 @@
   /* Check for options.  */
   while (1)
     {
-      int c = getopt_long (argc, argv, "m:hVv", options, 0);
+      int c = getopt_long (argc, argv, "m:rhVv", options, 0);
       
       if (c == -1)
 	break;
@@ -157,6 +166,10 @@
 	    dev_map = xstrdup (optarg);
 	    break;
 
+	  case 'r':
+	    print_root=1;
+	    break;
+
 	  case 'h':
 	    usage (0);
 	    break;

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] grub-probefs --root-device
  2006-09-22 16:33 [PATCH] grub-probefs --root-device Robert Millan
@ 2006-09-22 21:12 ` Robert Millan
  2006-09-23  3:20 ` Yoshinori K. Okuji
  1 sibling, 0 replies; 16+ messages in thread
From: Robert Millan @ 2006-09-22 21:12 UTC (permalink / raw)
  To: grub-devel

[-- Attachment #1: Type: text/plain, Size: 1291 bytes --]

On Fri, Sep 22, 2006 at 06:33:13PM +0200, Robert Millan wrote:
> 
> This would be very useful to get rid of ugly kludges in Debian, such as this
> one:
>   http://svn.debian.org/wsvn/pkg-grub/grub2/trunk/debian/update-grub?op=file&rev=0&sc=0
>   (look for convert() here)
> 
> Fortunately grub-probefs is already doing what we need, we just need a way to
> tell it to print the information.

Uhm it seems I need the system device name as well.  Please look at this new
patch with an additional option (I had to rework the grub_guess_root_device
interface to get the info yet unprocessed by grub_util_biosdisk_get_grub_dev).

2006-09-22  Robert Millan  <rmh@aybabtu.com>

	* util/i386/pc/getroot.c (grub_guess_root_device): Stop using
	grub_util_biosdisk_get_grub_dev to convert system device to GRUB device.
	* util/grub-emu.c: Use grub_util_biosdisk_get_grub_dev with the string
	returned by grub_guess_root_device.
	* util/i386/pc/grub-setup.c: Ditto.
	* util/i386/pc/grub-probefs.c: Ditto.

	* util/i386/pc/grub-probefs.c: Add two options (--grub-root-device and
	--root-device) to print GRUB or system device and exit.

-- 
Robert Millan

My spam trap is honeypot@aybabtu.com.  Note: this address is only intended for
spam harvesters.  Writing to it will get you added to my black list.

[-- Attachment #2: print_paths.diff --]
[-- Type: text/plain, Size: 4768 bytes --]


2006-09-22  Robert Millan  <rmh@aybabtu.com>

	* util/i386/pc/getroot.c (grub_guess_root_device): Stop using
	grub_util_biosdisk_get_grub_dev to convert system device to GRUB device.
	* util/grub-emu.c: Use grub_util_biosdisk_get_grub_dev with the string
	returned by grub_guess_root_device.
	* util/i386/pc/grub-setup.c: Ditto.
	* util/i386/pc/grub-probefs.c: Ditto.

	* util/i386/pc/grub-probefs.c: Add two options (--grub-root-device and
	--root-device) to print GRUB or system device and exit.

Index: util/grub-emu.c
===================================================================
RCS file: /sources/grub/grub2/util/grub-emu.c,v
retrieving revision 1.30
diff -u -r1.30 grub-emu.c
--- util/grub-emu.c	13 Jun 2006 22:50:01 -0000	1.30
+++ util/grub-emu.c	22 Sep 2006 21:00:09 -0000
@@ -185,7 +185,7 @@
   /* Make sure that there is a root device.  */
   if (! args.root_dev)
     {
-      args.root_dev = grub_guess_root_device (args.dir ? : DEFAULT_DIRECTORY);
+      args.root_dev = grub_util_biosdisk_get_grub_dev (grub_guess_root_device (args.dir ? : DEFAULT_DIRECTORY));
       if (! args.root_dev)
 	{
 	  grub_util_info ("guessing the root device failed, because of `%s'",
Index: util/i386/pc/getroot.c
===================================================================
RCS file: /sources/grub/grub2/util/i386/pc/getroot.c,v
retrieving revision 1.5
diff -u -r1.5 getroot.c
--- util/i386/pc/getroot.c	14 Sep 2006 18:52:50 -0000	1.5
+++ util/i386/pc/getroot.c	22 Sep 2006 21:00:09 -0000
@@ -223,5 +223,5 @@
   if (! os_dev)
     return 0;
 
-  return grub_util_biosdisk_get_grub_dev (os_dev);
+  return os_dev;
 }
Index: util/i386/pc/grub-probefs.c
===================================================================
RCS file: /sources/grub/grub2/util/i386/pc/grub-probefs.c,v
retrieving revision 1.3
diff -u -r1.3 grub-probefs.c
--- util/i386/pc/grub-probefs.c	23 Apr 2006 13:37:36 -0000	1.3
+++ util/i386/pc/grub-probefs.c	22 Sep 2006 21:00:09 -0000
@@ -47,6 +47,9 @@
 
 #define DEFAULT_DEVICE_MAP	DEFAULT_DIRECTORY "/device.map"
 
+int print_root = 0;
+int print_grub_root = 0;
+
 void
 grub_putchar (int c)
 {
@@ -74,13 +77,33 @@
 probe (const char *path)
 {
   char *device_name;
+  char *grub_device_name;
   grub_device_t dev;
   grub_fs_t fs;
   
   device_name = grub_guess_root_device (path);
   if (! device_name)
     {
-      fprintf (stderr, "cannot find a GRUB device for %s.\n", path);
+      fprintf (stderr, "cannot find a device for %s.\n", path);
+      return;
+    }
+
+  grub_device_name = grub_util_biosdisk_get_grub_dev (device_name);
+  if (! grub_device_name)
+    {
+      fprintf (stderr, "cannot find a GRUB device for %s.\n", device_name);
+      return;
+    }
+
+  if (print_root)
+    {
+      printf ("%s\n", device_name);
+      return;
+    }
+
+  if (print_grub_root)
+    {
+      printf ("(%s)\n", grub_device_name);
       return;
     }
 
@@ -102,6 +125,8 @@
 static struct option options[] =
   {
     {"device-map", required_argument, 0, 'm'},
+    {"root-device", no_argument, 0, 'r'},
+    {"grub-root-device", no_argument, 0, 'g'},
     {"help", no_argument, 0, 'h'},
     {"version", no_argument, 0, 'V'},
     {"verbose", no_argument, 0, 'v'},
@@ -121,6 +146,8 @@
 Probe a filesystem module for a given path.\n\
 \n\
   -m, --device-map=FILE     use FILE as the device map [default=%s]\n\
+  -r, --root-device         print guessed root device and exit\n\
+  -g, --grub-root-device    print guessed GRUB root device and exit\n\
   -h, --help                display this message and exit\n\
   -V, --version             print version information and exit\n\
   -v, --verbose             print verbose messages\n\
@@ -143,7 +170,7 @@
   /* Check for options.  */
   while (1)
     {
-      int c = getopt_long (argc, argv, "m:hVv", options, 0);
+      int c = getopt_long (argc, argv, "m:rghVv", options, 0);
       
       if (c == -1)
 	break;
@@ -157,6 +184,14 @@
 	    dev_map = xstrdup (optarg);
 	    break;
 
+	  case 'r':
+	    print_root=1;
+	    break;
+
+	  case 'g':
+	    print_grub_root=1;
+	    break;
+
 	  case 'h':
 	    usage (0);
 	    break;
Index: util/i386/pc/grub-setup.c
===================================================================
RCS file: /sources/grub/grub2/util/i386/pc/grub-setup.c,v
retrieving revision 1.18
diff -u -r1.18 grub-setup.c
--- util/i386/pc/grub-setup.c	4 Jun 2006 15:56:55 -0000	1.18
+++ util/i386/pc/grub-setup.c	22 Sep 2006 21:00:09 -0000
@@ -669,7 +669,7 @@
     }
   else
     {
-      root_dev = grub_guess_root_device (dir ? : DEFAULT_DIRECTORY);
+      root_dev = grub_util_biosdisk_get_grub_dev (grub_guess_root_device (dir ? : DEFAULT_DIRECTORY));
       if (! root_dev)
 	{
 	  grub_util_info ("guessing the root device failed, because of `%s'",

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] grub-probefs --root-device
  2006-09-22 16:33 [PATCH] grub-probefs --root-device Robert Millan
  2006-09-22 21:12 ` Robert Millan
@ 2006-09-23  3:20 ` Yoshinori K. Okuji
  2006-09-23  7:26   ` Robert Millan
  1 sibling, 1 reply; 16+ messages in thread
From: Yoshinori K. Okuji @ 2006-09-23  3:20 UTC (permalink / raw)
  To: The development of GRUB 2

On Friday 22 September 2006 18:33, Robert Millan wrote:
> This would be very useful to get rid of ugly kludges in Debian, such as
> this one:
>  
> http://svn.debian.org/wsvn/pkg-grub/grub2/trunk/debian/update-grub?op=file&
>rev=0&sc=0 (look for convert() here)
>
> Fortunately grub-probefs is already doing what we need, we just need a way
> to tell it to print the information.

However, this usage is against the original meaning, thus the naming is not 
appropriate any longer. In addition, I don't like that we make an ad-hoc text 
output (the first line is a fs module name, the second line is a root device 
name, etc.).

So I propose that we rename the utility to "grub-probe" and add some options 
to change the target of grub-probe. The default should be probing a fs to 
help people who are used to grub-probefs. Here is an example:

$ grub-probe --target=fs
ufs
$ grub-probe
ufs
$ grub-probe --target=drive
(hd0,1)
$ grub-probe --target=device
/dev/hda1

What do you think?

Okuji



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] grub-probefs --root-device
  2006-09-23  3:20 ` Yoshinori K. Okuji
@ 2006-09-23  7:26   ` Robert Millan
  2006-09-23  8:37     ` Robert Millan
  2006-09-26 17:29     ` [PATCH] grub-probefs --root-device Vesa Jääskeläinen
  0 siblings, 2 replies; 16+ messages in thread
From: Robert Millan @ 2006-09-23  7:26 UTC (permalink / raw)
  To: The development of GRUB 2

[-- Attachment #1: Type: text/plain, Size: 1762 bytes --]

On Sat, Sep 23, 2006 at 05:20:37AM +0200, Yoshinori K. Okuji wrote:
> 
> However, this usage is against the original meaning, thus the naming is not 
> appropriate any longer. In addition, I don't like that we make an ad-hoc text 
> output (the first line is a fs module name, the second line is a root device 
> name, etc.).
> 
> So I propose that we rename the utility to "grub-probe" and add some options 
> to change the target of grub-probe. The default should be probing a fs to 
> help people who are used to grub-probefs. Here is an example:
> 
> $ grub-probe --target=fs
> ufs
> $ grub-probe
> ufs
> $ grub-probe --target=drive
> (hd0,1)
> $ grub-probe --target=device
> /dev/hda1
> 
> What do you think?

Fine with me.  Please see attached patch (note: for readability I omitted the
rename itself from my patch).

2006-09-23  Robert Millan  <rmh@aybabtu.com>

	* util/i386/pc/getroot.c (grub_guess_root_device): Stop using
	grub_util_biosdisk_get_grub_dev to convert system device to GRUB device.
	* util/grub-emu.c: Use grub_util_biosdisk_get_grub_dev with the string
	returned by grub_guess_root_device.
	* util/i386/pc/grub-setup.c: Ditto.
	* util/i386/pc/grub-probefs.c: Ditto.

	* util/i386/pc/grub-probefs.c: Rename to ...
	* util/i386/pc/grub-probe.c: ... this.
	* DISTLIST: Update reference to grub-probefs.
	* conf/i386-efi.mk: Ditto.
	* conf/i386-efi.rmk: Ditto.
	* conf/i386-pc.mk: Ditto.
	* conf/i386-pc.rmk: Ditto.
	* util/i386/pc/grub-install.in: Ditto.

	* util/i386/pc/grub-probe.c: Add --target=(fs|device|drive) option to
	choose which information we want to print.

-- 
Robert Millan

My spam trap is honeypot@aybabtu.com.  Note: this address is only intended for
spam harvesters.  Writing to it will get you added to my black list.

[-- Attachment #2: print_paths.diff --]
[-- Type: text/plain, Size: 16245 bytes --]


2006-09-23  Robert Millan  <rmh@aybabtu.com>

	* util/i386/pc/getroot.c (grub_guess_root_device): Stop using
	grub_util_biosdisk_get_grub_dev to convert system device to GRUB device.
	* util/grub-emu.c: Use grub_util_biosdisk_get_grub_dev with the string
	returned by grub_guess_root_device.
	* util/i386/pc/grub-setup.c: Ditto.
	* util/i386/pc/grub-probefs.c: Ditto.

	* util/i386/pc/grub-probefs.c: Rename to ...
	* util/i386/pc/grub-probe.c: ... this.
	* DISTLIST: Update reference to grub-probefs.
	* conf/i386-efi.mk: Ditto.
	* conf/i386-efi.rmk: Ditto.
	* conf/i386-pc.mk: Ditto.
	* conf/i386-pc.rmk: Ditto.
	* util/i386/pc/grub-install.in: Ditto.

	* util/i386/pc/grub-probe.c: Add --target=(fs|device|drive) option to
	choose which information we want to print.

Index: DISTLIST
===================================================================
RCS file: /sources/grub/grub2/DISTLIST,v
retrieving revision 1.36
diff -u -r1.36 DISTLIST
--- DISTLIST	4 Jun 2006 12:59:19 -0000	1.36
+++ DISTLIST	23 Sep 2006 07:16:31 -0000
@@ -253,7 +253,7 @@
 util/i386/pc/grub-install.in
 util/i386/pc/grub-mkdevicemap.c
 util/i386/pc/grub-mkimage.c
-util/i386/pc/grub-probefs.c
+util/i386/pc/grub-probe.c
 util/i386/pc/grub-setup.c
 util/i386/pc/misc.c
 util/powerpc/ieee1275/grub-install.in
Index: conf/i386-efi.mk
===================================================================
RCS file: /sources/grub/grub2/conf/i386-efi.mk,v
retrieving revision 1.15
diff -u -r1.15 i386-efi.mk
--- conf/i386-efi.mk	22 Sep 2006 00:27:38 -0000	1.15
+++ conf/i386-efi.mk	23 Sep 2006 07:16:31 -0000
@@ -6,7 +6,7 @@
 
 # Utilities.
 bin_UTILITIES = grub-mkimage
-#sbin_UTILITIES = grub-setup grub-emu grub-mkdevicemap grub-probefs
+#sbin_UTILITIES = grub-setup grub-emu grub-mkdevicemap grub-probe
 
 # For grub-mkimage.
 grub_mkimage_SOURCES = util/i386/efi/grub-mkimage.c util/misc.c \
@@ -41,8 +41,8 @@
 # For grub-mkdevicemap.
 #grub_mkdevicemap_SOURCES = util/i386/pc/grub-mkdevicemap.c util/misc.c
 
-# For grub-probefs.
-#grub_probefs_SOURCES = util/i386/pc/grub-probefs.c	\
+# For grub-probe.
+#grub_probefs_SOURCES = util/i386/pc/grub-probe.c	\
 #	util/i386/pc/biosdisk.c	util/misc.c util/i386/pc/getroot.c	\
 #	kern/device.c kern/disk.c kern/err.c kern/misc.c fs/fat.c	\
 #	fs/ext2.c kern/parser.c kern/partition.c partmap/pc.c fs/ufs.c 	\
Index: conf/i386-efi.rmk
===================================================================
RCS file: /sources/grub/grub2/conf/i386-efi.rmk,v
retrieving revision 1.9
diff -u -r1.9 i386-efi.rmk
--- conf/i386-efi.rmk	28 May 2006 23:01:43 -0000	1.9
+++ conf/i386-efi.rmk	23 Sep 2006 07:16:31 -0000
@@ -6,7 +6,7 @@
 
 # Utilities.
 bin_UTILITIES = grub-mkimage
-#sbin_UTILITIES = grub-setup grub-emu grub-mkdevicemap grub-probefs
+#sbin_UTILITIES = grub-setup grub-emu grub-mkdevicemap grub-probe
 
 # For grub-mkimage.
 grub_mkimage_SOURCES = util/i386/efi/grub-mkimage.c util/misc.c \
@@ -23,8 +23,8 @@
 # For grub-mkdevicemap.
 #grub_mkdevicemap_SOURCES = util/i386/pc/grub-mkdevicemap.c util/misc.c
 
-# For grub-probefs.
-#grub_probefs_SOURCES = util/i386/pc/grub-probefs.c	\
+# For grub-probe.
+#grub_probefs_SOURCES = util/i386/pc/grub-probe.c	\
 #	util/i386/pc/biosdisk.c	util/misc.c util/i386/pc/getroot.c	\
 #	kern/device.c kern/disk.c kern/err.c kern/misc.c fs/fat.c	\
 #	fs/ext2.c kern/parser.c kern/partition.c partmap/pc.c fs/ufs.c 	\
Index: conf/i386-pc.mk
===================================================================
RCS file: /sources/grub/grub2/conf/i386-pc.mk,v
retrieving revision 1.78
diff -u -r1.78 i386-pc.mk
--- conf/i386-pc.mk	22 Sep 2006 00:27:38 -0000	1.78
+++ conf/i386-pc.mk	23 Sep 2006 07:16:32 -0000
@@ -183,7 +183,7 @@
 
 # Utilities.
 bin_UTILITIES = grub-mkimage
-sbin_UTILITIES = grub-setup grub-emu grub-mkdevicemap grub-probefs
+sbin_UTILITIES = grub-setup grub-emu grub-mkdevicemap grub-probe
 
 # For grub-mkimage.
 grub_mkimage_SOURCES = util/i386/pc/grub-mkimage.c util/misc.c \
@@ -339,20 +339,20 @@
 -include grub_mkdevicemap-util_misc.d
 
 
-# For grub-probefs.
-grub_probefs_SOURCES = util/i386/pc/grub-probefs.c	\
+# For grub-probe.
+grub_probefs_SOURCES = util/i386/pc/grub-probe.c	\
 	util/i386/pc/biosdisk.c	util/misc.c util/i386/pc/getroot.c	\
 	kern/device.c kern/disk.c kern/err.c kern/misc.c fs/fat.c	\
 	fs/ext2.c kern/parser.c kern/partition.c partmap/pc.c fs/ufs.c 	\
 	fs/minix.c fs/hfs.c fs/jfs.c kern/fs.c kern/env.c fs/fshelp.c 	\
 	fs/xfs.c fs/affs.c fs/sfs.c fs/hfsplus.c
-CLEANFILES += grub-probefs grub_probefs-util_i386_pc_grub_probefs.o grub_probefs-util_i386_pc_biosdisk.o grub_probefs-util_misc.o grub_probefs-util_i386_pc_getroot.o grub_probefs-kern_device.o grub_probefs-kern_disk.o grub_probefs-kern_err.o grub_probefs-kern_misc.o grub_probefs-fs_fat.o grub_probefs-fs_ext2.o grub_probefs-kern_parser.o grub_probefs-kern_partition.o grub_probefs-partmap_pc.o grub_probefs-fs_ufs.o grub_probefs-fs_minix.o grub_probefs-fs_hfs.o grub_probefs-fs_jfs.o grub_probefs-kern_fs.o grub_probefs-kern_env.o grub_probefs-fs_fshelp.o grub_probefs-fs_xfs.o grub_probefs-fs_affs.o grub_probefs-fs_sfs.o grub_probefs-fs_hfsplus.o
+CLEANFILES += grub-probe grub_probefs-util_i386_pc_grub_probefs.o grub_probefs-util_i386_pc_biosdisk.o grub_probefs-util_misc.o grub_probefs-util_i386_pc_getroot.o grub_probefs-kern_device.o grub_probefs-kern_disk.o grub_probefs-kern_err.o grub_probefs-kern_misc.o grub_probefs-fs_fat.o grub_probefs-fs_ext2.o grub_probefs-kern_parser.o grub_probefs-kern_partition.o grub_probefs-partmap_pc.o grub_probefs-fs_ufs.o grub_probefs-fs_minix.o grub_probefs-fs_hfs.o grub_probefs-fs_jfs.o grub_probefs-kern_fs.o grub_probefs-kern_env.o grub_probefs-fs_fshelp.o grub_probefs-fs_xfs.o grub_probefs-fs_affs.o grub_probefs-fs_sfs.o grub_probefs-fs_hfsplus.o
 MOSTLYCLEANFILES += grub_probefs-util_i386_pc_grub_probefs.d grub_probefs-util_i386_pc_biosdisk.d grub_probefs-util_misc.d grub_probefs-util_i386_pc_getroot.d grub_probefs-kern_device.d grub_probefs-kern_disk.d grub_probefs-kern_err.d grub_probefs-kern_misc.d grub_probefs-fs_fat.d grub_probefs-fs_ext2.d grub_probefs-kern_parser.d grub_probefs-kern_partition.d grub_probefs-partmap_pc.d grub_probefs-fs_ufs.d grub_probefs-fs_minix.d grub_probefs-fs_hfs.d grub_probefs-fs_jfs.d grub_probefs-kern_fs.d grub_probefs-kern_env.d grub_probefs-fs_fshelp.d grub_probefs-fs_xfs.d grub_probefs-fs_affs.d grub_probefs-fs_sfs.d grub_probefs-fs_hfsplus.d
 
-grub-probefs: $(grub_probefs_DEPENDENCIES) grub_probefs-util_i386_pc_grub_probefs.o grub_probefs-util_i386_pc_biosdisk.o grub_probefs-util_misc.o grub_probefs-util_i386_pc_getroot.o grub_probefs-kern_device.o grub_probefs-kern_disk.o grub_probefs-kern_err.o grub_probefs-kern_misc.o grub_probefs-fs_fat.o grub_probefs-fs_ext2.o grub_probefs-kern_parser.o grub_probefs-kern_partition.o grub_probefs-partmap_pc.o grub_probefs-fs_ufs.o grub_probefs-fs_minix.o grub_probefs-fs_hfs.o grub_probefs-fs_jfs.o grub_probefs-kern_fs.o grub_probefs-kern_env.o grub_probefs-fs_fshelp.o grub_probefs-fs_xfs.o grub_probefs-fs_affs.o grub_probefs-fs_sfs.o grub_probefs-fs_hfsplus.o
+grub-probe: $(grub_probefs_DEPENDENCIES) grub_probefs-util_i386_pc_grub_probefs.o grub_probefs-util_i386_pc_biosdisk.o grub_probefs-util_misc.o grub_probefs-util_i386_pc_getroot.o grub_probefs-kern_device.o grub_probefs-kern_disk.o grub_probefs-kern_err.o grub_probefs-kern_misc.o grub_probefs-fs_fat.o grub_probefs-fs_ext2.o grub_probefs-kern_parser.o grub_probefs-kern_partition.o grub_probefs-partmap_pc.o grub_probefs-fs_ufs.o grub_probefs-fs_minix.o grub_probefs-fs_hfs.o grub_probefs-fs_jfs.o grub_probefs-kern_fs.o grub_probefs-kern_env.o grub_probefs-fs_fshelp.o grub_probefs-fs_xfs.o grub_probefs-fs_affs.o grub_probefs-fs_sfs.o grub_probefs-fs_hfsplus.o
 	$(CC) -o $@ grub_probefs-util_i386_pc_grub_probefs.o grub_probefs-util_i386_pc_biosdisk.o grub_probefs-util_misc.o grub_probefs-util_i386_pc_getroot.o grub_probefs-kern_device.o grub_probefs-kern_disk.o grub_probefs-kern_err.o grub_probefs-kern_misc.o grub_probefs-fs_fat.o grub_probefs-fs_ext2.o grub_probefs-kern_parser.o grub_probefs-kern_partition.o grub_probefs-partmap_pc.o grub_probefs-fs_ufs.o grub_probefs-fs_minix.o grub_probefs-fs_hfs.o grub_probefs-fs_jfs.o grub_probefs-kern_fs.o grub_probefs-kern_env.o grub_probefs-fs_fshelp.o grub_probefs-fs_xfs.o grub_probefs-fs_affs.o grub_probefs-fs_sfs.o grub_probefs-fs_hfsplus.o $(LDFLAGS) $(grub_probefs_LDFLAGS)
 
-grub_probefs-util_i386_pc_grub_probefs.o: util/i386/pc/grub-probefs.c
+grub_probefs-util_i386_pc_grub_probefs.o: util/i386/pc/grub-probe.c
 	$(CC) -Iutil/i386/pc -I$(srcdir)/util/i386/pc $(CPPFLAGS) $(CFLAGS) -DGRUB_UTIL=1 $(grub_probefs_CFLAGS) -MD -c -o $@ $<
 -include grub_probefs-util_i386_pc_grub_probefs.d
 
Index: conf/i386-pc.rmk
===================================================================
RCS file: /sources/grub/grub2/conf/i386-pc.rmk,v
retrieving revision 1.69
diff -u -r1.69 i386-pc.rmk
--- conf/i386-pc.rmk	22 Sep 2006 00:27:38 -0000	1.69
+++ conf/i386-pc.rmk	23 Sep 2006 07:16:32 -0000
@@ -51,7 +51,7 @@
 
 # Utilities.
 bin_UTILITIES = grub-mkimage
-sbin_UTILITIES = grub-setup grub-emu grub-mkdevicemap grub-probefs
+sbin_UTILITIES = grub-setup grub-emu grub-mkdevicemap grub-probe
 
 # For grub-mkimage.
 grub_mkimage_SOURCES = util/i386/pc/grub-mkimage.c util/misc.c \
@@ -69,8 +69,8 @@
 # For grub-mkdevicemap.
 grub_mkdevicemap_SOURCES = util/i386/pc/grub-mkdevicemap.c util/misc.c
 
-# For grub-probefs.
-grub_probefs_SOURCES = util/i386/pc/grub-probefs.c	\
+# For grub-probe.
+grub_probefs_SOURCES = util/i386/pc/grub-probe.c	\
 	util/i386/pc/biosdisk.c	util/misc.c util/i386/pc/getroot.c	\
 	kern/device.c kern/disk.c kern/err.c kern/misc.c fs/fat.c	\
 	fs/ext2.c kern/parser.c kern/partition.c partmap/pc.c fs/ufs.c 	\
Index: util/grub-emu.c
===================================================================
RCS file: /sources/grub/grub2/util/grub-emu.c,v
retrieving revision 1.30
diff -u -r1.30 grub-emu.c
--- util/grub-emu.c	13 Jun 2006 22:50:01 -0000	1.30
+++ util/grub-emu.c	23 Sep 2006 07:16:32 -0000
@@ -185,7 +185,7 @@
   /* Make sure that there is a root device.  */
   if (! args.root_dev)
     {
-      args.root_dev = grub_guess_root_device (args.dir ? : DEFAULT_DIRECTORY);
+      args.root_dev = grub_util_biosdisk_get_grub_dev (grub_guess_root_device (args.dir ? : DEFAULT_DIRECTORY));
       if (! args.root_dev)
 	{
 	  grub_util_info ("guessing the root device failed, because of `%s'",
Index: util/i386/pc/getroot.c
===================================================================
RCS file: /sources/grub/grub2/util/i386/pc/getroot.c,v
retrieving revision 1.5
diff -u -r1.5 getroot.c
--- util/i386/pc/getroot.c	14 Sep 2006 18:52:50 -0000	1.5
+++ util/i386/pc/getroot.c	23 Sep 2006 07:16:32 -0000
@@ -223,5 +223,5 @@
   if (! os_dev)
     return 0;
 
-  return grub_util_biosdisk_get_grub_dev (os_dev);
+  return os_dev;
 }
Index: util/i386/pc/grub-install.in
===================================================================
RCS file: /sources/grub/grub2/util/i386/pc/grub-install.in,v
retrieving revision 1.9
diff -u -r1.9 grub-install.in
--- util/i386/pc/grub-install.in	14 Sep 2006 18:52:50 -0000	1.9
+++ util/i386/pc/grub-install.in	23 Sep 2006 07:16:32 -0000
@@ -33,7 +33,7 @@
 grub_setup=${sbindir}/grub-setup
 grub_mkimage=${bindir}/grub-mkimage
 grub_mkdevicemap=${sbindir}/grub-mkdevicemap
-grub_probefs=${sbindir}/grub-probefs
+grub_probefs=${sbindir}/grub-probe
 rootdir=
 grub_prefix=/boot/grub
 modules=
@@ -59,7 +59,7 @@
   --grub-setup=FILE       use FILE as grub-setup
   --grub-mkimage=FILE     use FILE as grub-mkimage
   --grub-mkdevicemap=FILE use FILE as grub-mkdevicemap
-  --grub-probefs=FILE     use FILE as grub-probefs
+  --grub-probe=FILE     use FILE as grub-probe
   --no-floppy             do not probe any floppy drive
   --recheck               probe a device map even if it already exists
 
@@ -92,8 +92,8 @@
 	grub_mkimage=`echo "$option" | sed 's/--grub-mkimage=//'` ;;
     --grub-mkdevicemap=*)
 	grub_mkdevicemap=`echo "$option" | sed 's/--grub-mkdevicemap=//'` ;;
-    --grub-probefs=*)
-	grub_probefs=`echo "$option" | sed 's/--grub-probefs=//'` ;;
+    --grub-probe=*)
+	grub_probefs=`echo "$option" | sed 's/--grub-probe=//'` ;;
     --no-floppy)
 	no_floppy="--no-floppy" ;;
     --recheck)
Index: util/i386/pc/grub-probefs.c
===================================================================
RCS file: /sources/grub/grub2/util/i386/pc/grub-probefs.c,v
retrieving revision 1.3
diff -u -r1.3 grub-probefs.c
--- util/i386/pc/grub-probefs.c	23 Apr 2006 13:37:36 -0000	1.3
+++ util/i386/pc/grub-probefs.c	23 Sep 2006 07:16:32 -0000
@@ -1,4 +1,4 @@
-/* grub-probefs.c - probe a filesystem module for a given path */
+/* grub-probe.c - probe device information for a given path */
 /*
  *  GRUB  --  GRand Unified Bootloader
  *  Copyright (C) 2005,2006 Free Software Foundation, Inc.
@@ -47,6 +47,12 @@
 
 #define DEFAULT_DEVICE_MAP	DEFAULT_DIRECTORY "/device.map"
 
+#define PRINT_FS	0
+#define PRINT_DRIVE	1
+#define PRINT_DEVICE	2
+
+int print = PRINT_FS;
+
 void
 grub_putchar (int c)
 {
@@ -74,13 +80,33 @@
 probe (const char *path)
 {
   char *device_name;
+  char *drive_name;
   grub_device_t dev;
   grub_fs_t fs;
   
   device_name = grub_guess_root_device (path);
   if (! device_name)
     {
-      fprintf (stderr, "cannot find a GRUB device for %s.\n", path);
+      fprintf (stderr, "cannot find a device for %s.\n", path);
+      return;
+    }
+
+  if (print == PRINT_DEVICE)
+    {
+      printf ("%s\n", device_name);
+      return;
+    }
+
+  drive_name = grub_util_biosdisk_get_grub_dev (device_name);
+  if (! drive_name)
+    {
+      fprintf (stderr, "cannot find a GRUB drive for %s.\n", drive_name);
+      return;
+    }
+
+  if (print == PRINT_DRIVE)
+    {
+      printf ("(%s)\n", drive_name);
       return;
     }
 
@@ -102,6 +128,7 @@
 static struct option options[] =
   {
     {"device-map", required_argument, 0, 'm'},
+    {"target", required_argument, 0, 't'},
     {"help", no_argument, 0, 'h'},
     {"version", no_argument, 0, 'V'},
     {"verbose", no_argument, 0, 'v'},
@@ -113,14 +140,15 @@
 {
   if (status)
     fprintf (stderr,
-	     "Try ``grub-probefs --help'' for more information.\n");
+	     "Try ``grub-probe --help'' for more information.\n");
   else
     printf ("\
-Usage: grub-probefs [OPTION]... PATH\n\
+Usage: grub-probe [OPTION]... PATH\n\
 \n\
-Probe a filesystem module for a given path.\n\
+Probe device information for a given path.\n\
 \n\
   -m, --device-map=FILE     use FILE as the device map [default=%s]\n\
+  -t, --target=(fs|drive|device)  print filesystem module, GRUB drive or system device [default=fs]\n\
   -h, --help                display this message and exit\n\
   -V, --version             print version information and exit\n\
   -v, --verbose             print verbose messages\n\
@@ -138,12 +166,12 @@
   char *dev_map = 0;
   char *path;
   
-  progname = "grub-probefs";
+  progname = "grub-probe";
   
   /* Check for options.  */
   while (1)
     {
-      int c = getopt_long (argc, argv, "m:hVv", options, 0);
+      int c = getopt_long (argc, argv, "m:t:hVv", options, 0);
       
       if (c == -1)
 	break;
@@ -157,6 +185,17 @@
 	    dev_map = xstrdup (optarg);
 	    break;
 
+	  case 't':
+	    if (!strcmp (optarg, "fs"))
+	      print = PRINT_FS;
+	    else if (!strcmp (optarg, "drive"))
+	      print = PRINT_DRIVE;
+	    else if (!strcmp (optarg, "device"))
+	      print = PRINT_DEVICE;
+	    else
+	      usage (1);
+	    break;
+
 	  case 'h':
 	    usage (0);
 	    break;
Index: util/i386/pc/grub-setup.c
===================================================================
RCS file: /sources/grub/grub2/util/i386/pc/grub-setup.c,v
retrieving revision 1.18
diff -u -r1.18 grub-setup.c
--- util/i386/pc/grub-setup.c	4 Jun 2006 15:56:55 -0000	1.18
+++ util/i386/pc/grub-setup.c	23 Sep 2006 07:16:32 -0000
@@ -669,7 +669,7 @@
     }
   else
     {
-      root_dev = grub_guess_root_device (dir ? : DEFAULT_DIRECTORY);
+      root_dev = grub_util_biosdisk_get_grub_dev (grub_guess_root_device (dir ? : DEFAULT_DIRECTORY));
       if (! root_dev)
 	{
 	  grub_util_info ("guessing the root device failed, because of `%s'",

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] grub-probefs --root-device
  2006-09-23  7:26   ` Robert Millan
@ 2006-09-23  8:37     ` Robert Millan
  2006-09-25 10:09       ` Robert Millan
  2006-09-26 17:29     ` [PATCH] grub-probefs --root-device Vesa Jääskeläinen
  1 sibling, 1 reply; 16+ messages in thread
From: Robert Millan @ 2006-09-23  8:37 UTC (permalink / raw)
  To: The development of GRUB 2


Uhm actualy, I'll need this on non-i386 too.  Can we enable grub-probe.c for all
platforms?  If the last part (about PC/BIOS translation) is i386-specific,
perhaps it could be conditionalised so that non-i386 can use
--target=(drive|device) ?

-- 
Robert Millan

My spam trap is honeypot@aybabtu.com.  Note: this address is only intended for
spam harvesters.  Writing to it will get you added to my black list.



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] grub-probefs --root-device
  2006-09-23  8:37     ` Robert Millan
@ 2006-09-25 10:09       ` Robert Millan
  2006-09-26  2:42         ` grub 2 on debian amd64 Colin Lamarre
  0 siblings, 1 reply; 16+ messages in thread
From: Robert Millan @ 2006-09-25 10:09 UTC (permalink / raw)
  To: The development of GRUB 2

On Sat, Sep 23, 2006 at 10:37:52AM +0200, Robert Millan wrote:
> 
> Uhm actualy, I'll need this on non-i386 too.  Can we enable grub-probe.c for all
> platforms?  If the last part (about PC/BIOS translation) is i386-specific,
> perhaps it could be conditionalised so that non-i386 can use
> --target=(drive|device) ?

Looking at how grub-probefs depends on other pc/i386 stuff, perhaps it would
make more sense to merge this first and then try writing a different grub-probe
for the other arches.

Does my last patch look fine for commit?

-- 
Robert Millan

My spam trap is honeypot@aybabtu.com.  Note: this address is only intended for
spam harvesters.  Writing to it will get you added to my black list.



^ permalink raw reply	[flat|nested] 16+ messages in thread

* grub 2 on debian amd64
  2006-09-25 10:09       ` Robert Millan
@ 2006-09-26  2:42         ` Colin Lamarre
  2006-09-26  2:53           ` Hollis Blanchard
  2006-09-26 16:32           ` Robert Millan
  0 siblings, 2 replies; 16+ messages in thread
From: Colin Lamarre @ 2006-09-26  2:42 UTC (permalink / raw)
  To: The development of GRUB 2

Hi,

I set out to install grub 2 on a debian/amd64, win2k, xp machine just
for fun, kinda like the jackass of computing. I don't see any simple
way, has anyone put together an easy 2 step proc yet? Kew code btw,
must be difficult to debug, good luck!

thanks!

Colin

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: grub 2 on debian amd64
  2006-09-26  2:42         ` grub 2 on debian amd64 Colin Lamarre
@ 2006-09-26  2:53           ` Hollis Blanchard
  2006-09-26 16:32           ` Robert Millan
  1 sibling, 0 replies; 16+ messages in thread
From: Hollis Blanchard @ 2006-09-26  2:53 UTC (permalink / raw)
  To: The development of GRUB 2; +Cc: Colin Lamarre

On Mon, 2006-09-25 at 19:42 -0700, Colin Lamarre wrote:
> Hi,
> 
> I set out to install grub 2 on a debian/amd64, win2k, xp machine just
> for fun, kinda like the jackass of computing. I don't see any simple
> way, has anyone put together an easy 2 step proc yet? Kew code btw,
> must be difficult to debug, good luck!

Have you seen the wiki at http://grub.enbug.org ?

-Hollis




^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: grub 2 on debian amd64
  2006-09-26  2:42         ` grub 2 on debian amd64 Colin Lamarre
  2006-09-26  2:53           ` Hollis Blanchard
@ 2006-09-26 16:32           ` Robert Millan
  1 sibling, 0 replies; 16+ messages in thread
From: Robert Millan @ 2006-09-26 16:32 UTC (permalink / raw)
  To: The development of GRUB 2

On Mon, Sep 25, 2006 at 07:42:23PM -0700, Colin Lamarre wrote:
> Hi,
> 
> I set out to install grub 2 on a debian/amd64, win2k, xp machine just
> for fun, kinda like the jackass of computing. I don't see any simple
> way, has anyone put together an easy 2 step proc yet? Kew code btw,
> must be difficult to debug, good luck!

If you're using the debian package, grub-install "(hd0)" && update-grub -y
should do.

Except it's broken now =), so wait for next upload or use CVS.

-- 
Robert Millan

My spam trap is honeypot@aybabtu.com.  Note: this address is only intended for
spam harvesters.  Writing to it will get you added to my black list.



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] grub-probefs --root-device
  2006-09-23  7:26   ` Robert Millan
  2006-09-23  8:37     ` Robert Millan
@ 2006-09-26 17:29     ` Vesa Jääskeläinen
  2006-09-28 14:39       ` Robert Millan
  1 sibling, 1 reply; 16+ messages in thread
From: Vesa Jääskeläinen @ 2006-09-26 17:29 UTC (permalink / raw)
  To: The development of GRUB 2

Hi,

Here are some comments about your patch. As requested :)

Robert Millan wrote:
> 2006-09-23  Robert Millan  <rmh@aybabtu.com>
> 
> 	* util/i386/pc/getroot.c (grub_guess_root_device): Stop using
> 	grub_util_biosdisk_get_grub_dev to convert system device to GRUB device.
> 	* util/grub-emu.c: Use grub_util_biosdisk_get_grub_dev with the string
> 	returned by grub_guess_root_device.

Method name missing from grub-emu.

> 	* util/i386/pc/grub-setup.c: Ditto.
> 	* util/i386/pc/grub-probefs.c: Ditto.
> 
> 	* util/i386/pc/grub-probefs.c: Rename to ...
> 	* util/i386/pc/grub-probe.c: ... this.
> 	* DISTLIST: Update reference to grub-probefs.
> 	* conf/i386-efi.mk: Ditto.
> 	* conf/i386-efi.rmk: Ditto.
> 	* conf/i386-pc.mk: Ditto.
> 	* conf/i386-pc.rmk: Ditto.
> 	* util/i386/pc/grub-install.in: Ditto.

Describe what changed in terms of source code not in terms of "english".
 Eg. DISTLIST: Removed grub-probefs.  Added grub-probe.

I am not sure is "ditto" a good term.. I have seen "Likewise." in other
entries and used that myself too.

And no need to inform about changes to .mk as they are generated files.
Just make sure on commit they are there.

> 	* util/i386/pc/grub-probe.c: Add --target=(fs|device|drive) option to
> 	choose which information we want to print.

Method...

> Index: DISTLIST
> ===================================================================
> RCS file: /sources/grub/grub2/DISTLIST,v
> retrieving revision 1.36
> diff -u -r1.36 DISTLIST
> --- DISTLIST	4 Jun 2006 12:59:19 -0000	1.36
> +++ DISTLIST	23 Sep 2006 07:16:31 -0000
> @@ -253,7 +253,7 @@
>  util/i386/pc/grub-install.in
>  util/i386/pc/grub-mkdevicemap.c
>  util/i386/pc/grub-mkimage.c
> -util/i386/pc/grub-probefs.c
> +util/i386/pc/grub-probe.c
>  util/i386/pc/grub-setup.c
>  util/i386/pc/misc.c
>  util/powerpc/ieee1275/grub-install.in

> Index: conf/i386-efi.rmk
> ===================================================================
> RCS file: /sources/grub/grub2/conf/i386-efi.rmk,v
> retrieving revision 1.9
> diff -u -r1.9 i386-efi.rmk
> --- conf/i386-efi.rmk	28 May 2006 23:01:43 -0000	1.9
> +++ conf/i386-efi.rmk	23 Sep 2006 07:16:31 -0000
> @@ -6,7 +6,7 @@
>  
>  # Utilities.
>  bin_UTILITIES = grub-mkimage
> -#sbin_UTILITIES = grub-setup grub-emu grub-mkdevicemap grub-probefs
> +#sbin_UTILITIES = grub-setup grub-emu grub-mkdevicemap grub-probe
>  
>  # For grub-mkimage.
>  grub_mkimage_SOURCES = util/i386/efi/grub-mkimage.c util/misc.c \
> @@ -23,8 +23,8 @@
>  # For grub-mkdevicemap.
>  #grub_mkdevicemap_SOURCES = util/i386/pc/grub-mkdevicemap.c util/misc.c
>  
> -# For grub-probefs.
> -#grub_probefs_SOURCES = util/i386/pc/grub-probefs.c	\
> +# For grub-probe.
> +#grub_probefs_SOURCES = util/i386/pc/grub-probe.c	\

Should be grub_probe_SOURCES.

>  #	util/i386/pc/biosdisk.c	util/misc.c util/i386/pc/getroot.c	\
>  #	kern/device.c kern/disk.c kern/err.c kern/misc.c fs/fat.c	\
>  #	fs/ext2.c kern/parser.c kern/partition.c partmap/pc.c fs/ufs.c 	\
> Index: conf/i386-pc.rmk
> ===================================================================
> RCS file: /sources/grub/grub2/conf/i386-pc.rmk,v
> retrieving revision 1.69
> diff -u -r1.69 i386-pc.rmk
> --- conf/i386-pc.rmk	22 Sep 2006 00:27:38 -0000	1.69
> +++ conf/i386-pc.rmk	23 Sep 2006 07:16:32 -0000
> @@ -51,7 +51,7 @@
>  
>  # Utilities.
>  bin_UTILITIES = grub-mkimage
> -sbin_UTILITIES = grub-setup grub-emu grub-mkdevicemap grub-probefs
> +sbin_UTILITIES = grub-setup grub-emu grub-mkdevicemap grub-probe
>  
>  # For grub-mkimage.
>  grub_mkimage_SOURCES = util/i386/pc/grub-mkimage.c util/misc.c \
> @@ -69,8 +69,8 @@
>  # For grub-mkdevicemap.
>  grub_mkdevicemap_SOURCES = util/i386/pc/grub-mkdevicemap.c util/misc.c
>  
> -# For grub-probefs.
> -grub_probefs_SOURCES = util/i386/pc/grub-probefs.c	\
> +# For grub-probe.
> +grub_probefs_SOURCES = util/i386/pc/grub-probe.c	\

Same here.

>  	util/i386/pc/biosdisk.c	util/misc.c util/i386/pc/getroot.c	\
>  	kern/device.c kern/disk.c kern/err.c kern/misc.c fs/fat.c	\
>  	fs/ext2.c kern/parser.c kern/partition.c partmap/pc.c fs/ufs.c 	\
> Index: util/grub-emu.c
> ===================================================================
> RCS file: /sources/grub/grub2/util/grub-emu.c,v
> retrieving revision 1.30
> diff -u -r1.30 grub-emu.c
> --- util/grub-emu.c	13 Jun 2006 22:50:01 -0000	1.30
> +++ util/grub-emu.c	23 Sep 2006 07:16:32 -0000
> @@ -185,7 +185,7 @@
>    /* Make sure that there is a root device.  */
>    if (! args.root_dev)
>      {
> -      args.root_dev = grub_guess_root_device (args.dir ? : DEFAULT_DIRECTORY);
> +      args.root_dev = grub_util_biosdisk_get_grub_dev (grub_guess_root_device (args.dir ? : DEFAULT_DIRECTORY));
>        if (! args.root_dev)
>  	{
>  	  grub_util_info ("guessing the root device failed, because of `%s'",
> Index: util/i386/pc/getroot.c
> ===================================================================
> RCS file: /sources/grub/grub2/util/i386/pc/getroot.c,v
> retrieving revision 1.5
> diff -u -r1.5 getroot.c
> --- util/i386/pc/getroot.c	14 Sep 2006 18:52:50 -0000	1.5
> +++ util/i386/pc/getroot.c	23 Sep 2006 07:16:32 -0000
> @@ -223,5 +223,5 @@
>    if (! os_dev)
>      return 0;
>  
> -  return grub_util_biosdisk_get_grub_dev (os_dev);
> +  return os_dev;
>  }
> Index: util/i386/pc/grub-install.in
> ===================================================================
> RCS file: /sources/grub/grub2/util/i386/pc/grub-install.in,v
> retrieving revision 1.9
> diff -u -r1.9 grub-install.in
> --- util/i386/pc/grub-install.in	14 Sep 2006 18:52:50 -0000	1.9
> +++ util/i386/pc/grub-install.in	23 Sep 2006 07:16:32 -0000
> @@ -33,7 +33,7 @@
>  grub_setup=${sbindir}/grub-setup
>  grub_mkimage=${bindir}/grub-mkimage
>  grub_mkdevicemap=${sbindir}/grub-mkdevicemap
> -grub_probefs=${sbindir}/grub-probefs
> +grub_probefs=${sbindir}/grub-probe

Should be grub_probe as name changes... May need changes to other places
too.

>  rootdir=
>  grub_prefix=/boot/grub
>  modules=
> @@ -59,7 +59,7 @@
>    --grub-setup=FILE       use FILE as grub-setup
>    --grub-mkimage=FILE     use FILE as grub-mkimage
>    --grub-mkdevicemap=FILE use FILE as grub-mkdevicemap
> -  --grub-probefs=FILE     use FILE as grub-probefs
> +  --grub-probe=FILE     use FILE as grub-probe

At least here we are missing couple of spaces.

>    --no-floppy             do not probe any floppy drive
>    --recheck               probe a device map even if it already exists
>  
> @@ -92,8 +92,8 @@
>  	grub_mkimage=`echo "$option" | sed 's/--grub-mkimage=//'` ;;
>      --grub-mkdevicemap=*)
>  	grub_mkdevicemap=`echo "$option" | sed 's/--grub-mkdevicemap=//'` ;;
> -    --grub-probefs=*)
> -	grub_probefs=`echo "$option" | sed 's/--grub-probefs=//'` ;;
> +    --grub-probe=*)
> +	grub_probefs=`echo "$option" | sed 's/--grub-probe=//'` ;;

Needs change here at least...

>      --no-floppy)
>  	no_floppy="--no-floppy" ;;
>      --recheck)
> Index: util/i386/pc/grub-probefs.c
> ===================================================================
> RCS file: /sources/grub/grub2/util/i386/pc/grub-probefs.c,v
> retrieving revision 1.3
> diff -u -r1.3 grub-probefs.c
> --- util/i386/pc/grub-probefs.c	23 Apr 2006 13:37:36 -0000	1.3
> +++ util/i386/pc/grub-probefs.c	23 Sep 2006 07:16:32 -0000
> @@ -1,4 +1,4 @@
> -/* grub-probefs.c - probe a filesystem module for a given path */
> +/* grub-probe.c - probe device information for a given path */
>  /*
>   *  GRUB  --  GRand Unified Bootloader
>   *  Copyright (C) 2005,2006 Free Software Foundation, Inc.
> @@ -47,6 +47,12 @@
>  
>  #define DEFAULT_DEVICE_MAP	DEFAULT_DIRECTORY "/device.map"
>  
> +#define PRINT_FS	0
> +#define PRINT_DRIVE	1
> +#define PRINT_DEVICE	2
> +
> +int print = PRINT_FS;
> +
>  void
>  grub_putchar (int c)
>  {
> @@ -74,13 +80,33 @@
>  probe (const char *path)
>  {
>    char *device_name;
> +  char *drive_name;
>    grub_device_t dev;
>    grub_fs_t fs;
>    
>    device_name = grub_guess_root_device (path);
>    if (! device_name)
>      {
> -      fprintf (stderr, "cannot find a GRUB device for %s.\n", path);
> +      fprintf (stderr, "cannot find a device for %s.\n", path);
> +      return;
> +    }
> +
> +  if (print == PRINT_DEVICE)
> +    {
> +      printf ("%s\n", device_name);
> +      return;
> +    }
> +
> +  drive_name = grub_util_biosdisk_get_grub_dev (device_name);
> +  if (! drive_name)
> +    {
> +      fprintf (stderr, "cannot find a GRUB drive for %s.\n", drive_name);
> +      return;
> +    }
> +
> +  if (print == PRINT_DRIVE)
> +    {
> +      printf ("(%s)\n", drive_name);
>        return;
>      }
>  
> @@ -102,6 +128,7 @@
>  static struct option options[] =
>    {
>      {"device-map", required_argument, 0, 'm'},
> +    {"target", required_argument, 0, 't'},
>      {"help", no_argument, 0, 'h'},
>      {"version", no_argument, 0, 'V'},
>      {"verbose", no_argument, 0, 'v'},
> @@ -113,14 +140,15 @@
>  {
>    if (status)
>      fprintf (stderr,
> -	     "Try ``grub-probefs --help'' for more information.\n");
> +	     "Try ``grub-probe --help'' for more information.\n");
>    else
>      printf ("\
> -Usage: grub-probefs [OPTION]... PATH\n\
> +Usage: grub-probe [OPTION]... PATH\n\
>  \n\
> -Probe a filesystem module for a given path.\n\
> +Probe device information for a given path.\n\
>  \n\
>    -m, --device-map=FILE     use FILE as the device map [default=%s]\n\
> +  -t, --target=(fs|drive|device)  print filesystem module, GRUB drive or system device [default=fs]\n\
>    -h, --help                display this message and exit\n\
>    -V, --version             print version information and exit\n\
>    -v, --verbose             print verbose messages\n\
> @@ -138,12 +166,12 @@
>    char *dev_map = 0;
>    char *path;
>    
> -  progname = "grub-probefs";
> +  progname = "grub-probe";
>    
>    /* Check for options.  */
>    while (1)
>      {
> -      int c = getopt_long (argc, argv, "m:hVv", options, 0);
> +      int c = getopt_long (argc, argv, "m:t:hVv", options, 0);
>        
>        if (c == -1)
>  	break;
> @@ -157,6 +185,17 @@
>  	    dev_map = xstrdup (optarg);
>  	    break;
>  
> +	  case 't':
> +	    if (!strcmp (optarg, "fs"))
> +	      print = PRINT_FS;
> +	    else if (!strcmp (optarg, "drive"))
> +	      print = PRINT_DRIVE;
> +	    else if (!strcmp (optarg, "device"))
> +	      print = PRINT_DEVICE;
> +	    else
> +	      usage (1);
> +	    break;
> +
>  	  case 'h':
>  	    usage (0);
>  	    break;
> Index: util/i386/pc/grub-setup.c
> ===================================================================
> RCS file: /sources/grub/grub2/util/i386/pc/grub-setup.c,v
> retrieving revision 1.18
> diff -u -r1.18 grub-setup.c
> --- util/i386/pc/grub-setup.c	4 Jun 2006 15:56:55 -0000	1.18
> +++ util/i386/pc/grub-setup.c	23 Sep 2006 07:16:32 -0000
> @@ -669,7 +669,7 @@
>      }
>    else
>      {
> -      root_dev = grub_guess_root_device (dir ? : DEFAULT_DIRECTORY);
> +      root_dev = grub_util_biosdisk_get_grub_dev (grub_guess_root_device (dir ? : DEFAULT_DIRECTORY));
>        if (! root_dev)
>  	{
>  	  grub_util_info ("guessing the root device failed, because of `%s'",




^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] grub-probefs --root-device
  2006-09-26 17:29     ` [PATCH] grub-probefs --root-device Vesa Jääskeläinen
@ 2006-09-28 14:39       ` Robert Millan
  2006-10-01 19:27         ` Robert Millan
  0 siblings, 1 reply; 16+ messages in thread
From: Robert Millan @ 2006-09-28 14:39 UTC (permalink / raw)
  To: The development of GRUB 2

[-- Attachment #1: Type: text/plain, Size: 3438 bytes --]

On Tue, Sep 26, 2006 at 08:29:33PM +0300, Vesa Jääskeläinen wrote:
> Hi,
> 
> Here are some comments about your patch. As requested :)

Thanks for the corrections.  Some of them make me ashamed, I should have
looked better at all those grub-probefs instances... ;)

> Robert Millan wrote:
> > 2006-09-23  Robert Millan  <rmh@aybabtu.com>
> > 
> > 	* util/i386/pc/getroot.c (grub_guess_root_device): Stop using
> > 	grub_util_biosdisk_get_grub_dev to convert system device to GRUB device.
> > 	* util/grub-emu.c: Use grub_util_biosdisk_get_grub_dev with the string
> > 	returned by grub_guess_root_device.
> 
> Method name missing from grub-emu.

Ok (main).

> > 	* util/i386/pc/grub-setup.c: Ditto.
> > 	* util/i386/pc/grub-probefs.c: Ditto.
> > 
> > 	* util/i386/pc/grub-probefs.c: Rename to ...
> > 	* util/i386/pc/grub-probe.c: ... this.
> > 	* DISTLIST: Update reference to grub-probefs.
> > 	* conf/i386-efi.mk: Ditto.
> > 	* conf/i386-efi.rmk: Ditto.
> > 	* conf/i386-pc.mk: Ditto.
> > 	* conf/i386-pc.rmk: Ditto.
> > 	* util/i386/pc/grub-install.in: Ditto.
> 
> Describe what changed in terms of source code not in terms of "english".
>  Eg. DISTLIST: Removed grub-probefs.  Added grub-probe.
> 
> I am not sure is "ditto" a good term.. I have seen "Likewise." in other
> entries and used that myself too.
> 
> And no need to inform about changes to .mk as they are generated files.
> Just make sure on commit they are there.

Ok.  I'm also omitting .mk files from my patch.  I'll take care of regenerating
later.

> > 	* util/i386/pc/grub-probe.c: Add --target=(fs|device|drive) option to
> > 	choose which information we want to print.
> 
> Method...

This change applies in various places of the file (main, probe, options..)

> Should be grub_probe as name changes... May need changes to other places
> too.

Checked them all this time.

> >    --no-floppy             do not probe any floppy drive
> >    --recheck               probe a device map even if it already exists
> >  
> > @@ -92,8 +92,8 @@
> >  	grub_mkimage=`echo "$option" | sed 's/--grub-mkimage=//'` ;;
> >      --grub-mkdevicemap=*)
> >  	grub_mkdevicemap=`echo "$option" | sed 's/--grub-mkdevicemap=//'` ;;
> > -    --grub-probefs=*)
> > -	grub_probefs=`echo "$option" | sed 's/--grub-probefs=//'` ;;
> > +    --grub-probe=*)
> > +	grub_probefs=`echo "$option" | sed 's/--grub-probe=//'` ;;
> 
> Needs change here at least...

Done.  Also added an explicit --target=fs option in grub-install (better be
safe).

Please let me know if it's ok now:

2006-09-28  Robert Millan  <rmh@aybabtu.com>

	* util/i386/pc/getroot.c (grub_guess_root_device): Stop using
	grub_util_biosdisk_get_grub_dev to convert system device to GRUB device.
	* util/grub-emu.c (main): Use grub_util_biosdisk_get_grub_dev with the
	string returned by grub_guess_root_device.
	* util/i386/pc/grub-setup.c: Likewise.
	* util/i386/pc/grub-probefs.c: Likewise.

	* util/i386/pc/grub-probefs.c: Rename to ...
	* util/i386/pc/grub-probe.c: ... this.
	* DISTLIST: Remove grub-probefs, add grub-probe.
	* conf/i386-efi.rmk: Likewise.
	* conf/i386-pc.rmk: Likewise.
	* util/i386/pc/grub-install.in: Likewise.

	* util/i386/pc/grub-probe.c: Add --target=(fs|device|drive) option to
	choose which information we want to print.

-- 
Robert Millan

My spam trap is honeypot@aybabtu.com.  Note: this address is only intended for
spam harvesters.  Writing to it will get you added to my black list.

[-- Attachment #2: print_paths.diff --]
[-- Type: text/plain, Size: 10243 bytes --]


2006-09-28  Robert Millan  <rmh@aybabtu.com>

	* util/i386/pc/getroot.c (grub_guess_root_device): Stop using
	grub_util_biosdisk_get_grub_dev to convert system device to GRUB device.
	* util/grub-emu.c (main): Use grub_util_biosdisk_get_grub_dev with the
	string returned by grub_guess_root_device.
	* util/i386/pc/grub-setup.c: Likewise.
	* util/i386/pc/grub-probefs.c: Likewise.

	* util/i386/pc/grub-probefs.c: Rename to ...
	* util/i386/pc/grub-probe.c: ... this.
	* DISTLIST: Remove grub-probefs, add grub-probe.
	* conf/i386-efi.rmk: Likewise.
	* conf/i386-pc.rmk: Likewise.
	* util/i386/pc/grub-install.in: Likewise.

	* util/i386/pc/grub-probe.c: Add --target=(fs|device|drive) option to
	choose which information we want to print.

Index: DISTLIST
===================================================================
RCS file: /sources/grub/grub2/DISTLIST,v
retrieving revision 1.36
diff -u -r1.36 DISTLIST
--- DISTLIST	4 Jun 2006 12:59:19 -0000	1.36
+++ DISTLIST	28 Sep 2006 14:11:04 -0000
@@ -253,7 +253,7 @@
 util/i386/pc/grub-install.in
 util/i386/pc/grub-mkdevicemap.c
 util/i386/pc/grub-mkimage.c
-util/i386/pc/grub-probefs.c
+util/i386/pc/grub-probe.c
 util/i386/pc/grub-setup.c
 util/i386/pc/misc.c
 util/powerpc/ieee1275/grub-install.in
Index: conf/i386-efi.rmk
===================================================================
RCS file: /sources/grub/grub2/conf/i386-efi.rmk,v
retrieving revision 1.10
diff -u -r1.10 i386-efi.rmk
--- conf/i386-efi.rmk	22 Sep 2006 19:36:32 -0000	1.10
+++ conf/i386-efi.rmk	28 Sep 2006 14:11:04 -0000
@@ -6,7 +6,7 @@
 
 # Utilities.
 bin_UTILITIES = grub-mkimage
-#sbin_UTILITIES = grub-setup grub-emu grub-mkdevicemap grub-probefs
+#sbin_UTILITIES = grub-setup grub-emu grub-mkdevicemap grub-probe
 
 # For grub-mkimage.
 grub_mkimage_SOURCES = util/i386/efi/grub-mkimage.c util/misc.c \
@@ -23,8 +23,8 @@
 # For grub-mkdevicemap.
 #grub_mkdevicemap_SOURCES = util/i386/pc/grub-mkdevicemap.c util/misc.c
 
-# For grub-probefs.
-#grub_probefs_SOURCES = util/i386/pc/grub-probefs.c	\
+# For grub-probe.
+#grub_probe_SOURCES = util/i386/pc/grub-probe.c	\
 #	util/i386/pc/biosdisk.c	util/misc.c util/i386/pc/getroot.c	\
 #	kern/device.c kern/disk.c kern/err.c kern/misc.c fs/fat.c	\
 #	fs/ext2.c kern/parser.c kern/partition.c partmap/pc.c fs/ufs.c 	\
Index: conf/i386-pc.rmk
===================================================================
RCS file: /sources/grub/grub2/conf/i386-pc.rmk,v
retrieving revision 1.70
diff -u -r1.70 i386-pc.rmk
--- conf/i386-pc.rmk	22 Sep 2006 21:09:14 -0000	1.70
+++ conf/i386-pc.rmk	28 Sep 2006 14:11:05 -0000
@@ -51,7 +51,7 @@
 
 # Utilities.
 bin_UTILITIES = grub-mkimage
-sbin_UTILITIES = grub-setup grub-emu grub-mkdevicemap grub-probefs
+sbin_UTILITIES = grub-setup grub-emu grub-mkdevicemap grub-probe
 
 # For grub-mkimage.
 grub_mkimage_SOURCES = util/i386/pc/grub-mkimage.c util/misc.c \
@@ -69,8 +69,8 @@
 # For grub-mkdevicemap.
 grub_mkdevicemap_SOURCES = util/i386/pc/grub-mkdevicemap.c util/misc.c
 
-# For grub-probefs.
-grub_probefs_SOURCES = util/i386/pc/grub-probefs.c	\
+# For grub-probe.
+grub_probe_SOURCES = util/i386/pc/grub-probe.c	\
 	util/i386/pc/biosdisk.c	util/misc.c util/i386/pc/getroot.c	\
 	kern/device.c kern/disk.c kern/err.c kern/misc.c fs/fat.c	\
 	fs/ext2.c kern/parser.c kern/partition.c partmap/pc.c fs/ufs.c 	\
Index: util/grub-emu.c
===================================================================
RCS file: /sources/grub/grub2/util/grub-emu.c,v
retrieving revision 1.30
diff -u -r1.30 grub-emu.c
--- util/grub-emu.c	13 Jun 2006 22:50:01 -0000	1.30
+++ util/grub-emu.c	28 Sep 2006 14:11:06 -0000
@@ -185,7 +185,7 @@
   /* Make sure that there is a root device.  */
   if (! args.root_dev)
     {
-      args.root_dev = grub_guess_root_device (args.dir ? : DEFAULT_DIRECTORY);
+      args.root_dev = grub_util_biosdisk_get_grub_dev (grub_guess_root_device (args.dir ? : DEFAULT_DIRECTORY));
       if (! args.root_dev)
 	{
 	  grub_util_info ("guessing the root device failed, because of `%s'",
Index: util/i386/pc/getroot.c
===================================================================
RCS file: /sources/grub/grub2/util/i386/pc/getroot.c,v
retrieving revision 1.5
diff -u -r1.5 getroot.c
--- util/i386/pc/getroot.c	14 Sep 2006 18:52:50 -0000	1.5
+++ util/i386/pc/getroot.c	28 Sep 2006 14:11:06 -0000
@@ -223,5 +223,5 @@
   if (! os_dev)
     return 0;
 
-  return grub_util_biosdisk_get_grub_dev (os_dev);
+  return os_dev;
 }
Index: util/i386/pc/grub-install.in
===================================================================
RCS file: /sources/grub/grub2/util/i386/pc/grub-install.in,v
retrieving revision 1.9
diff -u -r1.9 grub-install.in
--- util/i386/pc/grub-install.in	14 Sep 2006 18:52:50 -0000	1.9
+++ util/i386/pc/grub-install.in	28 Sep 2006 14:11:06 -0000
@@ -33,7 +33,7 @@
 grub_setup=${sbindir}/grub-setup
 grub_mkimage=${bindir}/grub-mkimage
 grub_mkdevicemap=${sbindir}/grub-mkdevicemap
-grub_probefs=${sbindir}/grub-probefs
+grub_probe=${sbindir}/grub-probe
 rootdir=
 grub_prefix=/boot/grub
 modules=
@@ -59,7 +59,7 @@
   --grub-setup=FILE       use FILE as grub-setup
   --grub-mkimage=FILE     use FILE as grub-mkimage
   --grub-mkdevicemap=FILE use FILE as grub-mkdevicemap
-  --grub-probefs=FILE     use FILE as grub-probefs
+  --grub-probe=FILE       use FILE as grub-probe
   --no-floppy             do not probe any floppy drive
   --recheck               probe a device map even if it already exists
 
@@ -92,8 +92,8 @@
 	grub_mkimage=`echo "$option" | sed 's/--grub-mkimage=//'` ;;
     --grub-mkdevicemap=*)
 	grub_mkdevicemap=`echo "$option" | sed 's/--grub-mkdevicemap=//'` ;;
-    --grub-probefs=*)
-	grub_probefs=`echo "$option" | sed 's/--grub-probefs=//'` ;;
+    --grub-probe=*)
+	grub_probe=`echo "$option" | sed 's/--grub-probe=//'` ;;
     --no-floppy)
 	no_floppy="--no-floppy" ;;
     --recheck)
@@ -207,7 +207,7 @@
 done
 
 # Create the core image. First, auto-detect the filesystem module.
-fs_module=`$grub_probefs --device-map=${device_map} ${grubdir}`
+fs_module=`$grub_probe --target=fs --device-map=${device_map} ${grubdir}`
 if test "x$fs_module" = x -a "x$modules" = x; then
     echo "Auto-detection of a filesystem module failed." 1>&2
     echo "Please specify the module with the option \`--modules' explicitly." 1>&2
Index: util/i386/pc/grub-probefs.c
===================================================================
RCS file: /sources/grub/grub2/util/i386/pc/grub-probefs.c,v
retrieving revision 1.3
diff -u -r1.3 grub-probefs.c
--- util/i386/pc/grub-probefs.c	23 Apr 2006 13:37:36 -0000	1.3
+++ util/i386/pc/grub-probefs.c	28 Sep 2006 14:11:06 -0000
@@ -1,4 +1,4 @@
-/* grub-probefs.c - probe a filesystem module for a given path */
+/* grub-probe.c - probe device information for a given path */
 /*
  *  GRUB  --  GRand Unified Bootloader
  *  Copyright (C) 2005,2006 Free Software Foundation, Inc.
@@ -47,6 +47,12 @@
 
 #define DEFAULT_DEVICE_MAP	DEFAULT_DIRECTORY "/device.map"
 
+#define PRINT_FS	0
+#define PRINT_DRIVE	1
+#define PRINT_DEVICE	2
+
+int print = PRINT_FS;
+
 void
 grub_putchar (int c)
 {
@@ -74,13 +80,33 @@
 probe (const char *path)
 {
   char *device_name;
+  char *drive_name;
   grub_device_t dev;
   grub_fs_t fs;
   
   device_name = grub_guess_root_device (path);
   if (! device_name)
     {
-      fprintf (stderr, "cannot find a GRUB device for %s.\n", path);
+      fprintf (stderr, "cannot find a device for %s.\n", path);
+      return;
+    }
+
+  if (print == PRINT_DEVICE)
+    {
+      printf ("%s\n", device_name);
+      return;
+    }
+
+  drive_name = grub_util_biosdisk_get_grub_dev (device_name);
+  if (! drive_name)
+    {
+      fprintf (stderr, "cannot find a GRUB drive for %s.\n", drive_name);
+      return;
+    }
+
+  if (print == PRINT_DRIVE)
+    {
+      printf ("(%s)\n", drive_name);
       return;
     }
 
@@ -102,6 +128,7 @@
 static struct option options[] =
   {
     {"device-map", required_argument, 0, 'm'},
+    {"target", required_argument, 0, 't'},
     {"help", no_argument, 0, 'h'},
     {"version", no_argument, 0, 'V'},
     {"verbose", no_argument, 0, 'v'},
@@ -113,14 +140,15 @@
 {
   if (status)
     fprintf (stderr,
-	     "Try ``grub-probefs --help'' for more information.\n");
+	     "Try ``grub-probe --help'' for more information.\n");
   else
     printf ("\
-Usage: grub-probefs [OPTION]... PATH\n\
+Usage: grub-probe [OPTION]... PATH\n\
 \n\
-Probe a filesystem module for a given path.\n\
+Probe device information for a given path.\n\
 \n\
   -m, --device-map=FILE     use FILE as the device map [default=%s]\n\
+  -t, --target=(fs|drive|device)  print filesystem module, GRUB drive or system device [default=fs]\n\
   -h, --help                display this message and exit\n\
   -V, --version             print version information and exit\n\
   -v, --verbose             print verbose messages\n\
@@ -138,12 +166,12 @@
   char *dev_map = 0;
   char *path;
   
-  progname = "grub-probefs";
+  progname = "grub-probe";
   
   /* Check for options.  */
   while (1)
     {
-      int c = getopt_long (argc, argv, "m:hVv", options, 0);
+      int c = getopt_long (argc, argv, "m:t:hVv", options, 0);
       
       if (c == -1)
 	break;
@@ -157,6 +185,17 @@
 	    dev_map = xstrdup (optarg);
 	    break;
 
+	  case 't':
+	    if (!strcmp (optarg, "fs"))
+	      print = PRINT_FS;
+	    else if (!strcmp (optarg, "drive"))
+	      print = PRINT_DRIVE;
+	    else if (!strcmp (optarg, "device"))
+	      print = PRINT_DEVICE;
+	    else
+	      usage (1);
+	    break;
+
 	  case 'h':
 	    usage (0);
 	    break;
Index: util/i386/pc/grub-setup.c
===================================================================
RCS file: /sources/grub/grub2/util/i386/pc/grub-setup.c,v
retrieving revision 1.18
diff -u -r1.18 grub-setup.c
--- util/i386/pc/grub-setup.c	4 Jun 2006 15:56:55 -0000	1.18
+++ util/i386/pc/grub-setup.c	28 Sep 2006 14:11:06 -0000
@@ -669,7 +669,7 @@
     }
   else
     {
-      root_dev = grub_guess_root_device (dir ? : DEFAULT_DIRECTORY);
+      root_dev = grub_util_biosdisk_get_grub_dev (grub_guess_root_device (dir ? : DEFAULT_DIRECTORY));
       if (! root_dev)
 	{
 	  grub_util_info ("guessing the root device failed, because of `%s'",

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] grub-probefs --root-device
  2006-09-28 14:39       ` Robert Millan
@ 2006-10-01 19:27         ` Robert Millan
  2006-10-14 10:06           ` ping (Re: [PATCH] grub-probefs --root-device) Robert Millan
  0 siblings, 1 reply; 16+ messages in thread
From: Robert Millan @ 2006-10-01 19:27 UTC (permalink / raw)
  To: The development of GRUB 2; +Cc: Yoshinori K. Okuji


Is it alright for commit now?

On Thu, Sep 28, 2006 at 04:39:56PM +0200, Robert Millan wrote:
> On Tue, Sep 26, 2006 at 08:29:33PM +0300, Vesa Jääskeläinen wrote:
> > Hi,
> > 
> > Here are some comments about your patch. As requested :)
> 
> Thanks for the corrections.  Some of them make me ashamed, I should have
> looked better at all those grub-probefs instances... ;)
> 
> > Robert Millan wrote:
> > > 2006-09-23  Robert Millan  <rmh@aybabtu.com>
> > > 
> > > 	* util/i386/pc/getroot.c (grub_guess_root_device): Stop using
> > > 	grub_util_biosdisk_get_grub_dev to convert system device to GRUB device.
> > > 	* util/grub-emu.c: Use grub_util_biosdisk_get_grub_dev with the string
> > > 	returned by grub_guess_root_device.
> > 
> > Method name missing from grub-emu.
> 
> Ok (main).
> 
> > > 	* util/i386/pc/grub-setup.c: Ditto.
> > > 	* util/i386/pc/grub-probefs.c: Ditto.
> > > 
> > > 	* util/i386/pc/grub-probefs.c: Rename to ...
> > > 	* util/i386/pc/grub-probe.c: ... this.
> > > 	* DISTLIST: Update reference to grub-probefs.
> > > 	* conf/i386-efi.mk: Ditto.
> > > 	* conf/i386-efi.rmk: Ditto.
> > > 	* conf/i386-pc.mk: Ditto.
> > > 	* conf/i386-pc.rmk: Ditto.
> > > 	* util/i386/pc/grub-install.in: Ditto.
> > 
> > Describe what changed in terms of source code not in terms of "english".
> >  Eg. DISTLIST: Removed grub-probefs.  Added grub-probe.
> > 
> > I am not sure is "ditto" a good term.. I have seen "Likewise." in other
> > entries and used that myself too.
> > 
> > And no need to inform about changes to .mk as they are generated files.
> > Just make sure on commit they are there.
> 
> Ok.  I'm also omitting .mk files from my patch.  I'll take care of regenerating
> later.
> 
> > > 	* util/i386/pc/grub-probe.c: Add --target=(fs|device|drive) option to
> > > 	choose which information we want to print.
> > 
> > Method...
> 
> This change applies in various places of the file (main, probe, options..)
> 
> > Should be grub_probe as name changes... May need changes to other places
> > too.
> 
> Checked them all this time.
> 
> > >    --no-floppy             do not probe any floppy drive
> > >    --recheck               probe a device map even if it already exists
> > >  
> > > @@ -92,8 +92,8 @@
> > >  	grub_mkimage=`echo "$option" | sed 's/--grub-mkimage=//'` ;;
> > >      --grub-mkdevicemap=*)
> > >  	grub_mkdevicemap=`echo "$option" | sed 's/--grub-mkdevicemap=//'` ;;
> > > -    --grub-probefs=*)
> > > -	grub_probefs=`echo "$option" | sed 's/--grub-probefs=//'` ;;
> > > +    --grub-probe=*)
> > > +	grub_probefs=`echo "$option" | sed 's/--grub-probe=//'` ;;
> > 
> > Needs change here at least...
> 
> Done.  Also added an explicit --target=fs option in grub-install (better be
> safe).
> 
> Please let me know if it's ok now:
> 
> 2006-09-28  Robert Millan  <rmh@aybabtu.com>
> 
> 	* util/i386/pc/getroot.c (grub_guess_root_device): Stop using
> 	grub_util_biosdisk_get_grub_dev to convert system device to GRUB device.
> 	* util/grub-emu.c (main): Use grub_util_biosdisk_get_grub_dev with the
> 	string returned by grub_guess_root_device.
> 	* util/i386/pc/grub-setup.c: Likewise.
> 	* util/i386/pc/grub-probefs.c: Likewise.
> 
> 	* util/i386/pc/grub-probefs.c: Rename to ...
> 	* util/i386/pc/grub-probe.c: ... this.
> 	* DISTLIST: Remove grub-probefs, add grub-probe.
> 	* conf/i386-efi.rmk: Likewise.
> 	* conf/i386-pc.rmk: Likewise.
> 	* util/i386/pc/grub-install.in: Likewise.
> 
> 	* util/i386/pc/grub-probe.c: Add --target=(fs|device|drive) option to
> 	choose which information we want to print.
> 
> -- 
> Robert Millan
> 
> My spam trap is honeypot@aybabtu.com.  Note: this address is only intended for
> spam harvesters.  Writing to it will get you added to my black list.

> 
> 2006-09-28  Robert Millan  <rmh@aybabtu.com>
> 
> 	* util/i386/pc/getroot.c (grub_guess_root_device): Stop using
> 	grub_util_biosdisk_get_grub_dev to convert system device to GRUB device.
> 	* util/grub-emu.c (main): Use grub_util_biosdisk_get_grub_dev with the
> 	string returned by grub_guess_root_device.
> 	* util/i386/pc/grub-setup.c: Likewise.
> 	* util/i386/pc/grub-probefs.c: Likewise.
> 
> 	* util/i386/pc/grub-probefs.c: Rename to ...
> 	* util/i386/pc/grub-probe.c: ... this.
> 	* DISTLIST: Remove grub-probefs, add grub-probe.
> 	* conf/i386-efi.rmk: Likewise.
> 	* conf/i386-pc.rmk: Likewise.
> 	* util/i386/pc/grub-install.in: Likewise.
> 
> 	* util/i386/pc/grub-probe.c: Add --target=(fs|device|drive) option to
> 	choose which information we want to print.
> 
> Index: DISTLIST
> ===================================================================
> RCS file: /sources/grub/grub2/DISTLIST,v
> retrieving revision 1.36
> diff -u -r1.36 DISTLIST
> --- DISTLIST	4 Jun 2006 12:59:19 -0000	1.36
> +++ DISTLIST	28 Sep 2006 14:11:04 -0000
> @@ -253,7 +253,7 @@
>  util/i386/pc/grub-install.in
>  util/i386/pc/grub-mkdevicemap.c
>  util/i386/pc/grub-mkimage.c
> -util/i386/pc/grub-probefs.c
> +util/i386/pc/grub-probe.c
>  util/i386/pc/grub-setup.c
>  util/i386/pc/misc.c
>  util/powerpc/ieee1275/grub-install.in
> Index: conf/i386-efi.rmk
> ===================================================================
> RCS file: /sources/grub/grub2/conf/i386-efi.rmk,v
> retrieving revision 1.10
> diff -u -r1.10 i386-efi.rmk
> --- conf/i386-efi.rmk	22 Sep 2006 19:36:32 -0000	1.10
> +++ conf/i386-efi.rmk	28 Sep 2006 14:11:04 -0000
> @@ -6,7 +6,7 @@
>  
>  # Utilities.
>  bin_UTILITIES = grub-mkimage
> -#sbin_UTILITIES = grub-setup grub-emu grub-mkdevicemap grub-probefs
> +#sbin_UTILITIES = grub-setup grub-emu grub-mkdevicemap grub-probe
>  
>  # For grub-mkimage.
>  grub_mkimage_SOURCES = util/i386/efi/grub-mkimage.c util/misc.c \
> @@ -23,8 +23,8 @@
>  # For grub-mkdevicemap.
>  #grub_mkdevicemap_SOURCES = util/i386/pc/grub-mkdevicemap.c util/misc.c
>  
> -# For grub-probefs.
> -#grub_probefs_SOURCES = util/i386/pc/grub-probefs.c	\
> +# For grub-probe.
> +#grub_probe_SOURCES = util/i386/pc/grub-probe.c	\
>  #	util/i386/pc/biosdisk.c	util/misc.c util/i386/pc/getroot.c	\
>  #	kern/device.c kern/disk.c kern/err.c kern/misc.c fs/fat.c	\
>  #	fs/ext2.c kern/parser.c kern/partition.c partmap/pc.c fs/ufs.c 	\
> Index: conf/i386-pc.rmk
> ===================================================================
> RCS file: /sources/grub/grub2/conf/i386-pc.rmk,v
> retrieving revision 1.70
> diff -u -r1.70 i386-pc.rmk
> --- conf/i386-pc.rmk	22 Sep 2006 21:09:14 -0000	1.70
> +++ conf/i386-pc.rmk	28 Sep 2006 14:11:05 -0000
> @@ -51,7 +51,7 @@
>  
>  # Utilities.
>  bin_UTILITIES = grub-mkimage
> -sbin_UTILITIES = grub-setup grub-emu grub-mkdevicemap grub-probefs
> +sbin_UTILITIES = grub-setup grub-emu grub-mkdevicemap grub-probe
>  
>  # For grub-mkimage.
>  grub_mkimage_SOURCES = util/i386/pc/grub-mkimage.c util/misc.c \
> @@ -69,8 +69,8 @@
>  # For grub-mkdevicemap.
>  grub_mkdevicemap_SOURCES = util/i386/pc/grub-mkdevicemap.c util/misc.c
>  
> -# For grub-probefs.
> -grub_probefs_SOURCES = util/i386/pc/grub-probefs.c	\
> +# For grub-probe.
> +grub_probe_SOURCES = util/i386/pc/grub-probe.c	\
>  	util/i386/pc/biosdisk.c	util/misc.c util/i386/pc/getroot.c	\
>  	kern/device.c kern/disk.c kern/err.c kern/misc.c fs/fat.c	\
>  	fs/ext2.c kern/parser.c kern/partition.c partmap/pc.c fs/ufs.c 	\
> Index: util/grub-emu.c
> ===================================================================
> RCS file: /sources/grub/grub2/util/grub-emu.c,v
> retrieving revision 1.30
> diff -u -r1.30 grub-emu.c
> --- util/grub-emu.c	13 Jun 2006 22:50:01 -0000	1.30
> +++ util/grub-emu.c	28 Sep 2006 14:11:06 -0000
> @@ -185,7 +185,7 @@
>    /* Make sure that there is a root device.  */
>    if (! args.root_dev)
>      {
> -      args.root_dev = grub_guess_root_device (args.dir ? : DEFAULT_DIRECTORY);
> +      args.root_dev = grub_util_biosdisk_get_grub_dev (grub_guess_root_device (args.dir ? : DEFAULT_DIRECTORY));
>        if (! args.root_dev)
>  	{
>  	  grub_util_info ("guessing the root device failed, because of `%s'",
> Index: util/i386/pc/getroot.c
> ===================================================================
> RCS file: /sources/grub/grub2/util/i386/pc/getroot.c,v
> retrieving revision 1.5
> diff -u -r1.5 getroot.c
> --- util/i386/pc/getroot.c	14 Sep 2006 18:52:50 -0000	1.5
> +++ util/i386/pc/getroot.c	28 Sep 2006 14:11:06 -0000
> @@ -223,5 +223,5 @@
>    if (! os_dev)
>      return 0;
>  
> -  return grub_util_biosdisk_get_grub_dev (os_dev);
> +  return os_dev;
>  }
> Index: util/i386/pc/grub-install.in
> ===================================================================
> RCS file: /sources/grub/grub2/util/i386/pc/grub-install.in,v
> retrieving revision 1.9
> diff -u -r1.9 grub-install.in
> --- util/i386/pc/grub-install.in	14 Sep 2006 18:52:50 -0000	1.9
> +++ util/i386/pc/grub-install.in	28 Sep 2006 14:11:06 -0000
> @@ -33,7 +33,7 @@
>  grub_setup=${sbindir}/grub-setup
>  grub_mkimage=${bindir}/grub-mkimage
>  grub_mkdevicemap=${sbindir}/grub-mkdevicemap
> -grub_probefs=${sbindir}/grub-probefs
> +grub_probe=${sbindir}/grub-probe
>  rootdir=
>  grub_prefix=/boot/grub
>  modules=
> @@ -59,7 +59,7 @@
>    --grub-setup=FILE       use FILE as grub-setup
>    --grub-mkimage=FILE     use FILE as grub-mkimage
>    --grub-mkdevicemap=FILE use FILE as grub-mkdevicemap
> -  --grub-probefs=FILE     use FILE as grub-probefs
> +  --grub-probe=FILE       use FILE as grub-probe
>    --no-floppy             do not probe any floppy drive
>    --recheck               probe a device map even if it already exists
>  
> @@ -92,8 +92,8 @@
>  	grub_mkimage=`echo "$option" | sed 's/--grub-mkimage=//'` ;;
>      --grub-mkdevicemap=*)
>  	grub_mkdevicemap=`echo "$option" | sed 's/--grub-mkdevicemap=//'` ;;
> -    --grub-probefs=*)
> -	grub_probefs=`echo "$option" | sed 's/--grub-probefs=//'` ;;
> +    --grub-probe=*)
> +	grub_probe=`echo "$option" | sed 's/--grub-probe=//'` ;;
>      --no-floppy)
>  	no_floppy="--no-floppy" ;;
>      --recheck)
> @@ -207,7 +207,7 @@
>  done
>  
>  # Create the core image. First, auto-detect the filesystem module.
> -fs_module=`$grub_probefs --device-map=${device_map} ${grubdir}`
> +fs_module=`$grub_probe --target=fs --device-map=${device_map} ${grubdir}`
>  if test "x$fs_module" = x -a "x$modules" = x; then
>      echo "Auto-detection of a filesystem module failed." 1>&2
>      echo "Please specify the module with the option \`--modules' explicitly." 1>&2
> Index: util/i386/pc/grub-probefs.c
> ===================================================================
> RCS file: /sources/grub/grub2/util/i386/pc/grub-probefs.c,v
> retrieving revision 1.3
> diff -u -r1.3 grub-probefs.c
> --- util/i386/pc/grub-probefs.c	23 Apr 2006 13:37:36 -0000	1.3
> +++ util/i386/pc/grub-probefs.c	28 Sep 2006 14:11:06 -0000
> @@ -1,4 +1,4 @@
> -/* grub-probefs.c - probe a filesystem module for a given path */
> +/* grub-probe.c - probe device information for a given path */
>  /*
>   *  GRUB  --  GRand Unified Bootloader
>   *  Copyright (C) 2005,2006 Free Software Foundation, Inc.
> @@ -47,6 +47,12 @@
>  
>  #define DEFAULT_DEVICE_MAP	DEFAULT_DIRECTORY "/device.map"
>  
> +#define PRINT_FS	0
> +#define PRINT_DRIVE	1
> +#define PRINT_DEVICE	2
> +
> +int print = PRINT_FS;
> +
>  void
>  grub_putchar (int c)
>  {
> @@ -74,13 +80,33 @@
>  probe (const char *path)
>  {
>    char *device_name;
> +  char *drive_name;
>    grub_device_t dev;
>    grub_fs_t fs;
>    
>    device_name = grub_guess_root_device (path);
>    if (! device_name)
>      {
> -      fprintf (stderr, "cannot find a GRUB device for %s.\n", path);
> +      fprintf (stderr, "cannot find a device for %s.\n", path);
> +      return;
> +    }
> +
> +  if (print == PRINT_DEVICE)
> +    {
> +      printf ("%s\n", device_name);
> +      return;
> +    }
> +
> +  drive_name = grub_util_biosdisk_get_grub_dev (device_name);
> +  if (! drive_name)
> +    {
> +      fprintf (stderr, "cannot find a GRUB drive for %s.\n", drive_name);
> +      return;
> +    }
> +
> +  if (print == PRINT_DRIVE)
> +    {
> +      printf ("(%s)\n", drive_name);
>        return;
>      }
>  
> @@ -102,6 +128,7 @@
>  static struct option options[] =
>    {
>      {"device-map", required_argument, 0, 'm'},
> +    {"target", required_argument, 0, 't'},
>      {"help", no_argument, 0, 'h'},
>      {"version", no_argument, 0, 'V'},
>      {"verbose", no_argument, 0, 'v'},
> @@ -113,14 +140,15 @@
>  {
>    if (status)
>      fprintf (stderr,
> -	     "Try ``grub-probefs --help'' for more information.\n");
> +	     "Try ``grub-probe --help'' for more information.\n");
>    else
>      printf ("\
> -Usage: grub-probefs [OPTION]... PATH\n\
> +Usage: grub-probe [OPTION]... PATH\n\
>  \n\
> -Probe a filesystem module for a given path.\n\
> +Probe device information for a given path.\n\
>  \n\
>    -m, --device-map=FILE     use FILE as the device map [default=%s]\n\
> +  -t, --target=(fs|drive|device)  print filesystem module, GRUB drive or system device [default=fs]\n\
>    -h, --help                display this message and exit\n\
>    -V, --version             print version information and exit\n\
>    -v, --verbose             print verbose messages\n\
> @@ -138,12 +166,12 @@
>    char *dev_map = 0;
>    char *path;
>    
> -  progname = "grub-probefs";
> +  progname = "grub-probe";
>    
>    /* Check for options.  */
>    while (1)
>      {
> -      int c = getopt_long (argc, argv, "m:hVv", options, 0);
> +      int c = getopt_long (argc, argv, "m:t:hVv", options, 0);
>        
>        if (c == -1)
>  	break;
> @@ -157,6 +185,17 @@
>  	    dev_map = xstrdup (optarg);
>  	    break;
>  
> +	  case 't':
> +	    if (!strcmp (optarg, "fs"))
> +	      print = PRINT_FS;
> +	    else if (!strcmp (optarg, "drive"))
> +	      print = PRINT_DRIVE;
> +	    else if (!strcmp (optarg, "device"))
> +	      print = PRINT_DEVICE;
> +	    else
> +	      usage (1);
> +	    break;
> +
>  	  case 'h':
>  	    usage (0);
>  	    break;
> Index: util/i386/pc/grub-setup.c
> ===================================================================
> RCS file: /sources/grub/grub2/util/i386/pc/grub-setup.c,v
> retrieving revision 1.18
> diff -u -r1.18 grub-setup.c
> --- util/i386/pc/grub-setup.c	4 Jun 2006 15:56:55 -0000	1.18
> +++ util/i386/pc/grub-setup.c	28 Sep 2006 14:11:06 -0000
> @@ -669,7 +669,7 @@
>      }
>    else
>      {
> -      root_dev = grub_guess_root_device (dir ? : DEFAULT_DIRECTORY);
> +      root_dev = grub_util_biosdisk_get_grub_dev (grub_guess_root_device (dir ? : DEFAULT_DIRECTORY));
>        if (! root_dev)
>  	{
>  	  grub_util_info ("guessing the root device failed, because of `%s'",

> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/grub-devel


-- 
Robert Millan

My spam trap is honeypot@aybabtu.com.  Note: this address is only intended for
spam harvesters.  Writing to it will get you added to my black list.



^ permalink raw reply	[flat|nested] 16+ messages in thread

* ping (Re: [PATCH] grub-probefs --root-device)
  2006-10-01 19:27         ` Robert Millan
@ 2006-10-14 10:06           ` Robert Millan
  2006-10-14 10:10             ` Yoshinori K. Okuji
  0 siblings, 1 reply; 16+ messages in thread
From: Robert Millan @ 2006-10-14 10:06 UTC (permalink / raw)
  To: The development of GRUB 2; +Cc: Yoshinori K. Okuji


Ping :)

On Sun, Oct 01, 2006 at 09:27:59PM +0200, Robert Millan wrote:
> 
> Is it alright for commit now?
> 
> On Thu, Sep 28, 2006 at 04:39:56PM +0200, Robert Millan wrote:
> > On Tue, Sep 26, 2006 at 08:29:33PM +0300, Vesa Jääskeläinen wrote:
> > > Hi,
> > > 
> > > Here are some comments about your patch. As requested :)
> > 
> > Thanks for the corrections.  Some of them make me ashamed, I should have
> > looked better at all those grub-probefs instances... ;)
> > 
> > > Robert Millan wrote:
> > > > 2006-09-23  Robert Millan  <rmh@aybabtu.com>
> > > > 
> > > > 	* util/i386/pc/getroot.c (grub_guess_root_device): Stop using
> > > > 	grub_util_biosdisk_get_grub_dev to convert system device to GRUB device.
> > > > 	* util/grub-emu.c: Use grub_util_biosdisk_get_grub_dev with the string
> > > > 	returned by grub_guess_root_device.
> > > 
> > > Method name missing from grub-emu.
> > 
> > Ok (main).
> > 
> > > > 	* util/i386/pc/grub-setup.c: Ditto.
> > > > 	* util/i386/pc/grub-probefs.c: Ditto.
> > > > 
> > > > 	* util/i386/pc/grub-probefs.c: Rename to ...
> > > > 	* util/i386/pc/grub-probe.c: ... this.
> > > > 	* DISTLIST: Update reference to grub-probefs.
> > > > 	* conf/i386-efi.mk: Ditto.
> > > > 	* conf/i386-efi.rmk: Ditto.
> > > > 	* conf/i386-pc.mk: Ditto.
> > > > 	* conf/i386-pc.rmk: Ditto.
> > > > 	* util/i386/pc/grub-install.in: Ditto.
> > > 
> > > Describe what changed in terms of source code not in terms of "english".
> > >  Eg. DISTLIST: Removed grub-probefs.  Added grub-probe.
> > > 
> > > I am not sure is "ditto" a good term.. I have seen "Likewise." in other
> > > entries and used that myself too.
> > > 
> > > And no need to inform about changes to .mk as they are generated files.
> > > Just make sure on commit they are there.
> > 
> > Ok.  I'm also omitting .mk files from my patch.  I'll take care of regenerating
> > later.
> > 
> > > > 	* util/i386/pc/grub-probe.c: Add --target=(fs|device|drive) option to
> > > > 	choose which information we want to print.
> > > 
> > > Method...
> > 
> > This change applies in various places of the file (main, probe, options..)
> > 
> > > Should be grub_probe as name changes... May need changes to other places
> > > too.
> > 
> > Checked them all this time.
> > 
> > > >    --no-floppy             do not probe any floppy drive
> > > >    --recheck               probe a device map even if it already exists
> > > >  
> > > > @@ -92,8 +92,8 @@
> > > >  	grub_mkimage=`echo "$option" | sed 's/--grub-mkimage=//'` ;;
> > > >      --grub-mkdevicemap=*)
> > > >  	grub_mkdevicemap=`echo "$option" | sed 's/--grub-mkdevicemap=//'` ;;
> > > > -    --grub-probefs=*)
> > > > -	grub_probefs=`echo "$option" | sed 's/--grub-probefs=//'` ;;
> > > > +    --grub-probe=*)
> > > > +	grub_probefs=`echo "$option" | sed 's/--grub-probe=//'` ;;
> > > 
> > > Needs change here at least...
> > 
> > Done.  Also added an explicit --target=fs option in grub-install (better be
> > safe).
> > 
> > Please let me know if it's ok now:
> > 
> > 2006-09-28  Robert Millan  <rmh@aybabtu.com>
> > 
> > 	* util/i386/pc/getroot.c (grub_guess_root_device): Stop using
> > 	grub_util_biosdisk_get_grub_dev to convert system device to GRUB device.
> > 	* util/grub-emu.c (main): Use grub_util_biosdisk_get_grub_dev with the
> > 	string returned by grub_guess_root_device.
> > 	* util/i386/pc/grub-setup.c: Likewise.
> > 	* util/i386/pc/grub-probefs.c: Likewise.
> > 
> > 	* util/i386/pc/grub-probefs.c: Rename to ...
> > 	* util/i386/pc/grub-probe.c: ... this.
> > 	* DISTLIST: Remove grub-probefs, add grub-probe.
> > 	* conf/i386-efi.rmk: Likewise.
> > 	* conf/i386-pc.rmk: Likewise.
> > 	* util/i386/pc/grub-install.in: Likewise.
> > 
> > 	* util/i386/pc/grub-probe.c: Add --target=(fs|device|drive) option to
> > 	choose which information we want to print.
> > 
> > -- 
> > Robert Millan
> > 
> > My spam trap is honeypot@aybabtu.com.  Note: this address is only intended for
> > spam harvesters.  Writing to it will get you added to my black list.
> 
> > 
> > 2006-09-28  Robert Millan  <rmh@aybabtu.com>
> > 
> > 	* util/i386/pc/getroot.c (grub_guess_root_device): Stop using
> > 	grub_util_biosdisk_get_grub_dev to convert system device to GRUB device.
> > 	* util/grub-emu.c (main): Use grub_util_biosdisk_get_grub_dev with the
> > 	string returned by grub_guess_root_device.
> > 	* util/i386/pc/grub-setup.c: Likewise.
> > 	* util/i386/pc/grub-probefs.c: Likewise.
> > 
> > 	* util/i386/pc/grub-probefs.c: Rename to ...
> > 	* util/i386/pc/grub-probe.c: ... this.
> > 	* DISTLIST: Remove grub-probefs, add grub-probe.
> > 	* conf/i386-efi.rmk: Likewise.
> > 	* conf/i386-pc.rmk: Likewise.
> > 	* util/i386/pc/grub-install.in: Likewise.
> > 
> > 	* util/i386/pc/grub-probe.c: Add --target=(fs|device|drive) option to
> > 	choose which information we want to print.
> > 
> > Index: DISTLIST
> > ===================================================================
> > RCS file: /sources/grub/grub2/DISTLIST,v
> > retrieving revision 1.36
> > diff -u -r1.36 DISTLIST
> > --- DISTLIST	4 Jun 2006 12:59:19 -0000	1.36
> > +++ DISTLIST	28 Sep 2006 14:11:04 -0000
> > @@ -253,7 +253,7 @@
> >  util/i386/pc/grub-install.in
> >  util/i386/pc/grub-mkdevicemap.c
> >  util/i386/pc/grub-mkimage.c
> > -util/i386/pc/grub-probefs.c
> > +util/i386/pc/grub-probe.c
> >  util/i386/pc/grub-setup.c
> >  util/i386/pc/misc.c
> >  util/powerpc/ieee1275/grub-install.in
> > Index: conf/i386-efi.rmk
> > ===================================================================
> > RCS file: /sources/grub/grub2/conf/i386-efi.rmk,v
> > retrieving revision 1.10
> > diff -u -r1.10 i386-efi.rmk
> > --- conf/i386-efi.rmk	22 Sep 2006 19:36:32 -0000	1.10
> > +++ conf/i386-efi.rmk	28 Sep 2006 14:11:04 -0000
> > @@ -6,7 +6,7 @@
> >  
> >  # Utilities.
> >  bin_UTILITIES = grub-mkimage
> > -#sbin_UTILITIES = grub-setup grub-emu grub-mkdevicemap grub-probefs
> > +#sbin_UTILITIES = grub-setup grub-emu grub-mkdevicemap grub-probe
> >  
> >  # For grub-mkimage.
> >  grub_mkimage_SOURCES = util/i386/efi/grub-mkimage.c util/misc.c \
> > @@ -23,8 +23,8 @@
> >  # For grub-mkdevicemap.
> >  #grub_mkdevicemap_SOURCES = util/i386/pc/grub-mkdevicemap.c util/misc.c
> >  
> > -# For grub-probefs.
> > -#grub_probefs_SOURCES = util/i386/pc/grub-probefs.c	\
> > +# For grub-probe.
> > +#grub_probe_SOURCES = util/i386/pc/grub-probe.c	\
> >  #	util/i386/pc/biosdisk.c	util/misc.c util/i386/pc/getroot.c	\
> >  #	kern/device.c kern/disk.c kern/err.c kern/misc.c fs/fat.c	\
> >  #	fs/ext2.c kern/parser.c kern/partition.c partmap/pc.c fs/ufs.c 	\
> > Index: conf/i386-pc.rmk
> > ===================================================================
> > RCS file: /sources/grub/grub2/conf/i386-pc.rmk,v
> > retrieving revision 1.70
> > diff -u -r1.70 i386-pc.rmk
> > --- conf/i386-pc.rmk	22 Sep 2006 21:09:14 -0000	1.70
> > +++ conf/i386-pc.rmk	28 Sep 2006 14:11:05 -0000
> > @@ -51,7 +51,7 @@
> >  
> >  # Utilities.
> >  bin_UTILITIES = grub-mkimage
> > -sbin_UTILITIES = grub-setup grub-emu grub-mkdevicemap grub-probefs
> > +sbin_UTILITIES = grub-setup grub-emu grub-mkdevicemap grub-probe
> >  
> >  # For grub-mkimage.
> >  grub_mkimage_SOURCES = util/i386/pc/grub-mkimage.c util/misc.c \
> > @@ -69,8 +69,8 @@
> >  # For grub-mkdevicemap.
> >  grub_mkdevicemap_SOURCES = util/i386/pc/grub-mkdevicemap.c util/misc.c
> >  
> > -# For grub-probefs.
> > -grub_probefs_SOURCES = util/i386/pc/grub-probefs.c	\
> > +# For grub-probe.
> > +grub_probe_SOURCES = util/i386/pc/grub-probe.c	\
> >  	util/i386/pc/biosdisk.c	util/misc.c util/i386/pc/getroot.c	\
> >  	kern/device.c kern/disk.c kern/err.c kern/misc.c fs/fat.c	\
> >  	fs/ext2.c kern/parser.c kern/partition.c partmap/pc.c fs/ufs.c 	\
> > Index: util/grub-emu.c
> > ===================================================================
> > RCS file: /sources/grub/grub2/util/grub-emu.c,v
> > retrieving revision 1.30
> > diff -u -r1.30 grub-emu.c
> > --- util/grub-emu.c	13 Jun 2006 22:50:01 -0000	1.30
> > +++ util/grub-emu.c	28 Sep 2006 14:11:06 -0000
> > @@ -185,7 +185,7 @@
> >    /* Make sure that there is a root device.  */
> >    if (! args.root_dev)
> >      {
> > -      args.root_dev = grub_guess_root_device (args.dir ? : DEFAULT_DIRECTORY);
> > +      args.root_dev = grub_util_biosdisk_get_grub_dev (grub_guess_root_device (args.dir ? : DEFAULT_DIRECTORY));
> >        if (! args.root_dev)
> >  	{
> >  	  grub_util_info ("guessing the root device failed, because of `%s'",
> > Index: util/i386/pc/getroot.c
> > ===================================================================
> > RCS file: /sources/grub/grub2/util/i386/pc/getroot.c,v
> > retrieving revision 1.5
> > diff -u -r1.5 getroot.c
> > --- util/i386/pc/getroot.c	14 Sep 2006 18:52:50 -0000	1.5
> > +++ util/i386/pc/getroot.c	28 Sep 2006 14:11:06 -0000
> > @@ -223,5 +223,5 @@
> >    if (! os_dev)
> >      return 0;
> >  
> > -  return grub_util_biosdisk_get_grub_dev (os_dev);
> > +  return os_dev;
> >  }
> > Index: util/i386/pc/grub-install.in
> > ===================================================================
> > RCS file: /sources/grub/grub2/util/i386/pc/grub-install.in,v
> > retrieving revision 1.9
> > diff -u -r1.9 grub-install.in
> > --- util/i386/pc/grub-install.in	14 Sep 2006 18:52:50 -0000	1.9
> > +++ util/i386/pc/grub-install.in	28 Sep 2006 14:11:06 -0000
> > @@ -33,7 +33,7 @@
> >  grub_setup=${sbindir}/grub-setup
> >  grub_mkimage=${bindir}/grub-mkimage
> >  grub_mkdevicemap=${sbindir}/grub-mkdevicemap
> > -grub_probefs=${sbindir}/grub-probefs
> > +grub_probe=${sbindir}/grub-probe
> >  rootdir=
> >  grub_prefix=/boot/grub
> >  modules=
> > @@ -59,7 +59,7 @@
> >    --grub-setup=FILE       use FILE as grub-setup
> >    --grub-mkimage=FILE     use FILE as grub-mkimage
> >    --grub-mkdevicemap=FILE use FILE as grub-mkdevicemap
> > -  --grub-probefs=FILE     use FILE as grub-probefs
> > +  --grub-probe=FILE       use FILE as grub-probe
> >    --no-floppy             do not probe any floppy drive
> >    --recheck               probe a device map even if it already exists
> >  
> > @@ -92,8 +92,8 @@
> >  	grub_mkimage=`echo "$option" | sed 's/--grub-mkimage=//'` ;;
> >      --grub-mkdevicemap=*)
> >  	grub_mkdevicemap=`echo "$option" | sed 's/--grub-mkdevicemap=//'` ;;
> > -    --grub-probefs=*)
> > -	grub_probefs=`echo "$option" | sed 's/--grub-probefs=//'` ;;
> > +    --grub-probe=*)
> > +	grub_probe=`echo "$option" | sed 's/--grub-probe=//'` ;;
> >      --no-floppy)
> >  	no_floppy="--no-floppy" ;;
> >      --recheck)
> > @@ -207,7 +207,7 @@
> >  done
> >  
> >  # Create the core image. First, auto-detect the filesystem module.
> > -fs_module=`$grub_probefs --device-map=${device_map} ${grubdir}`
> > +fs_module=`$grub_probe --target=fs --device-map=${device_map} ${grubdir}`
> >  if test "x$fs_module" = x -a "x$modules" = x; then
> >      echo "Auto-detection of a filesystem module failed." 1>&2
> >      echo "Please specify the module with the option \`--modules' explicitly." 1>&2
> > Index: util/i386/pc/grub-probefs.c
> > ===================================================================
> > RCS file: /sources/grub/grub2/util/i386/pc/grub-probefs.c,v
> > retrieving revision 1.3
> > diff -u -r1.3 grub-probefs.c
> > --- util/i386/pc/grub-probefs.c	23 Apr 2006 13:37:36 -0000	1.3
> > +++ util/i386/pc/grub-probefs.c	28 Sep 2006 14:11:06 -0000
> > @@ -1,4 +1,4 @@
> > -/* grub-probefs.c - probe a filesystem module for a given path */
> > +/* grub-probe.c - probe device information for a given path */
> >  /*
> >   *  GRUB  --  GRand Unified Bootloader
> >   *  Copyright (C) 2005,2006 Free Software Foundation, Inc.
> > @@ -47,6 +47,12 @@
> >  
> >  #define DEFAULT_DEVICE_MAP	DEFAULT_DIRECTORY "/device.map"
> >  
> > +#define PRINT_FS	0
> > +#define PRINT_DRIVE	1
> > +#define PRINT_DEVICE	2
> > +
> > +int print = PRINT_FS;
> > +
> >  void
> >  grub_putchar (int c)
> >  {
> > @@ -74,13 +80,33 @@
> >  probe (const char *path)
> >  {
> >    char *device_name;
> > +  char *drive_name;
> >    grub_device_t dev;
> >    grub_fs_t fs;
> >    
> >    device_name = grub_guess_root_device (path);
> >    if (! device_name)
> >      {
> > -      fprintf (stderr, "cannot find a GRUB device for %s.\n", path);
> > +      fprintf (stderr, "cannot find a device for %s.\n", path);
> > +      return;
> > +    }
> > +
> > +  if (print == PRINT_DEVICE)
> > +    {
> > +      printf ("%s\n", device_name);
> > +      return;
> > +    }
> > +
> > +  drive_name = grub_util_biosdisk_get_grub_dev (device_name);
> > +  if (! drive_name)
> > +    {
> > +      fprintf (stderr, "cannot find a GRUB drive for %s.\n", drive_name);
> > +      return;
> > +    }
> > +
> > +  if (print == PRINT_DRIVE)
> > +    {
> > +      printf ("(%s)\n", drive_name);
> >        return;
> >      }
> >  
> > @@ -102,6 +128,7 @@
> >  static struct option options[] =
> >    {
> >      {"device-map", required_argument, 0, 'm'},
> > +    {"target", required_argument, 0, 't'},
> >      {"help", no_argument, 0, 'h'},
> >      {"version", no_argument, 0, 'V'},
> >      {"verbose", no_argument, 0, 'v'},
> > @@ -113,14 +140,15 @@
> >  {
> >    if (status)
> >      fprintf (stderr,
> > -	     "Try ``grub-probefs --help'' for more information.\n");
> > +	     "Try ``grub-probe --help'' for more information.\n");
> >    else
> >      printf ("\
> > -Usage: grub-probefs [OPTION]... PATH\n\
> > +Usage: grub-probe [OPTION]... PATH\n\
> >  \n\
> > -Probe a filesystem module for a given path.\n\
> > +Probe device information for a given path.\n\
> >  \n\
> >    -m, --device-map=FILE     use FILE as the device map [default=%s]\n\
> > +  -t, --target=(fs|drive|device)  print filesystem module, GRUB drive or system device [default=fs]\n\
> >    -h, --help                display this message and exit\n\
> >    -V, --version             print version information and exit\n\
> >    -v, --verbose             print verbose messages\n\
> > @@ -138,12 +166,12 @@
> >    char *dev_map = 0;
> >    char *path;
> >    
> > -  progname = "grub-probefs";
> > +  progname = "grub-probe";
> >    
> >    /* Check for options.  */
> >    while (1)
> >      {
> > -      int c = getopt_long (argc, argv, "m:hVv", options, 0);
> > +      int c = getopt_long (argc, argv, "m:t:hVv", options, 0);
> >        
> >        if (c == -1)
> >  	break;
> > @@ -157,6 +185,17 @@
> >  	    dev_map = xstrdup (optarg);
> >  	    break;
> >  
> > +	  case 't':
> > +	    if (!strcmp (optarg, "fs"))
> > +	      print = PRINT_FS;
> > +	    else if (!strcmp (optarg, "drive"))
> > +	      print = PRINT_DRIVE;
> > +	    else if (!strcmp (optarg, "device"))
> > +	      print = PRINT_DEVICE;
> > +	    else
> > +	      usage (1);
> > +	    break;
> > +
> >  	  case 'h':
> >  	    usage (0);
> >  	    break;
> > Index: util/i386/pc/grub-setup.c
> > ===================================================================
> > RCS file: /sources/grub/grub2/util/i386/pc/grub-setup.c,v
> > retrieving revision 1.18
> > diff -u -r1.18 grub-setup.c
> > --- util/i386/pc/grub-setup.c	4 Jun 2006 15:56:55 -0000	1.18
> > +++ util/i386/pc/grub-setup.c	28 Sep 2006 14:11:06 -0000
> > @@ -669,7 +669,7 @@
> >      }
> >    else
> >      {
> > -      root_dev = grub_guess_root_device (dir ? : DEFAULT_DIRECTORY);
> > +      root_dev = grub_util_biosdisk_get_grub_dev (grub_guess_root_device (dir ? : DEFAULT_DIRECTORY));
> >        if (! root_dev)
> >  	{
> >  	  grub_util_info ("guessing the root device failed, because of `%s'",
> 
> > _______________________________________________
> > Grub-devel mailing list
> > Grub-devel@gnu.org
> > http://lists.gnu.org/mailman/listinfo/grub-devel
> 
> 
> -- 
> Robert Millan
> 
> My spam trap is honeypot@aybabtu.com.  Note: this address is only intended for
> spam harvesters.  Writing to it will get you added to my black list.
> 
> 
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/grub-devel
> 

-- 
Robert Millan

My spam trap is honeypot@aybabtu.com.  Note: this address is only intended for
spam harvesters.  Writing to it will get you added to my black list.



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: ping (Re: [PATCH] grub-probefs --root-device)
  2006-10-14 10:06           ` ping (Re: [PATCH] grub-probefs --root-device) Robert Millan
@ 2006-10-14 10:10             ` Yoshinori K. Okuji
  2006-10-14 19:04               ` Robert Millan
  0 siblings, 1 reply; 16+ messages in thread
From: Yoshinori K. Okuji @ 2006-10-14 10:10 UTC (permalink / raw)
  To: The development of GRUB 2

On Saturday 14 October 2006 12:06, Robert Millan wrote:
> Ping :)

Thank you for prompting me. ;)

Please check it in. I have no objection.

Okuji



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: ping (Re: [PATCH] grub-probefs --root-device)
  2006-10-14 10:10             ` Yoshinori K. Okuji
@ 2006-10-14 19:04               ` Robert Millan
  2006-10-14 19:11                 ` Robert Millan
  0 siblings, 1 reply; 16+ messages in thread
From: Robert Millan @ 2006-10-14 19:04 UTC (permalink / raw)
  To: The development of GRUB 2

On Sat, Oct 14, 2006 at 12:10:49PM +0200, Yoshinori K. Okuji wrote:
> On Saturday 14 October 2006 12:06, Robert Millan wrote:
> > Ping :)
> 
> Thank you for prompting me. ;)
> 
> Please check it in. I have no objection.

Committed, thanks!

-- 
Robert Millan

My spam trap is honeypot@aybabtu.com.  Note: this address is only intended for
spam harvesters.  Writing to it will get you added to my black list.



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: ping (Re: [PATCH] grub-probefs --root-device)
  2006-10-14 19:04               ` Robert Millan
@ 2006-10-14 19:11                 ` Robert Millan
  0 siblings, 0 replies; 16+ messages in thread
From: Robert Millan @ 2006-10-14 19:11 UTC (permalink / raw)
  To: The development of GRUB 2

On Sat, Oct 14, 2006 at 09:04:32PM +0200, Robert Millan wrote:
> 
> Committed, thanks!

Btw, for --target=device and --target=drive, the new grub-probe command should
also be usable on non-i386.  I think we just need to disable some code.  Any
powerpc user wants to give that a try?

-- 
Robert Millan

My spam trap is honeypot@aybabtu.com.  Note: this address is only intended for
spam harvesters.  Writing to it will get you added to my black list.



^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2006-10-14 19:11 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-22 16:33 [PATCH] grub-probefs --root-device Robert Millan
2006-09-22 21:12 ` Robert Millan
2006-09-23  3:20 ` Yoshinori K. Okuji
2006-09-23  7:26   ` Robert Millan
2006-09-23  8:37     ` Robert Millan
2006-09-25 10:09       ` Robert Millan
2006-09-26  2:42         ` grub 2 on debian amd64 Colin Lamarre
2006-09-26  2:53           ` Hollis Blanchard
2006-09-26 16:32           ` Robert Millan
2006-09-26 17:29     ` [PATCH] grub-probefs --root-device Vesa Jääskeläinen
2006-09-28 14:39       ` Robert Millan
2006-10-01 19:27         ` Robert Millan
2006-10-14 10:06           ` ping (Re: [PATCH] grub-probefs --root-device) Robert Millan
2006-10-14 10:10             ` Yoshinori K. Okuji
2006-10-14 19:04               ` Robert Millan
2006-10-14 19:11                 ` Robert Millan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.