Lines Matching refs:cur
74 fsnode *first, *cur, *prev, *last; in walk_dir() local
95 first = cur = join; in walk_dir()
96 while (cur->next != NULL) in walk_dir()
97 cur = cur->next; in walk_dir()
98 prev = cur; in walk_dir()
135 cur = join->next; in walk_dir()
137 if (cur == NULL || strcmp(cur->name, name) == 0) in walk_dir()
139 if (cur == last) { in walk_dir()
140 cur = NULL; in walk_dir()
143 cur = cur->next; in walk_dir()
145 if (cur != NULL) { in walk_dir()
146 if (S_ISDIR(cur->type) && in walk_dir()
150 path, cur->child); in walk_dir()
151 cur->child = walk_dir(root, rp, cur, in walk_dir()
152 cur->child); in walk_dir()
157 inode_type(cur->type)); in walk_dir()
161 cur = create_fsnode(root, dir, name, &stbuf); in walk_dir()
162 cur->parent = parent; in walk_dir()
165 cur->next = first; in walk_dir()
166 first = cur; in walk_dir()
168 prev = cur; in walk_dir()
169 cur->first = first; in walk_dir()
172 prev->next = cur; in walk_dir()
173 prev = cur; in walk_dir()
175 first = cur; in walk_dir()
176 cur->first = first; in walk_dir()
177 if (S_ISDIR(cur->type)) { in walk_dir()
178 cur->child = walk_dir(root, rp, cur, NULL); in walk_dir()
185 curino = link_check(cur->inode); in walk_dir()
187 free(cur->inode); in walk_dir()
188 cur->inode = curino; in walk_dir()
189 cur->inode->nlink++; in walk_dir()
196 if (S_ISLNK(cur->type)) { in walk_dir()
204 cur->symlink = estrdup(slink); in walk_dir()
209 for (cur = first->next; cur != NULL; cur = cur->next) in walk_dir()
210 cur->first = first; in walk_dir()
220 fsnode *cur; in create_fsnode() local
222 cur = ecalloc(1, sizeof(*cur)); in create_fsnode()
223 cur->path = estrdup(path); in create_fsnode()
224 cur->name = estrdup(name); in create_fsnode()
225 cur->inode = ecalloc(1, sizeof(*cur->inode)); in create_fsnode()
226 cur->root = root; in create_fsnode()
227 cur->type = stbuf->st_mode & S_IFMT; in create_fsnode()
228 cur->inode->nlink = 1; in create_fsnode()
229 cur->inode->st = *stbuf; in create_fsnode()
231 cur->inode->st.st_atime = stampst.st_atime; in create_fsnode()
232 cur->inode->st.st_mtime = stampst.st_mtime; in create_fsnode()
233 cur->inode->st.st_ctime = stampst.st_ctime; in create_fsnode()
235 cur->inode->st.st_atimensec = stampst.st_atimensec; in create_fsnode()
236 cur->inode->st.st_mtimensec = stampst.st_mtimensec; in create_fsnode()
237 cur->inode->st.st_ctimensec = stampst.st_ctimensec; in create_fsnode()
240 cur->inode->st.st_birthtime = stampst.st_birthtime; in create_fsnode()
241 cur->inode->st.st_birthtimensec = stampst.st_birthtimensec; in create_fsnode()
244 return (cur); in create_fsnode()
255 fsnode *cur, *next; in free_fsnodes() local
270 for (cur = node->first; cur->next; cur = cur->next) { in free_fsnodes()
271 if (cur->next == node) { in free_fsnodes()
272 cur->next = node->next; in free_fsnodes()
279 for (cur = node; cur != NULL; cur = next) { in free_fsnodes()
280 next = cur->next; in free_fsnodes()
281 if (cur->child) { in free_fsnodes()
282 cur->child->parent = NULL; in free_fsnodes()
283 free_fsnodes(cur->child); in free_fsnodes()
285 if (cur->inode->nlink-- == 1) in free_fsnodes()
286 free(cur->inode); in free_fsnodes()
287 if (cur->symlink) in free_fsnodes()
288 free(cur->symlink); in free_fsnodes()
289 free(cur->path); in free_fsnodes()
290 free(cur->name); in free_fsnodes()
291 free(cur); in free_fsnodes()
560 fsnode *cur; in dump_fsnodes() local
564 for (cur = root; cur != NULL; cur = cur->next) { in dump_fsnodes()
565 if (snprintf(path, sizeof(path), "%s/%s", cur->path, in dump_fsnodes()
566 cur->name) >= (int)sizeof(path)) in dump_fsnodes()
571 cur, cur->parent, cur->first); in dump_fsnodes()
572 printf("%7s: %s", inode_type(cur->type), path); in dump_fsnodes()
573 if (S_ISLNK(cur->type)) { in dump_fsnodes()
574 assert(cur->symlink != NULL); in dump_fsnodes()
575 printf(" -> %s", cur->symlink); in dump_fsnodes()
577 assert (cur->symlink == NULL); in dump_fsnodes()
579 if (cur->inode->nlink > 1) in dump_fsnodes()
580 printf(", nlinks=%d", cur->inode->nlink); in dump_fsnodes()
583 if (cur->child) { in dump_fsnodes()
584 assert (cur->type == S_IFDIR); in dump_fsnodes()
585 dump_fsnodes(cur->child); in dump_fsnodes()