* grub-core/fs/hfspluscomp.c (hfsplus_read_compressed_real): Call

file_progress_read_hook.
	* grub-core/fs/ntfscomp.c (hfsplus_read_compressed_real): Likewise.
This commit is contained in:
Vladimir Serbinenko 2013-11-02 16:30:53 +01:00
parent 2855a0fcce
commit f169f65e75
7 changed files with 47 additions and 0 deletions

View file

@ -226,6 +226,9 @@ read_block (struct grub_ntfs_rlst *ctx, grub_uint8_t *buf, grub_size_t num)
{
grub_memset (buf, 0, nn * GRUB_NTFS_COM_LEN);
buf += nn * GRUB_NTFS_COM_LEN;
if (grub_file_progress_hook && ctx->file)
grub_file_progress_hook (0, 0, nn * GRUB_NTFS_COM_LEN,
ctx->file);
}
}
else
@ -236,6 +239,9 @@ read_block (struct grub_ntfs_rlst *ctx, grub_uint8_t *buf, grub_size_t num)
return grub_errno;
if (buf)
buf += GRUB_NTFS_COM_LEN;
if (grub_file_progress_hook && ctx->file)
grub_file_progress_hook (0, 0, GRUB_NTFS_COM_LEN,
ctx->file);
nn--;
}
}
@ -262,6 +268,11 @@ read_block (struct grub_ntfs_rlst *ctx, grub_uint8_t *buf, grub_size_t num)
ctx->target_vcn)) << ctx->comp.log_spc, 0,
tt << (ctx->comp.log_spc + GRUB_NTFS_BLK_SHR), buf))
return grub_errno;
if (grub_file_progress_hook && ctx->file)
grub_file_progress_hook (0, 0,
tt << (ctx->comp.log_spc
+ GRUB_NTFS_BLK_SHR),
ctx->file);
buf += tt << (ctx->comp.log_spc + GRUB_NTFS_BLK_SHR);
}
nn -= tt;
@ -280,6 +291,11 @@ read_block (struct grub_ntfs_rlst *ctx, grub_uint8_t *buf, grub_size_t num)
nn << (ctx->comp.log_spc + GRUB_NTFS_BLK_SHR), buf))
return grub_errno;
buf += nn << (ctx->comp.log_spc + GRUB_NTFS_BLK_SHR);
if (grub_file_progress_hook && ctx->file)
grub_file_progress_hook (0, 0,
nn << (ctx->comp.log_spc
+ GRUB_NTFS_BLK_SHR),
ctx->file);
}
ctx->target_vcn += nn;
}
@ -306,6 +322,8 @@ ntfscomp (grub_uint8_t *dest, grub_disk_addr_t ofs,
n = len;
grub_memcpy (dest, ctx->attr->sbuf + ofs - ctx->attr->save_pos, n);
if (grub_file_progress_hook && ctx->file)
grub_file_progress_hook (0, 0, n, ctx->file);
if (n == len)
return 0;
@ -351,6 +369,9 @@ ntfscomp (grub_uint8_t *dest, grub_disk_addr_t ofs,
if (ofs % GRUB_NTFS_COM_LEN)
{
grub_uint32_t t, n, o;
void *file = ctx->file;
ctx->file = 0;
t = ctx->target_vcn << (ctx->comp.log_spc + GRUB_NTFS_BLK_SHR);
if (read_block (ctx, ctx->attr->sbuf, 1))
@ -359,6 +380,8 @@ ntfscomp (grub_uint8_t *dest, grub_disk_addr_t ofs,
goto quit;
}
ctx->file = file;
ctx->attr->save_pos = t;
o = ofs % GRUB_NTFS_COM_LEN;
@ -366,6 +389,8 @@ ntfscomp (grub_uint8_t *dest, grub_disk_addr_t ofs,
if (n > len)
n = len;
grub_memcpy (dest, &ctx->attr->sbuf[o], n);
if (grub_file_progress_hook && ctx->file)
grub_file_progress_hook (0, 0, n, ctx->file);
if (n == len)
goto quit;
dest += n;
@ -383,7 +408,9 @@ ntfscomp (grub_uint8_t *dest, grub_disk_addr_t ofs,
if (len)
{
grub_uint32_t t;
void *file = ctx->file;
ctx->file = 0;
t = ctx->target_vcn << (ctx->comp.log_spc + GRUB_NTFS_BLK_SHR);
if (read_block (ctx, ctx->attr->sbuf, 1))
{
@ -394,6 +421,8 @@ ntfscomp (grub_uint8_t *dest, grub_disk_addr_t ofs,
ctx->attr->save_pos = t;
grub_memcpy (dest, ctx->attr->sbuf, len);
if (grub_file_progress_hook && file)
grub_file_progress_hook (0, 0, len, file);
}
quit: