Blame SOURCES/Retire-mdassemble.patch

2c1b57
From 32141c1765967e37d6f1accdf124c166bc103c3b Mon Sep 17 00:00:00 2001
2c1b57
From: Jes Sorensen <jsorensen@fb.com>
2c1b57
Date: Tue, 11 Apr 2017 12:54:26 -0400
2c1b57
Subject: [RHEL7.5 PATCH 070/169] Retire mdassemble
2c1b57
2c1b57
mdassemble doesn't handle container based arrays, no support for sysfs,
2c1b57
etc. It has not been actively maintained for years, so time to send it
2c1b57
off to retirement.
2c1b57
2c1b57
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
2c1b57
---
2c1b57
 Assemble.c    | 21 +++-------------
2c1b57
 Makefile      | 37 ----------------------------
2c1b57
 Manage.c      | 10 +-------
2c1b57
 Monitor.c     |  3 ---
2c1b57
 mdassemble.c  | 79 -----------------------------------------------------------
2c1b57
 super-ddf.c   | 30 -----------------------
2c1b57
 super-gpt.c   |  6 -----
2c1b57
 super-intel.c | 52 +--------------------------------------
2c1b57
 super-mbr.c   |  8 ------
2c1b57
 super0.c      | 11 ---------
2c1b57
 super1.c      | 21 +++-------------
2c1b57
 util.c        | 37 +++-------------------------
2c1b57
 12 files changed, 12 insertions(+), 303 deletions(-)
2c1b57
 delete mode 100644 mdassemble.c
2c1b57
2c1b57
diff --git a/Assemble.c b/Assemble.c
2c1b57
index 0db428f..b828523 100644
2c1b57
--- a/Assemble.c
2c1b57
+++ b/Assemble.c
2c1b57
@@ -222,13 +222,11 @@ static int select_devices(struct mddev_dev *devlist,
2c1b57
 					pr_err("%s is a container, but we are looking for components\n",
2c1b57
 					       devname);
2c1b57
 				tmpdev->used = 2;
2c1b57
-#if !defined(MDASSEMBLE) || defined(MDASSEMBLE) && defined(MDASSEMBLE_AUTO)
2c1b57
 			} if (!tst && (tst = super_by_fd(dfd, NULL)) == NULL) {
2c1b57
 				if (report_mismatch)
2c1b57
 					pr_err("not a recognisable container: %s\n",
2c1b57
 					       devname);
2c1b57
 				tmpdev->used = 2;
2c1b57
-#endif
2c1b57
 			} else if (!tst->ss->load_container
2c1b57
 				   || tst->ss->load_container(tst, dfd, NULL)) {
2c1b57
 				if (report_mismatch)
2c1b57
@@ -574,9 +572,7 @@ static int load_devices(struct devs *devices, char *devmap,
2c1b57
 	struct mddev_dev *tmpdev;
2c1b57
 	int devcnt = 0;
2c1b57
 	int nextspare = 0;
2c1b57
-#ifndef MDASSEMBLE
2c1b57
 	int bitmap_done = 0;
2c1b57
-#endif
2c1b57
 	int most_recent = -1;
2c1b57
 	int bestcnt = 0;
2c1b57
 	int *best = *bestp;
2c1b57
@@ -592,7 +588,6 @@ static int load_devices(struct devs *devices, char *devmap,
2c1b57
 		if (tmpdev->used != 1)
2c1b57
 			continue;
2c1b57
 		/* looks like a good enough match to update the super block if needed */
2c1b57
-#ifndef MDASSEMBLE
2c1b57
 		if (c->update) {
2c1b57
 			/* prepare useful information in info structures */
2c1b57
 			struct stat stb2;
2c1b57
@@ -683,9 +678,7 @@ static int load_devices(struct devs *devices, char *devmap,
2c1b57
 				else
2c1b57
 					bitmap_done = 1;
2c1b57
 			}
2c1b57
-		} else
2c1b57
-#endif
2c1b57
-		{
2c1b57
+		} else {
2c1b57
 			dfd = dev_open(devname,
2c1b57
 				       tmpdev->disposition == 'I'
2c1b57
 				       ? O_RDWR : (O_RDWR|O_EXCL));
2c1b57
@@ -1097,7 +1090,6 @@ static int start_array(int mdfd,
2c1b57
 		 * it read-only and let the grow code make it writable.
2c1b57
 		 */
2c1b57
 		int rv;
2c1b57
-#ifndef MDASSEMBLE
2c1b57
 		if (content->reshape_active &&
2c1b57
 		    !(content->reshape_active & RESHAPE_NO_BACKUP) &&
2c1b57
 		    content->delta_disks <= 0) {
2c1b57
@@ -1122,7 +1114,6 @@ static int start_array(int mdfd,
2c1b57
 			rv = sysfs_set_str(content, NULL,
2c1b57
 					   "array_state", "readonly");
2c1b57
 		} else
2c1b57
-#endif
2c1b57
 			rv = ioctl(mdfd, RUN_ARRAY, NULL);
2c1b57
 		reopen_mddev(mdfd); /* drop O_EXCL */
2c1b57
 		if (rv == 0) {
2c1b57
@@ -1506,7 +1497,6 @@ try_again:
2c1b57
 		ioctl(mdfd, STOP_ARRAY, NULL);
2c1b57
 	}
2c1b57
 
2c1b57
-#ifndef MDASSEMBLE
2c1b57
 	if (content != &info) {
2c1b57
 		/* This is a member of a container.  Try starting the array. */
2c1b57
 		int err;
2c1b57
@@ -1515,7 +1505,7 @@ try_again:
2c1b57
 		close(mdfd);
2c1b57
 		return err;
2c1b57
 	}
2c1b57
-#endif
2c1b57
+
2c1b57
 	/* Ok, no bad inconsistancy, we can try updating etc */
2c1b57
 	devices = xcalloc(num_devs, sizeof(*devices));
2c1b57
 	devmap = xcalloc(num_devs, content->array.raid_disks);
2c1b57
@@ -1668,14 +1658,13 @@ try_again:
2c1b57
 		return 1;
2c1b57
 	}
2c1b57
 	st->ss->getinfo_super(st, content, NULL);
2c1b57
-#ifndef MDASSEMBLE
2c1b57
 	if (sysfs_init(content, mdfd, NULL)) {
2c1b57
 		pr_err("Unable to initialize sysfs\n");
2c1b57
 		close(mdfd);
2c1b57
 		free(devices);
2c1b57
 		return 1;
2c1b57
 	}
2c1b57
-#endif
2c1b57
+
2c1b57
 	/* after reload context, store journal_clean in context */
2c1b57
 	content->journal_clean = journal_clean;
2c1b57
 	for (i=0; i
2c1b57
@@ -1761,7 +1750,6 @@ try_again:
2c1b57
 	 * that was moved aside due to the reshape overwriting live data
2c1b57
 	 * The code of doing this lives in Grow.c
2c1b57
 	 */
2c1b57
-#ifndef MDASSEMBLE
2c1b57
 	if (content->reshape_active &&
2c1b57
 	    !(content->reshape_active & RESHAPE_NO_BACKUP)) {
2c1b57
 		int err = 0;
2c1b57
@@ -1813,7 +1801,6 @@ try_again:
2c1b57
 			return err;
2c1b57
 		}
2c1b57
 	}
2c1b57
-#endif
2c1b57
 
2c1b57
 	/* Almost ready to actually *do* something */
2c1b57
 	/* First, fill in the map, so that udev can find our name
2c1b57
@@ -1876,7 +1863,6 @@ try_again:
2c1b57
 	return rv == 2 ? 0 : rv;
2c1b57
 }
2c1b57
 
2c1b57
-#ifndef MDASSEMBLE
2c1b57
 int assemble_container_content(struct supertype *st, int mdfd,
2c1b57
 			       struct mdinfo *content, struct context *c,
2c1b57
 			       char *chosen_name, int *result)
2c1b57
@@ -2119,4 +2105,3 @@ int assemble_container_content(struct supertype *st, int mdfd,
2c1b57
 	return err;
2c1b57
 	/* FIXME should have an O_EXCL and wait for read-auto */
2c1b57
 }
2c1b57
-#endif
2c1b57
diff --git a/Makefile b/Makefile
2c1b57
index 5ff6cc0..a5d2a0a 100644
2c1b57
--- a/Makefile
2c1b57
+++ b/Makefile
2c1b57
@@ -158,18 +158,6 @@ MON_SRCS = $(patsubst %.o,%.c,$(MON_OBJS))
2c1b57
 STATICSRC = pwgr.c
2c1b57
 STATICOBJS = pwgr.o
2c1b57
 
2c1b57
-ASSEMBLE_SRCS := mdassemble.c Assemble.c Manage.c config.c policy.c dlink.c util.c \
2c1b57
-	maps.c lib.c xmalloc.c \
2c1b57
-	super0.c super1.c super-ddf.c super-intel.c sha1.c crc32.c sg_io.c mdstat.c \
2c1b57
-	platform-intel.c probe_roms.c sysfs.c super-mbr.c super-gpt.c mapfile.c \
2c1b57
-	crc32c.c
2c1b57
-ASSEMBLE_AUTO_SRCS := mdopen.c
2c1b57
-ASSEMBLE_FLAGS:= $(CFLAGS) -DMDASSEMBLE
2c1b57
-ifdef MDASSEMBLE_AUTO
2c1b57
-ASSEMBLE_SRCS += $(ASSEMBLE_AUTO_SRCS)
2c1b57
-ASSEMBLE_FLAGS += -DMDASSEMBLE_AUTO
2c1b57
-endif
2c1b57
-
2c1b57
 all : mdadm mdmon
2c1b57
 man : mdadm.man md.man mdadm.conf.man mdmon.man raid6check.man
2c1b57
 
2c1b57
@@ -222,31 +210,6 @@ test_stripe : restripe.c xmalloc.o mdadm.h
2c1b57
 raid6check : raid6check.o mdadm.h $(CHECK_OBJS)
2c1b57
 	$(CC) $(CXFLAGS) $(LDFLAGS) -o raid6check raid6check.o $(CHECK_OBJS)
2c1b57
 
2c1b57
-mdassemble : $(ASSEMBLE_SRCS) $(INCL)
2c1b57
-	$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(ASSEMBLE_FLAGS) -o mdassemble $(ASSEMBLE_SRCS)  $(STATICSRC)
2c1b57
-
2c1b57
-mdassemble.diet : $(ASSEMBLE_SRCS) $(INCL)
2c1b57
-	rm -f $(OBJS)
2c1b57
-	$(DIET_GCC) $(ASSEMBLE_FLAGS) -o mdassemble $(ASSEMBLE_SRCS)  $(STATICSRC)
2c1b57
-
2c1b57
-mdassemble.static : $(ASSEMBLE_SRCS) $(INCL)
2c1b57
-	rm -f $(OBJS)
2c1b57
-	$(CC) $(LDFLAGS) $(CPPFLAGS) $(ASSEMBLE_FLAGS) -static -DHAVE_STDINT_H -o mdassemble.static $(ASSEMBLE_SRCS) $(STATICSRC)
2c1b57
-
2c1b57
-mdassemble.auto : $(ASSEMBLE_SRCS) $(INCL) $(ASSEMBLE_AUTO_SRCS)
2c1b57
-	rm -f mdassemble.static
2c1b57
-	$(MAKE) MDASSEMBLE_AUTO=1 mdassemble.static
2c1b57
-	mv mdassemble.static mdassemble.auto
2c1b57
-
2c1b57
-mdassemble.uclibc : $(ASSEMBLE_SRCS) $(INCL)
2c1b57
-	rm -f $(OJS)
2c1b57
-	$(UCLIBC_GCC) $(ASSEMBLE_FLAGS) -DUCLIBC -DHAVE_STDINT_H -static -o mdassemble.uclibc $(ASSEMBLE_SRCS) $(STATICSRC)
2c1b57
-
2c1b57
-# This doesn't work
2c1b57
-mdassemble.klibc : $(ASSEMBLE_SRCS) $(INCL)
2c1b57
-	rm -f $(OBJS)
2c1b57
-	$(KLIBC_GCC) $(ASSEMBLE_FLAGS) -o mdassemble $(ASSEMBLE_SRCS)
2c1b57
-
2c1b57
 mdadm.8 : mdadm.8.in
2c1b57
 	sed -e 's/{DEFAULT_METADATA}/$(DEFAULT_METADATA)/g' \
2c1b57
 	-e 's,{MAP_PATH},$(MAP_PATH),g'  mdadm.8.in > mdadm.8
2c1b57
diff --git a/Manage.c b/Manage.c
2c1b57
index 9e69132..bb84d28 100644
2c1b57
--- a/Manage.c
2c1b57
+++ b/Manage.c
2c1b57
@@ -41,12 +41,9 @@ int Manage_ro(char *devname, int fd, int readonly)
2c1b57
 	 *
2c1b57
 	 */
2c1b57
 	mdu_array_info_t array;
2c1b57
-#ifndef MDASSEMBLE
2c1b57
 	struct mdinfo *mdi;
2c1b57
-#endif
2c1b57
 	int rv = 0;
2c1b57
 
2c1b57
-#ifndef MDASSEMBLE
2c1b57
 	/* If this is an externally-managed array, we need to modify the
2c1b57
 	 * metadata_version so that mdmon doesn't undo our change.
2c1b57
 	 */
2c1b57
@@ -90,7 +87,7 @@ int Manage_ro(char *devname, int fd, int readonly)
2c1b57
 		}
2c1b57
 		goto out;
2c1b57
 	}
2c1b57
-#endif
2c1b57
+
2c1b57
 	if (md_get_array_info(fd, &array)) {
2c1b57
 		pr_err("%s does not appear to be active.\n",
2c1b57
 			devname);
2c1b57
@@ -114,14 +111,10 @@ int Manage_ro(char *devname, int fd, int readonly)
2c1b57
 		}
2c1b57
 	}
2c1b57
 out:
2c1b57
-#ifndef MDASSEMBLE
2c1b57
 	sysfs_free(mdi);
2c1b57
-#endif
2c1b57
 	return rv;
2c1b57
 }
