SFS mtime support

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2010-12-11 22:48:29 +01:00
parent bd1de4341b
commit 7b32d83d78

View file

@ -66,7 +66,7 @@ struct grub_sfs_obj
grub_uint32_t dir_objc;
} dir __attribute__ ((packed));
} file_dir;
grub_uint8_t unused3[4];
grub_uint32_t mtime;
grub_uint8_t type;
grub_uint8_t filename[1];
grub_uint8_t comment[1];
@ -119,6 +119,7 @@ struct grub_fshelp_node
struct grub_sfs_data *data;
int block;
int size;
grub_uint32_t mtime;
};
/* Information about a "mounted" sfs filesystem. */
@ -355,10 +356,12 @@ grub_sfs_iterate_dir (grub_fshelp_node_t dir,
int pos;
auto int NESTED_FUNC_ATTR grub_sfs_create_node (const char *name, int block,
int size, int type);
int size, int type,
grub_uint32_t mtime);
int NESTED_FUNC_ATTR grub_sfs_create_node (const char *name, int block,
int size, int type)
int size, int type,
grub_uint32_t mtime)
{
node = grub_malloc (sizeof (*node));
if (!node)
@ -367,6 +370,7 @@ grub_sfs_iterate_dir (grub_fshelp_node_t dir,
node->data = data;
node->size = size;
node->block = block;
node->mtime = mtime;
return hook (name, type, node);
}
@ -426,7 +430,7 @@ grub_sfs_iterate_dir (grub_fshelp_node_t dir,
if (grub_sfs_create_node (filename, block,
grub_be_to_cpu32 (obj->file_dir.file.size),
type))
type, grub_be_to_cpu32 (obj->mtime)))
{
grub_free (objc_data);
return 1;
@ -525,6 +529,8 @@ grub_sfs_dir (grub_device_t device, const char *path,
struct grub_dirhook_info info;
grub_memset (&info, 0, sizeof (info));
info.dir = ((filetype & GRUB_FSHELP_TYPE_MASK) == GRUB_FSHELP_DIR);
info.mtime = node->mtime + 8 * 365 * 86400 + 86400 * 2;
info.mtimeset = 1;
grub_free (node);
return hook (filename, &info);
}