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)
- grub_printf ("%-12llu", (unsigned long long) file->size);
+ grub_printf ("%-12llu", (unsigned long long) info->size);
else
- grub_printf ("%-12s", grub_get_human_size (file->size,
- GRUB_HUMAN_SIZE_SHORT));
- grub_file_close (file);
- grub_free (pathname);
+ grub_printf ("%-12s", grub_get_human_size (info->size,
+ GRUB_HUMAN_SIZE_SHORT));
}
else
grub_printf ("%-12s", _("DIR"));
info.dir = ((filetype & GRUB_FSHELP_TYPE_MASK) == GRUB_FSHELP_DIR);
info.mtimeset = 1;
info.mtime = aftime2ctime (&node->di.mtime);
+ info.size = grub_be_to_cpu32 (node->di.size);
grub_free (node);
return ctx->hook (filename, &info, ctx->hook_data);
}
{
grub_int32_t mtime;
grub_uint32_t mode;
+ grub_uint64_t size;
grub_err_t err;
- if (arcops->find_file (data, &name, &mtime, &mode))
+ if (arcops->find_file (data, &name, &mtime, &mode, &size))
goto fail;
if (mode == GRUB_ARCHELP_ATTR_END)
info.mtime = mtime;
info.mtimeset = 1;
}
+ info.size = size;
if (hook (n, &info, hook_data))
{
grub_free (name);
{
grub_uint32_t mode;
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;
if (mode == GRUB_ARCHELP_ATTR_END)
info.mtime = grub_bfs_to_cpu64 (ino.mtime) >> 16;
#endif
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);
}
else
{
info.mtime = grub_le_to_cpu64 (inode.mtime.sec);
+ info.size = grub_le_to_cpu64 (inode.size);
info.mtimeset = 1;
}
c = cdirel->name[grub_le_to_cpu16 (cdirel->n)];
static grub_err_t
grub_cbfs_find_file (struct grub_archelp_data *data, char **name,
grub_int32_t *mtime,
- grub_uint32_t *mode)
+ grub_uint32_t *mode,
+ grub_uint64_t *size)
{
grub_size_t offset;
for (;;
return GRUB_ERR_NONE;
}
data->size = grub_be_to_cpu32 (hd.len);
+ *size = grub_be_to_cpu32 (hd.len);
(void) mtime;
offset = grub_be_to_cpu32 (hd.offset);
static grub_err_t
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;
grub_size_t namesize;
data->dofs = data->hofs + ALIGN_CPIO (sizeof (hd) + namesize);
data->next_hofs = data->dofs + ALIGN_CPIO (data->size);
+ *size = data->size;
return GRUB_ERR_NONE;
}
{
info.mtimeset = 1;
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);
#endif
data->cur_cluster_num = ~0U;
+ info.size = data->file_size;
+
if (call_hook)
hook (ctxt.filename, &info, hook_data);
info.dir = 0;
info.mtimeset = 1;
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);
}
info.dir = ((filetype & GRUB_FSHELP_TYPE_MASK) == GRUB_FSHELP_DIR);
info.mtimeset = 1;
info.mtime = node->mtime;
+ info.size = node->size;
info.case_insensitive = !! (filetype & GRUB_FSHELP_CASE_INSENSITIVE);
grub_free (node);
return ctx->hook (filename, &info, ctx->hook_data);
grub_memset (&info, 0, sizeof (info));
info.dir = ((filetype & GRUB_FSHELP_TYPE_MASK) == GRUB_FSHELP_DIR);
info.mtimeset = !!iso9660_to_unixtime2 (&node->dirents[0].mtime, &info.mtime);
-
+ info.size = get_node_size (node);
grub_free (node);
return ctx->hook (filename, &info, ctx->hook_data);
}
& GRUB_JFS_FILETYPE_MASK) == GRUB_JFS_FILETYPE_DIR;
info.mtimeset = 1;
info.mtime = grub_le_to_cpu32 (inode.mtime.sec);
+ info.size = grub_le_to_cpu64 (inode.size);
if (hook (diro->name, &info, hook_data))
goto fail;
}
& GRUB_MINIX_IFDIR) == GRUB_MINIX_IFDIR);
info.mtimeset = 1;
info.mtime = grub_minix_to_cpu32 (data->inode.mtime);
+ info.size = GRUB_MINIX_INODE_SIZE (data);
if (hook (filename, &info, hook_data) ? 1 : 0)
break;
{
info.mtimeset = 1;
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);
grub_memset (&info, 0, sizeof (info));
info.dir = ((filetype & GRUB_FSHELP_TYPE_MASK) == GRUB_FSHELP_DIR);
+ init_file (node, node->ino);
info.mtimeset = 1;
info.mtime = grub_divmod64 (node->mtime, 10000000, 0)
- 86400ULL * 365 * (1970 - 1601)
- 86400ULL * ((1970 - 1601) / 4) + 86400ULL * ((1970 - 1601) / 100);
+ info.mtime = node->size;
+ free_file (node);
grub_free (node);
return ctx->hook (filename, &info, ctx->hook_data);
}
info.dir = ((filetype & GRUB_FSHELP_TYPE_MASK) == GRUB_FSHELP_DIR);
info.mtimeset = 1;
info.mtime = node->mtime;
+ info.size = node->size;
grub_free (node);
return ctx->hook (filename, &info, ctx->hook_data);
}
grub_memset (&info, 0, sizeof (info));
info.dir = ((filetype & GRUB_FSHELP_TYPE_MASK) == GRUB_FSHELP_DIR);
+ info.size = grub_be_to_cpu32 (node->file.size);
grub_free (node);
return ctx->hook (filename, &info, ctx->hook_data);
}
info.dir = ((filetype & GRUB_FSHELP_TYPE_MASK) == GRUB_FSHELP_DIR);
info.mtime = node->mtime + 8 * 365 * 86400 + 86400 * 2;
info.mtimeset = 1;
+ info.size = node->size;
grub_free (node->cache);
grub_free (node);
return ctx->hook (filename, &info, ctx->hook_data);
info.dir = ((filetype & GRUB_FSHELP_TYPE_MASK) == GRUB_FSHELP_DIR);
info.mtimeset = 1;
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);
return ctx->hook (filename, &info, ctx->hook_data);
}
static grub_err_t
grub_cpio_find_file (struct grub_archelp_data *data, char **name,
grub_int32_t *mtime,
- grub_uint32_t *mode)
+ grub_uint32_t *mode,
+ grub_uint64_t *size)
{
struct head hd;
int reread = 0, have_longname = 0, have_longlink = 0;
grub_memcpy (data->linkname, hd.linkname, sizeof (hd.linkname));
data->linkname[100] = 0;
}
+ *size = data->size;
return GRUB_ERR_NONE;
}
return GRUB_ERR_NONE;
info.mtimeset = !!grub_datetime2unixtime (&datetime, &info.mtime);
info.mtime -= 60 * tz;
+ info.size = U64 (node->block.fe.file_size);
}
grub_free (node);
return ctx->hook (filename, &info, ctx->hook_data);
#endif
info.mtimeset = 1;
+ info.size = grub_ufs_to_cpu64 (inode.size);
+
if (hook (filename, &info, hook_data))
{
grub_free (filename);
{
info.mtimeset = 1;
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);
grub_free (node);
info.mtimeset = 1;
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.size = grub_zfs_to_cpu64 (grub_get_unaligned64 ((char *) sahdrp + hdrsize + SA_SIZE_OFFSET), dn.endian);
+
}
if (dn.dn.dn_bonustype == DMU_OT_ZNODE)
info.mtimeset = 1;
info.mtime = grub_zfs_to_cpu64 (((znode_phys_t *) DN_BONUS (&dn.dn))->zp_mtime[0],
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);
grub_dprintf ("zfs", "type=%d, name=%s\n",
grub_err_t
(*find_file) (struct grub_archelp_data *data, char **name,
grub_int32_t *mtime,
- grub_archelp_mode_t *mode);
+ grub_archelp_mode_t *mode,
+ grub_uint64_t *size);
char *
(*get_link_target) (struct grub_archelp_data *data);
unsigned mtimeset:1;
unsigned case_insensitive:1;
grub_int32_t mtime;
+ grub_off_t size;
};
typedef int (*grub_fs_dir_hook_t) (const char *filename,