for all archives to a separate module. This splits tar from cpio
as they are very different but keeps cpio, cpio_be, odc and newc
together since they're very similar.
(handle_symlink): Fix off-by-one error.
Canonicalize the target.
(grub_cpio_dir): Canonicalize the name.
Fix memory leak.
Set directory.
(grub_cpio_open): Canonicalize the name.
* Makefile.util.def (libgrubmods): Add odc.c, newc.c and cpio_be.c.
* grub-core/Makefile.core.def (newc): New module.
(odc): Likewise.
(cpio_be): Likewise.
* grub-core/fs/cpio.c (ALIGN_CPIO): New macro.
(MAGIC): Likewise.
(MAGIC2): Likewise.
(head) [MODE_ODC]: Adapt for the format.
(head) [MODE_NEWC]: Likewise.
(head) [!MODE_*]: Write fields of interest as arrays.
(MAGIC_USTAR): Removed.
(read_number) [MODE_NEWC]: Change to hex.
(read_number) [!MODE_*]: Parse binary arrays.
(grub_cpio_find_file): Factor out the code for better structure and
always use read_number.
(grub_cpio_mount): Use MAGIC and MAGIC2.
(grub_cpio_dir): Exit on first hook non-0 return.
(grub_cpio_fs) [MODE_ODC]: Set name to odc.
(grub_cpio_fs) [MODE_NEWC]: Set name to newc.
(GRUB_MOD_INIT) [MODE_ODC]: Set name to odc.
(GRUB_MOD_INIT) [MODE_NEWC]: Set name to newc.
(GRUB_MOD_FINI) [MODE_ODC]: Set name to odc.
(GRUB_MOD_FINI) [MODE_NEWC]: Set name to newc.
* grub-core/fs/newc.c: New file.
* grub-core/fs/odc.c: Likewise.
* grub-core/fs/cpio_be.c: Likewise.
* grub-core/fs/cpio.c (ATTR_TYPE): New definition.
(ATTR_FILE): Likewise.
(ATTR_DIR): Likewise.
(ATTR_LNK): Likewise.
(grub_cpio_data) [MODE_USTAR]: New fields linkname and linkname_alloc.
(grub_cpio_find_file): Fill mode, handle linkname field as well as
L and K entries.
(grub_cpio_mount): Zero-fill data.
(handle_symlink): New function.
* grub-core/fs/cpio.c (grub_cpio_data): Use grub_off_t for offsets.
(canonicalize): New function.
(grub_cpio_find_file): Use canonicalize. Store offs in
grub_disk_addr_t.
(grub_cpio_dir): Use grub_disk_addr_t.
(grub_cpio_open): Likewise.
* 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.