diff options
author | Robert Yang <liezhi.yang@windriver.com> | 2014-03-06 11:00:23 -0500 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2014-03-06 11:00:23 -0500 |
commit | 0d4deba22e2aa95ad958b44972dc933fd0ebbc59 (patch) | |
tree | d6a87b98eb85d764b1695466ffc596089509fc2f /misc/create_inode.h | |
parent | 3ba59bf649772967bcde59c6e1513937c2a0c835 (diff) | |
download | e2fsprogs-0d4deba22e2aa95ad958b44972dc933fd0ebbc59.tar.gz |
mke2fs: add the ability to copy files from a given directory
We will add a -d option which will be used for adding the files from a
given directory to the filesystem, it is similiar to genext2fs, but
genext2fs doesn't fully support ext4.
* We already have the basic operations in debugfs:
- Copy regular file
- Create directory
- Create symlink
- Create special file
We will move these operations into create_inode.h and create_inode.c,
then let both mke2fs and debugfs use them.
* What we need to do are:
- Copy the given directory recursively, this will be done by the
populate_fs()
- Set the owner, mode and other informations
- Handle the hard links
TODO:
- The libext2fs can't create the socket file (S_IFSOCK), do we have a
plan to support it ?
Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Reviewed-by: Darren Hart <dvhart@linux.intel.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'misc/create_inode.h')
-rw-r--r-- | misc/create_inode.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/misc/create_inode.h b/misc/create_inode.h new file mode 100644 index 00000000..9fc97fa5 --- /dev/null +++ b/misc/create_inode.h @@ -0,0 +1,17 @@ +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include "et/com_err.h" +#include "e2p/e2p.h" +#include "ext2fs/ext2fs.h" +#include "nls-enable.h" + +ext2_filsys current_fs; +ext2_ino_t root; + +/* For populating the filesystem */ +extern errcode_t populate_fs(ext2_ino_t parent_ino, const char *source_dir); +extern errcode_t do_mknod_internal(ext2_ino_t cwd, const char *name, struct stat *st); +extern errcode_t do_symlink_internal(ext2_ino_t cwd, const char *name, char *target); +extern errcode_t do_mkdir_internal(ext2_ino_t cwd, const char *name, struct stat *st); +extern errcode_t do_write_internal(ext2_ino_t cwd, const char *src, const char *dest); |