On Thu, Aug 14, 2014 at 10:46:29AM +0800, Baoquan He wrote: > 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. > Ok, will do it. Thanks Vivek