Re: [lkcd-devel] Re: What's left over.

Alexander Viro
2002-11-06T01:30:54Z

On Tue, 5 Nov 2002, Werner Almesberger wrote:

> Now, if we assume that it's okay for kexec to use a system call,
> the next question is whether kexec should indeed use it, i.e.
> whether a system call makes sense for what it is trying to do.
> Since there are no device files or network elements naturally
> involved here (i.e. other major kernel function interfaces),
> the answer seems to be "yes".

That's not obvious. By the same logics, we would need syscalls for
turning off overcommit, etc., etc.

FWIW, I suspect that
open("/proc/image", O_EXCL|O_WRONLY);
bunch of lseek()/write()
close()
would be more natural - definitely easier to understand than arguments of
your sys_kexec(). It's easy to switch from your code to that - you
put initialization into ->open(), pulling segments from userland into
->write(), use default ->lseek() and do actual work on ->close() if
no errors had happened. file->private_data will point to intermediate
state you need.

After all, that's what happens - you form an image, writing to it user-supplied
data from given buffers at given offsets and when you are done with that you
commit the changes. IMO special syscall is less natural match for that
than sequence above - commit-on-close is not something unusual, so it matches
the semantics of all syscalls involved...