1 /* $NetBSD: chfs_pool.h,v 1.1 2011/11/24 15:51:31 ahoka Exp $ */
4 * Copyright (c) 2010 Department of Software Engineering,
5 * University of Szeged, Hungary
8 * This code is derived from software contributed to The NetBSD Foundation
9 * by the Department of Software Engineering, University of Szeged, Hungary
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
20 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
21 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
22 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
24 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
25 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
26 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
27 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 #ifndef _FS_CHFS_CHFS_POOL_H_
34 #define _FS_CHFS_CHFS_POOL_H_
37 /* --------------------------------------------------------------------- */
41 struct chfs_mount
* chp_mount
;
45 /* --------------------------------------------------------------------- */
47 struct chfs_str_pool
{
48 struct chfs_pool chsp_pool_16
;
49 struct chfs_pool chsp_pool_32
;
50 struct chfs_pool chsp_pool_64
;
51 struct chfs_pool chsp_pool_128
;
52 struct chfs_pool chsp_pool_256
;
53 struct chfs_pool chsp_pool_512
;
54 struct chfs_pool chsp_pool_1024
;
57 /* --------------------------------------------------------------------- */
61 * Convenience functions and macros to manipulate a chfs_pool.
64 void chfs_pool_init(struct chfs_pool
*chpp
, size_t size
,
65 const char *what
, struct chfs_mount
*chmp
);
66 void chfs_pool_destroy(struct chfs_pool
*chpp
);
68 #define CHFS_POOL_GET(chpp, flags) pool_get((struct pool *)(chpp), flags)
69 #define CHFS_POOL_PUT(chpp, v) pool_put((struct pool *)(chpp), v)
71 /* --------------------------------------------------------------------- */
74 * Functions to manipulate a chfs_str_pool.
77 void chfs_str_pool_init(struct chfs_str_pool
*, struct chfs_mount
*);
78 void chfs_str_pool_destroy(struct chfs_str_pool
*);
79 char * chfs_str_pool_get(struct chfs_str_pool
*, size_t, int);
80 void chfs_str_pool_put(struct chfs_str_pool
*, char *, size_t);
84 #endif /* _FS_CHFS_CHFS_POOL_H_ */