From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1YANF0-0007SQ-88 for mharc-grub-devel@gnu.org; Sun, 11 Jan 2015 13:27:58 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52483) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YANEx-0007M9-9v for grub-devel@gnu.org; Sun, 11 Jan 2015 13:27:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YANEu-0004TC-2W for grub-devel@gnu.org; Sun, 11 Jan 2015 13:27:55 -0500 Received: from mail-la0-x230.google.com ([2a00:1450:4010:c03::230]:39744) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YANEt-0004T5-R2 for grub-devel@gnu.org; Sun, 11 Jan 2015 13:27:52 -0500 Received: by mail-la0-f48.google.com with SMTP id gf13so21034631lab.7 for ; Sun, 11 Jan 2015 10:27:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=aQ1BCk9Eyo8Z6F6qoA2+OCXQ4zOFakEt6gfaLUF4G+A=; b=doKCmx3OwqReSQZi5WolYEfpwSkK2j/NwCeF8gveUuAkFmEinBorHMcLjSfhN5WoA3 bzoAEcmBpFtAciq/RwKwJ68LvbpQUaq6nRlE0qQpzkIsDHpn7kQsIM1bRDbxBbuKimgb Sn6f4UnUMJ2Oj7UrHc6akPAgQuRtVQMp0ORWGXx/gE2PnNRiTKT8KspE3uZFyXHFzbj3 nLqozUuWXraVGzYeHcgHdz29oY3aTvx/7B73Njh5M6se7omY6b4wPkv2J9Tq4jZegoDf qPpBPSZJxx5ZArpYIOkVCOzAbVEhTSDZgntgbLf9G0nX4aBoNE6/trqkxe6UV6U/SJlT C7uA== X-Received: by 10.152.120.97 with SMTP id lb1mr32793818lab.76.1421000870601; Sun, 11 Jan 2015 10:27:50 -0800 (PST) Received: from opensuse.site (ppp91-76-14-38.pppoe.mtu-net.ru. [91.76.14.38]) by mx.google.com with ESMTPSA id f7sm3453191lam.46.2015.01.11.10.27.49 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 11 Jan 2015 10:27:49 -0800 (PST) Date: Sun, 11 Jan 2015 21:27:44 +0300 From: Andrei Borzenkov To: Kris Moore Subject: Re: Patch to fix kldstat(2) / dtrace when booting FreeBSD Message-ID: <20150111212748.153e7951@opensuse.site> In-Reply-To: <54B0025E.4020407@pcbsd.org> References: <54B0025E.4020407@pcbsd.org> X-Mailer: Claws Mail 3.11.0 (GTK+ 2.24.25; x86_64-suse-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4010:c03::230 Cc: grub-devel@gnu.org X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Jan 2015 18:27:56 -0000 =D0=92 Fri, 09 Jan 2015 11:31:26 -0500 Kris Moore =D0=BF=D0=B8=D1=88=D0=B5=D1=82: >=20 > The following patch fixes an important issue when booting FreeBSD. > FreeBSD's kldstat(2) function expects that the full pathname will be > provided to kernel / modules. The current GRUB was striping this out and > only leaving the filename itself. This broke dtrace and other things > which used the full pathname to locate the kernel or modules on disk. >=20 > The attached patch fixes this behavior. >=20 > diff --git a/grub-core/loader/i386/bsd.c b/grub-core/loader/i386/bsd.c > index 8f691e0..fb47969 100644 > --- a/grub-core/loader/i386/bsd.c > +++ b/grub-core/loader/i386/bsd.c > @@ -415,11 +415,15 @@ grub_freebsd_add_meta_module (const char *filename,= const char *type, > grub_addr_t addr, grub_uint32_t size) > { > const char *name; > - name =3D grub_strrchr (filename, '/'); > + /* Don't strip the full path, some FreeBSD functionality, such > + * as kldstat(2) / dtrace, rely on this. Instead we only need to remove > + * any ZFS dataset information first. */ > + name =3D grub_strrchr (filename, '@'); What if filename itself contains '@'? Is it possible? > if (name) > name++; > else > name =3D filename; > + Please, could we avoid unrelated formatting changes? > if (grub_strcmp (type, "/boot/zfs/zpool.cache") =3D=3D 0) > name =3D "/boot/zfs/zpool.cache"; > =20