diff --git a/Makefile b/Makefile index 2517f75..3af1665 100644 --- a/Makefile +++ b/Makefile @@ -48,9 +48,15 @@ CWFLAGS += -Wp,-D_FORTIFY_SOURCE=2 -O endif ifdef DEBIAN -CPPFLAGS= -DDEBIAN +CPPFLAGS := -DDEBIAN else -CPPFLAGS= +CPPFLAGS := +endif +ifdef DEFAULT_OLD_METADATA + CPPFLAG += -DDEFAULT_OLD_METADATA + DEFAULT_METADATA=0.90 +else + DEFAULT_METADATA=1.2 endif SYSCONFDIR = /etc @@ -180,6 +186,9 @@ mdassemble.klibc : $(ASSEMBLE_SRCS) mdadm.h rm -f $(OBJS) $(KLIBC_GCC) $(ASSEMBLE_FLAGS) -o mdassemble $(ASSEMBLE_SRCS) +mdadm.8 : mdadm.8.in + sed -e 's/{DEFAULT_METADATA}/$(DEFAULT_METADATA)/g' mdadm.8.in > mdadm.8 + mdadm.man : mdadm.8 nroff -man mdadm.8 > mdadm.man diff --git a/mdadm.8 b/mdadm.8.in similarity index 99% rename from mdadm.8 rename to mdadm.8.in index 90470d9..da1a0a9 100644 --- a/mdadm.8 +++ b/mdadm.8.in @@ -299,7 +299,7 @@ says to get a list of array devices from .TP .BR \-e ", " \-\-metadata= Declare the style of RAID metadata (superblock) to be used. The -default is 1.2 for +default is {DEFAULT_METADATA} for .BR \-\-create , and to guess for other operations. The default can be overridden by setting the @@ -311,16 +311,24 @@ keyword in Options are: .RS +.ie '{DEFAULT_METADATA}'0.90' +.IP "0, 0.90, default" +.el .IP "0, 0.90" +.. Use the original 0.90 format superblock. This format limits arrays to 28 component devices and limits component devices of levels 1 and greater to 2 terabytes. +.ie '{DEFAULT_METADATA}'0.90' +.IP "1, 1.0, 1.1, 1.2" +.el .IP "1, 1.0, 1.1, 1.2 default" +.. Use the new version-1 format superblock. This has few restrictions. The different sub-versions store the superblock at different locations on the device, either at the end (for 1.0), at the start (for 1.1) or -4K from the start (for 1.2). '1' is equivalent to '1.0', 'default' is -equivalent to '1.2'. +4K from the start (for 1.2). "1" is equivalent to "1.0". +'if '{DEFAULT_METADATA}'1.2' "default" is equivalent to "1.2". .IP ddf Use the "Industry Standard" DDF (Disk Data Format) format defined by SNIA. diff --git a/super0.c b/super0.c index a0c7eb4..83600cb 100644 --- a/super0.c +++ b/super0.c @@ -922,6 +922,9 @@ static struct supertype *match_metadata_desc0(char *arg) while (arg[0] == '0' && arg[1] == '0') arg++; if (strcmp(arg, "0") == 0 || +#ifdef DEFAULT_OLD_METADATA /* ifndef in super1.c */ + strcmp(arg, "default") == 0 || +#endif /* DEFAULT_OLD_METADATA */ strcmp(arg, "0.90") == 0 || strcmp(arg, "") == 0 /* no metadata - i.e. non_persistent */ ) diff --git a/super1.c b/super1.c index 8fa0745..216690d 100644 --- a/super1.c +++ b/super1.c @@ -1381,7 +1381,9 @@ static struct supertype *match_metadata_desc1(char *arg) return st; } if (strcmp(arg, "1.2") == 0 || +#ifndef DEFAULT_OLD_METADATA /* ifdef in super0.c */ strcmp(arg, "default") == 0 || +#endif /* DEFAULT_OLD_METADATA */ strcmp(arg, "1.02") == 0) { st->minor_version = 2; return st;