mirror of
https://git.savannah.gnu.org/git/grub.git
synced 2026-10-21 23:02:40 +00:00
More efficient retrieval of file size
This commit is contained in:
1 parent
442b86de32
commit
8e2fb1e3ce
27 files changed
+54
-33
No files matched your search
+2
-26
@@ -116,35 +116,11 @@ print_files_long (const char *filename, const struct grub_dirhook_info *info,
|
|||||||
|
|
||||||
if (! info->dir)
|
if (! info->dir)
|
||||||
{
|
{
|
||||||
grub_file_t file;
|
|
||||||
char *pathname;
|
|
||||||
|
|
||||||
if (ctx->dirname[grub_strlen (ctx->dirname) - 1] == '/')
|
|
||||||
pathname = grub_xasprintf ("%s%s", ctx->dirname, filename);
|
|
||||||
else
|
|
||||||
pathname = grub_xasprintf ("%s/%s", ctx->dirname, filename);
|
|
||||||
|
|
||||||
if (!pathname)
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
/* XXX: For ext2fs symlinks are detected as files while they
|
|
||||||
should be reported as directories. */
|
|
||||||
grub_file_filter_disable_compression ();
|
|
||||||
file = grub_file_open (pathname);
|
|
||||||
if (! file)
|
|
||||||
{
|
|
||||||
grub_errno = 0;
|
|
||||||
grub_free (pathname);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! ctx->human)
|
if (! ctx->human)
|
||||||
grub_printf ("%-12llu", (unsigned long long) file->size);
|
grub_printf ("%-12llu", (unsigned long long) info->size);
|
||||||
else
|
else
|
||||||
grub_printf ("%-12s", grub_get_human_size (file->size,
|
grub_printf ("%-12s", grub_get_human_size (info->size,
|
||||||
GRUB_HUMAN_SIZE_SHORT));
|
GRUB_HUMAN_SIZE_SHORT));
|
||||||
grub_file_close (file);
|
|
||||||
grub_free (pathname);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
grub_printf ("%-12s", _("DIR"));
|
grub_printf ("%-12s", _("DIR"));
|
||||||
|
|||||||
@@ -565,6 +565,7 @@ grub_affs_dir_iter (const char *filename, enum grub_fshelp_filetype filetype,
|
|||||||
info.dir = ((filetype & GRUB_FSHELP_TYPE_MASK) == GRUB_FSHELP_DIR);
|
info.dir = ((filetype & GRUB_FSHELP_TYPE_MASK) == GRUB_FSHELP_DIR);
|
||||||
info.mtimeset = 1;
|
info.mtimeset = 1;
|
||||||
info.mtime = aftime2ctime (&node->di.mtime);
|
info.mtime = aftime2ctime (&node->di.mtime);
|
||||||
|
info.size = grub_be_to_cpu32 (node->di.size);
|
||||||
grub_free (node);
|
grub_free (node);
|
||||||
return ctx->hook (filename, &info, ctx->hook_data);
|
return ctx->hook (filename, &info, ctx->hook_data);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -155,9 +155,10 @@ grub_archelp_dir (struct grub_archelp_data *data,
|
|||||||
{
|
{
|
||||||
grub_int32_t mtime;
|
grub_int32_t mtime;
|
||||||
grub_uint32_t mode;
|
grub_uint32_t mode;
|
||||||
|
grub_uint64_t size;
|
||||||
grub_err_t err;
|
grub_err_t err;
|
||||||
|
|
||||||
if (arcops->find_file (data, &name, &mtime, &mode))
|
if (arcops->find_file (data, &name, &mtime, &mode, &size))
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
if (mode == GRUB_ARCHELP_ATTR_END)
|
if (mode == GRUB_ARCHELP_ATTR_END)
|
||||||
@@ -189,6 +190,7 @@ grub_archelp_dir (struct grub_archelp_data *data,
|
|||||||
info.mtime = mtime;
|
info.mtime = mtime;
|
||||||
info.mtimeset = 1;
|
info.mtimeset = 1;
|
||||||
}
|
}
|
||||||
|
info.size = size;
|
||||||
if (hook (n, &info, hook_data))
|
if (hook (n, &info, hook_data))
|
||||||
{
|
{
|
||||||
grub_free (name);
|
grub_free (name);
|
||||||
@@ -248,8 +250,9 @@ grub_archelp_open (struct grub_archelp_data *data,
|
|||||||
{
|
{
|
||||||
grub_uint32_t mode;
|
grub_uint32_t mode;
|
||||||
int restart;
|
int restart;
|
||||||
|
grub_uint64_t size;
|
||||||
|
|
||||||
if (arcops->find_file (data, &fn, NULL, &mode))
|
if (arcops->find_file (data, &fn, NULL, &mode, &size))
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
if (mode == GRUB_ARCHELP_ATTR_END)
|
if (mode == GRUB_ARCHELP_ATTR_END)
|
||||||
|
|||||||
@@ -889,6 +889,7 @@ grub_bfs_dir_iter (const char *name, grub_uint64_t value,
|
|||||||
info.mtime = grub_bfs_to_cpu64 (ino.mtime) >> 16;
|
info.mtime = grub_bfs_to_cpu64 (ino.mtime) >> 16;
|
||||||
#endif
|
#endif
|
||||||
info.dir = ((grub_bfs_to_cpu32 (ino.mode) & ATTR_TYPE) == ATTR_DIR);
|
info.dir = ((grub_bfs_to_cpu32 (ino.mode) & ATTR_TYPE) == ATTR_DIR);
|
||||||
|
info.size = grub_bfs_to_cpu64 (ino.size);
|
||||||
return ctx->hook (name, &info, ctx->hook_data);
|
return ctx->hook (name, &info, ctx->hook_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1580,6 +1580,7 @@ grub_btrfs_dir (grub_device_t device, const char *path,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
info.mtime = grub_le_to_cpu64 (inode.mtime.sec);
|
info.mtime = grub_le_to_cpu64 (inode.mtime.sec);
|
||||||
|
info.size = grub_le_to_cpu64 (inode.size);
|
||||||
info.mtimeset = 1;
|
info.mtimeset = 1;
|
||||||
}
|
}
|
||||||
c = cdirel->name[grub_le_to_cpu16 (cdirel->n)];
|
c = cdirel->name[grub_le_to_cpu16 (cdirel->n)];
|
||||||
|
|||||||
+3
-1
@@ -44,7 +44,8 @@ struct grub_archelp_data
|
|||||||
static grub_err_t
|
static grub_err_t
|
||||||
grub_cbfs_find_file (struct grub_archelp_data *data, char **name,
|
grub_cbfs_find_file (struct grub_archelp_data *data, char **name,
|
||||||
grub_int32_t *mtime,
|
grub_int32_t *mtime,
|
||||||
grub_uint32_t *mode)
|
grub_uint32_t *mode,
|
||||||
|
grub_uint64_t *size)
|
||||||
{
|
{
|
||||||
grub_size_t offset;
|
grub_size_t offset;
|
||||||
for (;;
|
for (;;
|
||||||
@@ -71,6 +72,7 @@ grub_cbfs_find_file (struct grub_archelp_data *data, char **name,
|
|||||||
return GRUB_ERR_NONE;
|
return GRUB_ERR_NONE;
|
||||||
}
|
}
|
||||||
data->size = grub_be_to_cpu32 (hd.len);
|
data->size = grub_be_to_cpu32 (hd.len);
|
||||||
|
*size = grub_be_to_cpu32 (hd.len);
|
||||||
(void) mtime;
|
(void) mtime;
|
||||||
offset = grub_be_to_cpu32 (hd.offset);
|
offset = grub_be_to_cpu32 (hd.offset);
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,8 @@ struct grub_archelp_data
|
|||||||
|
|
||||||
static grub_err_t
|
static grub_err_t
|
||||||
grub_cpio_find_file (struct grub_archelp_data *data, char **name,
|
grub_cpio_find_file (struct grub_archelp_data *data, char **name,
|
||||||
grub_int32_t *mtime, grub_uint32_t *mode)
|
grub_int32_t *mtime, grub_uint32_t *mode,
|
||||||
|
grub_uint64_t *size)
|
||||||
{
|
{
|
||||||
struct head hd;
|
struct head hd;
|
||||||
grub_size_t namesize;
|
grub_size_t namesize;
|
||||||
@@ -86,6 +87,7 @@ grub_cpio_find_file (struct grub_archelp_data *data, char **name,
|
|||||||
|
|
||||||
data->dofs = data->hofs + ALIGN_CPIO (sizeof (hd) + namesize);
|
data->dofs = data->hofs + ALIGN_CPIO (sizeof (hd) + namesize);
|
||||||
data->next_hofs = data->dofs + ALIGN_CPIO (data->size);
|
data->next_hofs = data->dofs + ALIGN_CPIO (data->size);
|
||||||
|
*size = data->size;
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_ERR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -884,6 +884,8 @@ grub_ext2_dir_iter (const char *filename, enum grub_fshelp_filetype filetype,
|
|||||||
{
|
{
|
||||||
info.mtimeset = 1;
|
info.mtimeset = 1;
|
||||||
info.mtime = grub_le_to_cpu32 (node->inode.mtime);
|
info.mtime = grub_le_to_cpu32 (node->inode.mtime);
|
||||||
|
info.size = grub_le_to_cpu32 (node->inode.size);
|
||||||
|
info.size |= ((grub_off_t) grub_le_to_cpu32 (node->inode.size_high)) << 32;
|
||||||
}
|
}
|
||||||
|
|
||||||
info.dir = ((filetype & GRUB_FSHELP_TYPE_MASK) == GRUB_FSHELP_DIR);
|
info.dir = ((filetype & GRUB_FSHELP_TYPE_MASK) == GRUB_FSHELP_DIR);
|
||||||
|
|||||||
@@ -938,6 +938,8 @@ grub_fat_find_dir (grub_disk_t disk, struct grub_fat_data *data,
|
|||||||
#endif
|
#endif
|
||||||
data->cur_cluster_num = ~0U;
|
data->cur_cluster_num = ~0U;
|
||||||
|
|
||||||
|
info.size = data->file_size;
|
||||||
|
|
||||||
if (call_hook)
|
if (call_hook)
|
||||||
hook (ctxt.filename, &info, hook_data);
|
hook (ctxt.filename, &info, hook_data);
|
||||||
|
|
||||||
|
|||||||
@@ -1237,6 +1237,7 @@ grub_hfs_dir_hook (struct grub_hfs_record *rec, void *hook_arg)
|
|||||||
info.dir = 0;
|
info.dir = 0;
|
||||||
info.mtimeset = 1;
|
info.mtimeset = 1;
|
||||||
info.mtime = grub_be_to_cpu32 (frec->mtime) - 2082844800;
|
info.mtime = grub_be_to_cpu32 (frec->mtime) - 2082844800;
|
||||||
|
info.size = grub_be_to_cpu32 (frec->size);
|
||||||
return ctx->hook (fname, &info, ctx->hook_data);
|
return ctx->hook (fname, &info, ctx->hook_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -917,6 +917,7 @@ grub_hfsplus_dir_iter (const char *filename,
|
|||||||
info.dir = ((filetype & GRUB_FSHELP_TYPE_MASK) == GRUB_FSHELP_DIR);
|
info.dir = ((filetype & GRUB_FSHELP_TYPE_MASK) == GRUB_FSHELP_DIR);
|
||||||
info.mtimeset = 1;
|
info.mtimeset = 1;
|
||||||
info.mtime = node->mtime;
|
info.mtime = node->mtime;
|
||||||
|
info.size = node->size;
|
||||||
info.case_insensitive = !! (filetype & GRUB_FSHELP_CASE_INSENSITIVE);
|
info.case_insensitive = !! (filetype & GRUB_FSHELP_CASE_INSENSITIVE);
|
||||||
grub_free (node);
|
grub_free (node);
|
||||||
return ctx->hook (filename, &info, ctx->hook_data);
|
return ctx->hook (filename, &info, ctx->hook_data);
|
||||||
|
|||||||
@@ -861,7 +861,7 @@ grub_iso9660_dir_iter (const char *filename,
|
|||||||
grub_memset (&info, 0, sizeof (info));
|
grub_memset (&info, 0, sizeof (info));
|
||||||
info.dir = ((filetype & GRUB_FSHELP_TYPE_MASK) == GRUB_FSHELP_DIR);
|
info.dir = ((filetype & GRUB_FSHELP_TYPE_MASK) == GRUB_FSHELP_DIR);
|
||||||
info.mtimeset = !!iso9660_to_unixtime2 (&node->dirents[0].mtime, &info.mtime);
|
info.mtimeset = !!iso9660_to_unixtime2 (&node->dirents[0].mtime, &info.mtime);
|
||||||
|
info.size = get_node_size (node);
|
||||||
grub_free (node);
|
grub_free (node);
|
||||||
return ctx->hook (filename, &info, ctx->hook_data);
|
return ctx->hook (filename, &info, ctx->hook_data);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -778,6 +778,7 @@ grub_jfs_dir (grub_device_t device, const char *path,
|
|||||||
& GRUB_JFS_FILETYPE_MASK) == GRUB_JFS_FILETYPE_DIR;
|
& GRUB_JFS_FILETYPE_MASK) == GRUB_JFS_FILETYPE_DIR;
|
||||||
info.mtimeset = 1;
|
info.mtimeset = 1;
|
||||||
info.mtime = grub_le_to_cpu32 (inode.mtime.sec);
|
info.mtime = grub_le_to_cpu32 (inode.mtime.sec);
|
||||||
|
info.size = grub_le_to_cpu64 (inode.size);
|
||||||
if (hook (diro->name, &info, hook_data))
|
if (hook (diro->name, &info, hook_data))
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -576,6 +576,7 @@ grub_minix_dir (grub_device_t device, const char *path,
|
|||||||
& GRUB_MINIX_IFDIR) == GRUB_MINIX_IFDIR);
|
& GRUB_MINIX_IFDIR) == GRUB_MINIX_IFDIR);
|
||||||
info.mtimeset = 1;
|
info.mtimeset = 1;
|
||||||
info.mtime = grub_minix_to_cpu32 (data->inode.mtime);
|
info.mtime = grub_minix_to_cpu32 (data->inode.mtime);
|
||||||
|
info.size = GRUB_MINIX_INODE_SIZE (data);
|
||||||
|
|
||||||
if (hook (filename, &info, hook_data) ? 1 : 0)
|
if (hook (filename, &info, hook_data) ? 1 : 0)
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -1066,6 +1066,7 @@ grub_nilfs2_dir_iter (const char *filename, enum grub_fshelp_filetype filetype,
|
|||||||
{
|
{
|
||||||
info.mtimeset = 1;
|
info.mtimeset = 1;
|
||||||
info.mtime = grub_le_to_cpu64 (node->inode.i_mtime);
|
info.mtime = grub_le_to_cpu64 (node->inode.i_mtime);
|
||||||
|
info.size = grub_le_to_cpu64 (node->inode.i_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
info.dir = ((filetype & GRUB_FSHELP_TYPE_MASK) == GRUB_FSHELP_DIR);
|
info.dir = ((filetype & GRUB_FSHELP_TYPE_MASK) == GRUB_FSHELP_DIR);
|
||||||
|
|||||||
@@ -981,10 +981,13 @@ grub_ntfs_dir_iter (const char *filename, enum grub_fshelp_filetype filetype,
|
|||||||
|
|
||||||
grub_memset (&info, 0, sizeof (info));
|
grub_memset (&info, 0, sizeof (info));
|
||||||
info.dir = ((filetype & GRUB_FSHELP_TYPE_MASK) == GRUB_FSHELP_DIR);
|
info.dir = ((filetype & GRUB_FSHELP_TYPE_MASK) == GRUB_FSHELP_DIR);
|
||||||
|
init_file (node, node->ino);
|
||||||
info.mtimeset = 1;
|
info.mtimeset = 1;
|
||||||
info.mtime = grub_divmod64 (node->mtime, 10000000, 0)
|
info.mtime = grub_divmod64 (node->mtime, 10000000, 0)
|
||||||
- 86400ULL * 365 * (1970 - 1601)
|
- 86400ULL * 365 * (1970 - 1601)
|
||||||
- 86400ULL * ((1970 - 1601) / 4) + 86400ULL * ((1970 - 1601) / 100);
|
- 86400ULL * ((1970 - 1601) / 4) + 86400ULL * ((1970 - 1601) / 100);
|
||||||
|
info.mtime = node->size;
|
||||||
|
free_file (node);
|
||||||
grub_free (node);
|
grub_free (node);
|
||||||
return ctx->hook (filename, &info, ctx->hook_data);
|
return ctx->hook (filename, &info, ctx->hook_data);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1271,6 +1271,7 @@ grub_reiserfs_dir_iter (const char *filename,
|
|||||||
info.dir = ((filetype & GRUB_FSHELP_TYPE_MASK) == GRUB_FSHELP_DIR);
|
info.dir = ((filetype & GRUB_FSHELP_TYPE_MASK) == GRUB_FSHELP_DIR);
|
||||||
info.mtimeset = 1;
|
info.mtimeset = 1;
|
||||||
info.mtime = node->mtime;
|
info.mtime = node->mtime;
|
||||||
|
info.size = node->size;
|
||||||
grub_free (node);
|
grub_free (node);
|
||||||
return ctx->hook (filename, &info, ctx->hook_data);
|
return ctx->hook (filename, &info, ctx->hook_data);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -331,6 +331,7 @@ grub_romfs_dir_iter (const char *filename, enum grub_fshelp_filetype filetype,
|
|||||||
grub_memset (&info, 0, sizeof (info));
|
grub_memset (&info, 0, sizeof (info));
|
||||||
|
|
||||||
info.dir = ((filetype & GRUB_FSHELP_TYPE_MASK) == GRUB_FSHELP_DIR);
|
info.dir = ((filetype & GRUB_FSHELP_TYPE_MASK) == GRUB_FSHELP_DIR);
|
||||||
|
info.size = grub_be_to_cpu32 (node->file.size);
|
||||||
grub_free (node);
|
grub_free (node);
|
||||||
return ctx->hook (filename, &info, ctx->hook_data);
|
return ctx->hook (filename, &info, ctx->hook_data);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -671,6 +671,7 @@ grub_sfs_dir_iter (const char *filename, enum grub_fshelp_filetype filetype,
|
|||||||
info.dir = ((filetype & GRUB_FSHELP_TYPE_MASK) == GRUB_FSHELP_DIR);
|
info.dir = ((filetype & GRUB_FSHELP_TYPE_MASK) == GRUB_FSHELP_DIR);
|
||||||
info.mtime = node->mtime + 8 * 365 * 86400 + 86400 * 2;
|
info.mtime = node->mtime + 8 * 365 * 86400 + 86400 * 2;
|
||||||
info.mtimeset = 1;
|
info.mtimeset = 1;
|
||||||
|
info.size = node->size;
|
||||||
grub_free (node->cache);
|
grub_free (node->cache);
|
||||||
grub_free (node);
|
grub_free (node);
|
||||||
return ctx->hook (filename, &info, ctx->hook_data);
|
return ctx->hook (filename, &info, ctx->hook_data);
|
||||||
|
|||||||
@@ -656,6 +656,15 @@ grub_squash_dir_iter (const char *filename, enum grub_fshelp_filetype filetype,
|
|||||||
info.dir = ((filetype & GRUB_FSHELP_TYPE_MASK) == GRUB_FSHELP_DIR);
|
info.dir = ((filetype & GRUB_FSHELP_TYPE_MASK) == GRUB_FSHELP_DIR);
|
||||||
info.mtimeset = 1;
|
info.mtimeset = 1;
|
||||||
info.mtime = grub_le_to_cpu32 (node->ino.mtime);
|
info.mtime = grub_le_to_cpu32 (node->ino.mtime);
|
||||||
|
switch (node->ino.type)
|
||||||
|
{
|
||||||
|
case grub_cpu_to_le16_compile_time (SQUASH_TYPE_LONG_REGULAR):
|
||||||
|
info.size = grub_le_to_cpu64 (node->ino.long_file.size);
|
||||||
|
break;
|
||||||
|
case grub_cpu_to_le16_compile_time (SQUASH_TYPE_REGULAR):
|
||||||
|
info.size = grub_le_to_cpu32 (node->ino.file.size);
|
||||||
|
break;
|
||||||
|
}
|
||||||
grub_free (node);
|
grub_free (node);
|
||||||
return ctx->hook (filename, &info, ctx->hook_data);
|
return ctx->hook (filename, &info, ctx->hook_data);
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-1
@@ -72,7 +72,8 @@ struct grub_archelp_data
|
|||||||
static grub_err_t
|
static grub_err_t
|
||||||
grub_cpio_find_file (struct grub_archelp_data *data, char **name,
|
grub_cpio_find_file (struct grub_archelp_data *data, char **name,
|
||||||
grub_int32_t *mtime,
|
grub_int32_t *mtime,
|
||||||
grub_uint32_t *mode)
|
grub_uint32_t *mode,
|
||||||
|
grub_uint64_t *size)
|
||||||
{
|
{
|
||||||
struct head hd;
|
struct head hd;
|
||||||
int reread = 0, have_longname = 0, have_longlink = 0;
|
int reread = 0, have_longname = 0, have_longlink = 0;
|
||||||
@@ -200,6 +201,7 @@ grub_cpio_find_file (struct grub_archelp_data *data, char **name,
|
|||||||
grub_memcpy (data->linkname, hd.linkname, sizeof (hd.linkname));
|
grub_memcpy (data->linkname, hd.linkname, sizeof (hd.linkname));
|
||||||
data->linkname[100] = 0;
|
data->linkname[100] = 0;
|
||||||
}
|
}
|
||||||
|
*size = data->size;
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_ERR_NONE;
|
||||||
}
|
}
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_ERR_NONE;
|
||||||
|
|||||||
@@ -1072,6 +1072,7 @@ grub_udf_dir_iter (const char *filename, enum grub_fshelp_filetype filetype,
|
|||||||
info.mtimeset = !!grub_datetime2unixtime (&datetime, &info.mtime);
|
info.mtimeset = !!grub_datetime2unixtime (&datetime, &info.mtime);
|
||||||
|
|
||||||
info.mtime -= 60 * tz;
|
info.mtime -= 60 * tz;
|
||||||
|
info.size = U64 (node->block.fe.file_size);
|
||||||
}
|
}
|
||||||
grub_free (node);
|
grub_free (node);
|
||||||
return ctx->hook (filename, &info, ctx->hook_data);
|
return ctx->hook (filename, &info, ctx->hook_data);
|
||||||
|
|||||||
@@ -711,6 +711,8 @@ grub_ufs_dir (grub_device_t device, const char *path,
|
|||||||
#endif
|
#endif
|
||||||
info.mtimeset = 1;
|
info.mtimeset = 1;
|
||||||
|
|
||||||
|
info.size = grub_ufs_to_cpu64 (inode.size);
|
||||||
|
|
||||||
if (hook (filename, &info, hook_data))
|
if (hook (filename, &info, hook_data))
|
||||||
{
|
{
|
||||||
grub_free (filename);
|
grub_free (filename);
|
||||||
|
|||||||
@@ -732,6 +732,7 @@ grub_xfs_dir_iter (const char *filename, enum grub_fshelp_filetype filetype,
|
|||||||
{
|
{
|
||||||
info.mtimeset = 1;
|
info.mtimeset = 1;
|
||||||
info.mtime = grub_be_to_cpu32 (node->inode.mtime.sec);
|
info.mtime = grub_be_to_cpu32 (node->inode.mtime.sec);
|
||||||
|
info.size = grub_be_to_cpu64 (node->inode.size);
|
||||||
}
|
}
|
||||||
info.dir = ((filetype & GRUB_FSHELP_TYPE_MASK) == GRUB_FSHELP_DIR);
|
info.dir = ((filetype & GRUB_FSHELP_TYPE_MASK) == GRUB_FSHELP_DIR);
|
||||||
grub_free (node);
|
grub_free (node);
|
||||||
|
|||||||
@@ -3999,6 +3999,8 @@ iterate_zap (const char *name, grub_uint64_t val, struct grub_zfs_dir_ctx *ctx)
|
|||||||
info.mtimeset = 1;
|
info.mtimeset = 1;
|
||||||
info.mtime = grub_zfs_to_cpu64 (grub_get_unaligned64 ((char *) sahdrp + hdrsize + SA_MTIME_OFFSET), dn.endian);
|
info.mtime = grub_zfs_to_cpu64 (grub_get_unaligned64 ((char *) sahdrp + hdrsize + SA_MTIME_OFFSET), dn.endian);
|
||||||
info.case_insensitive = ctx->data->subvol.case_insensitive;
|
info.case_insensitive = ctx->data->subvol.case_insensitive;
|
||||||
|
info.size = grub_zfs_to_cpu64 (grub_get_unaligned64 ((char *) sahdrp + hdrsize + SA_SIZE_OFFSET), dn.endian);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dn.dn.dn_bonustype == DMU_OT_ZNODE)
|
if (dn.dn.dn_bonustype == DMU_OT_ZNODE)
|
||||||
@@ -4006,6 +4008,7 @@ iterate_zap (const char *name, grub_uint64_t val, struct grub_zfs_dir_ctx *ctx)
|
|||||||
info.mtimeset = 1;
|
info.mtimeset = 1;
|
||||||
info.mtime = grub_zfs_to_cpu64 (((znode_phys_t *) DN_BONUS (&dn.dn))->zp_mtime[0],
|
info.mtime = grub_zfs_to_cpu64 (((znode_phys_t *) DN_BONUS (&dn.dn))->zp_mtime[0],
|
||||||
dn.endian);
|
dn.endian);
|
||||||
|
info.size = grub_zfs_to_cpu64 (((znode_phys_t *) DN_BONUS (&dn.dn))->zp_size, dn.endian);
|
||||||
}
|
}
|
||||||
info.dir = (dn.dn.dn_type == DMU_OT_DIRECTORY_CONTENTS);
|
info.dir = (dn.dn.dn_type == DMU_OT_DIRECTORY_CONTENTS);
|
||||||
grub_dprintf ("zfs", "type=%d, name=%s\n",
|
grub_dprintf ("zfs", "type=%d, name=%s\n",
|
||||||
|
|||||||
@@ -40,7 +40,8 @@ struct grub_archelp_ops
|
|||||||
grub_err_t
|
grub_err_t
|
||||||
(*find_file) (struct grub_archelp_data *data, char **name,
|
(*find_file) (struct grub_archelp_data *data, char **name,
|
||||||
grub_int32_t *mtime,
|
grub_int32_t *mtime,
|
||||||
grub_archelp_mode_t *mode);
|
grub_archelp_mode_t *mode,
|
||||||
|
grub_uint64_t *size);
|
||||||
|
|
||||||
char *
|
char *
|
||||||
(*get_link_target) (struct grub_archelp_data *data);
|
(*get_link_target) (struct grub_archelp_data *data);
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ struct grub_dirhook_info
|
|||||||
unsigned mtimeset:1;
|
unsigned mtimeset:1;
|
||||||
unsigned case_insensitive:1;
|
unsigned case_insensitive:1;
|
||||||
grub_int32_t mtime;
|
grub_int32_t mtime;
|
||||||
|
grub_off_t size;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef int (*grub_fs_dir_hook_t) (const char *filename,
|
typedef int (*grub_fs_dir_hook_t) (const char *filename,
|
||||||
|
|||||||
Reference in new issue
Block a user