From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1II8SN-0001DW-7o for mharc-grub-devel@gnu.org; Mon, 06 Aug 2007 15:41:35 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1II8SL-0001DJ-58 for grub-devel@gnu.org; Mon, 06 Aug 2007 15:41:33 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1II8SI-0001BC-Mk for grub-devel@gnu.org; Mon, 06 Aug 2007 15:41:32 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1II8SI-0001B1-GT for grub-devel@gnu.org; Mon, 06 Aug 2007 15:41:30 -0400 Received: from ch-smtp02.sth.basefarm.net ([80.76.149.213]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1II8S9-0001kC-JL for grub-devel@gnu.org; Mon, 06 Aug 2007 15:41:24 -0400 Received: from c80-216-246-123.bredband.comhem.se ([80.216.246.123]:63140 helo=localhost.localdomain) by ch-smtp02.sth.basefarm.net with esmtp (Exim 4.66) (envelope-from ) id 1II8Rs-0006Pl-7n; Mon, 06 Aug 2007 21:41:04 +0200 From: Johan Rydberg To: The development of GRUB 2 References: <87fy3194au.fsf@xs4all.nl> Date: Mon, 06 Aug 2007 22:07:45 +0200 In-Reply-To: <87fy3194au.fsf@xs4all.nl> (Marco Gerards's message of "Thu, 02 Aug 2007 20:31:21 +0200") Message-ID: <878x8otoj2.fsf@gnu.org> User-Agent: Gnus/5.110004 (No Gnus v0.4) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" X-Originating-IP: 80.216.246.123 X-Scan-Result: No virus found in message 1II8Rs-0006Pl-7n. X-Scan-Signature: ch-smtp02.sth.basefarm.net 1II8Rs-0006Pl-7n ede223a7c54d500baada2a45e8189d98 X-Detected-Kernel: Linux 2.6? (barebone, rare!) Cc: Subject: Re: Ethernet support [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: Mon, 06 Aug 2007 19:41:33 -0000 --=-=-= Content-Transfer-Encoding: quoted-printable Marco Gerards writes: > If I do not get any comments within a week, I'll just commit the > patch. >=20 I have a few more comments; > +#include > +#include > + > +enum grub_memstack_type > + { > + GRUB_MEMSTACK_TYPE_ETHERNET, > + GRUB_MEMSTACK_TYPE_IPV4, > + GRUB_MEMSTACK_TYPE_ARP, > + GRUB_MEMSTACK_TYPE_UDP, > + GRUB_MEMSTACK_TYPE_DATA /* XXX */ > + }; > +typedef enum grub_memstack_type grub_memstack_type_t; I do not see why this is needed at all? The data should be opaque. > +grub_memstack_t grub_memstack_new (void); > + > +void grub_memstack_free (grub_memstack_t stack); > + > +void *grub_memstack_push (grub_memstack_t stack, > + grub_memstack_type_t type, > + grub_size_t size); > + > +void *grub_memstack_bottom (grub_memstack_t stack, > + grub_memstack_type_t type, > + grub_size_t size); > + > +void *grub_memstack_pop (grub_memstack_t stack, grub_size_t *size); > + > +grub_err_t grub_memstack_popall (grub_memstack_t stack, > + char *buf, grub_size_t *size); > + The network component in a operating system is often seen as a stack, because packets travel up and down through a logical stack of functionality layers. That doesn't say that the data that is passed is really a stack. BSD uses a data structure called "mbufs", which really just is a linked list of small data chunks. There are operations to append, prepend and gather data from the "mbuf". I suggest to remove the word "stack" from our data structure, and replace it with something more generic; "buf" maybe?=20=20 And since it is really a linked list, _push should become prepend, and _bottom append, respectively.=20=20 Also, I do not think that the read operation should be destructive. Maybe a _read function is in order? If we do this, we have a shot at adding a data structure that could be used in other places than just our small network stack. ~j --=-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2.2 (GNU/Linux) iD8DBQBGt3+U3CqIy3K3X2ERAm9xAJ0ZD8PKSPMcl5uGiiCpXlMkIJCE4wCfUs8F +W7NNihmWdeurHFw32zEp2w= =yHdE -----END PGP SIGNATURE----- --=-=-=--