mdadm/DDF-factor-out-array-name-generation.patch
Neil Brown 78f6e472f9 - DDF-handle-fake-RAIDs-with-changing-subarray-UUIDs.patch
- DDF-compare_super_ddf-fix-sequence-number-check.patch
- Monitor-don-t-set-arrays-dirty-after-transition-to-r.patch
- DDF-add_to_super_ddf-be-careful-with-workspace_lba.patch
- Monitor-write-meta-data-in-readonly-state-sometimes.patch
- Assembe-fix-bug-in-force_array-it-wasn-t-forcing-pro.patch
  Various bugfixes from upstream - several to improve
  DDF support, one which fixes a nasty bug in "--assemble --force".

- DDF-brief_examine_subarrays_ddf-print-array-name.patch
  DDF-factor-out-array-name-generation.patch
  Include name in "-Db" output for DDF
  FATE#316007

OBS-URL: https://build.opensuse.org/package/show/Base:System/mdadm?expand=0&rev=96
2013-11-11 00:47:33 +00:00

70 lines
2.1 KiB
Diff

From 8bf989d8e1bf1c6305076ad8108ec207c23c03cb Mon Sep 17 00:00:00 2001
From: "mwilck@arcor.de" <mwilck@arcor.de>
Date: Wed, 11 Sep 2013 21:55:34 +0200
Subject: [PATCH] DDF: factor out array name generation
The same algorithm was used in getinfo_super_ddf_bvd and
container_content_ddf. Put it in a common function.
Signed-off-by: Martin Wilck <mwilck@arcor.de>
Signed-off-by: NeilBrown <neilb@suse.de>
---
super-ddf.c | 25 +++++++++++++------------
1 file changed, 13 insertions(+), 12 deletions(-)
--- mdadm-3.3.orig/super-ddf.c
+++ mdadm-3.3/super-ddf.c
@@ -1910,6 +1910,17 @@ static void getinfo_super_ddf(struct sup
}
}
+/* size of name must be at least 17 bytes! */
+static void _ddf_array_name(char *name, const struct ddf_super *ddf, int i)
+{
+ int j;
+ memcpy(name, ddf->virt->entries[i].name, 16);
+ name[16] = 0;
+ for(j = 0; j < 16; j++)
+ if (name[j] == ' ')
+ name[j] = 0;
+}
+
static void getinfo_super_ddf_bvd(struct supertype *st, struct mdinfo *info, char *map)
{
struct ddf_super *ddf = st->sb;
@@ -1987,11 +1998,7 @@ static void getinfo_super_ddf_bvd(struct
info->container_member);
info->safe_mode_delay = DDF_SAFE_MODE_DELAY;
- memcpy(info->name, ddf->virt->entries[info->container_member].name, 16);
- info->name[16]=0;
- for(j=0; j<16; j++)
- if (info->name[j] == ' ')
- info->name[j] = 0;
+ _ddf_array_name(info->name, ddf, info->container_member);
if (map)
for (j = 0; j < map_disks; j++) {
@@ -3656,7 +3663,6 @@ static struct mdinfo *container_content_
for (vc = ddf->conflist ; vc ; vc=vc->next)
{
unsigned int i;
- unsigned int j;
struct mdinfo *this;
char *ep;
__u32 *cptr;
@@ -3698,12 +3704,7 @@ static struct mdinfo *container_content_
this->array.state = 1;
this->resync_start = MaxSector;
}
- memcpy(this->name, ddf->virt->entries[i].name, 16);
- this->name[16]=0;
- for(j=0; j<16; j++)
- if (this->name[j] == ' ')
- this->name[j] = 0;
-
+ _ddf_array_name(this->name, ddf, i);
memset(this->uuid, 0, sizeof(this->uuid));
this->component_size = be64_to_cpu(vc->conf.blocks);
this->array.size = this->component_size / 2;