All of lore.kernel.org
 help / color / mirror / Atom feed
From: Doug Nazar <nazard.michi@gmail.com>
To: grub-devel@gnu.org
Subject: Re: Detect if we actually have partitions and print raid info in "ls -l"
Date: Thu, 29 Jul 2010 04:14:00 -0400	[thread overview]
Message-ID: <4C513848.9070208@gmail.com> (raw)
In-Reply-To: <4C50FE43.6020201@gmail.com>

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

  On 2010-07-29 12:06 AM, Doug Nazar wrote:
>
> The second expands the 'ls -l' output to include raid information. 
> Previously depending on the raid metadata layout, it was possible to 
> detect the filesystem on the underlying raid partition. So now it 
> checks for raid devices first and if detected prints out the raid 
> info. This probably requires the previous patches for raid that have 
> been posted in the last few days. Holler if you want a roll-up patch.
>
>     Partition ide1,apple9: RAID6, md/1 - Disk 2/4, UUID 
> 5c991134-a98c-2396-7204-9d6b077d2840
>

Realized I'd added a dependency on the raid module. This patch cleans 
that up.

Doug


[-- Attachment #2: grub-print-raid-info-remove-dependency.diff --]
[-- Type: text/plain, Size: 2983 bytes --]

=== modified file 'conf/common.rmk'
--- conf/common.rmk	2010-07-06 18:27:55 +0000
+++ conf/common.rmk	2010-07-29 08:01:45 +0000
@@ -104,7 +104,7 @@
 kernel_img_HEADERS += boot.h cache.h device.h disk.h dl.h elf.h elfload.h \
 	env.h err.h file.h fs.h kernel.h loader.h misc.h mm.h net.h parser.h \
 	partition.h msdos_partition.h reader.h symbol.h term.h time.h types.h \
-	list.h command.h i18n.h env_private.h libgcc.h
+	list.h command.h i18n.h env_private.h libgcc.h raid.h
 
 ifneq ($(platform), emu)
 kernel_img_HEADERS += machine/memory.h machine/loader.h

=== modified file 'disk/raid.c'
--- disk/raid.c	2010-07-29 04:26:32 +0000
+++ disk/raid.c	2010-07-29 07:42:28 +0000
@@ -724,7 +724,7 @@
       }
 }
 
-struct grub_raid_array *
+static struct grub_raid_array *
 grub_raid_probe(grub_device_t dev, int *index, char **uuid)
 {
   struct grub_raid *p;
@@ -776,11 +776,13 @@
 \f
 GRUB_MOD_INIT(raid)
 {
+  grub_raid_probe_func = grub_raid_probe;
   grub_disk_dev_register (&grub_raid_dev);
 }
 
 GRUB_MOD_FINI(raid)
 {
   grub_disk_dev_unregister (&grub_raid_dev);
+  grub_raid_probe_func = 0;
   free_array ();
 }

=== modified file 'include/grub/raid.h'
--- include/grub/raid.h	2010-07-29 02:47:49 +0000
+++ include/grub/raid.h	2010-07-29 08:08:27 +0000
@@ -75,7 +75,9 @@
 
 void grub_raid_block_xor (char *buf1, const char *buf2, int size);
 
-struct grub_raid_array * grub_raid_probe(grub_device_t dev, int *index, char **uuid);
+typedef struct grub_raid_array * (*grub_raid_probe_func_t) (grub_device_t dev,
+							    int *index, 
+							    char **uuid);
 
 typedef grub_err_t (*grub_raid5_recover_func_t) (struct grub_raid_array *array,
                                                  int disknr, char *buf,
@@ -89,5 +91,6 @@
 
 extern grub_raid5_recover_func_t grub_raid5_recover_func;
 extern grub_raid6_recover_func_t grub_raid6_recover_func;
+extern grub_raid_probe_func_t EXPORT_VAR(grub_raid_probe_func);
 
 #endif /* ! GRUB_RAID_H */

=== modified file 'kern/device.c'
--- kern/device.c	2010-03-31 20:03:48 +0000
+++ kern/device.c	2010-07-29 07:47:45 +0000
@@ -25,6 +25,11 @@
 #include <grub/misc.h>
 #include <grub/env.h>
 #include <grub/partition.h>
+#include <grub/raid.h>
+
+/* Toss it here for now. Perhaps in the future expand it to a
+   generic helper function that checks raid, lvm, etc. */
+grub_raid_probe_func_t grub_raid_probe_func;
 
 grub_device_t
 grub_device_open (const char *name)

=== modified file 'normal/misc.c'
--- normal/misc.c	2010-07-29 02:47:49 +0000
+++ normal/misc.c	2010-07-29 07:44:38 +0000
@@ -54,11 +54,13 @@
   else if (dev->disk)
     {
       grub_fs_t fs;
-      struct grub_raid_array *array;
+      struct grub_raid_array *array = 0;
       int disk_index;
       char *array_uuid = 0;
-      
-      array = grub_raid_probe(dev, &disk_index, &array_uuid);
+
+      if (grub_raid_probe_func)
+	array = (*grub_raid_probe_func)(dev, &disk_index, &array_uuid);
+	
       if (!array)
       {
 	fs = grub_fs_probe (dev);


  reply	other threads:[~2010-07-29  8:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-29  4:06 Detect if we actually have partitions and print raid info in "ls -l" Doug Nazar
2010-07-29  8:14 ` Doug Nazar [this message]
2010-07-29 15:37   ` Lennart Sorensen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4C513848.9070208@gmail.com \
    --to=nazard.michi@gmail.com \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.