2008-06-01 Robert Millan <rmh@aybabtu.com>
* util/biosdisk.c (get_drive): Verify that `map[i].drive' is non-NULL before dereferencing it. * fs/fat.c (struct grub_fat_bpb): Move fat32-specific fields into a union with fat12/fat16-specific ones. Add some new fields, including `num_serial' for both versions. (struct grub_fat_data): Add `uuid' member. (grub_fat_mount): Refer to fat32-specific fields in `bpb' by their new names. Initialize `data->uuid' using `num_serial'. (grub_fat_uuid): New function. (grub_fat_fs): Reference grub_fat_uuid() in `uuid' struct member. * 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.
This commit is contained in:
parent
1385c5bb3d
commit
00c108a446
5 changed files with 169 additions and 19 deletions
|
@ -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 device, char **label)
|
|||
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 (sizeof ("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"));
|
||||
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
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue