From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1KU5se-0004QC-7r for mharc-grub-devel@gnu.org; Fri, 15 Aug 2008 16:26:40 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KU5sc-0004Q0-Jl for grub-devel@gnu.org; Fri, 15 Aug 2008 16:26:38 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KU5sZ-0004Pa-Uh for grub-devel@gnu.org; Fri, 15 Aug 2008 16:26:37 -0400 Received: from [199.232.76.173] (port=41857 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KU5sZ-0004PT-Oo for grub-devel@gnu.org; Fri, 15 Aug 2008 16:26:35 -0400 Received: from mta-out.inet.fi ([195.156.147.13]:59477 helo=jenni1.inet.fi) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KU5sZ-0004ap-BH for grub-devel@gnu.org; Fri, 15 Aug 2008 16:26:35 -0400 Received: from [127.0.0.1] (88.193.32.97) by jenni1.inet.fi (8.5.014) id 488F153400B6C042 for grub-devel@gnu.org; Fri, 15 Aug 2008 23:26:34 +0300 Message-ID: <48A5E682.3070006@nic.fi> Date: Fri, 15 Aug 2008 23:26:42 +0300 From: =?ISO-8859-1?Q?Vesa_J=E4=E4skel=E4inen?= User-Agent: Thunderbird 2.0.0.16 (Windows/20080708) MIME-Version: 1.0 To: The development of GRUB 2 References: <1218684975.8757.139.camel@localhost> <48A4589D.3040902@nic.fi> <20080814180005.GB5614@thorin> <1218749362.19647.20.camel@localhost> <48A5AF50.2040906@nic.fi> <1218819798.2510.13.camel@localhost> <48A5B96D.7040209@nic.fi> <1218823154.2510.23.camel@localhost> <48A5CC71.3020508@nic.fi> <1218827894.2510.51.camel@localhost> <48A5DD13.5050903@nic.fi> <1218831181.2510.56.camel@localhost> In-Reply-To: <1218831181.2510.56.camel@localhost> X-Enigmail-Version: 0.95.7 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: Quoted-Printable X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 3) Subject: Re: [RFC] Platform information services 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: Fri, 15 Aug 2008 20:26:38 -0000 Javier Mart=EDn wrote: >>> An use case would be in the proposed drivemap module, in the function >>> installing an interrupt handler in the real-mode IVT: instead of the >>> current code with magic addresses, >>> >>> /* Real mode IVT slot (seg:off far pointer) for interrupt 0x13. */ >>> grub_uint32_t *ivtslot =3D (grub_uint32_t*)0x0000004c; >>> >>> The module could be like this: >>> >>> /* Real mode IVT slot (seg:off far pointer) for interrupt 0x13. */ >>> grub_uint32_t *ivtslot =3D 19 + >>> (grub_uint32_t*)grub_machine_get_fwstruct(GRUB_I386_PC_IVT); >> The better way that complies with all your error cases provided: >> >> grub_ivt_entry_t *entry; >> entry =3D grub_get_ivt_entry(0x13); >> *entry =3D new_value; > This was another of the solutions I was considering in this thread (the > "many-functions approach"), I just found the single-function solution > more elegant in the case of "large numbers" (>10) of structures becomin= g > visible through this method, but your snippet looks fine and "safer". It is only visible within platform where it is used, so that is not a problem. "Large number" of structures are still needed for that platform (and if they are not needed, then there is no need for the function) and that need cannot be discarded in anyway. Unless you want to use magic numbers to define offsets... So I would dismiss the idea and continue to use other methods. >> of course grub_ivt_entry_t could be renamed to be something like >> grub_realmode_addr_t. > grub_realmode_farptr_t would suit better IMO. Please be free to use that.