Re: [PATCH 2/4] Add --initrd argument to mdadm

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

> From: Jes Sorensen <Jes.Sorensen@xxxxxxxxxx>
> 
> 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@xxxxxxxxxx>
> ---
>  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: signature.asc
Description: PGP signature


[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux