From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1II8Sl-0001N4-Jd for mharc-grub-devel@gnu.org; Mon, 06 Aug 2007 15:41:59 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1II8Sj-0001L7-8J for grub-devel@gnu.org; Mon, 06 Aug 2007 15:41:57 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1II8Sf-0001Ju-P0 for grub-devel@gnu.org; Mon, 06 Aug 2007 15:41:56 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1II8Sf-0001Jo-HD for grub-devel@gnu.org; Mon, 06 Aug 2007 15:41:53 -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 1II8Sd-0001qj-HZ for grub-devel@gnu.org; Mon, 06 Aug 2007 15:41:52 -0400 Received: from c80-216-246-123.bredband.comhem.se ([80.216.246.123]:63141 helo=localhost.localdomain) by ch-smtp02.sth.basefarm.net with esmtp (Exim 4.66) (envelope-from ) id 1II8SU-0006hf-7J; Mon, 06 Aug 2007 21:41:42 +0200 From: Johan Rydberg To: The development of GRUB 2 In-Reply-To: <87fy3194au.fsf@xs4all.nl> (Marco Gerards's message of "Thu, 02 Aug 2007 20:31:21 +0200") References: <87fy3194au.fsf@xs4all.nl> User-Agent: Gnus/5.110004 (No Gnus v0.4) Emacs/21.4 (gnu/linux) Date: Mon, 06 Aug 2007 22:08:45 +0200 Message-ID: <877io8tohe.fsf@gnu.org> 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 1II8SU-0006hf-7J. X-Scan-Signature: ch-smtp02.sth.basefarm.net 1II8SU-0006hf-7J 27222abc53af0bda38463da8d80c7c73 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:57 -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/S3CqIy3K3X2ERAqRSAJ9lwXukuiGSXDI//9CNlYRP7uBfNwCeJbFW y+EFOyY58xtP/qK43R+zpLs= =MvPS -----END PGP SIGNATURE----- --=-=-=--