Lines Matching refs:dir

30 @@ -254,7 +254,7 @@ static struct dir *squashfs_opendir(unsigned int block_start, unsigned int offse
36 struct dir *dir;
39 @@ -267,7 +267,7 @@ static struct dir *squashfs_opendir(unsigned int block_start, unsigned int offse
42 dir->dir_count = 0;
43 - dir->cur_entry = 0;
44 + dir->cur_entry = NULL;
45 dir->mode = (*i)->mode;
46 dir->uid = (*i)->uid;
47 dir->guid = (*i)->gid;
48 @@ -351,20 +351,20 @@ static struct dir *squashfs_opendir(unsigned int block_start, unsigned int of…
52 - if((dir->dir_count % DIR_ENT_SIZE) == 0) {
53 - new_dir = realloc(dir->dirs, (dir->dir_count +
58 - dir->dirs = new_dir;
64 - dir->dirs[dir->dir_count].name = strdup(dire->name);
65 - dir->dirs[dir->dir_count].start_block =
67 - dir->dirs[dir->dir_count].offset = dire->offset;
68 - dir->dirs[dir->dir_count].type = dire->type;
75 + dir->dirs = ent;
79 dir->dir_count ++;
88 void squashfs_closedir(struct dir *dir)
91 + struct dir_ent *ent = dir->dirs;
93 - for(i = 0; i < dir->dir_count; i++)
94 - free(dir->dirs[i].name);
103 - free(dir->dirs);
104 free(dir);
110 @@ -347,7 +347,7 @@ static struct dir *squashfs_opendir(unsigned int block_start, unsigned int offse
116 struct dir *dir;
119 @@ -360,7 +360,7 @@ static struct dir *squashfs_opendir(unsigned int block_start, unsigned int offse
122 dir->dir_count = 0;
123 - dir->cur_entry = 0;
124 + dir->cur_entry = NULL;
125 dir->mode = (*i)->mode;
126 dir->uid = (*i)->uid;
127 dir->guid = (*i)->gid;
128 @@ -444,19 +444,20 @@ static struct dir *squashfs_opendir(unsigned int block_start, unsigned int of…
132 - if((dir->dir_count % DIR_ENT_SIZE) == 0) {
133 - new_dir = realloc(dir->dirs, (dir->dir_count +
137 - dir->dirs = new_dir;
143 - dir->dirs[dir->dir_count].name = strdup(dire->name);
144 - dir->dirs[dir->dir_count].start_block =
146 - dir->dirs[dir->dir_count].offset = dire->offset;
147 - dir->dirs[dir->dir_count].type = dire->type;
154 + dir->dirs = ent;
158 dir->dir_count ++;
165 @@ -381,7 +381,7 @@ static struct dir *squashfs_opendir(unsigned int block_start, unsigned int offse
171 struct dir *dir;
174 @@ -394,7 +394,7 @@ static struct dir *squashfs_opendir(unsigned int block_start, unsigned int offse
177 dir->dir_count = 0;
178 - dir->cur_entry = 0;
179 + dir->cur_entry = NULL;
180 dir->mode = (*i)->mode;
181 dir->uid = (*i)->uid;
182 dir->guid = (*i)->gid;
183 @@ -478,19 +478,20 @@ static struct dir *squashfs_opendir(unsigned int block_start, unsigned int of…
187 - if((dir->dir_count % DIR_ENT_SIZE) == 0) {
188 - new_dir = realloc(dir->dirs, (dir->dir_count +
192 - dir->dirs = new_dir;
198 - dir->dirs[dir->dir_count].name = strdup(dire->name);
199 - dir->dirs[dir->dir_count].start_block =
201 - dir->dirs[dir->dir_count].offset = dire->offset;
202 - dir->dirs[dir->dir_count].type = dire->type;
209 + dir->dirs = ent;
213 dir->dir_count ++;
220 @@ -331,7 +331,7 @@ static struct dir *squashfs_opendir(unsigned int block_start, unsigned int offse
226 struct dir *dir;
229 @@ -344,7 +344,7 @@ static struct dir *squashfs_opendir(unsigned int block_start, unsigned int offse
232 dir->dir_count = 0;
233 - dir->cur_entry = 0;
234 + dir->cur_entry = NULL;
235 dir->mode = (*i)->mode;
236 dir->uid = (*i)->uid;
237 dir->guid = (*i)->gid;
238 @@ -415,19 +415,20 @@ static struct dir *squashfs_opendir(unsigned int block_start, unsigned int of…
242 - if((dir->dir_count % DIR_ENT_SIZE) == 0) {
243 - new_dir = realloc(dir->dirs, (dir->dir_count +
247 - dir->dirs = new_dir;
253 - dir->dirs[dir->dir_count].name = strdup(dire->name);
254 - dir->dirs[dir->dir_count].start_block =
256 - dir->dirs[dir->dir_count].offset = dire->offset;
257 - dir->dirs[dir->dir_count].type = dire->type;
264 + dir->dirs = ent;
268 dir->dir_count ++;
276 int squashfs_readdir(struct dir *dir, char **name, unsigned int *start_block,
279 - if(dir->cur_entry == dir->dir_count)
280 + if(dir->cur_entry == NULL)
281 + dir->cur_entry = dir->dirs;
283 + dir->cur_entry = dir->cur_entry->next;
285 + if(dir->cur_entry == NULL)
288 - *name = dir->dirs[dir->cur_entry].name;
289 - *start_block = dir->dirs[dir->cur_entry].start_block;
290 - *offset = dir->dirs[dir->cur_entry].offset;
291 - *type = dir->dirs[dir->cur_entry].type;
292 - dir->cur_entry ++;
293 + *name = dir->cur_entry->name;
294 + *start_block = dir->cur_entry->start_block;
295 + *offset = dir->cur_entry->offset;
296 + *type = dir->cur_entry->type;
311 struct dir {