linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: Jes.Sorensen@redhat.com
Cc: linux-raid@vger.kernel.org, dledford@redhat.com, kay@redhat.com,
	harald@redhat.com, lpoetter@redhat.com, mschmidt@redhat.com
Subject: Re: [PATCH 2/4] Add --initrd argument to mdadm
Date: Sun, 22 Jan 2012 22:17:58 +1100	[thread overview]
Message-ID: <20120122221758.412b18d4@notabene.brown> (raw)
In-Reply-To: <1326797330-4488-3-git-send-email-Jes.Sorensen@redhat.com>

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

On Tue, 17 Jan 2012 11:48:48 +0100 Jes.Sorensen@redhat.com wrote:

> From: Jes Sorensen <Jes.Sorensen@redhat.com>
> 
> When --initrd is parsed, mdadm will change the first character of
> argv[0] to '@'. This is used to signal to systemd that mdadm was
> launched from initramfs and should not be shut down before returning
> to the initramfs.
> 
> Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
> ---
>  ReadMe.c |    3 +++
>  mdadm.c  |   10 ++++++++++
>  mdadm.h  |    1 +
>  3 files changed, 14 insertions(+), 0 deletions(-)
> 
> diff --git a/ReadMe.c b/ReadMe.c
> index 9aa798b..49dc04f 100644
> --- a/ReadMe.c
> +++ b/ReadMe.c
> @@ -111,6 +111,7 @@ struct option long_options[] = {
>      {"kill-subarray", 1, 0, KillSubarray},
>      {"update-subarray", 1, 0, UpdateSubarray},
>      {"udev-rules", 2, 0, UdevRules},
> +    {"initrd", 0, 0, InitrdOpt},
>  
>      /* synonyms */
>      {"monitor",   0, 0, 'F'},
> @@ -268,6 +269,8 @@ char OptionHelp[] =
>  "  --query       -Q   : Display general information about how a\n"
>  "                       device relates to the md driver\n"
>  "  --auto-detect      : Start arrays auto-detected by the kernel\n"
> +"  --initrd           : Set first character of argv[0] to @ to indicate the\n"
> +"                       application was launched from initrd.\n"
>  ;
>  /*
>  "\n"
> diff --git a/mdadm.c b/mdadm.c
> index f07fac2..c0ccf55 100644
> --- a/mdadm.c
> +++ b/mdadm.c
> @@ -174,6 +174,16 @@ int main(int argc, char *argv[])
>  				homehost = optarg;
>  			continue;
>  
> +		/*
> +		 * --initrd sets first char of argv[0] to @. This is used
> +		 * by systemd to signal that the tast was launched from
> +		 * initrd/initramfs and should be preserved during shutdown
> +		 */
> +		case InitrdOpt:
> +			c = argv[0];
> +			c[0] = '@';
> +			continue;

Why not:
                        argv[0][0] = '@';
??

Also I'm wondering about the choice of "initrd" as the option name.
After all, we mostly use initramfs these days.

 --preboot ??
 --systemd-root-storage-daemon ??

OK, the second is a joke, and the first is introducing terminology that isn't
widely used...

 --for-root
??

I'm open to suggestions, but I'm not seeing --initrd as the best choice just
yet.

Otherwise this and 1/4 are OK.

Thanks,
NeilBrown

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

  parent reply	other threads:[~2012-01-22 11:17 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-17 10:48 [PATCH 0/4] add --initrd argument to mdadm/mdmon Jes.Sorensen
2012-01-17 10:48 ` [PATCH 1/4] mdmon: Use getopt_long() to parse command line options Jes.Sorensen
2012-01-17 10:48 ` [PATCH 2/4] Add --initrd argument to mdadm Jes.Sorensen
2012-01-18  8:13   ` Kwolek, Adam
2012-01-18 10:08     ` Jes Sorensen
2012-01-18 10:36       ` Kwolek, Adam
2012-01-18 16:43         ` Jes Sorensen
2012-01-18 16:46           ` Jes Sorensen
2012-01-19  7:25             ` Kwolek, Adam
2012-01-20 14:05               ` Jes Sorensen
2012-01-22 11:20                 ` NeilBrown
2012-01-22 11:17   ` NeilBrown [this message]
2012-01-23 10:25     ` Jes Sorensen
2012-01-23 20:13       ` Lennart Poettering
2012-01-23 20:50         ` Kay Sievers
2012-01-25 10:53           ` Jes Sorensen
2012-01-25 11:37             ` NeilBrown
2012-01-25 13:34               ` Jes Sorensen
2012-01-17 10:48 ` [PATCH 3/4] Add --initrd argument to mdmon Jes.Sorensen
2012-01-22 11:22   ` NeilBrown
2012-01-23 10:27     ` Jes Sorensen
2012-01-17 10:48 ` [PATCH 4/4] Spawn mdmon with --initrd if mdadm was launched with --initrd Jes.Sorensen
2012-01-17 19:57 ` [PATCH 0/4] add --initrd argument to mdadm/mdmon Doug Ledford
2012-01-17 20:16   ` Jes Sorensen
2012-01-22 11:25     ` NeilBrown
2012-01-21  1:27   ` Lennart Poettering

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=20120122221758.412b18d4@notabene.brown \
    --to=neilb@suse.de \
    --cc=Jes.Sorensen@redhat.com \
    --cc=dledford@redhat.com \
    --cc=harald@redhat.com \
    --cc=kay@redhat.com \
    --cc=linux-raid@vger.kernel.org \
    --cc=lpoetter@redhat.com \
    --cc=mschmidt@redhat.com \
    /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).