grub-devel
[Top][All Lists]
Advanced

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

Re: Detect if we actually have partitions and print raid info in "ls -l"


From: Lennart Sorensen
Subject: Re: Detect if we actually have partitions and print raid info in "ls -l"
Date: Thu, 29 Jul 2010 11:37:49 -0400
User-agent: Mutt/1.5.18 (2008-05-17)

On Thu, Jul 29, 2010 at 04:14:00AM -0400, Doug Nazar wrote:
>  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
>

> === 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 @@
>  
>  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);
> 

OK, I added your last 5 or so patches, and yes the tab completion works
great now on the md raid devices without partitions.

Booting without devaliases on the other hand not so much.  See comment
on the patch in that thread.

-- 
Len Sorensen



reply via email to

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