aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--debugfs/debugfs.c1
-rw-r--r--misc/create_inode.c3
-rw-r--r--misc/create_inode.h3
-rw-r--r--misc/mke2fs.8.in9
-rw-r--r--misc/mke2fs.c4
-rw-r--r--tests/f_extent_htree/script4
6 files changed, 22 insertions, 2 deletions
diff --git a/debugfs/debugfs.c b/debugfs/debugfs.c
index fe859d45..0b04508e 100644
--- a/debugfs/debugfs.c
+++ b/debugfs/debugfs.c
@@ -55,6 +55,7 @@ int sci_idx;
ext2_filsys current_fs;
quota_ctx_t current_qctx;
ext2_ino_t root, cwd;
+int no_copy_xattrs;
static int debugfs_setup_tdb(const char *device_name, char *undo_file,
io_manager *io_ptr)
diff --git a/misc/create_inode.c b/misc/create_inode.c
index 6621b0ab..05aa6363 100644
--- a/misc/create_inode.c
+++ b/misc/create_inode.c
@@ -142,6 +142,9 @@ static errcode_t set_inode_xattr(ext2_filsys fs, ext2_ino_t ino,
char *list = NULL;
int i;
+ if (no_copy_xattrs)
+ return 0;
+
size = llistxattr(filename, NULL, 0);
if (size == -1) {
retval = errno;
diff --git a/misc/create_inode.h b/misc/create_inode.h
index 3a376322..b5eeb420 100644
--- a/misc/create_inode.h
+++ b/misc/create_inode.h
@@ -33,6 +33,9 @@ struct fs_ops_callbacks {
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);
diff --git a/misc/mke2fs.8.in b/misc/mke2fs.8.in
index 7b989e0b..603e37e5 100644
--- a/misc/mke2fs.8.in
+++ b/misc/mke2fs.8.in
@@ -338,6 +338,15 @@ small risk if the system crashes before the journal has been overwritten
entirely one time. If the option value is omitted, it defaults to 1 to
enable lazy journal inode zeroing.
.TP
+.BI no_copy_xattrs
+Normally
+.B mke2fs
+will copy the extended attributes of the files in the directory
+hierarchy specified via the (optional)
+.B \-d
+option. This will disable the copy and leaves the files in the newly
+created file system without any extended attributes.
+.TP
.BI num_backup_sb= <0|1|2>
If the
.B sparse_super2
diff --git a/misc/mke2fs.c b/misc/mke2fs.c
index ce78b7c8..b23ea766 100644
--- a/misc/mke2fs.c
+++ b/misc/mke2fs.c
@@ -95,6 +95,7 @@ int journal_size;
int journal_flags;
static int lazy_itable_init;
static int packed_meta_blocks;
+int no_copy_xattrs;
static char *bad_blocks_filename = NULL;
static __u32 fs_stride;
/* Initialize usr/grp quotas by default */
@@ -880,6 +881,9 @@ static void parse_extended_opts(struct ext2_super_block *param,
r_usage++;
continue;
}
+ } else if (strcmp(token, "no_copy_xattrs") == 0) {
+ no_copy_xattrs = 1;
+ continue;
} else if (strcmp(token, "num_backup_sb") == 0) {
if (!arg) {
r_usage++;
diff --git a/tests/f_extent_htree/script b/tests/f_extent_htree/script
index ccd97e14..4939accc 100644
--- a/tests/f_extent_htree/script
+++ b/tests/f_extent_htree/script
@@ -30,8 +30,8 @@ fi
# make filesystem with enough inodes and blocks to hold all the test files
> $TMPFILE
NUM=$((NUM * 5 / 3))
-echo "mke2fs -b $BSIZE -O dir_index,extent -d$SRC -N$NUM $TMPFILE $NUM" >> $OUT
-$MKE2FS -b $BSIZE -O dir_index,extent -d$SRC -N$NUM $TMPFILE $NUM >> $OUT 2>&1
+echo "mke2fs -b $BSIZE -O dir_index,extent -E no_copy_xattrs -d$SRC -N$NUM $TMPFILE $NUM" >> $OUT
+$MKE2FS -b $BSIZE -O dir_index,extent -E no_copy_xattrs -d$SRC -N$NUM $TMPFILE $NUM >> $OUT 2>&1
rm -r $SRC
# Run e2fsck to convert dir to htree before deleting the files, as mke2fs