HFS mtime support
This commit is contained in:
parent
ebec6850b9
commit
58fa13fc7c
1 changed files with 19 additions and 6 deletions
|
@ -131,6 +131,8 @@ struct grub_hfs_dirrec
|
||||||
grub_uint8_t type;
|
grub_uint8_t type;
|
||||||
grub_uint8_t unused[5];
|
grub_uint8_t unused[5];
|
||||||
grub_uint32_t dirid;
|
grub_uint32_t dirid;
|
||||||
|
grub_uint32_t ctime;
|
||||||
|
grub_uint32_t mtime;
|
||||||
} __attribute__ ((packed));
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
/* Information about a file. */
|
/* Information about a file. */
|
||||||
|
@ -142,7 +144,9 @@ struct grub_hfs_filerec
|
||||||
grub_uint32_t fileid;
|
grub_uint32_t fileid;
|
||||||
grub_uint8_t unused2[2];
|
grub_uint8_t unused2[2];
|
||||||
grub_uint32_t size;
|
grub_uint32_t size;
|
||||||
grub_uint8_t unused3[44];
|
grub_uint8_t unused3[18];
|
||||||
|
grub_uint32_t mtime;
|
||||||
|
grub_uint8_t unused4[22];
|
||||||
|
|
||||||
/* The first 3 extents of the file. The other extents can be found
|
/* The first 3 extents of the file. The other extents can be found
|
||||||
in the extent overflow file. */
|
in the extent overflow file. */
|
||||||
|
@ -951,19 +955,29 @@ grub_hfs_dir (grub_device_t device, const char *path,
|
||||||
int dir_hook (struct grub_hfs_record *rec)
|
int dir_hook (struct grub_hfs_record *rec)
|
||||||
{
|
{
|
||||||
char fname[32] = { 0 };
|
char fname[32] = { 0 };
|
||||||
char *filetype = rec->data;
|
struct grub_hfs_dirrec *drec = rec->data;
|
||||||
|
struct grub_hfs_filerec *frec = rec->data;
|
||||||
struct grub_hfs_catalog_key *ckey = rec->key;
|
struct grub_hfs_catalog_key *ckey = rec->key;
|
||||||
struct grub_dirhook_info info;
|
struct grub_dirhook_info info;
|
||||||
grub_memset (&info, 0, sizeof (info));
|
grub_memset (&info, 0, sizeof (info));
|
||||||
|
|
||||||
grub_strncpy (fname, (char *) (ckey->str), ckey->strlen);
|
grub_strncpy (fname, (char *) (ckey->str), ckey->strlen);
|
||||||
|
|
||||||
if (*filetype == GRUB_HFS_FILETYPE_DIR
|
if (drec->type == GRUB_HFS_FILETYPE_DIR)
|
||||||
|| *filetype == GRUB_HFS_FILETYPE_FILE)
|
|
||||||
{
|
{
|
||||||
info.dir = (*filetype == GRUB_HFS_FILETYPE_DIR);
|
info.dir = 1;
|
||||||
|
info.mtimeset = 1;
|
||||||
|
info.mtime = grub_be_to_cpu32 (drec->mtime) - 2082844800;
|
||||||
return hook (fname, &info);
|
return hook (fname, &info);
|
||||||
}
|
}
|
||||||
|
if (frec->type == GRUB_HFS_FILETYPE_FILE)
|
||||||
|
{
|
||||||
|
info.dir = 0;
|
||||||
|
info.mtimeset = 1;
|
||||||
|
info.mtime = grub_be_to_cpu32 (frec->mtime) - 2082844800;
|
||||||
|
return hook (fname, &info);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1088,7 +1102,6 @@ grub_hfs_mtime (grub_device_t device, grub_int32_t *tm)
|
||||||
return grub_errno;
|
return grub_errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static grub_err_t
|
static grub_err_t
|
||||||
grub_hfs_uuid (grub_device_t device, char **uuid)
|
grub_hfs_uuid (grub_device_t device, char **uuid)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue