Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1K2owo-0008G7-Fy for mharc-grub-devel@gnu.org; Sun, 01 Jun 2008 10:54:14 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1K2owm-0008FO-Jf for grub-devel@gnu.org; Sun, 01 Jun 2008 10:54:12 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1K2owl-0008Eo-VX for grub-devel@gnu.org; Sun, 01 Jun 2008 10:54:12 -0400 Received: from [199.232.76.173] (port=48727 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K2owl-0008Ed-Qw for grub-devel@gnu.org; Sun, 01 Jun 2008 10:54:11 -0400 Received: from aybabtu.com ([69.60.117.155]:54738) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1K2owl-0005nl-Ak for grub-devel@gnu.org; Sun, 01 Jun 2008 10:54:11 -0400 Received: from [192.168.10.10] (helo=thorin) by aybabtu.com with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.63) (envelope-from ) id 1K2ow6-0002wG-Oh for grub-devel@gnu.org; Sun, 01 Jun 2008 16:53:31 +0200 Received: from rmh by thorin with local (Exim 4.63) (envelope-from ) id 1K2owY-0000BL-S3 for grub-devel@gnu.org; Sun, 01 Jun 2008 16:53:58 +0200 Date: Sun, 1 Jun 2008 16:53:58 +0200 From: Robert Millan To: grub-devel@gnu.org Message-ID: <20080601145358.GB676@thorin> References: <20080531215230.GA19893@thorin> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20080531215230.GA19893@thorin> Organization: free as in freedom X-Message-Flag: Worried about Outlook viruses? Switch to Thunderbird! www.mozilla.com/thunderbird X-Debbugs-No-Ack: true User-Agent: Mutt/1.5.13 (2006-08-11) X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. Subject: Re: [PATCH] reiserfs & xfs UUIDs X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Jun 2008 14:54:12 -0000 Committed. On Sat, May 31, 2008 at 11:52:30PM +0200, Robert Millan wrote: > > This patch adds support for UUIDs on reiserfs and xfs. > > -- > Robert Millan > > I know my rights; I want my phone call! > What good is a phone call… if you are unable to speak? > (as seen on /.) > 2008-05-31 Robert Millan > > * fs/reiserfs.c (grub_reiserfs_superblock): Add `uuid' field. > (grub_reiserfs_uuid): New function. > (grub_reiserfs_fs): Reference grub_reiserfs_uuid() in `uuid' struct > member. > * fs/xfs.c (grub_xfs_sblock): Add `uuid' field. > (grub_xfs_uuid): New function. > (grub_xfs_fs): Reference grub_reiserfs_uuid() in `uuid' struct member. > > diff -x configure -x config.h.in -x CVS -x '*~' -x '*.mk' -urp ../grub2/fs/reiserfs.c ./fs/reiserfs.c > --- ../grub2/fs/reiserfs.c 2008-05-28 15:41:57.000000000 +0200 > +++ ./fs/reiserfs.c 2008-05-31 23:47:45.000000000 +0200 > @@ -108,6 +108,8 @@ struct grub_reiserfs_superblock > grub_uint16_t version; > grub_uint16_t reserved; > grub_uint32_t inode_generation; > + grub_uint8_t unused[4]; > + grub_uint16_t uuid[8]; > } __attribute__ ((packed)); > > struct grub_reiserfs_journal_header > @@ -1468,6 +1470,38 @@ grub_reiserfs_label (grub_device_t devic > return grub_errno; > } > > +static grub_err_t > +grub_reiserfs_uuid (grub_device_t device, char **uuid) > +{ > + struct grub_reiserfs_data *data; > + grub_disk_t disk = device->disk; > + > +#ifndef GRUB_UTIL > + grub_dl_ref (my_mod); > +#endif > + > + data = grub_reiserfs_mount (disk); > + if (data) > + { > + *uuid = grub_malloc (40 + sizeof ('\0')); > + grub_sprintf (*uuid, "%04x%04x-%04x-%04x-%04x-%04x%04x%04x", > + grub_be_to_cpu16 (data->superblock.uuid[0]), grub_be_to_cpu16 (data->superblock.uuid[1]), > + grub_be_to_cpu16 (data->superblock.uuid[2]), grub_be_to_cpu16 (data->superblock.uuid[3]), > + grub_be_to_cpu16 (data->superblock.uuid[4]), grub_be_to_cpu16 (data->superblock.uuid[5]), > + grub_be_to_cpu16 (data->superblock.uuid[6]), grub_be_to_cpu16 (data->superblock.uuid[7])); > + } > + else > + *uuid = NULL; > + > +#ifndef GRUB_UTIL > + grub_dl_unref (my_mod); > +#endif > + > + grub_free (data); > + > + return grub_errno; > +} > + > static struct grub_fs grub_reiserfs_fs = > { > .name = "reiserfs", > @@ -1476,6 +1510,7 @@ static struct grub_fs grub_reiserfs_fs = > .read = grub_reiserfs_read, > .close = grub_reiserfs_close, > .label = grub_reiserfs_label, > + .uuid = grub_reiserfs_uuid, > .next = 0 > }; > > diff -x configure -x config.h.in -x CVS -x '*~' -x '*.mk' -urp ../grub2/fs/xfs.c ./fs/xfs.c > --- ../grub2/fs/xfs.c 2008-05-29 15:02:13.000000000 +0200 > +++ ./fs/xfs.c 2008-05-31 23:49:10.000000000 +0200 > @@ -37,17 +37,19 @@ struct grub_xfs_sblock > { > grub_uint8_t magic[4]; > grub_uint32_t bsize; > - grub_uint8_t unused1[48]; > + grub_uint8_t unused1[24]; > + grub_uint16_t uuid[8]; > + grub_uint8_t unused2[8]; > grub_uint64_t rootino; > - grub_uint8_t unused2[20]; > - grub_uint32_t agsize; > grub_uint8_t unused3[20]; > + grub_uint32_t agsize; > + grub_uint8_t unused4[20]; > grub_uint8_t label[12]; > grub_uint8_t log2_bsize; > - grub_uint8_t unused4[2]; > + grub_uint8_t unused5[2]; > grub_uint8_t log2_inop; > grub_uint8_t log2_agblk; > - grub_uint8_t unused5[67]; > + grub_uint8_t unused6[67]; > grub_uint8_t log2_dirblk; > } __attribute__ ((packed)); > > @@ -763,6 +765,38 @@ grub_xfs_label (grub_device_t device, ch > return grub_errno; > } > > +static grub_err_t > +grub_xfs_uuid (grub_device_t device, char **uuid) > +{ > + struct grub_xfs_data *data; > + grub_disk_t disk = device->disk; > + > +#ifndef GRUB_UTIL > + grub_dl_ref (my_mod); > +#endif > + > + data = grub_xfs_mount (disk); > + if (data) > + { > + *uuid = grub_malloc (40 + sizeof ('\0')); > + grub_sprintf (*uuid, "%04x%04x-%04x-%04x-%04x-%04x%04x%04x", > + grub_be_to_cpu16 (data->sblock.uuid[0]), grub_be_to_cpu16 (data->sblock.uuid[1]), > + grub_be_to_cpu16 (data->sblock.uuid[2]), grub_be_to_cpu16 (data->sblock.uuid[3]), > + grub_be_to_cpu16 (data->sblock.uuid[4]), grub_be_to_cpu16 (data->sblock.uuid[5]), > + grub_be_to_cpu16 (data->sblock.uuid[6]), grub_be_to_cpu16 (data->sblock.uuid[7])); > + } > + else > + *uuid = NULL; > + > +#ifndef GRUB_UTIL > + grub_dl_unref (my_mod); > +#endif > + > + grub_free (data); > + > + return grub_errno; > +} > + > > > static struct grub_fs grub_xfs_fs = > @@ -773,6 +807,7 @@ static struct grub_fs grub_xfs_fs = > .read = grub_xfs_read, > .close = grub_xfs_close, > .label = grub_xfs_label, > + .uuid = grub_xfs_uuid, > .next = 0 > }; > > _______________________________________________ > Grub-devel mailing list > Grub-devel@gnu.org > http://lists.gnu.org/mailman/listinfo/grub-devel -- Robert Millan I know my rights; I want my phone call! What good is a phone call… if you are unable to speak? (as seen on /.)