]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
2009-12-16 Vladimir Serbinenko <phcoder@gmail.com>
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Wed, 16 Dec 2009 14:40:31 +0000 (15:40 +0100)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Wed, 16 Dec 2009 14:40:31 +0000 (15:40 +0100)
UUID support for HFS.

* fs/hfs.c (grub_hfs_uuid): New function.
(grub_hfs_fs): New value .uuid.
* include/grub/hfs.h (grub_hfs_sblock): New field 'num_serial'.

ChangeLog
fs/hfs.c
include/grub/hfs.h

index 5dbedeff4553d48f36a496bbdfb888bde3ef97fd..9506d26ca7d446118c526276b385d33fef672856 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2009-12-16  Vladimir Serbinenko  <phcoder@gmail.com>
+
+       UUID support for HFS.
+
+       * fs/hfs.c (grub_hfs_uuid): New function.
+       (grub_hfs_fs): New value .uuid.
+       * include/grub/hfs.h (grub_hfs_sblock): New field 'num_serial'.
+
 2009-12-14 Felix Zielcke <fzielcke@z-51.de>
 
        Fix a segfault with parsing unknown long options.
index 5062b5f71e5b4557530386ceee18bc37680f676f..4934550542f5d37e21246011abc0c69c7f476227 100644 (file)
--- a/fs/hfs.c
+++ b/fs/hfs.c
@@ -1072,6 +1072,31 @@ grub_hfs_label (grub_device_t device, char **label)
   return grub_errno;
 }
 
+static grub_err_t
+grub_hfs_uuid (grub_device_t device, char **uuid)
+{
+  struct grub_hfs_data *data;
+
+  grub_dl_ref (my_mod);
+
+  data = grub_hfs_mount (device->disk);
+  if (data && data->sblock.num_serial != 0)
+    {
+      *uuid = grub_malloc (16 + sizeof ('\0'));
+      grub_sprintf (*uuid, "%016llx",
+                   (unsigned long long)
+                   grub_be_to_cpu64 (data->sblock.num_serial));
+    }
+  else
+    *uuid = NULL;
+
+  grub_dl_unref (my_mod);
+
+  grub_free (data);
+
+  return grub_errno;
+}
+
 
 \f
 static struct grub_fs grub_hfs_fs =
@@ -1082,6 +1107,7 @@ static struct grub_fs grub_hfs_fs =
     .read = grub_hfs_read,
     .close = grub_hfs_close,
     .label = grub_hfs_label,
+    .uuid = grub_hfs_uuid,
     .next = 0
   };
 
index 08b947ccb28c6f85563514aaa0192962e8e1553e..d93b9a2c9d80abb4bfc7517e5adc7542a780d28a 100644 (file)
@@ -48,7 +48,8 @@ struct grub_hfs_sblock
   /* A pascal style string that holds the volumename.  */
   grub_uint8_t volname[28];
 
-  grub_uint8_t unused5[60];
+  grub_uint8_t unused5[52];
+  grub_uint64_t num_serial;
   grub_uint16_t embed_sig;
   struct grub_hfs_extent embed_extent;
   grub_uint8_t unused6[4];