From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1OeOFo-0005Kj-4N for mharc-grub-devel@gnu.org; Thu, 29 Jul 2010 04:14:12 -0400 Received: from [140.186.70.92] (port=47718 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OeOFg-0005Kc-UH for grub-devel@gnu.org; Thu, 29 Jul 2010 04:14:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OeOFf-000887-Qd for grub-devel@gnu.org; Thu, 29 Jul 2010 04:14:04 -0400 Received: from mail-iw0-f169.google.com ([209.85.214.169]:54189) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OeOFf-00087w-LR for grub-devel@gnu.org; Thu, 29 Jul 2010 04:14:03 -0400 Received: by iwn2 with SMTP id 2so110075iwn.0 for ; Thu, 29 Jul 2010 01:14:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:references:in-reply-to :content-type; bh=zgdEyg30B7WEVMK8uxeJtz9xpxBqzkhA3VIB5ekvLvg=; b=RcF+jbQgeI8VCyPEjxl1AR6K3jsRj1+0RfSDhWkGEYzEV0F2F8pLq1LGHGQdam9sdY qp+T+0jeje/M7XJ2Wj1Ju9vEPzp1O9Ld5I2pi9lx3Wu5fZjmh8FaEYmvb9PY6F7WTCMj gdlrNtxi34rTZwMyyq15bgiPq+PPTVQCw3A74= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type; b=Nfr0lVU0TBqfg37N/Ymw7g4R66H0KUMRV+3zB77Tg3ARn+OJWQJQL+a2aAZPp/byoJ DIgqNiDARg7EQOkIImh6CNsE47M0WQbh6SEJLX0rOZJO5ZH+uKuMTjy/VieQEEj2OeEr jYMOtTHPhne9jCQDo7ySyYLwKyQQxdA+8c7/0= Received: by 10.231.35.10 with SMTP id n10mr13165552ibd.161.1280391242799; Thu, 29 Jul 2010 01:14:02 -0700 (PDT) Received: from [192.168.21.179] (bas1-toronto05-1177663517.dsl.bell.ca [70.49.184.29]) by mx.google.com with ESMTPS id 34sm594429ibi.0.2010.07.29.01.14.01 (version=SSLv3 cipher=RC4-MD5); Thu, 29 Jul 2010 01:14:02 -0700 (PDT) Message-ID: <4C513848.9070208@gmail.com> Date: Thu, 29 Jul 2010 04:14:00 -0400 From: Doug Nazar User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.7) Gecko/20100713 Thunderbird/3.1.1 MIME-Version: 1.0 To: grub-devel@gnu.org References: <4C50FE43.6020201@gmail.com> In-Reply-To: <4C50FE43.6020201@gmail.com> Content-Type: multipart/mixed; boundary="------------020106050508060304000301" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) Subject: Re: Detect if we actually have partitions and print raid info in "ls -l" X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Jul 2010 08:14:11 -0000 This is a multi-part message in MIME format. --------------020106050508060304000301 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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 --------------020106050508060304000301 Content-Type: text/plain; name="grub-print-raid-info-remove-dependency.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="grub-print-raid-info-remove-dependency.diff" === 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 #include #include +#include + +/* 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); --------------020106050508060304000301--