1/*	$NetBSD$	*/
2
3/*-
4 * Copyright (c) 2010 Department of Software Engineering,
5 *		      University of Szeged, Hungary
6 * All rights reserved.
7 *
8 * This code is derived from software contributed to The NetBSD Foundation
9 * by the Department of Software Engineering, University of Szeged, Hungary
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
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.
19 *
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
30 * SUCH DAMAGE.
31 */
32
33#ifndef _FS_CHFS_CHFS_POOL_H_
34#define _FS_CHFS_CHFS_POOL_H_
35
36
37/* --------------------------------------------------------------------- */
38
39struct chfs_pool {
40	struct pool		chp_pool;
41	struct chfs_mount *	chp_mount;
42	char			chp_name[64];
43};
44
45/* --------------------------------------------------------------------- */
46
47struct 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;
55};
56
57/* --------------------------------------------------------------------- */
58#ifdef _KERNEL
59
60/*
61 * Convenience functions and macros to manipulate a chfs_pool.
62 */
63
64void	chfs_pool_init(struct chfs_pool *chpp, size_t size,
65    const char *what, struct chfs_mount *chmp);
66void	chfs_pool_destroy(struct chfs_pool *chpp);
67
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)
70
71/* --------------------------------------------------------------------- */
72
73/*
74 * Functions to manipulate a chfs_str_pool.
75 */
76
77void	chfs_str_pool_init(struct chfs_str_pool *, struct chfs_mount *);
78void	chfs_str_pool_destroy(struct chfs_str_pool *);
79char *	chfs_str_pool_get(struct chfs_str_pool *, size_t, int);
80void	chfs_str_pool_put(struct chfs_str_pool *, char *, size_t);
81
82#endif
83
84#endif /* _FS_CHFS_CHFS_POOL_H_ */
85