From 9de342e3b04133ec23118695b2817c7cf6cad954 Mon Sep 17 00:00:00 2001 From: kn Date: Mon, 8 Jun 2020 19:17:12 +0000 Subject: Provide clear errors when trying to install oversized boot loader sparc64 installboot(8) on softraid(4) with too large files, e.g. unstripped builds, fails poorly with "installboot: softraid installboot failed". This is due to the BIOCINSTALLBOOT ioctl(2) returing the default EINVAL rather than using softraid's sr_error() interface properly; additionally, installboot does not check for such message from the bio(4) layer. Make the kernel generate "boot block too large" and "boot loader too large" messages for softraid devices and have installboot act upon them analogous to bioctl(8), by adapting its bio_status() into the new sr_status() helper. Input, reminder to look at bioctl, same kernel diff from, OK jsing --- usr.sbin/installboot/softraid.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'usr.sbin/installboot/softraid.c') diff --git a/usr.sbin/installboot/softraid.c b/usr.sbin/installboot/softraid.c index 8a3c5620fdc..c197164526a 100644 --- a/usr.sbin/installboot/softraid.c +++ b/usr.sbin/installboot/softraid.c @@ -1,4 +1,4 @@ -/* $OpenBSD: softraid.c,v 1.4 2015/10/03 16:56:52 krw Exp $ */ +/* $OpenBSD: softraid.c,v 1.5 2020/06/08 19:17:12 kn Exp $ */ /* * Copyright (c) 2012 Joel Sing * @@ -92,3 +92,19 @@ sr_volume(int devfd, char *dev, int *vol, int *disks) return 1; } + +void +sr_status(struct bio_status *bs) +{ + int i; + + for (i = 0; i < bs->bs_msg_count; i++) + warnx("%s", bs->bs_msgs[i].bm_msg); + + if (bs->bs_status == BIO_STATUS_ERROR) { + if (bs->bs_msg_count == 0) + errx(1, "unknown error"); + else + exit(1); + } +} -- cgit v1.2.3-59-g8ed1b