[2173] 2009-05-04 Vladimir Serbinenko <[email protected]>

Vladimir Serbinenko <[email protected]>
Newsgroups gmane.comp.boot-loaders.grub.cvs
Message-ID <[email protected]>
Revision: 2173
          http://svn.sv.gnu.org/viewvc/?view=rev&root=grub&revision=2173
Author:   phcoder
Date:     2009-05-04 15:50:44 +0000 (Mon, 04 May 2009)
Log Message:
-----------
2009-05-04  Vladimir Serbinenko  <[email protected]>

	HFS+ UUID

	* fs/hfsplus.c (grub_hfsplus_volheader): added num_serial field 
	in the space previously used by unused3
	(grub_hfsplus_uuid): new function
	(grub_hfsplus_fs): added uuid field

Modified Paths:
--------------
    trunk/grub2/ChangeLog
    trunk/grub2/fs/hfsplus.c

Modified: trunk/grub2/ChangeLog
===================================================================
--- trunk/grub2/ChangeLog	2009-05-04 03:49:08 UTC (rev 2172)
+++ trunk/grub2/ChangeLog	2009-05-04 15:50:44 UTC (rev 2173)
@@ -1,3 +1,12 @@
+2009-05-04  Vladimir Serbinenko  <[email protected]>
+
+	HFS+ UUID
+
+	* fs/hfsplus.c (grub_hfsplus_volheader): added num_serial field 
+	in the space previously used by unused3
+	(grub_hfsplus_uuid): new function
+	(grub_hfsplus_fs): added uuid field
+
 2009-05-03  Pavel Roskin  <[email protected]>
 
 	* disk/ata.c: Don't cast mod to void in GRUB_MOD_INIT to

Modified: trunk/grub2/fs/hfsplus.c
===================================================================
--- trunk/grub2/fs/hfsplus.c	2009-05-04 03:49:08 UTC (rev 2172)
+++ trunk/grub2/fs/hfsplus.c	2009-05-04 15:50:44 UTC (rev 2173)
@@ -61,7 +61,8 @@
   grub_uint32_t utime;
   grub_uint8_t unused2[16];
   grub_uint32_t blksize;
-  grub_uint8_t unused3[68];
+  grub_uint8_t unused3[60];
+  grub_uint64_t num_serial;
   struct grub_hfsplus_forkdata allocations_file;
   struct grub_hfsplus_forkdata extents_file;
   struct grub_hfsplus_forkdata catalog_file;
@@ -983,7 +984,37 @@
 
 }
 
+static grub_err_t
+grub_hfsplus_uuid (grub_device_t device, char **uuid)
+{
+  struct grub_hfsplus_data *data;
+  grub_disk_t disk = device->disk;
 
+#ifndef GRUB_UTIL
+  grub_dl_ref (my_mod);
+#endif
+
+  data = grub_hfsplus_mount (disk);
+  if (data)
+    {
+      *uuid = grub_malloc (16 + sizeof ('\0'));
+      grub_sprintf (*uuid, "%016llx", 
+		    (unsigned long long) 
+		    grub_be_to_cpu64 (data->volheader.num_serial));
+    }
+  else
+    *uuid = NULL;
+
+#ifndef GRUB_UTIL
+  grub_dl_unref (my_mod);
+#endif
+
+  grub_free (data);
+
+  return grub_errno;
+}
+
+
 
 static struct grub_fs grub_hfsplus_fs =
   {
@@ -994,6 +1025,7 @@
     .close = grub_hfsplus_close,
     .label = grub_hfsplus_label,
     .mtime = grub_hfsplus_mtime,
+    .uuid = grub_hfsplus_uuid,
     .next = 0
   };
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.