Rename tarerofs_get_dentry() to erofs_get_dentry() and make it global. Also make `whout` and 'opq' parameter optional when `aufs` is false.
Signed-off-by: Jingbo Xu <[email protected]> --- include/erofs/tar.h | 2 ++ lib/tar.c | 14 ++++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/include/erofs/tar.h b/include/erofs/tar.h index a14f8ac..8699cb5 100644 --- a/include/erofs/tar.h +++ b/include/erofs/tar.h @@ -26,4 +26,6 @@ int tarerofs_parse_tar(struct erofs_inode *root, struct erofs_tarfile *tar); int tarerofs_reserve_devtable(struct erofs_sb_info *sbi, unsigned int devices); int tarerofs_write_devtable(struct erofs_sb_info *sbi, struct erofs_tarfile *tar); +struct erofs_dentry *erofs_get_dentry(struct erofs_inode *pwd, char *path, + bool aufs, bool *whout, bool *opq); #endif diff --git a/lib/tar.c b/lib/tar.c index 2932980..10ae89c 100644 --- a/lib/tar.c +++ b/lib/tar.c @@ -158,15 +158,17 @@ static struct erofs_dentry *tarerofs_mkdir(struct erofs_inode *dir, const char * return d; } -static struct erofs_dentry *tarerofs_get_dentry(struct erofs_inode *pwd, char *path, - bool aufs, bool *whout, bool *opq) +struct erofs_dentry *erofs_get_dentry(struct erofs_inode *pwd, char *path, + bool aufs, bool *whout, bool *opq) { struct erofs_dentry *d = NULL; unsigned int len = strlen(path); char *s = path; - *whout = false; - *opq = false; + if (aufs) { + *whout = false; + *opq = false; + } while (s < path + len) { char *slash = memchr(s, '/', path + len - s); @@ -611,7 +613,7 @@ restart: erofs_dbg("parsing %s (mode %05o)", eh.path, st.st_mode); - d = tarerofs_get_dentry(root, eh.path, tar->aufs, &whout, &opq); + d = erofs_get_dentry(root, eh.path, tar->aufs, &whout, &opq); if (IS_ERR(d)) { ret = PTR_ERR(d); goto out; @@ -644,7 +646,7 @@ restart: } d->inode = NULL; - d2 = tarerofs_get_dentry(root, eh.link, tar->aufs, &dumb, &dumb); + d2 = erofs_get_dentry(root, eh.link, tar->aufs, &dumb, &dumb); if (IS_ERR(d2)) { ret = PTR_ERR(d2); goto out; -- 2.19.1.6.gb485710b
