summaryrefslogtreecommitdiffstats
path: root/super-ddf.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2008-11-04 20:51:12 +1100
committerNeilBrown <neilb@suse.de>2008-11-04 20:51:12 +1100
commitdb42fa9b21a8174db4b5d2588a01266947196278 (patch)
treeb9faada8423cafafd97dc5d0129ff22a7415032a /super-ddf.c
parent9008ed1c9623b7c11775ea8a7be17eb1bde5fd09 (diff)
downloadmdadm-db42fa9b21a8174db4b5d2588a01266947196278.tar.gz
mdadm-db42fa9b21a8174db4b5d2588a01266947196278.tar.xz
mdadm-db42fa9b21a8174db4b5d2588a01266947196278.zip
DDF: fix irregularities with retrieval of 'name' from metadata.
It is only 16 bytes, not 32. And is space padded, not nul terminated. Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'super-ddf.c')
-rw-r--r--super-ddf.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/super-ddf.c b/super-ddf.c
index 98e75ad..1caaf01 100644
--- a/super-ddf.c
+++ b/super-ddf.c
@@ -1300,6 +1300,7 @@ static void getinfo_super_ddf_bvd(struct supertype *st, struct mdinfo *info)
struct ddf_super *ddf = st->sb;
struct vcl *vc = ddf->currentconf;
int cd = ddf->currentdev;
+ int j;
/* FIXME this returns BVD info - what if we want SVD ?? */
@@ -1347,7 +1348,11 @@ static void getinfo_super_ddf_bvd(struct supertype *st, struct mdinfo *info)
st->subarray);
info->safe_mode_delay = 200;
- info->name[0] = 0;
+ 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;
}
@@ -2661,6 +2666,7 @@ static struct mdinfo *container_content_ddf(struct supertype *st)
for (vc = ddf->conflist ; vc ; vc=vc->next)
{
int i;
+ int j;
struct mdinfo *this;
this = malloc(sizeof(*this));
memset(this, 0, sizeof(*this));
@@ -2691,8 +2697,11 @@ static struct mdinfo *container_content_ddf(struct supertype *st)
this->array.state = 1;
this->resync_start = ~0ULL;
}
- memcpy(this->name, ddf->virt->entries[i].name, 32);
- this->name[32]=0;
+ 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;
memset(this->uuid, 0, sizeof(this->uuid));
this->component_size = __be64_to_cpu(vc->conf.blocks);