File 0159-Assorted-fixed-for-a-make-everything-build.patch of Package mdadm.5365

From 7071320a18428e9a11ea9f6dd806c6ff6fe9c547 Mon Sep 17 00:00:00 2001
From: NeilBrown <neilb@suse.com>
Date: Thu, 28 Jan 2016 13:28:58 +1100
Subject: [PATCH 219/359] Assorted fixed for a "make everything" build
References: bsc#1081910

(Coly Li: rebase to remove VMD related change.)

Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Coly Li <colyli@suse.de>

---
 Makefile         |  8 ++++----
 platform-intel.c |  3 +--
 super1.c         |  6 ++++--
 util.c           | 26 +++++++++++++++++++-------
 4 files changed, 28 insertions(+), 15 deletions(-)

Index: mdadm-3.3.1/Makefile
===================================================================
--- mdadm-3.3.1.orig/Makefile
+++ mdadm-3.3.1/Makefile
@@ -181,7 +181,7 @@ mdadm : $(OBJS) | check_rundir
 	$(CC) $(CFLAGS) $(LDFLAGS) -o mdadm $(OBJS) $(LDLIBS)
 
 mdadm.static : $(OBJS) $(STATICOBJS)
-	$(CC) $(CFLAGS) $(LDFLAGS) -static -o mdadm.static $(OBJS) $(STATICOBJS)
+	$(CC) $(CFLAGS) $(LDFLAGS) -static -o mdadm.static $(OBJS) $(STATICOBJS) $(LDLIBS)
 
 mdadm.tcc : $(SRCS) $(INCL)
 	$(TCC) -o mdadm.tcc $(SRCS)
@@ -191,13 +191,13 @@ mdadm.klibc : $(SRCS) $(INCL)
 	$(CC) -nostdinc -iwithprefix include -I$(KLIBC)/klibc/include -I$(KLIBC)/linux/include -I$(KLIBC)/klibc/arch/i386/include -I$(KLIBC)/klibc/include/bits32 $(CFLAGS) $(SRCS)
 
 mdadm.Os : $(SRCS) $(INCL)
-	$(CC) -o mdadm.Os $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -DHAVE_STDINT_H -Os $(SRCS)
+	$(CC) -o mdadm.Os $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -DHAVE_STDINT_H -Os $(SRCS) $(LDLIBS)
 
 mdadm.O2 : $(SRCS) $(INCL) mdmon.O2
-	$(CC) -o mdadm.O2 $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -DHAVE_STDINT_H -O2 -D_FORTIFY_SOURCE=2 $(SRCS)
+	$(CC) -o mdadm.O2 $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -DHAVE_STDINT_H -O2 -D_FORTIFY_SOURCE=2 $(SRCS) $(LDLIBS)
 
 mdmon.O2 : $(MON_SRCS) $(INCL) mdmon.h
-	$(CC) -o mdmon.O2 $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(MON_LDFLAGS) -DHAVE_STDINT_H -O2 -D_FORTIFY_SOURCE=2 $(MON_SRCS)
+	$(CC) -o mdmon.O2 $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(MON_LDFLAGS) -DHAVE_STDINT_H -O2 -D_FORTIFY_SOURCE=2 $(MON_SRCS) $(LDLIBS)
 
 # use '-z now' to guarantee no dynamic linker interactions with the monitor thread
 mdmon : $(MON_OBJS) | check_rundir
Index: mdadm-3.3.1/super1.c
===================================================================
--- mdadm-3.3.1.orig/super1.c
+++ mdadm-3.3.1/super1.c
@@ -1,7 +1,7 @@
 /*
  * mdadm - manage Linux "md" devices aka RAID arrays.
  *
- * Copyright (C) 2001-2009 Neil Brown <neilb@suse.de>
+ * Copyright (C) 2001-2016 Neil Brown <neilb@suse.com>
  *
  *
  *    This program is free software; you can redistribute it and/or modify
@@ -141,6 +141,7 @@ struct misc_dev_info {
 					|MD_FEATURE_JOURNAL		\
 					)
 
+#ifndef MDASSEMBLE
 static int role_from_sb(struct mdp_superblock_1 *sb)
 {
 	unsigned int d;
@@ -153,6 +154,7 @@ static int role_from_sb(struct mdp_super
 		role = MD_DISK_ROLE_SPARE;
 	return role;
 }
+#endif
 
 /* return how many bytes are needed for bitmap, for cluster-md each node
  * should have it's own bitmap */
@@ -1654,6 +1656,7 @@ static void free_super1(struct supertype
 #define META_BLOCK_SIZE 4096
 __u32 crc32c_le(__u32 crc, unsigned char const *p, size_t len);
 
+#ifndef MDASSEMBLE
 static int write_empty_r5l_meta_block(struct supertype *st, int fd)
 {
 	struct r5l_meta_block *mb;
@@ -1699,7 +1702,6 @@ fail_to_write:
 	return 1;
 }
 
-#ifndef MDASSEMBLE
 static int write_init_super1(struct supertype *st)
 {
 	struct mdp_superblock_1 *sb = st->sb;
Index: mdadm-3.3.1/util.c
===================================================================
--- mdadm-3.3.1.orig/util.c
+++ mdadm-3.3.1/util.c
@@ -82,8 +82,15 @@ struct blkpg_partition {
    aren't permitted). */
 #define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); }))
 
-static struct dlm_hooks *dlm_hooks = NULL;
 static int is_dlm_hooks_ready = 0;
+
+int dlm_funs_ready(void)
+{
+	return is_dlm_hooks_ready ? 1 : 0;
+}
+
+#ifndef MDASSEMBLE
+static struct dlm_hooks *dlm_hooks = NULL;
 struct dlm_lock_resource *dlm_lock_res = NULL;
 static int ast_called = 0;
 
@@ -92,11 +99,6 @@ struct dlm_lock_resource {
 	struct dlm_lksb lksb;
 };
 
-int dlm_funs_ready(void)
-{
-	return is_dlm_hooks_ready ? 1 : 0;
-}
-
 /* Using poll(2) to wait for and dispatch ASTs */
 static int poll_for_ast(dlm_lshandle_t ls)
 {
@@ -206,6 +208,16 @@ int cluster_release_dlmlock(int lockid)
 out:
 	return ret;
 }
+#else
+int cluster_get_dlmlock(int *lockid)
+{
+	return -1;
+}
+int cluster_release_dlmlock(int lockid)
+{
+	return -1;
+}
+#endif
 
 /*
  * Parse a 128 bit uuid in 4 integers
@@ -2115,10 +2127,10 @@ void reopen_mddev(int mdfd)
 		dup2(fd, mdfd);
 }
 
+#ifndef MDASSEMBLE
 static struct cmap_hooks *cmap_hooks = NULL;
 static int is_cmap_hooks_ready = 0;
 
-#ifndef MDASSEMBLE
 void set_cmap_hooks(void)
 {
 	cmap_hooks = xmalloc(sizeof(struct cmap_hooks));
openSUSE Build Service is sponsored by