summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/genext2fs/genext2fs-1.4.1/0008-Separate-out-the-creation-of-the-filesystem-structur.patch
diff options
context:
space:
mode:
authorDexuan Cui <dexuan.cui@intel.com>2012-03-29 00:35:09 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-04-02 04:31:48 +0100
commit79c806cb404c2d85aeec45b40ea6adbeae9f6346 (patch)
tree5627bb72a24373b931e6a3d4190335bc904cfd88 /meta/recipes-devtools/genext2fs/genext2fs-1.4.1/0008-Separate-out-the-creation-of-the-filesystem-structur.patch
parent84b7541abc2d7e59c22891219fce97d320d3bb33 (diff)
downloadpoky-79c806cb404c2d85aeec45b40ea6adbeae9f6346.tar.gz
genext2fs: support large files and filesystems without using large amounts of memory
update_to_1.95.patch was generated by making a diff bewteen the 1.4.1 release and the latest 1.9.5 version in the cvs repo: http://genext2fs.cvs.sourceforge.net/viewvc/genext2fs/genext2fs/genext2fs.c?revision=1.95 The patches 0001-0019 come from mailing list of genext2fs-devel http://sourceforge.net/mailarchive/forum.php?forum_name=genext2fs-devel&max_rows=100&style=flat&viewmonth=201106 (From OE-Core rev: 8f17e499cf91191727c8767e839738cb39c21655) Signed-off-by: Dexuan Cui <dexuan.cui@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/genext2fs/genext2fs-1.4.1/0008-Separate-out-the-creation-of-the-filesystem-structur.patch')
-rw-r--r--meta/recipes-devtools/genext2fs/genext2fs-1.4.1/0008-Separate-out-the-creation-of-the-filesystem-structur.patch95
1 files changed, 95 insertions, 0 deletions
diff --git a/meta/recipes-devtools/genext2fs/genext2fs-1.4.1/0008-Separate-out-the-creation-of-the-filesystem-structur.patch b/meta/recipes-devtools/genext2fs/genext2fs-1.4.1/0008-Separate-out-the-creation-of-the-filesystem-structur.patch
new file mode 100644
index 0000000000..25adeb63c0
--- /dev/null
+++ b/meta/recipes-devtools/genext2fs/genext2fs-1.4.1/0008-Separate-out-the-creation-of-the-filesystem-structur.patch
@@ -0,0 +1,95 @@
1Upstream-Status: inappropriate
2
3From 797e8548e5857b7a0586b27a9bdcadbea1561d8d Mon Sep 17 00:00:00 2001
4From: Corey Minyard <cminyard@mvista.com>
5Date: Sun, 5 Jun 2011 14:53:57 -0500
6Subject: [PATCH 08/19] Separate out the creation of the filesystem structure.
7
8Consolidate some processing that occurs when allocating a filesystem
9structure.
10---
11 genext2fs.c | 49 +++++++++++++++++++++++++------------------------
12 1 files changed, 25 insertions(+), 24 deletions(-)
13
14diff --git a/genext2fs.c b/genext2fs.c
15index d130362..497c9af 100644
16--- a/genext2fs.c
17+++ b/genext2fs.c
18@@ -2240,6 +2240,29 @@ swap_badfs(filesystem *fs)
19 }
20 }
21
22+// Allocate a new filesystem structure, allocate internal memory,
23+// and initialize the contents.
24+static filesystem *
25+alloc_fs(uint32 nbblocks)
26+{
27+ filesystem *fs;
28+
29+ fs = malloc(sizeof(*fs));
30+ if (!fs)
31+ error_msg_and_die("not enough memory for filesystem");
32+ memset(fs, 0, sizeof(*fs));
33+ if(!(fs->data = calloc(nbblocks, BLOCKSIZE)))
34+ error_msg_and_die("not enough memory for filesystem");
35+ fs->hdlink_cnt = HDLINK_CNT;
36+ fs->hdlinks.hdl = calloc(sizeof(struct hdlink_s), fs->hdlink_cnt);
37+ if (!fs->hdlinks.hdl)
38+ error_msg_and_die("Not enough memory");
39+ fs->hdlinks.count = 0 ;
40+ fs->sb = (superblock *) (fs->data + BLOCKSIZE);
41+ fs->gd = (groupdescriptor *) (fs->sb + 1);
42+ return fs;
43+}
44+
45 // initialize an empty filesystem
46 static filesystem *
47 init_fs(int nbblocks, int nbinodes, int nbresrvd, int holes, uint32 fs_timestamp)
48@@ -2290,21 +2313,10 @@ init_fs(int nbblocks, int nbinodes, int nbresrvd, int holes, uint32 fs_timestamp
49 free_blocks = nbblocks - overhead_per_group*nbgroups - 1 /*boot block*/;
50 free_blocks_per_group = nbblocks_per_group - overhead_per_group;
51
52- fs = malloc(sizeof(*fs));
53- if (!fs)
54- error_msg_and_die("not enough memory for filesystem");
55+ fs = alloc_fs(nbblocks);
56 fs->nheadblocks = (((nbgroups * sizeof(groupdescriptor))
57 + sizeof(superblock) + (BLOCKSIZE - 1))
58 / BLOCKSIZE);
59- if(!(fs->data = calloc(nbblocks, BLOCKSIZE)))
60- error_msg_and_die("not enough memory for filesystem");
61- fs->hdlink_cnt = HDLINK_CNT;
62- fs->hdlinks.hdl = calloc(sizeof(struct hdlink_s), fs->hdlink_cnt);
63- if (!fs->hdlinks.hdl)
64- error_msg_and_die("Not enough memory");
65- fs->hdlinks.count = 0 ;
66- fs->sb = (superblock *) (fs->data + BLOCKSIZE);
67- fs->gd = (groupdescriptor *) (fs->sb + 1);
68
69 // create the superblock for an empty filesystem
70 fs->sb->s_inodes_count = nbinodes_per_group * nbgroups;
71@@ -2442,20 +2454,9 @@ load_fs(FILE * fh, int swapit)
72 fssize = (fssize + BLOCKSIZE - 1) / BLOCKSIZE;
73 if(fssize < 16) // totally arbitrary
74 error_msg_and_die("too small filesystem");
75- fs = malloc(sizeof(*fs));
76- if (!fs)
77- error_msg_and_die("not enough memory for filesystem");
78- fs->hdlink_cnt = HDLINK_CNT;
79- fs->hdlinks.hdl = calloc(sizeof(struct hdlink_s), fs->hdlink_cnt);
80- if (!fs->hdlinks.hdl)
81- error_msg_and_die("Not enough memory");
82- fs->hdlinks.count = 0 ;
83- if(!(fs->data = calloc(fssize, BLOCKSIZE)))
84- error_msg_and_die("not enough memory for filesystem");
85+ fs = alloc_fs(fssize);
86 if(fread(fs->data, BLOCKSIZE, fssize, fh) != fssize)
87 perror_msg_and_die("input filesystem image");
88- fs->sb = (superblock *) (fs->data + BLOCKSIZE);
89- fs->gd = (groupdescriptor *) (fs->sb + 1);
90
91 if(swapit)
92 swap_badfs(fs);
93--
941.7.4.1
95