1 /*
2  * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
3  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
4  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
5  * IN NO EVENT SHALL ST BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
6  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
7  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
8  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
9  * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
10  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
11  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12  */
13 
14 /*
15 
16     Interface definitions for bget.c, the memory management package.
17 
18 */
19 
20 
21 #ifndef _
22 #ifdef PROTOTYPES
23 #define  _(x)  x		      /* If compiler knows prototypes */
24 #else
25 #define  _(x)  ()                     /* It it doesn't */
26 #endif /* PROTOTYPES */
27 #endif
28 
29 #define BGET_HDR_QUANTUM    (2 * sizeof(long))
30 
31 typedef long bufsize;
32 struct bpoolset;
33 
34 void	bpool	    _((void *buffer, bufsize len, struct bpoolset *poolset));
35 void   *bget	    _((bufsize align, bufsize hdr_size, bufsize size, struct bpoolset *poolset));
36 void   *bgetz	    _((bufsize align, bufsize hdr_size, bufsize size, struct bpoolset *poolset));
37 void   *bgetr	    _((void *buffer, bufsize align, bufsize hdr_size, bufsize newsize,
38 		       struct bpoolset *poolset));
39 void	brel	    _((void *buf, struct bpoolset *poolset, int wipe));
40 void	bectl	    _((int (*compact)(bufsize sizereq, int sequence),
41 		       void *(*acquire)(bufsize size),
42 		       void (*release)(void *buf), bufsize pool_incr,
43 		       struct bpoolset *poolset));
44 void	bstats	    _((bufsize *curalloc, bufsize *totfree, bufsize *maxfree,
45 		       long *nget, long *nrel, struct bpoolset *poolset));
46 void	bstatse     _((bufsize *pool_incr, long *npool, long *npget,
47 		       long *nprel, long *ndget, long *ndrel,
48 		       struct bpoolset *poolset));
49 void	bufdump     _((void *buf));
50 void	bpoold	    _((void *pool, int dumpalloc, int dumpfree));
51 int	bpoolv	    _((void *pool));
52 
53 #if !defined(__KERNEL__) && !defined(__LDELF__) && defined(CFG_TA_BGET_TEST)
54 int bget_main_test(void *(*malloc_func)(size_t), void (*free_func)(void *));
55 #endif
56