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

Kay Sievers kay at vrfy.org
Sun Mar 15 11:41:26 PDT 2015


On Sun, Mar 15, 2015 at 7:31 PM, Zbigniew Jędrzejewski-Szmek
<zbyszek at in.waw.pl> wrote:
> On Wed, Mar 11, 2015 at 05:22:18PM -0700, Shawn Landden wrote:
>> Still use helper when Xen Dom0, to avoid duplicating some hairy code.
>>
>> I think the rbtree version was far more understandable as greedy_realloc0()
>> is very messy to do correctly.
>>
>> Take fopenat() from lsof.
>> Add opendirat()
>>
>> Future: generate BootLoaderSpec files for other kernel install locations
>>
>> v5: fix syscall invocation from draft version
>> v6: usr either /boot/efi or /boot

>> +static int fopen_to_open(const char *m) {
>> +        int flags;
>> +
>> +        if (strchr(m, '+'))
>> +            flags = O_RDWR;
>> +        else if (m[0] == 'r')
>> +            flags = O_RDONLY;
>> +        else if (m[0] == 'w' || m[0] == 'a')
>> +            flags = O_WRONLY;
>> +        else
>> +            return(0);
>> +
>> +        if (m[0] == 'a')
>> +            flags |= O_APPEND|O_CREAT;
>> +        if (m[0] == 'w')
>> +            flags |= O_TRUNC|O_CREAT;
>> +
>> +        flags |= O_NONBLOCK;
>> +
>> +        return flags;
>> +}
> I really dislike this part. The open() interface is so much better
> than fopen().

We first need a clear definition of what this functionality is
supposed to solve and how and why we want that in systemd, and that we
can hold the promise we are making here. Unless that is done and looks
reasonable and acceptable, I see no way of this being merged.

Please do not waste any more time with style questions. The whole
approach in this patch does not seem convincing, and the idea of
parsing boot loader specifics with systemd code can't work out from my
point of view.

Kay


More information about the systemd-devel mailing list