All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] UUID support for UFS
@ 2009-07-21 13:03 Vladimir 'phcoder' Serbinenko
  2009-07-21 17:14 ` Pavel Roskin
  2009-07-22 17:40 ` Robert Millan
  0 siblings, 2 replies; 18+ messages in thread
From: Vladimir 'phcoder' Serbinenko @ 2009-07-21 13:03 UTC (permalink / raw)
  To: The development of GRUB 2

[-- Attachment #1: Type: text/plain, Size: 106 bytes --]

-- 
Regards
Vladimir 'phcoder' Serbinenko

Personal git repository: http://repo.or.cz/w/grub2/phcoder.git

[-- Attachment #2: ufs.diff --]
[-- Type: text/plain, Size: 2373 bytes --]

diff --git a/ChangeLog b/ChangeLog
index 02d5af1..f7275bd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2009-07-21  Vladimir Serbinenko  <phcoder@gmail.com>
 
+	UUID support for UFS
+	
+	* fs/ufs.c (grub_ufs_sblock): Add uuidhi and uuidlow.
+	(grub_ufs_uuid): New function.
+	(grub_ufs_fs): add .uuid
+
+2009-07-21  Vladimir Serbinenko  <phcoder@gmail.com>
+
 	* fs/ufs.c (grub_ufs_sblock): Fix offset of mtime2 which was off by
 	128 bytes
 
diff --git a/fs/ufs.c b/fs/ufs.c
index c9531b5..a41145e 100644
--- a/fs/ufs.c
+++ b/fs/ufs.c
@@ -87,7 +87,10 @@ struct grub_ufs_sblock
 
   /* The size of filesystem blocks to disk blocks.  */
   grub_uint32_t log2_blksz;
-  grub_uint8_t unused6[80];
+  grub_uint8_t unused6[40];
+  grub_uint32_t uuidhi;
+  grub_uint32_t uuidlow;
+  grub_uint8_t unused7[32];
 
   /* Inodes stored per cylinder group.  */
   grub_uint32_t ino_per_group;
@@ -95,14 +98,14 @@ struct grub_ufs_sblock
   /* The frags per cylinder group.  */
   grub_uint32_t frags_per_group;
 
-  grub_uint8_t unused7[488];
+  grub_uint8_t unused8[488];
 
   /* Volume name for UFS2.  */
   grub_uint8_t volume_name[GRUB_UFS_VOLNAME_LEN];
-  grub_uint8_t unused8[360];
+  grub_uint8_t unused9[360];
 
   grub_uint64_t mtime2;
-  grub_uint8_t unused9[292];
+  grub_uint8_t unused10[292];
 
   /* Magic value to check if this is really a UFS filesystem.  */
   grub_uint32_t magic;
@@ -736,6 +739,33 @@ grub_ufs_label (grub_device_t device, char **label)
   return grub_errno;
 }
 
+static grub_err_t
+grub_ufs_uuid (grub_device_t device, char **uuid)
+{
+  struct grub_ufs_data *data;
+  grub_disk_t disk = device->disk;
+
+  grub_dl_ref (my_mod);
+
+  data = grub_ufs_mount (disk);
+  if (data)
+    {
+      *uuid = grub_malloc (16 + sizeof ('\0'));
+      grub_sprintf (*uuid, "%08lx%08lx",
+		    (unsigned long) grub_le_to_cpu32 (data->sblock.uuidhi),
+		    (unsigned long) grub_le_to_cpu32 (data->sblock.uuidlow));
+    }
+  else
+    *uuid = NULL;
+
+  grub_dl_unref (my_mod);
+
+  grub_free (data);
+
+  return grub_errno;
+}
+
+
 /* Get mtime.  */
 static grub_err_t
 grub_ufs_mtime (grub_device_t device, grub_int32_t *tm)
@@ -769,6 +799,7 @@ static struct grub_fs grub_ufs_fs =
     .read = grub_ufs_read,
     .close = grub_ufs_close,
     .label = grub_ufs_label,
+    .uuid = grub_ufs_uuid,
     .mtime = grub_ufs_mtime,
     .next = 0
   };

^ permalink raw reply related	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2009-07-22 18:02 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-21 13:03 [PATCH] UUID support for UFS Vladimir 'phcoder' Serbinenko
2009-07-21 17:14 ` Pavel Roskin
2009-07-21 20:01   ` Vladimir 'phcoder' Serbinenko
2009-07-21 18:46     ` Javier Martín
2009-07-21 21:31       ` Pavel Roskin
2009-07-21 21:45         ` Vladimir 'phcoder' Serbinenko
2009-07-21 22:05           ` Pavel Roskin
2009-07-21 20:14             ` Javier Martín
2009-07-21 22:37               ` Pavel Roskin
2009-07-21 21:34                 ` Javier Martín
2009-07-22  0:20                   ` Pavel Roskin
2009-07-22 17:47                   ` Robert Millan
2009-07-22 18:02                     ` Javier Martín
2009-07-22 17:44           ` Robert Millan
2009-07-21 20:04     ` Pavel Roskin
2009-07-22 17:40 ` Robert Millan
2009-07-22 17:47   ` Vladimir 'phcoder' Serbinenko
2009-07-22 18:01   ` Pavel Roskin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.