On 2023/7/11 14:12, Jingbo Xu wrote:
From: Gao Xiang <[email protected]>
Let's try to add a new mode "tarerofs" for mkfs.erofs.
It mainly aims at two use cases:
- Convert a tarball (or later tarballs with a merged view) into
a full EROFS image [--tar=f];
- Generate an EROFS manifest image to reuse tar data [--tar=i],
which also enables EROFS 512-byte blocks.
The second use case is mainly prepared for OCI direct mount without
OCI blob unpacking. This also adds another `--aufs` option to
transform aufs special files into overlayfs metadata.
[ Note that `--tar=f` generates lots of temporary files for now which
can impact performance since the original tar stream(s) may be
non-seekable. ]
Signed-off-by: Gao Xiang <[email protected]>
Signed-off-by: Jingbo Xu <[email protected]>
---
change log:
1. don't return prematurely for special device files (in
erofs_mkfs_build_tree()). Otherwise erofs_mkfs_build_tree() may
mistakenly return a positive integer number returned from
erofs_prepare_xattr_ibody(), and mistakenly make it as the pointer to
the root inode, which will cause mkfs.erofs segmentation fault.
2. automatically create parent directory if it's not included as an
entry in the tarball stream. (refer to tarerofs_init_default_dir())
struct erofs_dentry *tarerofs_mkdir(struct erofs_inode *dir, const char *s)
{
struct inode *inode;
inode = erofs_new_inode();
if (IS_ERR(inode))
return inode;
inode->i_mode = S_IFDIR | 0755;
inode->i_parent = dir;
inode->i_uid = getuid();
inode->i_gid = getgid();
inode->i_mtime = sbi.build_time;
inode->i_mtime_nsec = sbi.build_time_nsec;
tarerofs_init_empty_dir(inode);
d = erofs_d_alloc(pwd, s);
d->type = EROFS_FT_DIR;
d->inode = inode;
return d;
}
?
Otherwise it looks good to me.
Thanks,
Gao Xiang