From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1KaXEv-0002P8-It for mharc-grub-devel@gnu.org; Tue, 02 Sep 2008 10:52:17 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KaXEu-0002OV-7c for grub-devel@gnu.org; Tue, 02 Sep 2008 10:52:16 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KaXEr-0002Ne-GG for grub-devel@gnu.org; Tue, 02 Sep 2008 10:52:15 -0400 Received: from [199.232.76.173] (port=46360 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KaXEr-0002NY-66 for grub-devel@gnu.org; Tue, 02 Sep 2008 10:52:13 -0400 Received: from ug-out-1314.google.com ([66.249.92.168]:19331) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KaXEq-0001ri-TK for grub-devel@gnu.org; Tue, 02 Sep 2008 10:52:13 -0400 Received: by ug-out-1314.google.com with SMTP id m2so2248684uge.17 for ; Tue, 02 Sep 2008 07:52:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:subject:from:to:in-reply-to :references:content-type:date:message-id:mime-version:x-mailer; bh=nchL/ifytnztQZIhXn9iPSheHkGpXPI9o0fsbV4prJw=; b=Zevo/o2yLpzmgUIVx1Ce5mLyZuPh6XeC0nnVLUG4exydBcZDkYUBCourksFtmq8ani rIu33ZxILo7xpCat9nruchxZJ8BHzYXCsdHijhhO8igkNeAdT5u3YERJRhp91Q4vUiWP nW7RSlG3RW4EfhN3D45txbzlLN+joKf1o793M= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=subject:from:to:in-reply-to:references:content-type:date:message-id :mime-version:x-mailer; b=mFXiBefDO1e5UY2Qf6KFhghdSqx5EiN9OdNGk5/N1jLBuSzw0UYD8MgqZ8Dh2PJeIj lECQm+ligz/bFDvijSl5L9FhqlscLQfXeQwiG6cFeCVkPgV1TYwF2PTiIyGQyI4WuJKz kmGkr6SZ4qYaanUoZpUrVJ6NAy+aHc7e8ERjw= Received: by 10.67.23.5 with SMTP id a5mr811032ugj.47.1220367130746; Tue, 02 Sep 2008 07:52:10 -0700 (PDT) Received: from ?192.168.1.100? ( [213.37.137.93]) by mx.google.com with ESMTPS id 6sm4509301ugc.5.2008.09.02.07.52.09 (version=SSLv3 cipher=RC4-MD5); Tue, 02 Sep 2008 07:52:10 -0700 (PDT) From: Javier =?ISO-8859-1?Q?Mart=EDn?= To: The development of GRUB 2 In-Reply-To: <48BD4C52.6040308@gmail.com> References: <48BD4C52.6040308@gmail.com> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-ZoMFWD582Usji/KbXIcQ" Date: Tue, 02 Sep 2008 16:54:59 +0200 Message-Id: <1220367299.23879.15.camel@localhost> Mime-Version: 1.0 X-Mailer: Evolution 2.22.3.1 X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 2) Subject: Re: Sendkey patch X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Sep 2008 14:52:16 -0000 --=-ZoMFWD582Usji/KbXIcQ Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable El mar, 02-09-2008 a las 16:23 +0200, phcoder escribi=C3=B3: > For implementing this functionality I needed my function to be executed > right before booting. To do it I added a simple interface for adding > "preboot" functions: > struct grub_preboot_t *grub_loader_add_preboot (grub_err_t > (*preboot_func) (int)); > As parameter this function recieves a callback (integer parameter to > callback is noreturn variable). This function returns a handle with > which the preboot function may be removed using > void grub_loader_remove_preboot (struct grub_preboot_t *p); > Implementation uses linked lists and tries to implement it in as few > commands as possible since this code is a part of core image. This > interface can later be reused for adding different hooks to bios ("map", > "memdisk",...). Now the questions are: > Whether such interface is OK for grub2? An interface like this is implemented in another patch in "discussion", my drivemap patch (see the August list archives). As yours, it is linked-list based and very similar in the prototypes. I haven't checked if your code has any kind of errors/corner cases, but it seems terser than mine even though it's a bit more difficult to understand because you use double pointers to avoid my handling of the head case. I don't understand the purpose of doubly-linking the list though... > Whether we need also interface for adding "postboot" commands? (in case > boot_function returns) I don't think it would offer a lot of functionality because most loaders don't return on failure, they just get stuck or their payload triple-faults and reboots. The same question applies for the failure of one of the preboot routines. Sure, things like an INT13 handler are easy to remove and restore the old machine state, but I really think the best option here would be panic and offer to reboot. -Habbit --=-ZoMFWD582Usji/KbXIcQ Content-Type: application/pgp-signature; name=signature.asc Content-Description: Esta parte del mensaje =?ISO-8859-1?Q?est=E1?= firmada digitalmente -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iQIVAwUASL1TwqSl+Fbdeo72AQLAqw/7Bxw3DTFnSJkX1uqTHEuvTLw2qW9tKXHZ TE4ptPf5wl72CvB62honInVwoDP8U8Z97sJ5qmI4oOBwvQmBUB/TTOrl6rCFSow5 fgHOVOmgno70JrSiEjqgQ0sxsQhbJD7VFLKXVobVXoUW+RNakQKRCmNEh+TY7lpN ANzedS9hrBlnCQxM9aozIJzJXdnwg0dhTEboufnG7So/q1ropzRPDABHUHQ7+AwZ tbFCDBT+fQmU/6Fr0sqxed6bKuSmv37/4TrpHz26pMjCK4Gpwj3kNU60di2HebOA I7EuGUQHCDOeFjQsaiaiMUBLMbdVpW0ls532gEkKzFoDGJY93ob0qYyvJIsZDzlb atfs38HB30hDqnZ4p72FbQJZsLYS3il5l22mOE2PLlc72/Aegep+Z7wuB3MXLno5 ndihQbUjfM0uzlC2wEm1C+gQQGKqAmEc2grbmtNEJ+miyopD3VjUTKuS/Bd0NpQc DKFbaf/l7xjpCKYpk1iiKsB6mTHoZJFioWCLlCF04WbGwCjc+I8p23zJB+mwWtq5 E5ZMdlpdL8t+I3LBmjS7beZBvv3Eu4TYXoVyS9QnDRH6GJ4KCH0JkNj5lMlRJ0FD rBn11a6R5La0ztAG01Swu9HRTZw8+yIvKDzrInQEl28DbnzxaIx3/Y9aD/SNzJJu lMLPz9TMsrI= =vDXr -----END PGP SIGNATURE----- --=-ZoMFWD582Usji/KbXIcQ--