zfsboot insists on /boot.config being >=512 bytes to not be "invalid format"

From: Johny Mattsson <johny-freebsd_at_earthmagic.org>
Date: Sat, 10 Oct 2009 22:28:25 +1100
Hi all,

Just came across a tiny annoyance on 8.0-RC1-p1 - when booting off a zfs
root and using a /boot.config file, zfsboot prints "Invalid format"
unless /boot.config is at least 512 bytes. Everything still works, so
this is a cosmetic/user-friendliness bug only.

Looking at /sys/boot/i386/zfsboot/zfsboot.c, this appears to stem from
xfsread() being used to load in /boot.config, and xfsread() wants to be
able to read in a full buffer. Switching to using plain zfs_read()
should fix it. Below is a one-liner patch to do so.

Cheers,
/Johny

--- zfsboot.c.orig      2009-10-10 22:04:29.464823028 +1100
+++ zfsboot.c   2009-10-10 22:05:06.766834831 +1100
_at__at_ -609,7 +609,7 _at__at_

      if (zfs_lookup(spa, PATH_CONFIG, &dn) == 0) {
         off = 0;
-       xfsread(&dn, &off, cmd, sizeof(cmd));
+       zfs_read(spa, &dn, &off, cmd, sizeof(cmd));
      }

      if (*cmd) {
Received on Sat Oct 10 2009 - 09:28:27 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:56 UTC