]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
* grub-core/fs/hfspluscomp.c (hfsplus_read_compressed_real): Call
authorVladimir Serbinenko <phcoder@gmail.com>
Sat, 2 Nov 2013 15:30:53 +0000 (16:30 +0100)
committerVladimir Serbinenko <phcoder@gmail.com>
Sat, 2 Nov 2013 15:30:53 +0000 (16:30 +0100)
file_progress_read_hook.
* grub-core/fs/ntfscomp.c (hfsplus_read_compressed_real): Likewise.

ChangeLog
grub-core/fs/hfsplus.c
grub-core/fs/hfspluscomp.c
grub-core/fs/ntfs.c
grub-core/fs/ntfscomp.c
include/grub/hfsplus.h
include/grub/ntfs.h

index 7f879adacc22a6998263bffb2a230105751186c2..f48ffefa499df406d3be5cb633d0c2a8e66d2828 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
index 7905624508a903b38f8c52bd3e3965091b79ca90..a119c7ace2d6717b19c2f7e2798b54009ccedb05 100644 (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);
index 13e4671e67f8f6cd4d599de431fc574d343bf124..59cb8cbc0cac64f3a43c46b7ddeba5064107f442 100644 (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;
index a0ae44200afc017a18c338fd9430cf205050c7a4..83ba5698c0187094a0b001dd86418443d80cbb90 100644 (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))
index c1d2d30cb6fe9b430c697c33d4bd005bbeaa9acb..2e1ce51a8556bec6cff04a3eec596d20a2a251eb 100644 (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:
index 0defd35b3e2037b341b37c60afdb4bd697b506f5..842554e04b83b5da6c27ab6a84d0b6b1240e1598 100644 (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;
index 0ae3defdf255a3ca6c9d6fe820c87beb9e18861c..af3f4b05df5044d64c776ce9dd51436ceddaddef 100644 (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,