[PATCH v3] arm64: Add purgatory printing

Geoff Levand geoff at infradead.org
Wed Sep 30 11:20:25 EDT 2020


Hi,

On 9/30/20 3:36 AM, matthias.bgg at kernel.org wrote:
> --- a/kexec/arch/arm64/include/arch/options.h
> +++ b/kexec/arch/arm64/include/arch/options.h
> 
> +static uint64_t find_purgatory_sink(const char *console)
> +{
> +	int fd, ret;
> +	char device[255], mem[255];
> +	struct stat sb;
> +	char buffer[10];
> +	uint64_t iomem = 0x0;
> +
> +	if (!console)
> +		return 0;
> +
> +	ret = snprintf(device, sizeof(device), "/sys/class/tty/%s", console);
> +	if (ret < 0 || ret >= sizeof(device)) {
> +		fprintf(stderr, "snprintf failed: %s\n", strerror(errno));
> +		return 0;
> +	}
> +
> +	if (stat(device, &sb) || !S_ISDIR(sb.st_mode)) {
> +		fprintf(stderr, "kexec: %s: No valid console found for %s\n",
> +			__func__, device);
> +		return 0;
> +	}
> +
> +	snprintf(mem, sizeof(mem), "%s%s", device, "/iomem_base");
> +	if (ret < 0 || ret >= sizeof(mem)) {

Seems this is is just doing the same check again...

> +		fprintf(stderr, "snprintf failed: %s\n", strerror(errno));
> +		return 0;
> +	}

-Geoff



More information about the kexec mailing list