2c1b57
 
2c1b57
-#ifndef MDASSEMBLE
2c1b57
-
2c1b57
 static void remove_devices(char *devnm, char *path)
2c1b57
 {
2c1b57
 	/*
2c1b57
@@ -1802,4 +1795,3 @@ int move_spare(char *from_devname, char *to_devname, dev_t devid)
2c1b57
 	close(fd2);
2c1b57
 	return 0;
2c1b57
 }
2c1b57
-#endif
2c1b57
diff --git a/Monitor.c b/Monitor.c
2c1b57
index 036a561..1f15377 100644
2c1b57
--- a/Monitor.c
2c1b57
+++ b/Monitor.c
2c1b57
@@ -1058,8 +1058,6 @@ int Wait(char *dev)
2c1b57
 	}
2c1b57
 }
2c1b57
 
2c1b57
-#ifndef MDASSEMBLE
2c1b57
-
2c1b57
 static char *clean_states[] = {
2c1b57
 	"clear", "inactive", "readonly", "read-auto", "clean", NULL };
2c1b57
 
2c1b57
@@ -1151,4 +1149,3 @@ int WaitClean(char *dev, int sock, int verbose)
2c1b57
 
2c1b57
 	return rv;
2c1b57
 }
2c1b57
-#endif /* MDASSEMBLE */
2c1b57
diff --git a/mdassemble.c b/mdassemble.c
2c1b57
deleted file mode 100644
2c1b57
index f0833bc..0000000
2c1b57
--- a/mdassemble.c
2c1b57
+++ /dev/null
2c1b57
@@ -1,79 +0,0 @@
2c1b57
-/*
2c1b57
- * mdassemble - assemble Linux "md" devices aka RAID arrays.
2c1b57
- *
2c1b57
- * Copyright (C) 2001-2009 Neil Brown <neilb@suse.de>
2c1b57
- * Copyright (C) 2003 Luca Berra <bluca@vodka.it>
2c1b57
- *
2c1b57
- *
2c1b57
- *    This program is free software; you can redistribute it and/or modify
2c1b57
- *    it under the terms of the GNU General Public License as published by
2c1b57
- *    the Free Software Foundation; either version 2 of the License, or
2c1b57
- *    (at your option) any later version.
2c1b57
- *
2c1b57
- *    This program is distributed in the hope that it will be useful,
2c1b57
- *    but WITHOUT ANY WARRANTY; without even the implied warranty of
2c1b57
- *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
2c1b57
- *    GNU General Public License for more details.
2c1b57
- *
2c1b57
- *    You should have received a copy of the GNU General Public License
2c1b57
- *    along with this program; if not, write to the Free Software
2c1b57
- *    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
2c1b57
- *
2c1b57
- *    Author: Neil Brown
2c1b57
- *    Email: <neilb@suse.de>
2c1b57
- */
2c1b57
-
2c1b57
-#include "mdadm.h"
2c1b57
-#include "md_p.h"
2c1b57
-
2c1b57
-char const Name[] = "mdassemble";
2c1b57
-
2c1b57
-#ifndef MDASSEMBLE_AUTO
2c1b57
-/* from mdopen.c */
2c1b57
-int open_mddev(char *dev, int report_errors/*unused*/)
2c1b57
-{
2c1b57
-	struct mdu_array_info_s array;
2c1b57
-	int mdfd = open(dev, O_RDONLY);
2c1b57
-	if (mdfd < 0)
2c1b57
-		pr_err("error opening %s: %s\n", dev, strerror(errno));
2c1b57
-	else if (md_get_array_info(mdfd, &array) != 0) {
2c1b57
-		pr_err("%s does not appear to be an md device\n", dev);
2c1b57
-		close(mdfd);
2c1b57
-		mdfd = -1;
2c1b57
-	}
2c1b57
-	return mdfd;
2c1b57
-}
2c1b57
-int create_mddev(char *dev, char *name, int autof/*unused*/, int trustworthy,
2c1b57
-		 char *chosen)
2c1b57
-{
2c1b57
-	return open_mddev(dev, 0);
2c1b57
-}
2c1b57
-#endif
2c1b57
-
2c1b57
-int rv;
2c1b57
-int mdfd = -1;
2c1b57
-
2c1b57
-int main(int argc, char *argv[])
2c1b57
-{
2c1b57
-	struct mddev_ident *array_list =  conf_get_ident(NULL);
2c1b57
-	struct context c = { .freeze_reshape = 1 };
2c1b57
-	if (!array_list) {
2c1b57
-		pr_err("No arrays found in config file\n");
2c1b57
-		rv = 1;
2c1b57
-	} else
2c1b57
-		for (; array_list; array_list = array_list->next) {
2c1b57
-			mdu_array_info_t array;
2c1b57
-			if (strcasecmp(array_list->devname, "<ignore>") == 0)
2c1b57
-				continue;
2c1b57
-			mdfd = open_mddev(array_list->devname, 0);
2c1b57
-			if (mdfd >= 0 && md_get_array_info(mdfd, &array) == 0) {
2c1b57
-				rv |= Manage_ro(array_list->devname, mdfd, -1); /* make it readwrite */
2c1b57
-				continue;
2c1b57
-			}
2c1b57
-			if (mdfd >= 0)
2c1b57
-				close(mdfd);
2c1b57
-			rv |= Assemble(array_list->st, array_list->devname,
2c1b57
-				       array_list, NULL, &c);
2c1b57
-		}
2c1b57
-	return rv;
2c1b57
-}
2c1b57
diff --git a/super-ddf.c b/super-ddf.c
2c1b57
index c6037c1..796eaa5 100644
2c1b57
--- a/super-ddf.c
2c1b57
+++ b/super-ddf.c
2c1b57
@@ -500,7 +500,6 @@ struct ddf_super {
2c1b57
 	} *dlist, *add_list;
2c1b57
 };
