]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - super0.c
mdadm.h: Introduced unaligned {get,put}_unaligned{16,32}()
[thirdparty/mdadm.git] / super0.c
index 10d9c40db1f32af5a05cd8d7eeb5523eec78d4cd..42989b9f66eb62ea4a25b25a5fbfd9c89c0a3568 100644 (file)
--- a/super0.c
+++ b/super0.c
@@ -76,8 +76,6 @@ static void super0_swap_endian(struct mdp_superblock_s *sb)
 
 }
 
-#ifndef MDASSEMBLE
-
 static void examine_super0(struct supertype *st, char *homehost)
 {
        mdp_super_t *sb = st->sb;
@@ -380,7 +378,6 @@ static void brief_detail_super0(struct supertype *st)
        else
                printf("%08x", sb->set_uuid0);
 }
-#endif
 
 static int match_home0(struct supertype *st, char *homehost)
 {
@@ -523,9 +520,10 @@ static int update_super0(struct supertype *st, struct mdinfo *info,
                 * up 4 bytes before continuing
                 */
                __u32 *sb32 = (__u32*)sb;
-               memcpy(sb32+MD_SB_GENERIC_CONSTANT_WORDS+7,
-                      sb32+MD_SB_GENERIC_CONSTANT_WORDS+7+1,
-                      (MD_SB_WORDS - (MD_SB_GENERIC_CONSTANT_WORDS+7+1))*4);
+
+               memmove(sb32+MD_SB_GENERIC_CONSTANT_WORDS+7,
+                       sb32+MD_SB_GENERIC_CONSTANT_WORDS+7+1,
+                       (MD_SB_WORDS - (MD_SB_GENERIC_CONSTANT_WORDS+7+1))*4);
                if (verbose >= 0)
                        pr_err("adjusting superblock of %s for 2.2/sparc compatibility.\n",
                               devname);
@@ -592,8 +590,8 @@ static int update_super0(struct supertype *st, struct mdinfo *info,
                         * being marked 'sync'
                         */
                        add = (1<<MD_DISK_SYNC);
-               if (((sb->disks[d].state & ~mask) | add)
-                   != (unsigned)info->disk.state) {
+               if (((sb->disks[d].state & ~mask) | add) !=
+                   (unsigned)info->disk.state) {
                        sb->disks[d].state = info->disk.state | wonly |failfast;
                        rv = 1;
                }
@@ -814,7 +812,6 @@ struct devinfo {
        struct devinfo *next;
 };
 
-#ifndef MDASSEMBLE
 /* Add a device to the superblock being created */
 static int add_to_super0(struct supertype *st, mdu_disk_info_t *dinfo,
                         int fd, char *devname, unsigned long long data_offset)
@@ -845,7 +842,6 @@ static int add_to_super0(struct supertype *st, mdu_disk_info_t *dinfo,
 
        return 0;
 }
-#endif
 
 static int store_super0(struct supertype *st, int fd)
 {
@@ -899,7 +895,6 @@ static int store_super0(struct supertype *st, int fd)
        return 0;
 }
 
-#ifndef MDASSEMBLE
 static int write_init_super0(struct supertype *st)
 {
        mdp_super_t *sb = st->sb;
@@ -930,7 +925,6 @@ static int write_init_super0(struct supertype *st)
        }
        return rv;
 }
-#endif
 
 static int compare_super0(struct supertype *st, struct supertype *tst)
 {
@@ -1065,8 +1059,8 @@ static int load_super0(struct supertype *st, int fd, char *devname)
         * valid.  If it doesn't clear the bit.  An --assemble --force
         * should get that written out.
         */
-       if (read(fd, super+1, ROUND_UP(sizeof(struct bitmap_super_s),4096))
-           != ROUND_UP(sizeof(struct bitmap_super_s),4096))
+       if (read(fd, super+1, ROUND_UP(sizeof(struct bitmap_super_s),4096)) !=
+           ROUND_UP(sizeof(struct bitmap_super_s), 4096))
                goto no_bitmap;
 
        uuid_from_super0(st, uuid);
@@ -1261,7 +1255,6 @@ static void free_super0(struct supertype *st)
        st->sb = NULL;
 }
 
-#ifndef MDASSEMBLE
 static int validate_geometry0(struct supertype *st, int level,
                              int layout, int raiddisks,
                              int *chunk, unsigned long long size,
@@ -1320,10 +1313,8 @@ static int validate_geometry0(struct supertype *st, int level,
        *freesize = MD_NEW_SIZE_SECTORS(ldsize >> 9);
        return 1;
 }
-#endif /* MDASSEMBLE */
 
 struct superswitch super0 = {
-#ifndef MDASSEMBLE
        .examine_super = examine_super0,
        .brief_examine_super = brief_examine_super0,
        .export_examine_super = export_examine_super0,
@@ -1333,7 +1324,6 @@ struct superswitch super0 = {
        .validate_geometry = validate_geometry0,
        .add_to_super = add_to_super0,
        .copy_metadata = copy_metadata0,
-#endif
        .match_home = match_home0,
        .uuid_from_super = uuid_from_super0,
        .getinfo_super = getinfo_super0,