Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 12 Jul 2002 13:36:22 -0700 (PDT)
From:      Julian Elischer <julian@elischer.org>
To:        =?unknown-8bit?Q?Aur=E9lien?= Nephtali <aurelien.nephtali@wanadoo.fr>
Cc:        hackers@FreeBSD.org
Subject:   Re: Kernel space: MALLOC() & TAILQ_*()
Message-ID:  <Pine.BSF.4.21.0207121336110.53224-100000@InterJet.elischer.org>
In-Reply-To: <20020710161342.GA22783@nitrogen>

next in thread | previous in thread | raw e-mail | index | archive | help
did you get answers to this?


On Wed, 10 Jul 2002, [unknown-8bit] Aur=E9lien Nephtali wrote:

> Hi,
>=20
> I'm new in kernel coding (i'm making a kernel module) so i had to learn h=
ow
> to use MALLOC*() macros to get memory, not very difficult in fact. But wh=
en
> the moment of making a chained list came, the first difficulty appears :/
> Before, i made chained lists like that:
>=20
> struct my_type {
> =09struct my_type=09*next;
> =09char=09=09elem[32];
> =09int=09=09elem_flags;
> };
>=20
> struct my_type=09*ch_list;
>=20
> struct my_type *add_2_list(char *elem, int flags) {
> =09struct my_type *chelem;
> =09
> =09chelem =3D (struct my_type *) malloc(sizeof(struct my_type));
> =09chelem->elem_flags =3D flags;
> =09strncpy(chelem->elem, elem, 32);
> =09chelem->next =3D (struct my_type *) ch_list;
> =09ch_list =3D (struct my_type *) chelem;
> =09
> =09return((struct my_type *) chelem);
> }
>=20
> (sorry if my code disturbs somebody but i want to be very clear)
>=20
> So my question is: Is there a way to *port* this code to be compatible wi=
th
> kernel code ? With MALLOC*() macros, i cannot use this code directly beca=
use
> each buffer has his own structure (i mean M_MYBUF)... So i looked at the
> queue(3) manpage ... but i want to know if i can *port* my code before.
>=20
> -- Aur=E9lien
>=20
>=20
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-hackers" in the body of the message
>=20


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0207121336110.53224-100000>