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