]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
mdadm: Do not reimplment offsetof
authorCristian Rodríguez <crrodriguez@opensuse.org>
Wed, 21 May 2014 16:45:19 +0000 (12:45 -0400)
committerNeilBrown <neilb@suse.de>
Thu, 22 May 2014 04:29:14 +0000 (14:29 +1000)
Proper implementations have offsetof in stddef.h

Signed-off-by: NeilBrown <neilb@suse.de>
Grow.c
super-ddf.c
super1.c

diff --git a/Grow.c b/Grow.c
index 202b6ef4d1078df7ab9da0b38650073420770ef4..2af6c96e764a67b6125bea90775342b462f61a45 100644 (file)
--- a/Grow.c
+++ b/Grow.c
@@ -24,6 +24,7 @@
 #include       "mdadm.h"
 #include       "dlink.h"
 #include       <sys/mman.h>
+#include       <stddef.h>
 #include       <stdint.h>
 #include       <signal.h>
 #include       <sys/wait.h>
 #include       "md_u.h"
 #include       "md_p.h"
 
-#ifndef offsetof
-#define offsetof(t,f) ((size_t)&(((t*)0)->f))
-#endif
-
 int restore_backup(struct supertype *st,
                   struct mdinfo *content,
                   int working_disks,
index f9121995e34ebcaded205f20e200b9fbacaa6647..64893e0741caf51f226bd4edb8d16b2c02f9a2be 100644 (file)
@@ -30,6 +30,7 @@
 #include "mdmon.h"
 #include "sha1.h"
 #include <values.h>
+#include <stddef.h>
 
 /* a non-official T10 name for creation GUIDs */
 static char T10[] = "Linux-MD";
@@ -536,10 +537,6 @@ static int init_super_ddf_bvd(struct supertype *st,
                              char *name, char *homehost,
                              int *uuid, unsigned long long data_offset);
 
-#ifndef offsetof
-#define offsetof(t,f) ((size_t)&(((t*)0)->f))
-#endif
-
 #if DEBUG
 static void pr_state(struct ddf_super *ddf, const char *msg)
 {
index 1bc5216faeb9066d45687a2fd70df68561ab1ad9..7cf9b518a41ff98bdd89ce891ac6dd3bd75b33fc 100644 (file)
--- a/super1.c
+++ b/super1.c
@@ -22,6 +22,7 @@
  *    Email: <neilb@suse.de>
  */
 
+#include <stddef.h>
 #include "mdadm.h"
 /*
  * The version-1 superblock :
@@ -133,9 +134,6 @@ struct misc_dev_info {
                                        |MD_FEATURE_NEW_OFFSET          \
                                        )
 
-#ifndef offsetof
-#define offsetof(t,f) ((size_t)&(((t*)0)->f))
-#endif
 static unsigned int calc_sb_1_csum(struct mdp_superblock_1 * sb)
 {
        unsigned int disk_csum, csum;