[systemd-devel] [v1] shutdown: add kexec loading, avoid calling `kexec` binary unnessecarily

Jan Janssen medhefgo at web.de
Thu Feb 26 00:04:08 PST 2015


Shawn Landden <shawn <at> churchofgit.com> writes:

>  void strv_free(char **l) {
> -        strv_clear(l);
> +        char **k;
> +
> +        if (!l)
> +                return;
> +
> +        for (k = l; *k; k++)
> +                free(*k);
> +
>          free(l);
>  }
What are you trying to achieve here? I see no point in optimizing out the *l
= NULL from strv_clear.

> +                                entry->linux_loc  = l + strspn(l,
WHITESPACE);
> +                        else if ((l = startswith(m, "initrd ")))
> +                                entry->initrd     = l + strspn(l,
WHITESPACE);
You need to support more than one initrd per kernel, see
https://wiki.archlinux.org/index.php/Microcode for why. Also, I am pretty
sure you can have a initrd=/path/to/initrd in the kernel options entry.
Since the efi bootloader just appends each given initrd to the kernel
command line.


All in all I am wondering why you need a rbtree for all this in the first
place? A simple hashmap should do just fine.

Also, you're not taking multi-boot into account (the machine-id field).
You're just discriminating based on the kernel version, but different
installations could have the same version field.

Jan



More information about the systemd-devel mailing list