grub-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] reiserfs & xfs UUIDs


From: Robert Millan
Subject: Re: [PATCH] reiserfs & xfs UUIDs
Date: Sun, 1 Jun 2008 16:53:58 +0200
User-agent: Mutt/1.5.13 (2006-08-11)

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
> 
> <GPLv2> I know my rights; I want my phone call!
> <DRM> What good is a phone call… if you are unable to speak?
> (as seen on /.)

> 2008-05-31  Robert Millan  <address@hidden>
> 
>       * 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
> address@hidden
> http://lists.gnu.org/mailman/listinfo/grub-devel


-- 
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What good is a phone call… if you are unable to speak?
(as seen on /.)




reply via email to

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