1 From c98fec004f077e566b9dfa20b25e3b86cb462a2e Mon Sep 17 00:00:00 2001
2 From: Robert Yang <liezhi.yang@windriver.com>
3 Date: Tue, 24 Dec 2013 01:41:08 -0500
4 Subject: [PATCH 01/11] mke2fs: add the ability to copy files from a given
7 We will add a -d option which will be used for adding the files from a
8 given directory to the filesystem, it is similiar to genext2fs, but
9 genext2fs doesn't fully support ext4.
11 * We already have the basic operations in debugfs:
17 We will move these operations into create_inode.h and create_inode.c,
18 then let both mke2fs and debugfs use them.
20 * What we need to do are:
21 - Copy the given directory recursively, this will be done by the
23 - Set the owner, mode and other informations
24 - Handle the hard links
27 - The libext2fs can't create the socket file (S_IFSOCK), do we have a
30 Upstream-Status: Backport
32 Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
33 Reviewed-by: Darren Hart <dvhart@linux.intel.com>
35 misc/create_inode.c | 26 ++++++++++++++++++++++++++
36 misc/create_inode.h | 17 +++++++++++++++++
37 2 files changed, 43 insertions(+)
38 create mode 100644 misc/create_inode.c
39 create mode 100644 misc/create_inode.h
41 diff --git a/misc/create_inode.c b/misc/create_inode.c
43 index 0000000..46aaa60
45 +++ b/misc/create_inode.c
47 +#include "create_inode.h"
49 +/* Make a special file which is block, character and fifo */
50 +errcode_t do_mknod_internal(ext2_ino_t cwd, const char *name, struct stat *st)
54 +/* Make a symlink name -> target */
55 +errcode_t do_symlink_internal(ext2_ino_t cwd, const char *name, char *target)
59 +/* Make a directory in the fs */
60 +errcode_t do_mkdir_internal(ext2_ino_t cwd, const char *name, struct stat *st)
64 +/* Copy the native file to the fs */
65 +errcode_t do_write_internal(ext2_ino_t cwd, const char *src, const char *dest)
69 +/* Copy files from source_dir to fs */
70 +errcode_t populate_fs(ext2_ino_t parent_ino, const char *source_dir)
73 diff --git a/misc/create_inode.h b/misc/create_inode.h
75 index 0000000..9fc97fa
77 +++ b/misc/create_inode.h
79 +#include <sys/types.h>
80 +#include <sys/stat.h>
82 +#include "et/com_err.h"
84 +#include "ext2fs/ext2fs.h"
85 +#include "nls-enable.h"
87 +ext2_filsys current_fs;
90 +/* For populating the filesystem */
91 +extern errcode_t populate_fs(ext2_ino_t parent_ino, const char *source_dir);
92 +extern errcode_t do_mknod_internal(ext2_ino_t cwd, const char *name, struct stat *st);
93 +extern errcode_t do_symlink_internal(ext2_ino_t cwd, const char *name, char *target);
94 +extern errcode_t do_mkdir_internal(ext2_ino_t cwd, const char *name, struct stat *st);
95 +extern errcode_t do_write_internal(ext2_ino_t cwd, const char *src, const char *dest);