Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 17 Oct 2005 23:01:03 +0930
From:      "Daniel O'Connor" <doconnor@gsoft.com.au>
To:        freebsd-hackers@freebsd.org
Cc:        kamal kc <kamal_ckk@yahoo.com>, freebsd-net@freebsd.org
Subject:   Re: malloc() in kernel and increasing mbuf and cluster size
Message-ID:  <200510172301.10658.doconnor@gsoft.com.au>
In-Reply-To: <20051017122657.58723.qmail@web35703.mail.mud.yahoo.com>
References:  <20051017122657.58723.qmail@web35703.mail.mud.yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
--nextPart1889844.n68iqsc57Q
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

On Mon, 17 Oct 2005 21:56, kamal kc wrote:
> the man pages use M_FOOBUF(where did it come from ??)
> in the field type.

'foo' is a generic term for a random variable name.

> Now how should i code it.
>
> struct malloc_type  mytype;
> mytype=3DMALLOC_DEFINE(.....,"mybuffers","mybuffers");
>
> what should i put in the type field ??

Read the man page!!
/* sys/something/foo_extern.h */

MALLOC_DECLARE(M_FOOBUF);

/* sys/something/foo_main.c */

MALLOC_DEFINE(M_FOOBUF, "foobuffers", "Buffers to foo data into the ether");
/* sys/something/foo_subr.c */

           ...
MALLOC(buf, struct foo_buf *, sizeof *buf, M_FOOBUF, M_NOWAIT);

Read other code, there are plenty of examples in the tree.

=2D-=20
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
"The nice thing about standards is that there
are so many of them to choose from."
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C

--nextPart1889844.n68iqsc57Q
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (FreeBSD)

iD8DBQBDU6ee5ZPcIHs/zowRAnuYAJ9GwEylrj8dC3y2wpxVWwXvnwGeuwCgh0L2
+iRcqEliPhd21JD6ENAZF7Y=
=KgSV
-----END PGP SIGNATURE-----

--nextPart1889844.n68iqsc57Q--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200510172301.10658.doconnor>