linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: Martin Wilck <mwilck@arcor.de>
Cc: linux-raid@vger.kernel.org
Subject: Re: [PATCH 1/2] DDF: brief_examine_subarrays_ddf: print array name
Date: Tue, 10 Sep 2013 10:01:51 +1000	[thread overview]
Message-ID: <20130910100151.31048cad@notabene.brown> (raw)
In-Reply-To: <522E13EF.3080001@arcor.de>

[-- Attachment #1: Type: text/plain, Size: 3080 bytes --]

On Mon, 09 Sep 2013 20:31:11 +0200 Martin Wilck <mwilck@arcor.de> wrote:

> Hi Neil,
> 
> >> Print an array name in brief output. Do this even if no name is set,
> >> faking a simple pseudo name (may happen for some BIOS RAIDs).
> >> This makes DDF and IMSM behave equally.
> >>
> >> SUSE's YaST2 needs this in order to detect MD arrays during
> >> installation.
> > 
> > Thanks, but I don't like this - I would really rather SUSE's YaST2 got fixed.
> > 
> > mdadm.conf is really for mdadm to read.  And the "--brief" output is meant
> > for inclusion in mdadm.conf.
> > 
> > If other programs want to parse the output of mdadm, they should use
> > --export, not --brief.
> 
> Well, yast is actually not calling --brief. It calls "mdadm --examine
> --scan", and --scan implies --brief (comment in mdadm.c). My patch
> simply causes DDF and IMSM to print similar output with "mdadm -Es".
> Isn't that reasonable?

This bit that I really didn't like is where you synthesised a "ddf_%d" name
if the name field was empty.  This is wrong.

There are a couple of other places where the name is extracted from the
ddf metadata: getinfo_super_ddf_bvd and container_content_ddf.
If brief_examine_subarrays_ddf uses the name in the same way following
the same rules (e.g. discarding trailing spaces) then that would be OK.
But if the name is empty, then no name should be given in the 'array' line.

NeilBrown

> 
> Martin
> 
> 
> > 
> > NeilBrown
> > 
> >>
> >> Signed-off-b545d3bca8b105ba10dadbab2fcd31467b5613c11y: Martin Wilck <mwilck@arcor.de>
> >> ---
> >>  super-ddf.c |   13 +++++++++++--
> >>  1 files changed, 11 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/super-ddf.c b/super-ddf.c
> >> index 8bba70a..72a8351 100644
> >> --- a/super-ddf.c
> >> +++ b/super-ddf.c
> >> @@ -30,6 +30,7 @@
> >>  #include "mdmon.h"
> >>  #include "sha1.h"
> >>  #include <values.h>
> >> +#include <ctype.h>
> >>  
> >>  /* a non-official T10 name for creation GUIDs */
> >>  static char T10[] = "Linux-MD";
> >> @@ -1577,14 +1578,22 @@ static void brief_examine_subarrays_ddf(struct supertype *st, int verbose)
> >>  		struct virtual_entry *ve = &ddf->virt->entries[i];
> >>  		struct vcl vcl;
> >>  		char nbuf1[64];
> >> +		char namebuf[sizeof(ve->name)+1], *c;
> >>  		if (all_ff(ve->guid))
> >>  			continue;
> >>  		memcpy(vcl.conf.guid, ve->guid, DDF_GUID_LEN);
> >>  		ddf->currentconf =&vcl;
> >>  		uuid_from_super_ddf(st, info.uuid);
> >>  		fname_from_uuid(st, &info, nbuf1, ':');
> >> -		printf("ARRAY container=%s member=%d UUID=%s\n",
> >> -		       nbuf+5, i, nbuf1+5);
> >> +		memcpy(namebuf, ve->name, sizeof(ve->name));
> >> +		namebuf[sizeof(ve->name)] = '\0';
> >> +		if (namebuf[0] == '\0')
> >> +			sprintf(namebuf, "ddf_%d", i);
> >> +		for (c = namebuf; c < namebuf + sizeof(ve->name); c++)
> >> +			if (isspace(*c))
> >> +				*c = '-';
> >> +		printf("ARRAY /dev/md/%s container=%s member=%d UUID=%s\n",
> >> +		       namebuf, nbuf+5, i, nbuf1+5);
> >>  	}
> >>  }
> >>  
> > 


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

  parent reply	other threads:[~2013-09-10  0:01 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-06 21:26 [PATCH 1/2] DDF: brief_examine_subarrays_ddf: print array name mwilck
2013-09-06 21:26 ` [PATCH 2/2] DDF: new algorithm for subarray UUID mwilck
2013-09-07 19:23   ` Martin Wilck
2013-09-09  1:20     ` NeilBrown
2013-09-09 18:37       ` Martin Wilck
2013-09-09 23:51         ` NeilBrown
2013-09-09  1:15 ` [PATCH 1/2] DDF: brief_examine_subarrays_ddf: print array name NeilBrown
2013-09-09 18:31   ` Martin Wilck
2013-09-09 18:40     ` [PATCH 2/2] DDF: handle fake RAIDs with changing subarray UUIDs mwilck
2013-09-09 23:48       ` NeilBrown
2013-09-10  0:01     ` NeilBrown [this message]
2013-09-11 19:50       ` [PATCH 1/2] DDF: brief_examine_subarrays_ddf: print array name Martin Wilck
2013-09-11 19:55         ` Martin Wilck
2013-09-12  5:47           ` NeilBrown
2013-09-11 19:55         ` [PATCH 1/2] DDF: factor out array name generation mwilck
2013-09-11 19:55         ` [PATCH 2/2] DDF: brief_examine_subarrays_ddf: print array name mwilck
2013-09-12  5:44           ` NeilBrown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130910100151.31048cad@notabene.brown \
    --to=neilb@suse.de \
    --cc=linux-raid@vger.kernel.org \
    --cc=mwilck@arcor.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).