summaryrefslogtreecommitdiff
path: root/ext2fs/ext2fs.c
diff options
context:
space:
mode:
authorJustus Winter <justus@gnupg.org>2016-10-03 19:23:55 +0200
committerJustus Winter <justus@gnupg.org>2016-11-10 15:31:02 +0100
commitff2229cc89f18429c1709f122203c13845a4de89 (patch)
tree2a3f87c80b613a6a8bc99d944da36c0edd6f65e3 /ext2fs/ext2fs.c
parent693f6a06ca7f9e293dc31f02793f66eedc3202a4 (diff)
ext2fs: Require users to opt-in for xattr-based translator records.
* ext2fs/ext2fs.c (use_xattr_translator_records): New variable. (X_XATTR_TRANSLATOR_RECORDS): New macro. (options): New option '--x-xattr-translator-records'. (parse_opt): Handle new option. * ext2fs/ext2fs.h (use_xattr_translator_records): New declaration. * ext2fs/inode.c (diskfs_set_translator): Use new variable. (diskfs_get_translator): Likewise.
Diffstat (limited to 'ext2fs/ext2fs.c')
-rw-r--r--ext2fs/ext2fs.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/ext2fs/ext2fs.c b/ext2fs/ext2fs.c
index 4f38c927..b4c865c8 100644
--- a/ext2fs/ext2fs.c
+++ b/ext2fs/ext2fs.c
@@ -63,6 +63,10 @@ pthread_spinlock_t modified_global_blocks_lock = PTHREAD_SPINLOCK_INITIALIZER;
int ext2_debug_flag;
#endif
+/* Use extended attribute-based translator records. */
+int use_xattr_translator_records;
+#define X_XATTR_TRANSLATOR_RECORDS -1
+
/* Ext2fs-specific options. */
static const struct argp_option
options[] =
@@ -72,6 +76,8 @@ options[] =
" (not compiled in)"
#endif
},
+ {"x-xattr-translator-records", X_XATTR_TRANSLATOR_RECORDS, 0, 0,
+ "Store translator records in extended attributes (experimental)"},
#ifdef ALTERNATE_SBLOCK
/* XXX This is not implemented. */
{"sblock", 'S', "BLOCKNO", 0,
@@ -89,6 +95,7 @@ parse_opt (int key, char *arg, struct argp_state *state)
struct
{
int debug_flag;
+ int use_xattr_translator_records;
#ifdef ALTERNATE_SBLOCK
unsigned int sb_block;
#endif
@@ -99,6 +106,9 @@ parse_opt (int key, char *arg, struct argp_state *state)
case 'D':
values->debug_flag = 1;
break;
+ case X_XATTR_TRANSLATOR_RECORDS:
+ values->use_xattr_translator_records = 1;
+ break;
#ifdef ALTERNATE_SBLOCK
case 'S':
values->sb_block = strtoul (arg, &arg, 0);
@@ -134,6 +144,7 @@ parse_opt (int key, char *arg, struct argp_state *state)
#endif
}
+ use_xattr_translator_records = values->use_xattr_translator_records;
break;
default:
@@ -151,6 +162,9 @@ diskfs_append_args (char **argz, size_t *argz_len)
/* Get the standard things. */
err = diskfs_append_std_options (argz, argz_len);
+ if (!err && use_xattr_translator_records)
+ err = argz_add (argz, argz_len, "--x-xattr-translator-records");
+
#ifdef EXT2FS_DEBUG
if (!err && ext2_debug_flag)
err = argz_add (argz, argz_len, "--debug");