From 79c806cb404c2d85aeec45b40ea6adbeae9f6346 Mon Sep 17 00:00:00 2001 From: Dexuan Cui Date: Thu, 29 Mar 2012 00:35:09 +0800 Subject: 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 Signed-off-by: Richard Purdie --- ...t-the-creation-of-the-filesystem-structur.patch | 95 ++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 meta/recipes-devtools/genext2fs/genext2fs-1.4.1/0008-Separate-out-the-creation-of-the-filesystem-structur.patch (limited to 'meta/recipes-devtools/genext2fs/genext2fs-1.4.1/0008-Separate-out-the-creation-of-the-filesystem-structur.patch') 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 @@ +Upstream-Status: inappropriate + +From 797e8548e5857b7a0586b27a9bdcadbea1561d8d Mon Sep 17 00:00:00 2001 +From: Corey Minyard +Date: Sun, 5 Jun 2011 14:53:57 -0500 +Subject: [PATCH 08/19] Separate out the creation of the filesystem structure. + +Consolidate some processing that occurs when allocating a filesystem +structure. +--- + genext2fs.c | 49 +++++++++++++++++++++++++------------------------ + 1 files changed, 25 insertions(+), 24 deletions(-) + +diff --git a/genext2fs.c b/genext2fs.c +index d130362..497c9af 100644 +--- a/genext2fs.c ++++ b/genext2fs.c +@@ -2240,6 +2240,29 @@ swap_badfs(filesystem *fs) + } + } + ++// Allocate a new filesystem structure, allocate internal memory, ++// and initialize the contents. ++static filesystem * ++alloc_fs(uint32 nbblocks) ++{ ++ filesystem *fs; ++ ++ fs = malloc(sizeof(*fs)); ++ if (!fs) ++ error_msg_and_die("not enough memory for filesystem"); ++ memset(fs, 0, sizeof(*fs)); ++ if(!(fs->data = calloc(nbblocks, BLOCKSIZE))) ++ error_msg_and_die("not enough memory for filesystem"); ++ fs->hdlink_cnt = HDLINK_CNT; ++ fs->hdlinks.hdl = calloc(sizeof(struct hdlink_s), fs->hdlink_cnt); ++ if (!fs->hdlinks.hdl) ++ error_msg_and_die("Not enough memory"); ++ fs->hdlinks.count = 0 ; ++ fs->sb = (superblock *) (fs->data + BLOCKSIZE); ++ fs->gd = (groupdescriptor *) (fs->sb + 1); ++ return fs; ++} ++ + // initialize an empty filesystem + static filesystem * + init_fs(int nbblocks, int nbinodes, int nbresrvd, int holes, uint32 fs_timestamp) +@@ -2290,21 +2313,10 @@ init_fs(int nbblocks, int nbinodes, int nbresrvd, int holes, uint32 fs_timestamp + free_blocks = nbblocks - overhead_per_group*nbgroups - 1 /*boot block*/; + free_blocks_per_group = nbblocks_per_group - overhead_per_group; + +- fs = malloc(sizeof(*fs)); +- if (!fs) +- error_msg_and_die("not enough memory for filesystem"); ++ fs = alloc_fs(nbblocks); + fs->nheadblocks = (((nbgroups * sizeof(groupdescriptor)) + + sizeof(superblock) + (BLOCKSIZE - 1)) + / BLOCKSIZE); +- if(!(fs->data = calloc(nbblocks, BLOCKSIZE))) +- error_msg_and_die("not enough memory for filesystem"); +- fs->hdlink_cnt = HDLINK_CNT; +- fs->hdlinks.hdl = calloc(sizeof(struct hdlink_s), fs->hdlink_cnt); +- if (!fs->hdlinks.hdl) +- error_msg_and_die("Not enough memory"); +- fs->hdlinks.count = 0 ; +- fs->sb = (superblock *) (fs->data + BLOCKSIZE); +- fs->gd = (groupdescriptor *) (fs->sb + 1); + + // create the superblock for an empty filesystem + fs->sb->s_inodes_count = nbinodes_per_group * nbgroups; +@@ -2442,20 +2454,9 @@ load_fs(FILE * fh, int swapit) + fssize = (fssize + BLOCKSIZE - 1) / BLOCKSIZE; + if(fssize < 16) // totally arbitrary + error_msg_and_die("too small filesystem"); +- fs = malloc(sizeof(*fs)); +- if (!fs) +- error_msg_and_die("not enough memory for filesystem"); +- fs->hdlink_cnt = HDLINK_CNT; +- fs->hdlinks.hdl = calloc(sizeof(struct hdlink_s), fs->hdlink_cnt); +- if (!fs->hdlinks.hdl) +- error_msg_and_die("Not enough memory"); +- fs->hdlinks.count = 0 ; +- if(!(fs->data = calloc(fssize, BLOCKSIZE))) +- error_msg_and_die("not enough memory for filesystem"); ++ fs = alloc_fs(fssize); + if(fread(fs->data, BLOCKSIZE, fssize, fh) != fssize) + perror_msg_and_die("input filesystem image"); +- fs->sb = (superblock *) (fs->data + BLOCKSIZE); +- fs->gd = (groupdescriptor *) (fs->sb + 1); + + if(swapit) + swap_badfs(fs); +-- +1.7.4.1 + -- cgit v1.2.3-54-g00ecf