mirror of
https://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git
synced 2024-11-27 03:54:19 +08:00
7e3a4f0a33
If archive.h is available during compilation, enable mke2fs to read a tarball as input. Since libarchive.so.13 is opened with dlopen, libarchive is not a hard library dependency of the resulting binary. In comparison with feeding a directory tree to mke2fs via -d this has the following advantages: - no superuser privileges, nor fakeroot, nor unshared user namespaces are needed to create filesystems with arbitrary ownership information and special files like device nodes which otherwise require being root - by reading a tarball from standard input, no temporary files need to be written out first as mke2fs can be used as part of a shell pipeline which reduces disk usage and makes the conversion independent of the underlying file system A round-trip from tarball to ext4 to tarball yields bit-by-bit identical results Signed-off-by: Johannes Schauer Marin Rodrigues <josch@mister-muffin.de>
68 lines
1.9 KiB
C
68 lines
1.9 KiB
C
#ifndef _CREATE_INODE_H
|
|
#define _CREATE_INODE_H
|
|
|
|
#include <sys/types.h>
|
|
#include <sys/stat.h>
|
|
#include <fcntl.h>
|
|
#include "et/com_err.h"
|
|
#include "e2p/e2p.h"
|
|
#include "ext2fs/ext2fs.h"
|
|
|
|
struct hdlink_s
|
|
{
|
|
dev_t src_dev;
|
|
ino_t src_ino;
|
|
ext2_ino_t dst_ino;
|
|
};
|
|
|
|
struct hdlinks_s
|
|
{
|
|
int count;
|
|
int size;
|
|
struct hdlink_s *hdl;
|
|
};
|
|
|
|
struct file_info {
|
|
char *path;
|
|
size_t path_len;
|
|
size_t path_max_len;
|
|
};
|
|
|
|
#define HDLINK_CNT (4)
|
|
|
|
struct fs_ops_callbacks {
|
|
errcode_t (* create_new_inode)(ext2_filsys fs, const char *target_path,
|
|
const char *name, ext2_ino_t parent_ino, ext2_ino_t root,
|
|
mode_t mode);
|
|
errcode_t (* end_create_new_inode)(ext2_filsys fs,
|
|
const char *target_path, const char *name,
|
|
ext2_ino_t parent_ino, ext2_ino_t root, mode_t mode);
|
|
};
|
|
|
|
extern int no_copy_xattrs; /* this should eventually be a flag
|
|
passed to populate_fs3() */
|
|
|
|
/* For populating the filesystem */
|
|
extern errcode_t populate_fs(ext2_filsys fs, ext2_ino_t parent_ino,
|
|
const char *source_dir, ext2_ino_t root);
|
|
extern errcode_t populate_fs2(ext2_filsys fs, ext2_ino_t parent_ino,
|
|
const char *source_dir, ext2_ino_t root,
|
|
struct fs_ops_callbacks *fs_callbacks);
|
|
extern errcode_t do_mknod_internal(ext2_filsys fs, ext2_ino_t cwd,
|
|
const char *name, unsigned int st_mode,
|
|
unsigned int st_rdev);
|
|
extern errcode_t do_symlink_internal(ext2_filsys fs, ext2_ino_t cwd,
|
|
const char *name, char *target,
|
|
ext2_ino_t root);
|
|
extern errcode_t do_mkdir_internal(ext2_filsys fs, ext2_ino_t cwd,
|
|
const char *name, ext2_ino_t root);
|
|
extern errcode_t do_write_internal(ext2_filsys fs, ext2_ino_t cwd,
|
|
const char *src, const char *dest,
|
|
ext2_ino_t root);
|
|
extern errcode_t add_link(ext2_filsys fs, ext2_ino_t parent_ino,
|
|
ext2_ino_t ino, const char *name);
|
|
extern errcode_t set_inode_extra(ext2_filsys fs, ext2_ino_t ino,
|
|
const struct stat *st);
|
|
|
|
#endif /* _CREATE_INODE_H */
|