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
45
fs/xfs.c
45
fs/xfs.c
|
@ -37,17 +37,19 @@ struct grub_xfs_sblock
|
|||
{
|
||||
grub_uint8_t magic[4];
|
||||
grub_uint32_t bsize;
|
||||
grub_uint8_t unused1[48];
|
||||
grub_uint8_t unused1[24];
|
||||
grub_uint16_t uuid[8];
|
||||
grub_uint8_t unused2[8];
|
||||
grub_uint64_t rootino;
|
||||
grub_uint8_t unused2[20];
|
||||
grub_uint32_t agsize;
|
||||
grub_uint8_t unused3[20];
|
||||
grub_uint32_t agsize;
|
||||
grub_uint8_t unused4[20];
|
||||
grub_uint8_t label[12];
|
||||
grub_uint8_t log2_bsize;
|
||||
grub_uint8_t unused4[2];
|
||||
grub_uint8_t unused5[2];
|
||||
grub_uint8_t log2_inop;
|
||||
grub_uint8_t log2_agblk;
|
||||
grub_uint8_t unused5[67];
|
||||
grub_uint8_t unused6[67];
|
||||
grub_uint8_t log2_dirblk;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
|
@ -763,6 +765,38 @@ grub_xfs_label (grub_device_t device, char **label)
|
|||
return grub_errno;
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_xfs_uuid (grub_device_t device, char **uuid)
|
||||
{
|
||||
struct grub_xfs_data *data;
|
||||
grub_disk_t disk = device->disk;
|
||||
|
||||
#ifndef GRUB_UTIL
|
||||
grub_dl_ref (my_mod);
|
||||
#endif
|
||||
|
||||
data = grub_xfs_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->sblock.uuid[0]), grub_be_to_cpu16 (data->sblock.uuid[1]),
|
||||
grub_be_to_cpu16 (data->sblock.uuid[2]), grub_be_to_cpu16 (data->sblock.uuid[3]),
|
||||
grub_be_to_cpu16 (data->sblock.uuid[4]), grub_be_to_cpu16 (data->sblock.uuid[5]),
|
||||
grub_be_to_cpu16 (data->sblock.uuid[6]), grub_be_to_cpu16 (data->sblock.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_xfs_fs =
|
||||
|
@ -773,6 +807,7 @@ static struct grub_fs grub_xfs_fs =
|
|||
.read = grub_xfs_read,
|
||||
.close = grub_xfs_close,
|
||||
.label = grub_xfs_label,
|
||||
.uuid = grub_xfs_uuid,
|
||||
.next = 0
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue