X-Git-Url: https://git.distorted.org.uk/u/mdw/catacomb/blobdiff_plain/47d5f7c2e72bdc2cc06414e1c07b27760974e2ca..c97fbcf9622edc35b594bf574f553f7f13c21164:/lmem.h diff --git a/lmem.h b/lmem.h index 8f24903..65a31a8 100644 --- a/lmem.h +++ b/lmem.h @@ -1,13 +1,13 @@ /* -*-c-*- * - * $Id: lmem.h,v 1.2 2000/06/17 11:29:38 mdw Exp $ + * $Id: lmem.h,v 1.5 2004/04/08 01:36:15 mdw Exp $ * * Locked memory allocation * * (c) 1999 Straylight/Edgeware */ -/*----- Licensing notice --------------------------------------------------* +/*----- Licensing notice --------------------------------------------------* * * This file is part of Catacomb. * @@ -15,29 +15,18 @@ * it under the terms of the GNU Library General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. - * + * * Catacomb is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. - * + * * You should have received a copy of the GNU Library General Public * License along with Catacomb; if not, write to the Free * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, * MA 02111-1307, USA. */ -/*----- Revision history --------------------------------------------------* - * - * $Log: lmem.h,v $ - * Revision 1.2 2000/06/17 11:29:38 mdw - * Add arena support. - * - * Revision 1.1 1999/12/22 16:02:52 mdw - * Interface to allocating `locked' memory (which isn't paged out). - * - */ - #ifndef CATACOMB_LMEM_H #define CATACOMB_LMEM_H @@ -69,14 +58,13 @@ typedef struct l_node { unsigned f; /* Various flags */ } l_node; -enum { - LF_ALLOC = 1 -}; +#define LF_ALLOC 1u /* --- Locked memory buffer state --- */ typedef struct lmem { arena a; /* Arena header block */ + unsigned f; /* Various flags */ char *p; /* Pointer to locked buffer */ l_node *l; /* Pointer to block list */ size_t sz; /* Size of locked buffer */ @@ -84,12 +72,7 @@ typedef struct lmem { int err; char *emsg; /* Error indicators */ } lmem; -/* --- Locked memory arena --- */ - -typedef struct lmem_arena { - arena a; - lmem l; -} lmem_arena; +#define LF_LOCKED 1u /*----- Functions provided ------------------------------------------------*/ @@ -147,6 +130,17 @@ extern void l_free(lmem */*lm*/, void */*p*/); extern void l_purge(lmem */*lm*/); +/* --- @l_destroy@ --- * + * + * Arguments: @lmem *lm@ = pointer to locked memory descriptor + * + * Returns: --- + * + * Use: Disposes of a locked memory arena permanently. + */ + +extern void l_destroy(lmem */*lm*/); + /* --- @l_report@ --- * * * Arguments: @lmem *lm@ = pointer to locked memory descriptor @@ -163,19 +157,6 @@ extern void l_purge(lmem */*lm*/); extern int l_report(lmem */*lm*/, dstr */*d*/); -/*----- Arena management --------------------------------------------------*/ - -/* --- @l_arena@ --- * - * - * Arguments: @lmem_arena *l@ = pointer to arena block - * - * Returns: --- - * - * Use: Initializes a locked-memory arena. - */ - -extern void l_arena(lmem_arena */*l*/); - /*----- That's all, folks -------------------------------------------------*/ #ifdef __cplusplus