From: Baoquan He <bhe@redhat.com>
To: Vivek Goyal <vgoyal@redhat.com>
Cc: Dave Young <dyoung@redhat.com>, Simon Horman <horms@verge.net.au>,
Kexec Mailing List <kexec@lists.infradead.org>,
WANG Chao <chaowang@redhat.com>
Subject: Re: [PATCH] kexec: Provide an option to use new kexec system call
Date: Thu, 14 Aug 2014 10:46:29 +0800 [thread overview]
Message-ID: <20140814024629.GA12702@dhcp-16-105.nay.redhat.com> (raw)
In-Reply-To: <20140813150602.GA1062@redhat.com>
On 08/13/14 at 11:06am, Vivek Goyal wrote:
> +/* New file based kexec system call related code */
> +static int do_kexec_file_load(int fileind, int argc, char **argv,
> + unsigned long flags) {
> +
> + char *kernel;
........
> + kernel_fd = open(kernel, O_RDONLY);
> + if (kernel_fd == -1) {
> + fprintf(stderr, "Failed to open file %s:%s\n", kernel,
> + strerror(errno));
> + return -1;
> + }
> +
> + /* slurp in the input kernel */
> + kernel_buf = slurp_decompress_file(kernel, &kernel_size);
> +
> + for (i = 0; i < file_types; i++) {
> + if (file_type[i].probe(kernel_buf, kernel_size) >= 0)
> + break;
> + }
> +
> + if (i == file_types) {
> + fprintf(stderr, "Cannot determine the file type " "of %s\n",
> + kernel);
> + return -1;
> + }
> +
> + ret = file_type[i].load(argc, argv, kernel_buf, kernel_size, &info);
> + if (ret < 0) {
> + fprintf(stderr, "Cannot load %s\n", kernel);
> + return ret;
> + }
> +
> + if (!is_kexec_file_load_implemented()) {
Hi Vivek,
Can we put this check earlier, maybe before kernel file openning? Since
if this syscall is not implemented, we don't have to do the opening or
loading things.
Thanks
Baoquan
> + fprintf(stderr, "syscall kexec_file_load not available.\n");
> + return -1;
> + }
> +
> + /*
> + * If there is no initramfs, set KEXEC_FILE_NO_INITRAMFS flag so that
> + * kernel does not return error with negative initrd_fd.
> + */
> + if (info.initrd_fd == -1)
> + info.kexec_flags |= KEXEC_FILE_NO_INITRAMFS;
> +
> + ret = kexec_file_load(kernel_fd, info.initrd_fd, info.command_line_len,
> + info.command_line, info.kexec_flags);
> + if (ret != 0)
> + fprintf(stderr, "kexec_file_load failed: %s\n",
> + strerror(errno));
> + return ret;
> +}
> +
>
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
next prev parent reply other threads:[~2014-08-14 2:48 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-13 15:06 [PATCH] kexec: Provide an option to use new kexec system call Vivek Goyal
2014-08-14 2:46 ` Baoquan He [this message]
2014-08-18 14:53 ` Vivek Goyal
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=20140814024629.GA12702@dhcp-16-105.nay.redhat.com \
--to=bhe@redhat.com \
--cc=chaowang@redhat.com \
--cc=dyoung@redhat.com \
--cc=horms@verge.net.au \
--cc=kexec@lists.infradead.org \
--cc=vgoyal@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.