#include "internal.h"
struct erofs_dentry *erofs_rebuild_get_dentry(struct erofs_inode *pwd,
- char *path, bool aufs, bool *whout, bool *opq);
+ char *path, bool aufs, bool *whout, bool *opq, bool to_head);
int erofs_rebuild_load_tree(struct erofs_inode *root, struct erofs_sb_info *sbi);
}
struct erofs_dentry *erofs_rebuild_get_dentry(struct erofs_inode *pwd,
- char *path, bool aufs, bool *whout, bool *opq)
+ char *path, bool aufs, bool *whout, bool *opq, bool to_head)
{
struct erofs_dentry *d = NULL;
unsigned int len = strlen(path);
}
if (inode) {
+ if (to_head) {
+ list_del(&d->d_child);
+ list_add(&d->d_child, &pwd->i_subdirs);
+ }
pwd = inode;
} else if (!slash) {
d = erofs_d_alloc(pwd, s);
erofs_dbg("parsing %s", path);
dname = path + strlen(parent->i_srcpath) + 1;
- d = erofs_rebuild_get_dentry(parent, dname, false, &dumb, &dumb);
+ d = erofs_rebuild_get_dentry(parent, dname, false,
+ &dumb, &dumb, false);
if (IS_ERR(d)) {
ret = PTR_ERR(d);
goto out;
erofs_dbg("parsing %s (mode %05o)", eh.path, st.st_mode);
- d = erofs_rebuild_get_dentry(root, eh.path, tar->aufs, &whout, &opq);
+ d = erofs_rebuild_get_dentry(root, eh.path, tar->aufs, &whout, &opq, true);
if (IS_ERR(d)) {
ret = PTR_ERR(d);
goto out;
}
d->inode = NULL;
- d2 = erofs_rebuild_get_dentry(root, eh.link, tar->aufs, &dumb, &dumb);
+ d2 = erofs_rebuild_get_dentry(root, eh.link, tar->aufs,
+ &dumb, &dumb, false);
if (IS_ERR(d2)) {
ret = PTR_ERR(d2);
goto out;