@@ -746,6 +746,23 @@ AC_MSG_RESULT([Building uuidd by default])
)
AC_SUBST(UUIDD_CMT)
dnl
+dnl handle --disable-mmp
+dnl
+AH_TEMPLATE([CONFIG_MMP], [Define to 1 to enable mmp support])
+AC_ARG_ENABLE([mmp],
+[ --disable-mmp disable support mmp, Multi Mount Protection],
+if test "$enableval" = "no"
+then
+ AC_MSG_RESULT([Disabling mmp support])
+else
+ AC_MSG_RESULT([Enabling mmp support])
+ AC_DEFINE(CONFIG_MMP, 1)
+fi
+,
+AC_MSG_RESULT([Enabling mmp support by default])
+AC_DEFINE(CONFIG_MMP, 1)
+)
+dnl
dnl
dnl
MAKEFILE_LIBRARY=$srcdir/lib/Makefile.library
@@ -2194,6 +2194,7 @@ void do_punch(int argc, char *argv[])
void do_dump_mmp(int argc EXT2FS_ATTR((unused)), char *argv[])
{
+#if CONFIG_MMP
struct ext2_super_block *sb;
struct mmp_struct *mmp_s;
time_t t;
@@ -2237,6 +2238,10 @@ void do_dump_mmp(int argc EXT2FS_ATTR((unused)), char *argv[])
fprintf(stdout, "node_name: %s\n", mmp_s->mmp_nodename);
fprintf(stdout, "device_name: %s\n", mmp_s->mmp_bdevname);
fprintf(stdout, "magic: 0x%x\n", mmp_s->mmp_magic);
+#else
+ fprintf(stdout, "MMP is unsupported, please recompile with "
+ "--enable-mmp\n");
+#endif
}
static int source_file(const char *cmd_file, int sci_idx)
@@ -765,6 +765,7 @@ static errcode_t parse_mmp_clear(struct field_set_info *info,
void do_set_mmp_value(int argc, char *argv[])
{
+#ifdef CONFIG_MMP
const char *usage = "<field> <value>\n"
"\t\"set_mmp_value -l\" will list the names of "
"MMP fields\n\twhich can be set.";
@@ -819,5 +820,9 @@ void do_set_mmp_value(int argc, char *argv[])
&set_mmp);
*mmp_s = set_mmp;
}
+#else
+ fprintf(stdout, "MMP is unsupported, please recompile with "
+ "--enable-mmp\n");
+#endif
}
@@ -12,6 +12,9 @@
/* Define to 1 if debugging ext3/4 journal code */
#undef CONFIG_JBD_DEBUG
+/* Define to 1 to enable mmp support */
+#undef CONFIG_MMP
+
/* Define to 1 to enable quota support */
#undef CONFIG_QUOTA
@@ -554,25 +554,26 @@ typedef struct ext2_icount *ext2_icount_t;
environment at configure time. */
#warning "Compression support is experimental"
#endif
-#define EXT2_LIB_FEATURE_INCOMPAT_SUPP (EXT2_FEATURE_INCOMPAT_FILETYPE|\
- EXT2_FEATURE_INCOMPAT_COMPRESSION|\
- EXT3_FEATURE_INCOMPAT_JOURNAL_DEV|\
- EXT2_FEATURE_INCOMPAT_META_BG|\
- EXT3_FEATURE_INCOMPAT_RECOVER|\
- EXT3_FEATURE_INCOMPAT_EXTENTS|\
- EXT4_FEATURE_INCOMPAT_FLEX_BG|\
- EXT4_FEATURE_INCOMPAT_MMP|\
- EXT4_FEATURE_INCOMPAT_64BIT)
+#define EXT2_LIB_INCOMPAT_COMPRESSION EXT2_FEATURE_INCOMPAT_COMPRESSION
#else
+#define EXT2_LIB_INCOMPAT_COMPRESSION (0)
+#endif
+
+#ifdef CONFIG_MMP
+#define EXT4_LIB_INCOMPAT_MMP EXT4_FEATURE_INCOMPAT_MMP
+#else
+#define EXT4_LIB_INCOMPAT_MMP (0)
+#endif
+
#define EXT2_LIB_FEATURE_INCOMPAT_SUPP (EXT2_FEATURE_INCOMPAT_FILETYPE|\
+ EXT2_LIB_INCOMPAT_COMPRESSION|\
EXT3_FEATURE_INCOMPAT_JOURNAL_DEV|\
EXT2_FEATURE_INCOMPAT_META_BG|\
EXT3_FEATURE_INCOMPAT_RECOVER|\
EXT3_FEATURE_INCOMPAT_EXTENTS|\
EXT4_FEATURE_INCOMPAT_FLEX_BG|\
- EXT4_FEATURE_INCOMPAT_MMP|\
+ EXT4_LIB_INCOMPAT_MMP|\
EXT4_FEATURE_INCOMPAT_64BIT)
-#endif
#ifdef CONFIG_QUOTA
#define EXT2_LIB_FEATURE_RO_COMPAT_SUPP (EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER|\
EXT4_FEATURE_RO_COMPAT_HUGE_FILE|\
@@ -33,6 +33,9 @@
errcode_t ext2fs_mmp_read(ext2_filsys fs, blk64_t mmp_blk, void *buf)
{
+#ifndef CONFIG_MMP
+ return EXT2_ET_OP_NOT_SUPPORTED;
+#endif
struct mmp_struct *mmp_cmp;
errcode_t retval = 0;
@@ -92,6 +95,9 @@ out:
errcode_t ext2fs_mmp_write(ext2_filsys fs, blk64_t mmp_blk, void *buf)
{
+#ifndef CONFIG_MMP
+ return EXT2_ET_OP_NOT_SUPPORTED;
+#endif
struct mmp_struct *mmp_s = buf;
struct timeval tv;
errcode_t retval = 0;
@@ -128,6 +134,9 @@ errcode_t ext2fs_mmp_write(ext2_filsys fs, blk64_t mmp_blk, void *buf)
unsigned ext2fs_mmp_new_seq()
{
+#ifndef CONFIG_MMP
+ return EXT2_ET_OP_NOT_SUPPORTED;
+#endif
unsigned new_seq;
struct timeval tv;
@@ -182,6 +191,9 @@ out:
errcode_t ext2fs_mmp_clear(ext2_filsys fs)
{
+#ifndef CONFIG_MMP
+ return EXT2_ET_OP_NOT_SUPPORTED;
+#endif
errcode_t retval = 0;
if (!(fs->flags & EXT2_FLAG_RW))
@@ -194,6 +206,9 @@ errcode_t ext2fs_mmp_clear(ext2_filsys fs)
errcode_t ext2fs_mmp_init(ext2_filsys fs)
{
+#ifndef CONFIG_MMP
+ return EXT2_ET_OP_NOT_SUPPORTED;
+#endif
struct ext2_super_block *sb = fs->super;
blk64_t mmp_block;
errcode_t retval;
@@ -229,6 +244,9 @@ out:
*/
errcode_t ext2fs_mmp_start(ext2_filsys fs)
{
+#ifndef CONFIG_MMP
+ return EXT2_ET_OP_NOT_SUPPORTED;
+#endif
struct mmp_struct *mmp_s;
unsigned seq;
unsigned int mmp_check_interval;
@@ -328,6 +346,9 @@ mmp_error:
*/
errcode_t ext2fs_mmp_stop(ext2_filsys fs)
{
+#ifndef CONFIG_MMP
+ return EXT2_ET_OP_NOT_SUPPORTED;
+#endif
struct mmp_struct *mmp, *mmp_cmp;
errcode_t retval = 0;
@@ -366,6 +387,9 @@ mmp_error:
*/
errcode_t ext2fs_mmp_update(ext2_filsys fs)
{
+#ifndef CONFIG_MMP
+ return EXT2_ET_OP_NOT_SUPPORTED;
+#endif
struct mmp_struct *mmp, *mmp_cmp;
struct timeval tv;
errcode_t retval = 0;