* 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

@ -1,3 +1,9 @@
2013-11-02 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/fs/hfspluscomp.c (hfsplus_read_compressed_real): Call
file_progress_read_hook.
* grub-core/fs/ntfscomp.c (hfsplus_read_compressed_real): Likewise.
2013-11-02 Vladimir Serbinenko <phcoder@gmail.com>
* conf/Makefile.common (CFLAGS_PLATFORM): Remove poisoning of float

View file

@ -888,6 +888,8 @@ grub_hfsplus_read (grub_file_t file, char *buf, grub_size_t len)
struct grub_hfsplus_data *data =
(struct grub_hfsplus_data *) file->data;
data->opened_file.file = file;
if (grub_hfsplus_read_compressed && data->opened_file.compressed)
return grub_hfsplus_read_compressed (&data->opened_file,
file->offset, len, buf);

View file

@ -23,6 +23,7 @@
#include <grub/misc.h>
#include <grub/mm.h>
#include <grub/deflate.h>
#include <grub/file.h>
GRUB_MOD_LICENSE ("GPLv3+");
@ -121,6 +122,8 @@ hfsplus_read_compressed_real (struct grub_hfsplus_file *node,
if (node->compressed == 1)
{
grub_memcpy (buf, node->cbuf + pos, len);
if (grub_file_progress_hook && node->file)
grub_file_progress_hook (0, 0, len, node->file);
return len;
}
@ -162,6 +165,8 @@ hfsplus_read_compressed_real (struct grub_hfsplus_file *node,
}
grub_memcpy (buf, node->cbuf + (pos % HFSPLUS_COMPRESS_BLOCK_SIZE),
curlen);
if (grub_file_progress_hook && node->file)
grub_file_progress_hook (0, 0, curlen, node->file);
buf += curlen;
pos += curlen;
len -= curlen;

View file

@ -378,6 +378,9 @@ read_data (struct grub_ntfs_attr *at, grub_uint8_t *pa, grub_uint8_t *dest,
ctx->comp.log_spc = at->mft->data->log_spc;
ctx->comp.disk = at->mft->data->disk;
if (read_hook == grub_file_progress_hook)
ctx->file = read_hook_data;
if (pa[8] == 0)
{
if (ofs + len > u32at (pa, 0x10))

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:

View file

@ -56,6 +56,7 @@ struct grub_hfsplus_file
grub_int32_t mtime;
int compressed;
char *cbuf;
void *file;
struct grub_hfsplus_compress_index *compress_index;
grub_uint32_t cbuf_block;
grub_uint32_t compress_index_size;

View file

@ -183,6 +183,7 @@ struct grub_ntfs_rlst
grub_uint8_t *cur_run;
struct grub_ntfs_attr *attr;
struct grub_ntfs_comp comp;
void *file;
};
typedef grub_err_t (*grub_ntfscomp_func_t) (grub_uint8_t *dest,