diff options
Diffstat (limited to 'meta/recipes-devtools/genext2fs/genext2fs-1.4.1/0007-Move-hdlinks-into-the-filesystem-structure.patch')
-rw-r--r-- | meta/recipes-devtools/genext2fs/genext2fs-1.4.1/0007-Move-hdlinks-into-the-filesystem-structure.patch | 175 |
1 files changed, 0 insertions, 175 deletions
diff --git a/meta/recipes-devtools/genext2fs/genext2fs-1.4.1/0007-Move-hdlinks-into-the-filesystem-structure.patch b/meta/recipes-devtools/genext2fs/genext2fs-1.4.1/0007-Move-hdlinks-into-the-filesystem-structure.patch deleted file mode 100644 index 52215c8e7a..0000000000 --- a/meta/recipes-devtools/genext2fs/genext2fs-1.4.1/0007-Move-hdlinks-into-the-filesystem-structure.patch +++ /dev/null | |||
@@ -1,175 +0,0 @@ | |||
1 | Upstream-Status: inappropriate | ||
2 | |||
3 | From 1ea2332c6cec1fb979a7cb4502360005bed50da4 Mon Sep 17 00:00:00 2001 | ||
4 | From: Corey Minyard <cminyard@mvista.com> | ||
5 | Date: Sun, 5 Jun 2011 14:08:02 -0500 | ||
6 | Subject: [PATCH 07/19] Move hdlinks into the filesystem structure. | ||
7 | |||
8 | Since the hard links structures are associated with a filesystem, put | ||
9 | them in the filesystem structure since it can hold other stuff now. | ||
10 | --- | ||
11 | genext2fs.c | 71 +++++++++++++++++++++++++++++++--------------------------- | ||
12 | 1 files changed, 38 insertions(+), 33 deletions(-) | ||
13 | |||
14 | diff --git a/genext2fs.c b/genext2fs.c | ||
15 | index e45e520..d130362 100644 | ||
16 | --- a/genext2fs.c | ||
17 | +++ b/genext2fs.c | ||
18 | @@ -583,6 +583,18 @@ typedef struct | ||
19 | uint32 bptind; | ||
20 | } blockwalker; | ||
21 | |||
22 | +#define HDLINK_CNT 16 | ||
23 | +struct hdlink_s | ||
24 | +{ | ||
25 | + uint32 src_inode; | ||
26 | + uint32 dst_nod; | ||
27 | +}; | ||
28 | + | ||
29 | +struct hdlinks_s | ||
30 | +{ | ||
31 | + int32 count; | ||
32 | + struct hdlink_s *hdl; | ||
33 | +}; | ||
34 | |||
35 | /* Filesystem structure that support groups */ | ||
36 | #if BLOCKSIZE == 1024 | ||
37 | @@ -592,6 +604,8 @@ typedef struct | ||
38 | superblock *sb; | ||
39 | groupdescriptor *gd; | ||
40 | uint32 nheadblocks; | ||
41 | + int32 hdlink_cnt; | ||
42 | + struct hdlinks_s hdlinks; | ||
43 | } filesystem; | ||
44 | #else | ||
45 | #error UNHANDLED BLOCKSIZE | ||
46 | @@ -615,22 +629,6 @@ typedef struct | ||
47 | #define udecl32(x) this->x = swab32(this->x); | ||
48 | #define utdecl32(x,n) { int i; for(i=0; i<n; i++) this->x[i] = swab32(this->x[i]); } | ||
49 | |||
50 | -#define HDLINK_CNT 16 | ||
51 | -static int32 hdlink_cnt = HDLINK_CNT; | ||
52 | -struct hdlink_s | ||
53 | -{ | ||
54 | - uint32 src_inode; | ||
55 | - uint32 dst_nod; | ||
56 | -}; | ||
57 | - | ||
58 | -struct hdlinks_s | ||
59 | -{ | ||
60 | - int32 count; | ||
61 | - struct hdlink_s *hdl; | ||
62 | -}; | ||
63 | - | ||
64 | -static struct hdlinks_s hdlinks; | ||
65 | - | ||
66 | static void | ||
67 | swap_sb(superblock *sb) | ||
68 | { | ||
69 | @@ -787,12 +785,12 @@ xreadlink(const char *path) | ||
70 | } | ||
71 | |||
72 | int | ||
73 | -is_hardlink(ino_t inode) | ||
74 | +is_hardlink(filesystem *fs, ino_t inode) | ||
75 | { | ||
76 | int i; | ||
77 | |||
78 | - for(i = 0; i < hdlinks.count; i++) { | ||
79 | - if(hdlinks.hdl[i].src_inode == inode) | ||
80 | + for(i = 0; i < fs->hdlinks.count; i++) { | ||
81 | + if(fs->hdlinks.hdl[i].src_inode == inode) | ||
82 | return i; | ||
83 | } | ||
84 | return -1; | ||
85 | @@ -1989,9 +1987,9 @@ add2fs_from_dir(filesystem *fs, uint32 this_nod, int squash_uids, int squash_per | ||
86 | save_nod = 0; | ||
87 | /* Check for hardlinks */ | ||
88 | if (!S_ISDIR(st.st_mode) && !S_ISLNK(st.st_mode) && st.st_nlink > 1) { | ||
89 | - int32 hdlink = is_hardlink(st.st_ino); | ||
90 | + int32 hdlink = is_hardlink(fs, st.st_ino); | ||
91 | if (hdlink >= 0) { | ||
92 | - add2dir(fs, this_nod, hdlinks.hdl[hdlink].dst_nod, name); | ||
93 | + add2dir(fs, this_nod, fs->hdlinks.hdl[hdlink].dst_nod, name); | ||
94 | continue; | ||
95 | } else { | ||
96 | save_nod = 1; | ||
97 | @@ -2035,17 +2033,17 @@ add2fs_from_dir(filesystem *fs, uint32 this_nod, int squash_uids, int squash_per | ||
98 | error_msg("ignoring entry %s", name); | ||
99 | } | ||
100 | if (save_nod) { | ||
101 | - if (hdlinks.count == hdlink_cnt) { | ||
102 | - if ((hdlinks.hdl = | ||
103 | - realloc (hdlinks.hdl, (hdlink_cnt + HDLINK_CNT) * | ||
104 | + if (fs->hdlinks.count == fs->hdlink_cnt) { | ||
105 | + if ((fs->hdlinks.hdl = | ||
106 | + realloc (fs->hdlinks.hdl, (fs->hdlink_cnt + HDLINK_CNT) * | ||
107 | sizeof (struct hdlink_s))) == NULL) { | ||
108 | error_msg_and_die("Not enough memory"); | ||
109 | } | ||
110 | - hdlink_cnt += HDLINK_CNT; | ||
111 | + fs->hdlink_cnt += HDLINK_CNT; | ||
112 | } | ||
113 | - hdlinks.hdl[hdlinks.count].src_inode = st.st_ino; | ||
114 | - hdlinks.hdl[hdlinks.count].dst_nod = nod; | ||
115 | - hdlinks.count++; | ||
116 | + fs->hdlinks.hdl[fs->hdlinks.count].src_inode = st.st_ino; | ||
117 | + fs->hdlinks.hdl[fs->hdlinks.count].dst_nod = nod; | ||
118 | + fs->hdlinks.count++; | ||
119 | } | ||
120 | } | ||
121 | } | ||
122 | @@ -2300,6 +2298,11 @@ init_fs(int nbblocks, int nbinodes, int nbresrvd, int holes, uint32 fs_timestamp | ||
123 | / BLOCKSIZE); | ||
124 | if(!(fs->data = calloc(nbblocks, BLOCKSIZE))) | ||
125 | error_msg_and_die("not enough memory for filesystem"); | ||
126 | + fs->hdlink_cnt = HDLINK_CNT; | ||
127 | + fs->hdlinks.hdl = calloc(sizeof(struct hdlink_s), fs->hdlink_cnt); | ||
128 | + if (!fs->hdlinks.hdl) | ||
129 | + error_msg_and_die("Not enough memory"); | ||
130 | + fs->hdlinks.count = 0 ; | ||
131 | fs->sb = (superblock *) (fs->data + BLOCKSIZE); | ||
132 | fs->gd = (groupdescriptor *) (fs->sb + 1); | ||
133 | |||
134 | @@ -2442,12 +2445,18 @@ load_fs(FILE * fh, int swapit) | ||
135 | fs = malloc(sizeof(*fs)); | ||
136 | if (!fs) | ||
137 | error_msg_and_die("not enough memory for filesystem"); | ||
138 | + fs->hdlink_cnt = HDLINK_CNT; | ||
139 | + fs->hdlinks.hdl = calloc(sizeof(struct hdlink_s), fs->hdlink_cnt); | ||
140 | + if (!fs->hdlinks.hdl) | ||
141 | + error_msg_and_die("Not enough memory"); | ||
142 | + fs->hdlinks.count = 0 ; | ||
143 | if(!(fs->data = calloc(fssize, BLOCKSIZE))) | ||
144 | error_msg_and_die("not enough memory for filesystem"); | ||
145 | if(fread(fs->data, BLOCKSIZE, fssize, fh) != fssize) | ||
146 | perror_msg_and_die("input filesystem image"); | ||
147 | fs->sb = (superblock *) (fs->data + BLOCKSIZE); | ||
148 | fs->gd = (groupdescriptor *) (fs->sb + 1); | ||
149 | + | ||
150 | if(swapit) | ||
151 | swap_badfs(fs); | ||
152 | if(fs->sb->s_rev_level || (fs->sb->s_magic != EXT2_MAGIC_NUMBER)) | ||
153 | @@ -2461,6 +2470,7 @@ load_fs(FILE * fh, int swapit) | ||
154 | static void | ||
155 | free_fs(filesystem *fs) | ||
156 | { | ||
157 | + free(fs->hdlinks.hdl); | ||
158 | free(fs->data); | ||
159 | free(fs); | ||
160 | } | ||
161 | @@ -2964,11 +2974,6 @@ main(int argc, char **argv) | ||
162 | error_msg_and_die("Not enough arguments. Try --help or else see the man page."); | ||
163 | fsout = argv[optind]; | ||
164 | |||
165 | - hdlinks.hdl = (struct hdlink_s *)malloc(hdlink_cnt * sizeof(struct hdlink_s)); | ||
166 | - if (!hdlinks.hdl) | ||
167 | - error_msg_and_die("Not enough memory"); | ||
168 | - hdlinks.count = 0 ; | ||
169 | - | ||
170 | if(fsin) | ||
171 | { | ||
172 | if(strcmp(fsin, "-")) | ||
173 | -- | ||
174 | 1.7.4.1 | ||
175 | |||