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'.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2009-12-16 15:40:31 +01:00
parent 574cce0cfa
commit c179ebe4ee
3 changed files with 36 additions and 1 deletions

View File

@ -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.

View File

@ -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;
}
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
};

View 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];