* include/grub/ntfs.h (grub_ntfs_comp_table_element): New struct.

(grub_ntfs_comp): Use grub_ntfs_comp_table_element for comp_table.
	All users updated.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2012-05-15 17:09:14 +02:00
parent 5fc23ab2d8
commit e28e5fe519
3 changed files with 22 additions and 10 deletions

View file

@ -1,3 +1,9 @@
2012-05-15 Vladimir Serbinenko <phcoder@gmail.com>
* include/grub/ntfs.h (grub_ntfs_comp_table_element): New struct.
(grub_ntfs_comp): Use grub_ntfs_comp_table_element for comp_table.
All users updated.
2012-05-14 Vladimir Serbinenko <phcoder@gmail.com>
* Makefile.am (starfield_DATA): Replace dejavu.pf2 with dejavu_10.pf2,

View file

@ -32,12 +32,12 @@ decomp_nextvcn (struct grub_ntfs_comp *cc)
return grub_error (GRUB_ERR_BAD_FS, "compression block overflown");
if (grub_disk_read
(cc->disk,
(cc->comp_table[cc->comp_head][1] -
(cc->comp_table[cc->comp_head][0] - cc->cbuf_vcn)) * cc->spc, 0,
(cc->comp_table[cc->comp_head].next_lcn -
(cc->comp_table[cc->comp_head].next_vcn - cc->cbuf_vcn)) * cc->spc, 0,
cc->spc << GRUB_NTFS_BLK_SHR, cc->cbuf))
return grub_errno;
cc->cbuf_vcn++;
if ((cc->cbuf_vcn >= cc->comp_table[cc->comp_head][0]))
if ((cc->cbuf_vcn >= cc->comp_table[cc->comp_head].next_vcn))
cc->comp_head++;
cc->cbuf_ofs = 0;
return 0;
@ -202,8 +202,8 @@ read_block (struct grub_ntfs_rlst *ctx, char *buf, grub_size_t num)
{
if (ctx->flags & GRUB_NTFS_RF_BLNK)
break;
ctx->comp.comp_table[ctx->comp.comp_tail][0] = ctx->next_vcn;
ctx->comp.comp_table[ctx->comp.comp_tail][1] =
ctx->comp.comp_table[ctx->comp.comp_tail].next_vcn = ctx->next_vcn;
ctx->comp.comp_table[ctx->comp.comp_tail].next_lcn =
ctx->curr_lcn + ctx->next_vcn - ctx->curr_vcn;
ctx->comp.comp_tail++;
if (grub_ntfs_read_run_list (ctx))
@ -247,7 +247,7 @@ read_block (struct grub_ntfs_rlst *ctx, char *buf, grub_size_t num)
grub_disk_addr_t tt;
tt =
ctx->comp.comp_table[ctx->comp.comp_head][0] -
ctx->comp.comp_table[ctx->comp.comp_head].next_vcn -
ctx->target_vcn;
if (tt > nn)
tt = nn;
@ -256,8 +256,8 @@ read_block (struct grub_ntfs_rlst *ctx, char *buf, grub_size_t num)
{
if (grub_disk_read
(ctx->comp.disk,
(ctx->comp.comp_table[ctx->comp.comp_head][1] -
(ctx->comp.comp_table[ctx->comp.comp_head][0] -
(ctx->comp.comp_table[ctx->comp.comp_head].next_lcn -
(ctx->comp.comp_table[ctx->comp.comp_head].next_vcn -
ctx->target_vcn)) * ctx->comp.spc, 0,
tt * (ctx->comp.spc << GRUB_NTFS_BLK_SHR), buf))
return grub_errno;
@ -265,7 +265,7 @@ read_block (struct grub_ntfs_rlst *ctx, char *buf, grub_size_t num)
}
nn -= tt;
if (ctx->target_vcn >=
ctx->comp.comp_table[ctx->comp.comp_head][0])
ctx->comp.comp_table[ctx->comp.comp_head].next_vcn)
ctx->comp.comp_head++;
}
if (nn)

View file

@ -161,11 +161,17 @@ struct grub_ntfs_data
grub_uint64_t uuid;
};
struct grub_ntfs_comp_table_element
{
grub_uint32_t next_vcn;
grub_uint32_t next_lcn;
};
struct grub_ntfs_comp
{
grub_disk_t disk;
int comp_head, comp_tail;
grub_uint32_t comp_table[16][2];
struct grub_ntfs_comp_table_element comp_table[16];
grub_uint32_t cbuf_ofs, cbuf_vcn, spc;
char *cbuf;
};