1 #ifndef UFDT_NODE_POOL_H
2 #define UFDT_NODE_POOL_H
3 
4 /*
5  * Copyright (C) 2017 The Android Open Source Project
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19 
20 struct ufdt_node_pool_block_header;
21 
22 struct ufdt_node_pool {
23   /* A single linked list contains all blocks.
24      Blocks with one or more unused entries are in front;
25      blocks without unused entry are in rear. */
26   struct ufdt_node_pool_block_header *first_block;
27   struct ufdt_node_pool_block_header **last_block_ptr;
28 };
29 
30 void ufdt_node_pool_construct(struct ufdt_node_pool *pool);
31 void ufdt_node_pool_destruct(struct ufdt_node_pool *pool);
32 
33 void *ufdt_node_pool_alloc(struct ufdt_node_pool *pool);
34 void ufdt_node_pool_free(struct ufdt_node_pool *pool, void *node);
35 
36 #endif
37