[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[hurd] 07/21: ext2fs: Require users to opt-in for xattr-based translator
From: |
Samuel Thibault |
Subject: |
[hurd] 07/21: ext2fs: Require users to opt-in for xattr-based translator records. |
Date: |
Sat, 04 Mar 2017 21:10:58 +0000 |
This is an automated email from the git hooks/post-receive script.
sthibault pushed a commit to branch upstream
in repository hurd.
commit 4818346b39b5a58962d1676ea0bb3a0b954c1fed
Author: Justus Winter <address@hidden>
Date: Mon Oct 3 19:23:55 2016 +0200
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.
---
ext2fs/ext2fs.c | 14 ++++++++++++++
ext2fs/ext2fs.h | 10 ++++++++++
ext2fs/inode.c | 6 ++++--
3 files changed, 28 insertions(+), 2 deletions(-)
diff --git a/ext2fs/ext2fs.c b/ext2fs/ext2fs.c
index 4f38c92..b4c865c 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");
diff --git a/ext2fs/ext2fs.h b/ext2fs/ext2fs.h
index 2ee97fd..2104dba 100644
--- a/ext2fs/ext2fs.h
+++ b/ext2fs/ext2fs.h
@@ -587,4 +587,14 @@ error_t ext2_get_xattr (struct node *np, const char *name,
char *value, size_t *
error_t ext2_set_xattr (struct node *np, const char *name, const char *value,
size_t len, int flags);
error_t ext2_free_xattr_block (struct node *np);
+/* Use extended attribute-based translator records.
+ *
+ * This flag allows users to opt-in to the use of extended attributes
+ * for storing translator records. We will make this the default once
+ * we feel confident that the implementation is fine.
+ *
+ * XXX: Remove this in Hurd 1.0 (or 0.10, or whatever follows 0.9).
+ */
+int use_xattr_translator_records;
+
#endif
diff --git a/ext2fs/inode.c b/ext2fs/inode.c
index 5109953..58edb50 100644
--- a/ext2fs/inode.c
+++ b/ext2fs/inode.c
@@ -562,7 +562,8 @@ diskfs_set_translator (struct node *np, const char *name,
unsigned namelen,
/* If xattr is supported for this filesystem, use xattr to store translator
record, otherwise, use legacy translator record */
- if (EXT2_HAS_COMPAT_FEATURE (sblock, EXT2_FEATURE_COMPAT_EXT_ATTR))
+ if (EXT2_HAS_COMPAT_FEATURE (sblock, EXT2_FEATURE_COMPAT_EXT_ATTR)
+ && use_xattr_translator_records)
{
daddr_t blkno;
struct ext2_inode *di;
@@ -714,7 +715,8 @@ diskfs_get_translator (struct node *np, char **namep,
unsigned *namelen)
if (blkno)
{
/* If xattr is no supported by this filesystem, don't report a warning */
- if (EXT2_HAS_COMPAT_FEATURE (sblock, EXT2_FEATURE_COMPAT_EXT_ATTR))
+ if (EXT2_HAS_COMPAT_FEATURE (sblock, EXT2_FEATURE_COMPAT_EXT_ATTR)
+ && use_xattr_translator_records)
ext2_warning ("This is an old translator record, please update it");
transloc = disk_cache_block_ref (blkno);
--
Alioth's /usr/local/bin/git-commit-notice on
/srv/git.debian.org/git/pkg-hurd/hurd.git
- [hurd] 16/21: libshouldbeinlibc: Fix NDEBUG build., (continued)
- [hurd] 16/21: libshouldbeinlibc: Fix NDEBUG build., Samuel Thibault, 2017/03/04
- [hurd] 08/21: ext2fs: Fix block allocation., Samuel Thibault, 2017/03/04
- [hurd] 12/21: ext2fs: fix extended attribute retrieval, Samuel Thibault, 2017/03/04
- [hurd] 11/21: ext2fs: minor cleanup, Samuel Thibault, 2017/03/04
- [hurd] 15/21: Fix mig URL, Samuel Thibault, 2017/03/04
- [hurd] 19/21: boot: Fix failing device lookups in unprivileged mode., Samuel Thibault, 2017/03/04
- [hurd] 09/21: ext2fs: Fix potential block leak., Samuel Thibault, 2017/03/04
- [hurd] 14/21: Merge remote-tracking branch 'remotes/darnassus/ext2fs-xattrs', Samuel Thibault, 2017/03/04
- [hurd] 05/21: ext2fs: Fix block leak in xattr code., Samuel Thibault, 2017/03/04
- [hurd] 21/21: Avoid ports_interrupt_rpcs cancel itself, Samuel Thibault, 2017/03/04
- [hurd] 07/21: ext2fs: Require users to opt-in for xattr-based translator records.,
Samuel Thibault <=
- [hurd] 20/21: boot: Make the halt message nicer., Samuel Thibault, 2017/03/04
- [hurd] 13/21: ext2fs: downgrade warnings about old translator records to debug messages, Samuel Thibault, 2017/03/04
- [hurd] 18/21: boot: Add a verbose option., Samuel Thibault, 2017/03/04
- [hurd] 04/21: ext2fs: Use correct type for sizes., Samuel Thibault, 2017/03/04
- [hurd] 02/21: ext2fs: Use xattr to store passive translator, Samuel Thibault, 2017/03/04
- [hurd] 17/21: boot: Cleanup Makefile., Samuel Thibault, 2017/03/04
- [hurd] 01/21: ext2fs: Add support for xattr, Samuel Thibault, 2017/03/04