~ubuntu-branches/ubuntu/trusty/grub2/trusty-updates

« back to all changes in this revision

Viewing changes to debian/patches/ext2_big_files.patch

  • Committer: Bazaar Package Importer
  • Author(s): Colin Watson
  • Date: 2011-02-08 11:39:26 UTC
  • mfrom: (17.6.26 experimental)
  • mto: (17.6.27 experimental)
  • mto: This revision was merged to the branch mainline in revision 104.
  • Revision ID: james.westby@ubuntu.com-20110208113926-clfs90haboyk9zip
Tags: 1.99~rc1-2
* Merge 1.98+20100804-13 and 1.98+20100804-14, updating translations:
  - Kazakh (Baurzhan Muftakhidinov / Timur Birsh).
* mkconfig_skip_dmcrypt.patch: Refer to GRUB_PRELOAD_MODULES rather than
  suggesting people write a /etc/grub.d/01_modules script (thanks, Jordan
  Uggla).
* Handle empty dir passed to grub_find_root_device_from_mountinfo; fixes
  grub-mkrelpath on btrfs subvolumes (LP: #712029).
* Add rootflags=subvol=<name> if / is on a btrfs subvolume (LP: #712029).
* Upload to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
Description: Support big ext2 files
2
 
Author: Vladimir Serbinenko <phcoder@gmail.com>
3
 
Origin: upstream, http://bazaar.launchpad.net/~vcs-imports/grub/grub2-bzr/revision/2936
4
 
Bug-Debian: http://bugs.debian.org/543924
5
 
Forwarded: yes
6
 
Last-Update: 2010-12-21
7
 
 
8
 
Index: b/fs/ext2.c
9
 
===================================================================
10
 
--- a/fs/ext2.c
11
 
+++ b/fs/ext2.c
12
 
@@ -229,7 +229,7 @@
13
 
   };
14
 
   grub_uint32_t version;
15
 
   grub_uint32_t acl;
16
 
-  grub_uint32_t dir_acl;
17
 
+  grub_uint32_t size_high;
18
 
   grub_uint32_t fragment_addr;
19
 
   grub_uint32_t osd2[3];
20
 
 };
21
 
@@ -470,10 +470,41 @@
22
 
       blknr = grub_le_to_cpu32 (indir[rblock % perblock]);
23
 
     }
24
 
   /* triple indirect.  */
25
 
+  else if (fileblock < INDIRECT_BLOCKS + blksz / 4 * (blksz / 4 + 1)
26
 
+          + (blksz / 4) * (blksz / 4) * (blksz / 4 + 1))
27
 
+    {
28
 
+      unsigned int perblock = blksz / 4;
29
 
+      unsigned int rblock = fileblock - (INDIRECT_BLOCKS + blksz / 4
30
 
+                                        * (blksz / 4 + 1));
31
 
+      grub_uint32_t indir[blksz / 4];
32
 
+
33
 
+      if (grub_disk_read (data->disk,
34
 
+                         ((grub_disk_addr_t)
35
 
+                          grub_le_to_cpu32 (inode->blocks.triple_indir_block))
36
 
+                         << log2_blksz,
37
 
+                         0, blksz, indir))
38
 
+       return grub_errno;
39
 
+
40
 
+      if (grub_disk_read (data->disk,
41
 
+                         ((grub_disk_addr_t)
42
 
+                          grub_le_to_cpu32 (indir[(rblock / perblock) / perblock]))
43
 
+                         << log2_blksz,
44
 
+                         0, blksz, indir))
45
 
+       return grub_errno;
46
 
+
47
 
+      if (grub_disk_read (data->disk,
48
 
+                         ((grub_disk_addr_t)
49
 
+                          grub_le_to_cpu32 (indir[(rblock / perblock) % perblock]))
50
 
+                         << log2_blksz,
51
 
+                         0, blksz, indir))
52
 
+       return grub_errno;
53
 
+
54
 
+      blknr = grub_le_to_cpu32 (indir[rblock % perblock]);
55
 
+    }
56
 
   else
57
 
     {
58
 
       grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
59
 
-                 "ext2fs doesn't support triple indirect blocks");
60
 
+                 "ext2fs doesn't support quadruple indirect blocks");
61
 
     }
62
 
 
63
 
   return blknr;
64
 
@@ -485,11 +516,12 @@
65
 
 grub_ext2_read_file (grub_fshelp_node_t node,
66
 
                     void NESTED_FUNC_ATTR (*read_hook) (grub_disk_addr_t sector,
67
 
                                        unsigned offset, unsigned length),
68
 
-                    int pos, grub_size_t len, char *buf)
69
 
+                    grub_off_t pos, grub_size_t len, char *buf)
70
 
 {
71
 
   return grub_fshelp_read_file (node->data->disk, node, read_hook,
72
 
                                pos, len, buf, grub_ext2_read_block,
73
 
-                               node->inode.size,
74
 
+                               grub_cpu_to_le32 (node->inode.size)
75
 
+                               | (((grub_off_t) grub_cpu_to_le32 (node->inode.size_high)) << 32),
76
 
                                LOG2_EXT2_BLOCK_SIZE (node->data));
77
 
 
78
 
 }
79
 
@@ -751,6 +783,7 @@
80
 
   grub_free (fdiro);
81
 
 
82
 
   file->size = grub_le_to_cpu32 (data->inode->size);
83
 
+  file->size |= ((grub_off_t) grub_le_to_cpu32 (data->inode->size_high)) << 32;
84
 
   file->data = data;
85
 
   file->offset = 0;
86