Several FS mtime support.

* grub-core/fs/affs.c (grub_affs_time): New struct.
	(grub_affs_file): New field mtime.
	(grub_fshelp_node): Changed 'block' and 'parent' to more appropriate
	type. Removed 'size'. New field 'di'. All users updated.
	(grub_affs_mount): Simplify checsum checking.
	(grub_affs_iterate_dir): New helper grub_affs_create_node.
	(grub_affs_dir): Handle mtime.
	* grub-core/fs/cpio.c (grub_cpio_find_file): Handle mtime.
	(grub_cpio_dir): Likewise.
	* grub-core/fs/hfs.c (grub_hfs_dirrec): New fields 'ctime' and 'mtime'.
	(grub_hfs_filerec): New field mtime.
	(grub_hfs_dir): Handle mtime.
	(grub_hfs_mtime): New function.
	(grub_hfs_fs): Register grub_hfs_mtime.
	* grub-core/fs/iso9660.c (grub_iso9660_date2): New struct.
	(grub_iso9660_dir): New field mtime.
	(grub_fshelp_node): New field dirent.
	(iso9660_to_unixtime): New function.
	(iso9660_to_unixtime2): Likewise.
	(grub_iso9660_read_symlink): Use node->dirent.
	(grub_iso9660_iterate_dir): Likewise.
	(grub_iso9660_dir): Set mtime.
	(grub_iso9660_mtime): New function.
	(grub_iso9660_fs): Register grub_iso9660_mtime.
	* grub-core/fs/jfs.c (grub_jfs_time): New struct.
	(grub_jfs_inode): New fields atime, ctime and mtime.
	(grub_jfs_dir): Set mtime.
	* grub-core/fs/minix.c (grub_minix_dir): Likewise.
	* grub-core/fs/ntfs.c (list_file): Set mtime.
	(grub_ntfs_dir): Likewise.
	* grub-core/fs/reiserfs.c (grub_fshelp_node): New field 'mtime'.
	(grub_reiserfs_iterate_dir): Set mtime.
	(grub_reiserfs_dir): Likewise.
	* grub-core/fs/sfs.c (grub_sfs_obj): New field mtime.
	(grub_fshelp_node): Likewise.
	(grub_sfs_iterate_dir): Set mtime.
	(grub_sfs_dir): Likewise.
	* grub-core/fs/udf.c (grub_udf_dir): Set mtime.
	* grub-core/fs/xfs.c (grub_xfs_time): New struct.
	(grub_xfs_inode): New fields atime, mtime, ctime.
	(grub_xfs_dir): Set mtime.
	* include/grub/datetime.h (grub_datetime2unixtime): New function.
	* include/grub/hfs.h (grub_hfs_sblock): New fields ctime and mtime.
	* include/grub/ntfs.h (grub_fshelp_node): New field mtime.

	Support UDF symlinks.

	* grub-core/fs/udf.c (grub_udf_iterate_dir): Handle symlinks.
	(grub_ufs_read_symlink): New function. All users updated.

	Check amiga partmap checksum.

	* grub-core/partmap/amiga.c (grub_amiga_rdsk): Pad to 128 bytes.
	(grub_amiga_partition): Likewise.
	(amiga_partition_map_checksum): New function.
	(amiga_partition_map_iterate): Check checksum.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2011-05-15 12:23:54 +02:00
commit b756f75f07
16 changed files with 466 additions and 64 deletions

View file

@ -133,6 +133,8 @@ struct grub_hfs_dirrec
grub_uint8_t type;
grub_uint8_t unused[5];
grub_uint32_t dirid;
grub_uint32_t ctime;
grub_uint32_t mtime;
} __attribute__ ((packed));
/* Information about a file. */
@ -144,7 +146,9 @@ struct grub_hfs_filerec
grub_uint32_t fileid;
grub_uint8_t unused2[2];
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
in the extent overflow file. */
@ -953,19 +957,29 @@ grub_hfs_dir (grub_device_t device, const char *path,
int dir_hook (struct grub_hfs_record *rec)
{
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_dirhook_info info;
grub_memset (&info, 0, sizeof (info));
grub_strncpy (fname, (char *) (ckey->str), ckey->strlen);
if (*filetype == GRUB_HFS_FILETYPE_DIR
|| *filetype == GRUB_HFS_FILETYPE_FILE)
if (drec->type == GRUB_HFS_FILETYPE_DIR)
{
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);
}
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;
}
@ -1074,6 +1088,22 @@ 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)
{
@ -1109,6 +1139,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
};