2c1b57
 
2c1b57
-#ifndef MDASSEMBLE
2c1b57
 static int load_super_ddf_all(struct supertype *st, int fd,
2c1b57
 			      void **sbp, char *devname);
2c1b57
 static int get_svd_state(const struct ddf_super *, const struct vcl *);
2c1b57
@@ -518,7 +517,6 @@ static int validate_geometry_ddf_bvd(struct supertype *st,
2c1b57
 				     unsigned long long data_offset,
2c1b57
 				     char *dev, unsigned long long *freesize,
2c1b57
 				     int verbose);
2c1b57
-#endif
2c1b57
 
2c1b57
 static void free_super_ddf(struct supertype *st);
2c1b57
 static int all_ff(const char *guid);
2c1b57
@@ -1305,8 +1303,6 @@ static struct supertype *match_metadata_desc_ddf(char *arg)
2c1b57
 	return st;
2c1b57
 }
2c1b57
 
2c1b57
-#ifndef MDASSEMBLE
2c1b57
-
2c1b57
 static mapping_t ddf_state[] = {
2c1b57
 	{ "Optimal", 0},
2c1b57
 	{ "Degraded", 1},
2c1b57
@@ -1355,7 +1351,6 @@ static mapping_t ddf_sec_level[] = {
2c1b57
 	{ "Spanned", DDF_2SPANNED},
2c1b57
 	{ NULL, 0}
2c1b57
 };
2c1b57
-#endif
2c1b57
 
2c1b57
 static int all_ff(const char *guid)
2c1b57
 {
2c1b57
@@ -1382,7 +1377,6 @@ static const char *guid_str(const char *guid)
2c1b57
 	return (const char *) buf;
2c1b57
 }
2c1b57
 
2c1b57
-#ifndef MDASSEMBLE
2c1b57
 static void print_guid(char *guid, int tstamp)
2c1b57
 {
2c1b57
 	/* A GUIDs are part (or all) ASCII and part binary.
2c1b57
@@ -1748,7 +1742,6 @@ static void detail_super_ddf(struct supertype *st, char *homehost)
2c1b57
 	printf("     Virtual Disks : %d\n", cnt);
2c1b57
 	printf("\n");
2c1b57
 }
2c1b57
-#endif
2c1b57
 
2c1b57
 static const char *vendors_with_variable_volume_UUID[] = {
2c1b57
 	"LSI      ",
2c1b57
@@ -1795,7 +1788,6 @@ static void uuid_of_ddf_subarray(const struct ddf_super *ddf,
2c1b57
 	memcpy(uuid, sha, 4*4);
2c1b57
 }
2c1b57
 
2c1b57
-#ifndef MDASSEMBLE
2c1b57
 static void brief_detail_super_ddf(struct supertype *st)
2c1b57
 {
2c1b57
 	struct mdinfo info;
2c1b57
@@ -1811,7 +1803,6 @@ static void brief_detail_super_ddf(struct supertype *st)
2c1b57
 	fname_from_uuid(st, &info, nbuf,':');
2c1b57
 	printf(" UUID=%s", nbuf + 5);
2c1b57
 }
2c1b57
-#endif
2c1b57
 
2c1b57
 static int match_home_ddf(struct supertype *st, char *homehost)
2c1b57
 {
2c1b57
@@ -1833,7 +1824,6 @@ static int match_home_ddf(struct supertype *st, char *homehost)
2c1b57
 		ddf->controller.vendor_data[len] == 0);
2c1b57
 }
2c1b57
 
2c1b57
-#ifndef MDASSEMBLE
2c1b57
 static int find_index_in_bvd(const struct ddf_super *ddf,
2c1b57
 			     const struct vd_config *conf, unsigned int n,
2c1b57
 			     unsigned int *n_bvd)
2c1b57
@@ -1914,7 +1904,6 @@ bad:
2c1b57
 	pr_err("Could't find disk %d in array %u\n", n, inst);
2c1b57
 	return NULL;
2c1b57
 }
2c1b57
-#endif
2c1b57
 
2c1b57
 static int find_phys(const struct ddf_super *ddf, be32 phys_refnum)
2c1b57
 {
2c1b57
@@ -2274,7 +2263,6 @@ static unsigned int find_vde_by_name(const struct ddf_super *ddf,
2c1b57
 	return DDF_NOTFOUND;
2c1b57
 }
2c1b57
 
2c1b57
-#ifndef MDASSEMBLE
2c1b57
 static unsigned int find_vde_by_guid(const struct ddf_super *ddf,
2c1b57
 				     const char *guid)
2c1b57
 {
2c1b57
@@ -2286,7 +2274,6 @@ static unsigned int find_vde_by_guid(const struct ddf_super *ddf,
2c1b57
 			return i;
2c1b57
 	return DDF_NOTFOUND;
2c1b57
 }
2c1b57
-#endif
2c1b57
 
2c1b57
 static int init_super_ddf(struct supertype *st,
2c1b57
 			  mdu_array_info_t *info,
2c1b57
@@ -2507,7 +2494,6 @@ static int chunk_to_shift(int chunksize)
2c1b57
 	return ffs(chunksize/512)-1;
2c1b57
 }
2c1b57
 
2c1b57
-#ifndef MDASSEMBLE
2c1b57
 struct extent {
2c1b57
 	unsigned long long start, size;
2c1b57
 };
2c1b57
@@ -2608,7 +2594,6 @@ static unsigned long long find_space(
2c1b57
 	free(e);
2c1b57
 	return INVALID_SECTORS;
2c1b57
 }
2c1b57
-#endif
2c1b57
 
2c1b57
 static int init_super_ddf_bvd(struct supertype *st,
2c1b57
 			      mdu_array_info_t *info,
2c1b57
@@ -2727,7 +2712,6 @@ static int init_super_ddf_bvd(struct supertype *st,
2c1b57
 	return 1;
2c1b57
 }
2c1b57
 
2c1b57
-#ifndef MDASSEMBLE
2c1b57
 static void add_to_super_ddf_bvd(struct supertype *st,
2c1b57
 				 mdu_disk_info_t *dk, int fd, char *devname,
2c1b57
 				 unsigned long long data_offset)
2c1b57
@@ -3015,7 +2999,6 @@ static int remove_from_super_ddf(struct supertype *st, mdu_disk_info_t *dk)
2c1b57
 	}
2c1b57
 	return 0;
2c1b57
 }
2c1b57
-#endif
2c1b57
 
2c1b57
 /*
2c1b57
  * This is the write_init_super method for a ddf container.  It is
2c1b57
@@ -3176,7 +3159,6 @@ static int _write_super_to_disk(struct ddf_super *ddf, struct dl *d)
2c1b57
 	return 1;
2c1b57
 }
2c1b57
 
2c1b57
-#ifndef MDASSEMBLE
2c1b57
 static int __write_init_super_ddf(struct supertype *st)
2c1b57
 {
2c1b57
 	struct ddf_super *ddf = st->sb;
2c1b57
@@ -3259,8 +3241,6 @@ static int write_init_super_ddf(struct supertype *st)
2c1b57
 	}
2c1b57
 }
2c1b57
 
2c1b57
-#endif
2c1b57
-
2c1b57
 static __u64 avail_size_ddf(struct supertype *st, __u64 devsize,
2c1b57
 			    unsigned long long data_offset)
2c1b57
 {
2c1b57
@@ -3270,8 +3250,6 @@ static __u64 avail_size_ddf(struct supertype *st, __u64 devsize,
2c1b57
 	return devsize - 32*1024*2;
2c1b57
 }
2c1b57
 
2c1b57
-#ifndef MDASSEMBLE
2c1b57
-
2c1b57
 static int reserve_space(struct supertype *st, int raiddisks,
2c1b57
 			 unsigned long long size, int chunk,
2c1b57
 			 unsigned long long data_offset,
2c1b57
@@ -3653,8 +3631,6 @@ static int load_container_ddf(struct supertype *st, int fd,
2c1b57
 	return load_super_ddf_all(st, fd, &st->sb, devname);
2c1b57
 }
2c1b57
 
2c1b57
-#endif /* MDASSEMBLE */
2c1b57
-
2c1b57
 static int check_secondary(const struct vcl *vc)
2c1b57
 {
2c1b57
 	const struct vd_config *conf = &vc->conf;
2c1b57
@@ -4075,7 +4051,6 @@ static int compare_super_ddf(struct supertype *st, struct supertype *tst)
2c1b57
 	return 0;
2c1b57
 }
2c1b57
 
2c1b57
-#ifndef MDASSEMBLE
2c1b57
 /*
2c1b57
  * A new array 'a' has been started which claims to be instance 'inst'
2c1b57
  * within container 'c'.
2c1b57
@@ -5196,7 +5171,6 @@ static struct mdinfo *ddf_activate_spare(struct active_array *a,
2c1b57
 	*updates = mu;
2c1b57
 	return rv;
2c1b57
 }
2c1b57
-#endif /* MDASSEMBLE */
2c1b57
 
2c1b57
 static int ddf_level_to_layout(int level)
2c1b57
 {
2c1b57
@@ -5225,7 +5199,6 @@ static void default_geometry_ddf(struct supertype *st, int *level, int *layout,
2c1b57
 }
2c1b57
 
2c1b57
 struct superswitch super_ddf = {
2c1b57
-#ifndef	MDASSEMBLE
2c1b57
 	.examine_super	= examine_super_ddf,
2c1b57
 	.brief_examine_super = brief_examine_super_ddf,
2c1b57
 	.brief_examine_subarrays = brief_examine_subarrays_ddf,
2c1b57
@@ -5239,7 +5212,6 @@ struct superswitch super_ddf = {
2c1b57
 	.load_container	= load_container_ddf,
2c1b57
 	.copy_metadata = copy_metadata_ddf,
2c1b57
 	.kill_subarray  = kill_subarray_ddf,
2c1b57
-#endif
2c1b57
 	.match_home	= match_home_ddf,
2c1b57
 	.uuid_from_super= uuid_from_super_ddf,
2c1b57
 	.getinfo_super  = getinfo_super_ddf,
2c1b57
@@ -5259,7 +5231,6 @@ struct superswitch super_ddf = {
2c1b57
 
2c1b57
 	.external	= 1,
2c1b57
 
2c1b57
-#ifndef MDASSEMBLE
2c1b57
 /* for mdmon */
2c1b57
 	.open_new       = ddf_open_new,
2c1b57
 	.set_array_state= ddf_set_array_state,
2c1b57
@@ -5268,6 +5239,5 @@ struct superswitch super_ddf = {
2c1b57
 	.process_update	= ddf_process_update,
2c1b57
 	.prepare_update	= ddf_prepare_update,
2c1b57
 	.activate_spare = ddf_activate_spare,
2c1b57
-#endif
2c1b57
 	.name = "ddf",
2c1b57
 };
2c1b57
diff --git a/super-gpt.c b/super-gpt.c
2c1b57
index bb38a97..a1e9aa9 100644
2c1b57
--- a/super-gpt.c
2c1b57
+++ b/super-gpt.c
2c1b57
@@ -47,7 +47,6 @@ static void free_gpt(struct supertype *st)
2c1b57
 	st->sb = NULL;
2c1b57
 }
2c1b57
 
2c1b57
-#ifndef MDASSEMBLE
2c1b57
 static void examine_gpt(struct supertype *st, char *homehost)
2c1b57
 {
2c1b57
 	struct GPT *gpt = st->sb + 512;
2c1b57
@@ -66,7 +65,6 @@ static void examine_gpt(struct supertype *st, char *homehost)
2c1b57
 			);
2c1b57
 	}
2c1b57
 }
2c1b57
-#endif /* MDASSEMBLE */
2c1b57
 
2c1b57
 static int load_gpt(struct supertype *st, int fd, char *devname)
2c1b57
 {
2c1b57
@@ -199,7 +197,6 @@ static struct supertype *match_metadata_desc(char *arg)
2c1b57
 	return st;
2c1b57
 }
2c1b57
 
2c1b57
-#ifndef MDASSEMBLE
2c1b57
 static int validate_geometry(struct supertype *st, int level,
2c1b57
 			     int layout, int raiddisks,
2c1b57
 			     int *chunk, unsigned long long size,
2c1b57
@@ -210,13 +207,10 @@ static int validate_geometry(struct supertype *st, int level,
2c1b57
 	pr_err("gpt metadata cannot be used this way\n");
2c1b57
 	return 0;
2c1b57
 }
2c1b57
-#endif
2c1b57
 
2c1b57
 struct superswitch gpt = {
2c1b57
-#ifndef MDASSEMBLE
2c1b57
 	.examine_super = examine_gpt,
2c1b57
 	.validate_geometry = validate_geometry,
2c1b57
-#endif
2c1b57
 	.match_metadata_desc = match_metadata_desc,
2c1b57
 	.load_super = load_gpt,
2c1b57
 	.store_super = store_gpt,
2c1b57
diff --git a/super-intel.c b/super-intel.c
2c1b57
index 84dfe2b..0aed57c 100644
2c1b57
--- a/super-intel.c
2c1b57
+++ b/super-intel.c
2c1b57
@@ -260,9 +260,7 @@ struct bbm_log {
2c1b57
 	struct bbm_log_entry marked_block_entries[BBM_LOG_MAX_ENTRIES];
2c1b57
 } __attribute__ ((__packed__));
2c1b57
 
2c1b57
-#ifndef MDASSEMBLE
2c1b57
 static char *map_state_str[] = { "normal", "uninitialized", "degraded", "failed" };
2c1b57
-#endif
2c1b57
 
2c1b57
 #define BLOCKS_PER_KB	(1024/512)
2c1b57
 
2c1b57
@@ -672,12 +670,10 @@ static struct supertype *match_metadata_desc_imsm(char *arg)
2c1b57
 	return st;
2c1b57
 }
2c1b57
 
2c1b57
-#ifndef MDASSEMBLE
2c1b57
 static __u8 *get_imsm_version(struct imsm_super *mpb)
2c1b57
 {
2c1b57
 	return &mpb->sig[MPB_SIG_LEN];
2c1b57
 }
2c1b57
-#endif
2c1b57
 
2c1b57
 /* retrieve a disk directly from the anchor when the anchor is known to be
2c1b57
  * up-to-date, currently only at load time
2c1b57
@@ -784,7 +780,6 @@ static size_t sizeof_imsm_dev(struct imsm_dev *dev, int migr_state)
2c1b57
 	return size;
2c1b57
 }
2c1b57
 
2c1b57
-#ifndef MDASSEMBLE
2c1b57
 /* retrieve disk serial number list from a metadata update */
2c1b57
 static struct disk_info *get_disk_info(struct imsm_update_create_array *update)
2c1b57
 {
2c1b57
@@ -796,7 +791,6 @@ static struct disk_info *get_disk_info(struct imsm_update_create_array *update)
2c1b57
 
2c1b57
 	return inf;
2c1b57
 }
2c1b57
-#endif
2c1b57
 
2c1b57
 static struct imsm_dev *__get_imsm_dev(struct imsm_super *mpb, __u8 index)
2c1b57
 {
2c1b57
@@ -847,7 +841,6 @@ static inline struct bbm_log_block_addr __cpu_to_le48(unsigned long long sec)
2c1b57
 	return addr;
2c1b57
 }
2c1b57
 
2c1b57
-#ifndef MDASSEMBLE
2c1b57
 /* get size of the bbm log */
2c1b57
 static __u32 get_imsm_bbm_log_size(struct bbm_log *log)
2c1b57
 {
2c1b57
@@ -978,7 +971,6 @@ static int clear_badblock(struct bbm_log *log, const __u8 idx, const unsigned
2c1b57
 
2c1b57
 	return 1;
2c1b57
 }
2c1b57
-#endif /* MDASSEMBLE */
2c1b57
 
2c1b57
 /* allocate and load BBM log from metadata */
2c1b57
 static int load_bbm_log(struct intel_super *super)
2c1b57
@@ -1423,7 +1415,6 @@ static int is_gen_migration(struct imsm_dev *dev);
2c1b57
 
2c1b57
 #define IMSM_4K_DIV 8
2c1b57
 
2c1b57
-#ifndef MDASSEMBLE
2c1b57
 static __u64 blocks_per_migr_unit(struct intel_super *super,
2c1b57
 				  struct imsm_dev *dev);
2c1b57
 
2c1b57
@@ -1698,7 +1689,6 @@ void examine_migr_rec_imsm(struct intel_super *super)
2c1b57
 		break;
2c1b57
 	}
2c1b57
 }
2c1b57
-#endif /* MDASSEMBLE */
2c1b57
 
2c1b57
 void convert_from_4k_imsm_migr_rec(struct intel_super *super)
2c1b57
 {
2c1b57
@@ -1858,7 +1848,6 @@ static int imsm_check_attributes(__u32 attributes)
2c1b57
 	return ret_val;
2c1b57
 }
2c1b57
 
2c1b57
-#ifndef MDASSEMBLE
2c1b57
 static void getinfo_super_imsm(struct supertype *st, struct mdinfo *info, char *map);
2c1b57
 
2c1b57
 static void examine_super_imsm(struct supertype *st, char *homehost)
2c1b57
@@ -2572,8 +2561,6 @@ static int export_detail_platform_imsm(int verbose, char *controller_path)
2c1b57
 	return result;
2c1b57
 }
2c1b57
 
2c1b57
-#endif
2c1b57
-
2c1b57
 static int match_home_imsm(struct supertype *st, char *homehost)
2c1b57
 {
2c1b57
 	/* the imsm metadata format does not specify any host
2c1b57
@@ -2984,7 +2971,6 @@ out:
2c1b57
 	return retval;
2c1b57
 }
2c1b57
 
2c1b57
-#ifndef MDASSEMBLE
2c1b57
 /*******************************************************************************
2c1b57
  * function: imsm_create_metadata_checkpoint_update
2c1b57
  * Description: It creates update for checkpoint change.
2c1b57
@@ -3125,7 +3111,6 @@ static int write_imsm_migr_rec(struct supertype *st)
2c1b57
 		close(fd);
2c1b57
 	return retval;
2c1b57
 }
2c1b57
-#endif /* MDASSEMBLE */
2c1b57
 
2c1b57
 /* spare/missing disks activations are not allowe when
2c1b57
  * array/container performs reshape operation, because
2c1b57
@@ -3396,7 +3381,6 @@ static __u8 imsm_check_degraded(struct intel_super *super, struct imsm_dev *dev,
2c1b57
 static int imsm_count_failed(struct intel_super *super, struct imsm_dev *dev,
2c1b57
 			     int look_in_map);
2c1b57
 
2c1b57
-#ifndef MDASSEMBLE
2c1b57
 static void manage_second_map(struct intel_super *super, struct imsm_dev *dev)
2c1b57
 {
2c1b57
 	if (is_gen_migration(dev)) {
2c1b57
@@ -3412,7 +3396,6 @@ static void manage_second_map(struct intel_super *super, struct imsm_dev *dev)
2c1b57
 		}
2c1b57
 	}
2c1b57
 }
2c1b57
-#endif
2c1b57
 
2c1b57
 static struct imsm_disk *get_imsm_missing(struct intel_super *super, __u8 index)
2c1b57
 {
2c1b57
@@ -3994,7 +3977,6 @@ load_imsm_disk(int fd, struct intel_super *super, char *devname, int keep_fd)
2c1b57
 	return 0;
2c1b57
 }
2c1b57
 
2c1b57
-#ifndef MDASSEMBLE
2c1b57
 /* When migrating map0 contains the 'destination' state while map1
2c1b57
  * contains the current state.  When not migrating map0 contains the
2c1b57
  * current state.  This routine assumes that map[0].map_state is set to
2c1b57
@@ -4082,7 +4064,6 @@ static void end_migration(struct imsm_dev *dev, struct intel_super *super,
2c1b57
 	dev->vol.curr_migr_unit = 0;
2c1b57
 	map->map_state = map_state;
2c1b57
 }
2c1b57
-#endif
2c1b57
 
2c1b57
 static int parse_raid_devices(struct intel_super *super)
2c1b57
 {
2c1b57
@@ -4528,7 +4509,6 @@ static int find_missing(struct intel_super *super)
2c1b57
 	return 0;
2c1b57
 }
2c1b57
 
2c1b57
-#ifndef MDASSEMBLE
2c1b57
 static struct intel_disk *disk_list_get(__u8 *serial, struct intel_disk *disk_list)
2c1b57
 {
2c1b57
 	struct intel_disk *idisk = disk_list;
2c1b57
@@ -5066,7 +5046,6 @@ static int load_container_imsm(struct supertype *st, int fd, char *devname)
2c1b57
 {
2c1b57
 	return load_super_imsm_all(st, fd, &st->sb, devname, NULL, 1);
2c1b57
 }
2c1b57
-#endif
2c1b57
 
2c1b57
 static int load_super_imsm(struct supertype *st, int fd, char *devname)
2c1b57
 {
2c1b57
@@ -5483,7 +5462,6 @@ static int init_super_imsm(struct supertype *st, mdu_array_info_t *info,
2c1b57
 	return 1;
2c1b57
 }
2c1b57
 
2c1b57
-#ifndef MDASSEMBLE
2c1b57
 static int add_to_super_imsm_volume(struct supertype *st, mdu_disk_info_t *dk,
2c1b57
 				     int fd, char *devname)
2c1b57
 {
2c1b57
@@ -6028,7 +6006,6 @@ static int mgmt_disk(struct supertype *st)
2c1b57
 
2c1b57
 	return 0;
2c1b57
 }
2c1b57
-#endif
2c1b57
 
2c1b57
 __u32 crc32c_le(__u32 crc, unsigned char const *p, size_t len);
2c1b57
 
2c1b57
@@ -6136,8 +6113,6 @@ out:
2c1b57
 	return ret;
2c1b57
 }
2c1b57
 
2c1b57
-#ifndef MDASSEMBLE
2c1b57
-
2c1b57
 static int write_init_ppl_imsm_all(struct supertype *st, struct mdinfo *info)
2c1b57
 {
2c1b57
 	struct intel_super *super = st->sb;
2c1b57
@@ -6199,7 +6174,6 @@ static int write_init_super_imsm(struct supertype *st)
2c1b57
 
2c1b57
 	return rv;
2c1b57
 }
2c1b57
-#endif
2c1b57
 
2c1b57
 static int store_super_imsm(struct supertype *st, int fd)
2c1b57
 {
2c1b57
@@ -6209,16 +6183,11 @@ static int store_super_imsm(struct supertype *st, int fd)
2c1b57
 	if (!mpb)
2c1b57
 		return 1;
2c1b57
 
2c1b57
-#ifndef MDASSEMBLE
2c1b57
 	if (super->sector_size == 4096)
2c1b57
 		convert_to_4k(super);
2c1b57
 	return store_imsm_mpb(fd, mpb);
2c1b57
-#else
2c1b57
-	return 1;
2c1b57
-#endif
2c1b57
 }
2c1b57
 
2c1b57
-#ifndef MDASSEMBLE
2c1b57
 static int validate_geometry_imsm_container(struct supertype *st, int level,
2c1b57
 					    int layout, int raiddisks, int chunk,
2c1b57
 					    unsigned long long size,
2c1b57
@@ -7433,7 +7402,6 @@ static int update_subarray_imsm(struct supertype *st, char *subarray,
2c1b57
 
2c1b57
 	return 0;
2c1b57
 }
2c1b57
-#endif /* MDASSEMBLE */
2c1b57
 
2c1b57
 static int is_gen_migration(struct imsm_dev *dev)
2c1b57
 {
2c1b57
@@ -7467,7 +7435,6 @@ static int is_rebuilding(struct imsm_dev *dev)
2c1b57
 		return 0;
2c1b57
 }
2c1b57
 
2c1b57
-#ifndef MDASSEMBLE
2c1b57
 static int is_initializing(struct imsm_dev *dev)
2c1b57
 {
2c1b57
 	struct imsm_map *migr_map;
2c1b57
@@ -7485,7 +7452,6 @@ static int is_initializing(struct imsm_dev *dev)
2c1b57
 
2c1b57
 	return 0;
2c1b57
 }
2c1b57
-#endif
2c1b57
 
2c1b57
 static void update_recovery_start(struct intel_super *super,
2c1b57
 					struct imsm_dev *dev,
2c1b57
@@ -7519,9 +7485,7 @@ static void update_recovery_start(struct intel_super *super,
2c1b57
 	rebuild->recovery_start = units * blocks_per_migr_unit(super, dev);
2c1b57
 }
2c1b57
 
2c1b57
-#ifndef MDASSEMBLE
2c1b57
 static int recover_backup_imsm(struct supertype *st, struct mdinfo *info);
2c1b57
-#endif
2c1b57
 
2c1b57
 static struct mdinfo *container_content_imsm(struct supertype *st, char *subarray)
2c1b57
 {
2c1b57
@@ -7560,9 +7524,7 @@ static struct mdinfo *container_content_imsm(struct supertype *st, char *subarra
2c1b57
 		struct imsm_map *map2;
2c1b57
 		struct mdinfo *this;
2c1b57
 		int slot;
2c1b57
-#ifndef MDASSEMBLE
2c1b57
 		int chunk;
2c1b57
-#endif
2c1b57
 		char *ep;
2c1b57
 
2c1b57
 		if (subarray &&
2c1b57
@@ -7591,7 +7553,6 @@ static struct mdinfo *container_content_imsm(struct supertype *st, char *subarra
2c1b57
 		super->current_vol = i;
2c1b57
 		getinfo_super_imsm_volume(st, this, NULL);
2c1b57
 		this->next = rest;
2c1b57
-#ifndef MDASSEMBLE
2c1b57
 		chunk = __le16_to_cpu(map->blocks_per_strip) >> 1;
2c1b57
 		/* mdadm does not support all metadata features- set the bit in all arrays state */
2c1b57
 		if (!validate_geometry_imsm_orom(super,
2c1b57
@@ -7606,7 +7567,6 @@ static struct mdinfo *container_content_imsm(struct supertype *st, char *subarra
2c1b57
 			  (1<
2c1b57
 			  (1<
2c1b57
 		}
2c1b57
-#endif
2c1b57
 
2c1b57
 		/* if array has bad blocks, set suitable bit in all arrays state */
2c1b57
 		if (sb_errors)
2c1b57
@@ -7697,11 +7657,9 @@ static struct mdinfo *container_content_imsm(struct supertype *st, char *subarra
2c1b57
 		update_recovery_start(super, dev, this);
2c1b57
 		this->array.spare_disks += spare_disks;
2c1b57
 
2c1b57
-#ifndef MDASSEMBLE
2c1b57
 		/* check for reshape */
2c1b57
 		if (this->reshape_active == 1)
2c1b57
 			recover_backup_imsm(st, this);
2c1b57
-#endif
2c1b57
 		rest = this;
2c1b57
 	}
2c1b57
 
2c1b57
@@ -7831,7 +7789,6 @@ static int imsm_count_failed(struct intel_super *super, struct imsm_dev *dev,
2c1b57
 	return failed;
2c1b57
 }
2c1b57
 
2c1b57
-#ifndef MDASSEMBLE
2c1b57
 static int imsm_open_new(struct supertype *c, struct active_array *a,
2c1b57
 			 char *inst)
2c1b57
 {
2c1b57
@@ -10003,7 +9960,6 @@ static void imsm_delete(struct intel_super *super, struct dl **dlp, unsigned ind
2c1b57
 		__free_imsm_disk(dl);
2c1b57
 	}
2c1b57
 }
2c1b57
-#endif /* MDASSEMBLE */
2c1b57
 
2c1b57
 static void close_targets(int *targets, int new_disks)
2c1b57
 {
2c1b57
@@ -10206,7 +10162,7 @@ int validate_container_imsm(struct mdinfo *info)
2c1b57
 
2c1b57
 	return 0;
2c1b57
 }
2c1b57
-#ifndef MDASSEMBLE
2c1b57
+
2c1b57
 /*******************************************************************************
2c1b57
 * Function:   imsm_record_badblock
2c1b57
 * Description: This routine stores new bad block record in BBM log
2c1b57
@@ -11852,10 +11808,7 @@ abort:
2c1b57
 	return ret_val;
2c1b57
 }
2c1b57
 
2c1b57
-#endif /* MDASSEMBLE */
2c1b57
-
2c1b57
 struct superswitch super_imsm = {
2c1b57
-#ifndef	MDASSEMBLE
2c1b57
 	.examine_super	= examine_super_imsm,
2c1b57
 	.brief_examine_super = brief_examine_super_imsm,
2c1b57
 	.brief_examine_subarrays = brief_examine_subarrays_imsm,
2c1b57
@@ -11878,7 +11831,6 @@ struct superswitch super_imsm = {
2c1b57
 	.recover_backup = recover_backup_imsm,
2c1b57
 	.copy_metadata = copy_metadata_imsm,
2c1b57
 	.examine_badblocks = examine_badblocks_imsm,
2c1b57
-#endif
2c1b57
 	.match_home	= match_home_imsm,
2c1b57
 	.uuid_from_super= uuid_from_super_imsm,
2c1b57
 	.getinfo_super  = getinfo_super_imsm,
2c1b57
@@ -11904,7 +11856,6 @@ struct superswitch super_imsm = {
2c1b57
 	.external	= 1,
2c1b57
 	.name = "imsm",
2c1b57
 
2c1b57
-#ifndef MDASSEMBLE
2c1b57
 /* for mdmon */
2c1b57
 	.open_new	= imsm_open_new,
2c1b57
 	.set_array_state= imsm_set_array_state,
2c1b57
@@ -11916,5 +11867,4 @@ struct superswitch super_imsm = {
2c1b57
 	.record_bad_block = imsm_record_badblock,
2c1b57
 	.clear_bad_block  = imsm_clear_badblock,
2c1b57
 	.get_bad_blocks   = imsm_get_badblocks,
2c1b57
-#endif /* MDASSEMBLE */
2c1b57
 };
2c1b57
diff --git a/super-mbr.c b/super-mbr.c
2c1b57
index 1bbe57a..839f000 100644
2c1b57
--- a/super-mbr.c
2c1b57
+++ b/super-mbr.c
2c1b57
@@ -48,8 +48,6 @@ static void free_mbr(struct supertype *st)
2c1b57
 	st->sb = NULL;
2c1b57
 }
2c1b57
 
2c1b57
-#ifndef MDASSEMBLE
2c1b57
-
2c1b57
 static void examine_mbr(struct supertype *st, char *homehost)
2c1b57
 {
2c1b57
 	struct MBR *sb = st->sb;
2c1b57
@@ -71,8 +69,6 @@ static void examine_mbr(struct supertype *st, char *homehost)
2c1b57
 
2c1b57
 }
2c1b57
 
2c1b57
-#endif /*MDASSEMBLE */
2c1b57
-
2c1b57
 static int load_super_mbr(struct supertype *st, int fd, char *devname)
2c1b57
 {
2c1b57
 	/* try to read an mbr
2c1b57
@@ -187,7 +183,6 @@ static struct supertype *match_metadata_desc(char *arg)
2c1b57
 	return st;
2c1b57
 }
2c1b57
 
2c1b57
-#ifndef MDASSEMBLE
2c1b57
 static int validate_geometry(struct supertype *st, int level,
2c1b57
 			     int layout, int raiddisks,
2c1b57
 			     int *chunk, unsigned long long size,
2c1b57
@@ -198,13 +193,10 @@ static int validate_geometry(struct supertype *st, int level,
2c1b57
 	pr_err("mbr metadata cannot be used this way\n");
2c1b57
 	return 0;
2c1b57
 }
2c1b57
-#endif
2c1b57
 
2c1b57
 struct superswitch mbr = {
2c1b57
-#ifndef MDASSEMBLE
2c1b57
 	.examine_super = examine_mbr,
2c1b57
 	.validate_geometry = validate_geometry,
2c1b57
-#endif
2c1b57
 	.match_metadata_desc = match_metadata_desc,
2c1b57
 	.load_super = load_super_mbr,
2c1b57
 	.store_super = store_mbr,
2c1b57
diff --git a/super0.c b/super0.c
2c1b57
index 10d9c40..dc13efb 100644
2c1b57
--- a/super0.c
2c1b57
+++ b/super0.c
2c1b57
@@ -76,8 +76,6 @@ static void super0_swap_endian(struct mdp_superblock_s *sb)
2c1b57
 
2c1b57
 }
2c1b57
 
2c1b57
-#ifndef MDASSEMBLE
2c1b57
-
2c1b57
 static void examine_super0(struct supertype *st, char *homehost)
2c1b57
 {
2c1b57
 	mdp_super_t *sb = st->sb;
2c1b57
@@ -380,7 +378,6 @@ static void brief_detail_super0(struct supertype *st)
2c1b57
 	else
2c1b57
 		printf("%08x", sb->set_uuid0);
2c1b57
 }
2c1b57
-#endif
2c1b57
 
2c1b57
 static int match_home0(struct supertype *st, char *homehost)
2c1b57
 {
2c1b57
@@ -814,7 +811,6 @@ struct devinfo {
2c1b57
 	struct devinfo *next;
2c1b57
 };
2c1b57
 
2c1b57
-#ifndef MDASSEMBLE
2c1b57
 /* Add a device to the superblock being created */
2c1b57
 static int add_to_super0(struct supertype *st, mdu_disk_info_t *dinfo,
2c1b57
 			 int fd, char *devname, unsigned long long data_offset)
2c1b57
@@ -845,7 +841,6 @@ static int add_to_super0(struct supertype *st, mdu_disk_info_t *dinfo,
2c1b57
 
2c1b57
 	return 0;
2c1b57
 }
2c1b57
-#endif
2c1b57
 
2c1b57
 static int store_super0(struct supertype *st, int fd)
2c1b57
 {
2c1b57
@@ -899,7 +894,6 @@ static int store_super0(struct supertype *st, int fd)
2c1b57
 	return 0;
2c1b57
 }
2c1b57
 
2c1b57
-#ifndef MDASSEMBLE
2c1b57
 static int write_init_super0(struct supertype *st)
2c1b57
 {
2c1b57
 	mdp_super_t *sb = st->sb;
2c1b57
@@ -930,7 +924,6 @@ static int write_init_super0(struct supertype *st)
2c1b57
 	}
2c1b57
 	return rv;
2c1b57
 }
2c1b57
-#endif
2c1b57
 
2c1b57
 static int compare_super0(struct supertype *st, struct supertype *tst)
2c1b57
 {
2c1b57
@@ -1261,7 +1254,6 @@ static void free_super0(struct supertype *st)
2c1b57
 	st->sb = NULL;
2c1b57
 }
2c1b57
 
2c1b57
-#ifndef MDASSEMBLE
2c1b57
 static int validate_geometry0(struct supertype *st, int level,
2c1b57
 			      int layout, int raiddisks,
2c1b57
 			      int *chunk, unsigned long long size,
2c1b57
@@ -1320,10 +1312,8 @@ static int validate_geometry0(struct supertype *st, int level,
2c1b57
 	*freesize = MD_NEW_SIZE_SECTORS(ldsize >> 9);
2c1b57
 	return 1;
2c1b57
 }
2c1b57
-#endif /* MDASSEMBLE */
2c1b57
 
2c1b57
 struct superswitch super0 = {
2c1b57
-#ifndef MDASSEMBLE
2c1b57
 	.examine_super = examine_super0,
2c1b57
 	.brief_examine_super = brief_examine_super0,
2c1b57
 	.export_examine_super = export_examine_super0,
2c1b57
@@ -1333,7 +1323,6 @@ struct superswitch super0 = {
2c1b57
 	.validate_geometry = validate_geometry0,
2c1b57
 	.add_to_super = add_to_super0,
2c1b57
 	.copy_metadata = copy_metadata0,
2c1b57
-#endif
2c1b57
 	.match_home = match_home0,
2c1b57
 	.uuid_from_super = uuid_from_super0,
2c1b57
 	.getinfo_super = getinfo_super0,
2c1b57
diff --git a/super1.c b/super1.c
2c1b57
index 6f91611..4db4dff 100644
2c1b57
--- a/super1.c
2c1b57
+++ b/super1.c
2c1b57
@@ -152,7 +152,6 @@ struct misc_dev_info {
2c1b57
 					|MD_FEATURE_PPL			\
2c1b57
 					)
2c1b57
 
2c1b57
-#ifndef MDASSEMBLE
2c1b57
 static int role_from_sb(struct mdp_superblock_1 *sb)
2c1b57
 {
2c1b57
 	unsigned int d;
2c1b57
@@ -165,7 +164,6 @@ static int role_from_sb(struct mdp_superblock_1 *sb)
2c1b57
 		role = MD_DISK_ROLE_SPARE;
2c1b57
 	return role;
2c1b57
 }
2c1b57
-#endif
2c1b57
 
2c1b57
 /* return how many bytes are needed for bitmap, for cluster-md each node
2c1b57
  * should have it's own bitmap */
2c1b57
@@ -304,7 +302,6 @@ static inline unsigned int choose_ppl_space(int chunk)
2c1b57
 	return (PPL_HEADER_SIZE >> 9) + (chunk > 128*2 ? chunk : 128*2);
2c1b57
 }
2c1b57
 
2c1b57
-#ifndef MDASSEMBLE
2c1b57
 static void examine_super1(struct supertype *st, char *homehost)
2c1b57
 {
2c1b57
 	struct mdp_superblock_1 *sb = st->sb;
2c1b57
@@ -903,8 +900,6 @@ static int examine_badblocks_super1(struct supertype *st, int fd, char *devname)
2c1b57
 	return 0;
2c1b57
 }
2c1b57
 
2c1b57
-#endif
2c1b57
-
2c1b57
 static int match_home1(struct supertype *st, char *homehost)
2c1b57
 {
2c1b57
 	struct mdp_superblock_1 *sb = st->sb;
2c1b57
@@ -1276,7 +1271,6 @@ static int update_super1(struct supertype *st, struct mdinfo *info,
2c1b57
 		long bm_sectors = 0;
2c1b57
 		long space;
2c1b57
 
2c1b57
-#ifndef MDASSEMBLE
2c1b57
 		if (sb->feature_map & __cpu_to_le32(MD_FEATURE_BITMAP_OFFSET)) {
2c1b57
 			bitmap_offset = (long)__le32_to_cpu(sb->bitmap_offset);
2c1b57
 			bm_sectors = calc_bitmap_size(bms, 4096) >> 9;
2c1b57
@@ -1284,7 +1278,7 @@ static int update_super1(struct supertype *st, struct mdinfo *info,
2c1b57
 			bitmap_offset = (long)__le16_to_cpu(sb->ppl.offset);
2c1b57
 			bm_sectors = (long)__le16_to_cpu(sb->ppl.size);
2c1b57
 		}
2c1b57
-#endif
2c1b57
+
2c1b57
 		if (sb_offset < data_offset) {
2c1b57
 			/* 1.1 or 1.2.  Put bbl after bitmap leaving at least 32K
2c1b57
 			 */
2c1b57
@@ -1578,7 +1572,7 @@ struct devinfo {
2c1b57
 	mdu_disk_info_t disk;
2c1b57
 	struct devinfo *next;
2c1b57
 };
2c1b57
-#ifndef MDASSEMBLE
2c1b57
+
2c1b57
 /* Add a device to the superblock being created */
2c1b57
 static int add_to_super1(struct supertype *st, mdu_disk_info_t *dk,
2c1b57
 			 int fd, char *devname, unsigned long long data_offset)
2c1b57
@@ -1634,7 +1628,6 @@ static int add_to_super1(struct supertype *st, mdu_disk_info_t *dk,
2c1b57
 
2c1b57
 	return 0;
2c1b57
 }
2c1b57
-#endif
2c1b57
 
2c1b57
 static int locate_bitmap1(struct supertype *st, int fd, int node_num);
2c1b57
 
2c1b57
@@ -1742,8 +1735,6 @@ static unsigned long choose_bm_space(unsigned long devsize)
2c1b57
 
2c1b57
 static void free_super1(struct supertype *st);
2c1b57
 
2c1b57
-#ifndef MDASSEMBLE
2c1b57
-
2c1b57
 __u32 crc32c_le(__u32 crc, unsigned char const *p, size_t len);
2c1b57
 
2c1b57
 static int write_init_ppl1(struct supertype *st, struct mdinfo *info, int fd)
2c1b57
@@ -2028,7 +2019,6 @@ error_out:
2c1b57
 out:
2c1b57
 	return rv;
2c1b57
 }
2c1b57
-#endif
2c1b57
 
2c1b57
 static int compare_super1(struct supertype *st, struct supertype *tst)
2c1b57
 {
2c1b57
@@ -2282,7 +2272,6 @@ static __u64 avail_size1(struct supertype *st, __u64 devsize,
2c1b57
 	if (devsize < 24)
2c1b57
 		return 0;
2c1b57
 
2c1b57
-#ifndef MDASSEMBLE
2c1b57
 	if (__le32_to_cpu(super->feature_map) & MD_FEATURE_BITMAP_OFFSET) {
2c1b57
 		/* hot-add. allow for actual size of bitmap */
2c1b57
 		struct bitmap_super_s *bsb;
2c1b57
@@ -2291,7 +2280,7 @@ static __u64 avail_size1(struct supertype *st, __u64 devsize,
2c1b57
 	} else if (__le32_to_cpu(super->feature_map) & MD_FEATURE_PPL) {
2c1b57
 		bmspace = __le16_to_cpu(super->ppl.size);
2c1b57
 	}
2c1b57
-#endif
2c1b57
+
2c1b57
 	/* Allow space for bad block log */
2c1b57
 	if (super->bblog_size)
2c1b57
 		bbspace = __le16_to_cpu(super->bblog_size);
2c1b57
@@ -2644,7 +2633,6 @@ static void free_super1(struct supertype *st)
2c1b57
 	st->sb = NULL;
2c1b57
 }
2c1b57
 
2c1b57
-#ifndef MDASSEMBLE
2c1b57
 static int validate_geometry1(struct supertype *st, int level,
2c1b57
 			      int layout, int raiddisks,
2c1b57
 			      int *chunk, unsigned long long size,
2c1b57
@@ -2740,7 +2728,6 @@ static int validate_geometry1(struct supertype *st, int level,
2c1b57
 	*freesize = devsize;
2c1b57
 	return 1;
2c1b57
 }
2c1b57
-#endif /* MDASSEMBLE */
2c1b57
 
2c1b57
 void *super1_make_v0(struct supertype *st, struct mdinfo *info, mdp_super_t *sb0)
2c1b57
 {
2c1b57
@@ -2793,7 +2780,6 @@ void *super1_make_v0(struct supertype *st, struct mdinfo *info, mdp_super_t *sb0
2c1b57
 }
2c1b57
 
2c1b57
 struct superswitch super1 = {
2c1b57
-#ifndef MDASSEMBLE
2c1b57
 	.examine_super = examine_super1,
2c1b57
 	.brief_examine_super = brief_examine_super1,
2c1b57
 	.export_examine_super = export_examine_super1,
2c1b57
@@ -2806,7 +2792,6 @@ struct superswitch super1 = {
2c1b57
 	.examine_badblocks = examine_badblocks_super1,
2c1b57
 	.copy_metadata = copy_metadata1,
2c1b57
 	.write_init_ppl = write_init_ppl1,
2c1b57
-#endif
2c1b57
 	.match_home = match_home1,
2c1b57
 	.uuid_from_super = uuid_from_super1,
2c1b57
 	.getinfo_super = getinfo_super1,
2c1b57
diff --git a/util.c b/util.c
2c1b57
index a536f81..a695c45 100644
2c1b57
--- a/util.c
2c1b57
+++ b/util.c
2c1b57
@@ -89,7 +89,6 @@ int dlm_funs_ready(void)
2c1b57
 	return is_dlm_hooks_ready ? 1 : 0;
2c1b57
 }
2c1b57
 
2c1b57
-#ifndef MDASSEMBLE
2c1b57
 static struct dlm_hooks *dlm_hooks = NULL;
2c1b57
 struct dlm_lock_resource *dlm_lock_res = NULL;
2c1b57
 static int ast_called = 0;
2c1b57
@@ -200,16 +199,6 @@ int cluster_release_dlmlock(int lockid)
2c1b57
 out:
2c1b57
 	return ret;
2c1b57
 }
2c1b57
-#else
2c1b57
-int cluster_get_dlmlock(int *lockid)
2c1b57
-{
2c1b57
-	return -1;
2c1b57
-}
2c1b57
-int cluster_release_dlmlock(int lockid)
2c1b57
-{
2c1b57
-	return -1;
2c1b57
-}
2c1b57
-#endif
2c1b57
 
2c1b57
 /*
2c1b57
  * Get array info from the kernel. Longer term we want to deprecate the
2c1b57
@@ -291,7 +280,6 @@ int get_linux_version()
2c1b57
 	return (a*1000000)+(b*1000)+c;
2c1b57
 }
2c1b57
 
2c1b57
-#ifndef MDASSEMBLE
2c1b57
 int mdadm_version(char *version)
2c1b57
 {
2c1b57
 	int a, b, c;
2c1b57
@@ -397,7 +385,6 @@ long parse_num(char *num)
2c1b57
 	else
2c1b57
 		return rv;
2c1b57
 }
2c1b57
-#endif
2c1b57
 
2c1b57
 int parse_cluster_confirm_arg(char *input, char **devname, int *slot)
2c1b57
 {
2c1b57
@@ -639,7 +626,6 @@ char *fname_from_uuid(struct supertype *st, struct mdinfo *info, char *buf, char
2c1b57
 	return __fname_from_uuid(info->uuid, (st->ss == &super1) ? 1 : st->ss->swapuuid, buf, sep);
2c1b57
 }
2c1b57
 
2c1b57
-#ifndef MDASSEMBLE
2c1b57
 int check_ext2(int fd, char *name)
2c1b57
 {
2c1b57
 	/*
2c1b57
@@ -743,7 +729,6 @@ int ask(char *mesg)
2c1b57
 	pr_err("assuming 'no'\n");
2c1b57
 	return 0;
2c1b57
 }
2c1b57
-#endif /* MDASSEMBLE */
2c1b57
 
2c1b57
 int is_standard(char *dev, int *nump)
2c1b57
 {
2c1b57
@@ -803,7 +788,6 @@ unsigned long calc_csum(void *super, int bytes)
2c1b57
 	return csum;
2c1b57
 }
2c1b57
 
2c1b57
-#ifndef MDASSEMBLE
2c1b57
 char *human_size(long long bytes)
2c1b57
 {
2c1b57
 	static char buf[47];
2c1b57
@@ -895,7 +879,6 @@ void print_r10_layout(int layout)
2c1b57
 	if (near*far == 1)
2c1b57
 		printf("NO REDUNDANCY");
2c1b57
 }
2c1b57
-#endif
2c1b57
 
2c1b57
 unsigned long long calc_array_size(int level, int raid_disks, int layout,
2c1b57
 				   int chunksize, unsigned long long devsize)
2c1b57
@@ -962,7 +945,6 @@ dev_t devnm2devid(char *devnm)
2c1b57
 	return 0;
2c1b57
 }
2c1b57
 
2c1b57
-#if !defined(MDASSEMBLE) || defined(MDASSEMBLE) && defined(MDASSEMBLE_AUTO)
2c1b57
 char *get_md_name(char *devnm)
2c1b57
 {
2c1b57
 	/* find /dev/md%d or /dev/md/%d or make a device /dev/.tmp.md%d */
2c1b57
@@ -1016,7 +998,6 @@ void put_md_name(char *name)
2c1b57
 	if (strncmp(name, "/dev/.tmp.md", 12) == 0)
2c1b57
 		unlink(name);
2c1b57
 }
2c1b57
-#endif /* !defined(MDASSEMBLE) || defined(MDASSEMBLE) && defined(MDASSEMBLE_AUTO) */
2c1b57
 
2c1b57
 int get_maj_min(char *dev, int *major, int *minor)
2c1b57
 {
2c1b57
@@ -1146,9 +1127,8 @@ struct superswitch *superlist[] =
2c1b57
 	&super0, &super1,
2c1b57
 	&super_ddf, &super_imsm,
2c1b57
 	&mbr, &gpt,
2c1b57
-	NULL };
2c1b57
-
2c1b57
-#if !defined(MDASSEMBLE) || defined(MDASSEMBLE) && defined(MDASSEMBLE_AUTO)
2c1b57
+	NULL
2c1b57
+};
2c1b57
 
2c1b57
 struct supertype *super_by_fd(int fd, char **subarrayp)
2c1b57
 {
2c1b57
@@ -1213,7 +1193,6 @@ struct supertype *super_by_fd(int fd, char **subarrayp)
2c1b57
 
2c1b57
 	return st;
2c1b57
 }
2c1b57
-#endif /* !defined(MDASSEMBLE) || defined(MDASSEMBLE) && defined(MDASSEMBLE_AUTO) */
2c1b57
 
2c1b57
 int dev_size_from_id(dev_t id, unsigned long long *size)
2c1b57
 {
2c1b57
@@ -1753,7 +1732,7 @@ int add_disk(int mdfd, struct supertype *st,
2c1b57
 {
2c1b57
 	/* Add a device to an array, in one of 2 ways. */
2c1b57
 	int rv;
2c1b57
-#ifndef MDASSEMBLE
2c1b57
+
2c1b57
 	if (st->ss->external) {
2c1b57
 		if (info->disk.state & (1<
2c1b57
 			info->recovery_start = MaxSector;
2c1b57
@@ -1773,7 +1752,6 @@ int add_disk(int mdfd, struct supertype *st,
2c1b57
 			}
2c1b57
 		}
2c1b57
 	} else
2c1b57
-#endif
2c1b57
 		rv = ioctl(mdfd, ADD_NEW_DISK, &info->disk);
2c1b57
 	return rv;
2c1b57
 }
2c1b57
@@ -1782,12 +1760,11 @@ int remove_disk(int mdfd, struct supertype *st,
2c1b57
 		struct mdinfo *sra, struct mdinfo *info)
2c1b57
 {
2c1b57
 	int rv;
2c1b57
+
2c1b57
 	/* Remove the disk given by 'info' from the array */
2c1b57
-#ifndef MDASSEMBLE
2c1b57
 	if (st->ss->external)
2c1b57
 		rv = sysfs_set_str(sra, info, "slot", "none");
2c1b57
 	else
2c1b57
-#endif
2c1b57
 		rv = ioctl(mdfd, HOT_REMOVE_DISK, makedev(info->disk.major,
2c1b57
 							  info->disk.minor));
2c1b57
 	return rv;
2c1b57
@@ -1832,10 +1809,8 @@ int set_array_info(int mdfd, struct supertype *st, struct mdinfo *info)
2c1b57
 	mdu_array_info_t inf;
2c1b57
 	int rv;
2c1b57
 
2c1b57
-#ifndef MDASSEMBLE
2c1b57
 	if (st->ss->external)
2c1b57
 		return sysfs_set_array(info, 9003);
2c1b57
-#endif
2c1b57
 		
2c1b57
 	memset(&inf, 0, sizeof(inf));
2c1b57
 	inf.major_version = info->array.major_version;
2c1b57
@@ -2015,7 +1990,6 @@ use_random:
2c1b57
 	memcpy(buf, r, 16);
2c1b57
 }
2c1b57
 
2c1b57
-#ifndef MDASSEMBLE
2c1b57
 int flush_metadata_updates(struct supertype *st)
2c1b57
 {
2c1b57
 	int sfd;
2c1b57
@@ -2057,7 +2031,6 @@ void append_metadata_update(struct supertype *st, void *buf, int len)
2c1b57
 	*st->update_tail = mu;
2c1b57
 	st->update_tail = &mu->next;
2c1b57
 }
2c1b57
-#endif /* MDASSEMBLE */
2c1b57
 
2c1b57
 #ifdef __TINYC__
2c1b57
 /* tinyc doesn't optimize this check in ioctl.h out ... */
2c1b57
@@ -2197,7 +2170,6 @@ void reopen_mddev(int mdfd)
2c1b57
 		dup2(fd, mdfd);
2c1b57
 }
2c1b57
 
2c1b57
-#ifndef MDASSEMBLE
2c1b57
 static struct cmap_hooks *cmap_hooks = NULL;
2c1b57
 static int is_cmap_hooks_ready = 0;
2c1b57
 
2c1b57
@@ -2272,4 +2244,3 @@ void set_hooks(void)
2c1b57
 	set_dlm_hooks();
2c1b57
 	set_cmap_hooks();
2c1b57
 }
2c1b57
-#endif
2c1b57
-- 
2c1b57
2.7.4
2c1b57