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:
commit
b756f75f07
16 changed files with 466 additions and 64 deletions
|
@ -26,6 +26,7 @@
|
|||
#include <grub/types.h>
|
||||
#include <grub/fshelp.h>
|
||||
#include <grub/charset.h>
|
||||
#include <grub/datetime.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
|
@ -885,6 +886,8 @@ grub_udf_iterate_dir (grub_fshelp_node_t dir,
|
|||
|
||||
type = ((dirent.characteristics & GRUB_UDF_FID_CHAR_DIRECTORY) ?
|
||||
(GRUB_FSHELP_DIR) : (GRUB_FSHELP_REG));
|
||||
if (child->fe.icbtag.file_type == GRUB_UDF_ICBTAG_TYPE_SYMLINK)
|
||||
type = GRUB_FSHELP_SYMLINK;
|
||||
|
||||
if ((grub_udf_read_file (dir, 0, offset,
|
||||
dirent.file_ident_length,
|
||||
|
@ -912,6 +915,25 @@ grub_udf_iterate_dir (grub_fshelp_node_t dir,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static char *
|
||||
grub_ufs_read_symlink (grub_fshelp_node_t node)
|
||||
{
|
||||
grub_size_t sz = U64 (node->fe.file_size);
|
||||
grub_uint8_t *raw;
|
||||
char *ret;
|
||||
|
||||
if (sz < 4)
|
||||
return NULL;
|
||||
raw = grub_malloc (sz - 4);
|
||||
if (!raw)
|
||||
return NULL;
|
||||
if (grub_udf_read_file (node, NULL, 4, sz - 4, (char *) raw) < 0)
|
||||
return NULL;
|
||||
ret = read_string (raw, sz - 4);
|
||||
grub_free (raw);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_udf_dir (grub_device_t device, const char *path,
|
||||
int (*hook) (const char *filename,
|
||||
|
@ -930,8 +952,36 @@ grub_udf_dir (grub_device_t device, const char *path,
|
|||
grub_fshelp_node_t node)
|
||||
{
|
||||
struct grub_dirhook_info info;
|
||||
const struct grub_udf_timestamp *tstamp = NULL;
|
||||
grub_memset (&info, 0, sizeof (info));
|
||||
info.dir = ((filetype & GRUB_FSHELP_TYPE_MASK) == GRUB_FSHELP_DIR);
|
||||
if (U16 (node->fe.tag.tag_ident) == GRUB_UDF_TAG_IDENT_FE)
|
||||
tstamp = &node->fe.modification_time;
|
||||
else if (U16 (node->fe.tag.tag_ident) == GRUB_UDF_TAG_IDENT_EFE)
|
||||
tstamp = &node->efe.modification_time;
|
||||
|
||||
if (tstamp && (U16 (tstamp->type_and_timezone) & 0xf000) == 0x1000)
|
||||
{
|
||||
grub_int16_t tz;
|
||||
struct grub_datetime datetime;
|
||||
|
||||
datetime.year = U16 (tstamp->year);
|
||||
datetime.month = tstamp->month;
|
||||
datetime.day = tstamp->day;
|
||||
datetime.hour = tstamp->hour;
|
||||
datetime.minute = tstamp->minute;
|
||||
datetime.second = tstamp->second;
|
||||
|
||||
tz = U16 (tstamp->type_and_timezone) & 0xfff;
|
||||
if (tz & 0x800)
|
||||
tz |= 0xf000;
|
||||
if (tz == -2047)
|
||||
tz = 0;
|
||||
|
||||
info.mtimeset = !!grub_datetime2unixtime (&datetime, &info.mtime);
|
||||
|
||||
info.mtime -= 60 * tz;
|
||||
}
|
||||
grub_free (node);
|
||||
return hook (filename, &info);
|
||||
}
|
||||
|
@ -947,7 +997,8 @@ grub_udf_dir (grub_device_t device, const char *path,
|
|||
|
||||
if (grub_fshelp_find_file (path, &rootnode,
|
||||
&foundnode,
|
||||
grub_udf_iterate_dir, 0, GRUB_FSHELP_DIR))
|
||||
grub_udf_iterate_dir, grub_ufs_read_symlink,
|
||||
GRUB_FSHELP_DIR))
|
||||
goto fail;
|
||||
|
||||
grub_udf_iterate_dir (foundnode, iterate);
|
||||
|
@ -981,7 +1032,8 @@ grub_udf_open (struct grub_file *file, const char *name)
|
|||
|
||||
if (grub_fshelp_find_file (name, &rootnode,
|
||||
&foundnode,
|
||||
grub_udf_iterate_dir, 0, GRUB_FSHELP_REG))
|
||||
grub_udf_iterate_dir, grub_ufs_read_symlink,
|
||||
GRUB_FSHELP_REG))
|
||||
goto fail;
|
||||
|
||||
file->data = foundnode;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue