HFS filesystem mtime support

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2010-12-11 07:00:31 +01:00
parent 88db5b694a
commit ebec6850b9
2 changed files with 21 additions and 1 deletions

View file

@ -1072,6 +1072,23 @@ grub_hfs_label (grub_device_t device, char **label)
return grub_errno;
}
static grub_err_t
grub_hfs_mtime (grub_device_t device, grub_int32_t *tm)
{
struct grub_hfs_data *data;
data = grub_hfs_mount (device->disk);
if (data)
*tm = grub_be_to_cpu32 (data->sblock.mtime) - 2082844800;
else
*tm = 0;
grub_free (data);
return grub_errno;
}
static grub_err_t
grub_hfs_uuid (grub_device_t device, char **uuid)
{
@ -1107,6 +1124,7 @@ static struct grub_fs grub_hfs_fs =
.close = grub_hfs_close,
.label = grub_hfs_label,
.uuid = grub_hfs_uuid,
.mtime = grub_hfs_mtime,
.next = 0
};

View file

@ -39,7 +39,9 @@ typedef struct grub_hfs_extent grub_hfs_datarecord_t[3];
struct grub_hfs_sblock
{
grub_uint16_t magic;
grub_uint8_t unused[18];
grub_uint32_t ctime;
grub_uint32_t mtime;
grub_uint8_t unused[10];
grub_uint32_t blksz;
grub_uint8_t unused2[4];
grub_uint16_t first_block;