[PATCH v2] kexec/s390x: use mmap instead of read for slurp_file()

Dave Young dyoung at redhat.com
Tue Oct 27 23:46:23 PDT 2015


Hi, Michael

> @@ -552,11 +563,18 @@ char *slurp_file(const char *filename, o
>  		if (err < 0)
>  			die("Can not seek to the begin of file %s: %s\n",
>  					filename, strerror(errno));
> +		buf = slurp_fd(fd, filename, size, &nread, use_mmap);
>  	} else {
>  		size = stats.st_size;
> +		if (use_mmap) {
> +			buf = mmap(NULL, size, PROT_READ | PROT_WRITE,
> +				   MAP_PRIVATE, fd, 0);
> +			nread = stats.st_size;
> +		} else {
> +			buf = slurp_fd(fd, filename, size, &nread, 0);
> +		}
>  	}

Drop above changes and replace below lines with an extra use_mmap argument
should be enough?

-	buf = slurp_fd(fd, filename, size, &nread);
[snip]

Otherwise I'm fine with the patch.

Thanks
Dave



More information about the kexec mailing list