File: pool.h

package info (click to toggle)
skiboot 7.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 35,624 kB
  • sloc: ansic: 221,198; sh: 11,580; cpp: 5,767; python: 3,421; makefile: 1,773; asm: 1,503; perl: 1,479; tcl: 1,188; pascal: 107
file content (25 lines) | stat: -rw-r--r-- 610 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
/* Copyright 2014 IBM Corp. */

#ifndef __POOL_H
#define __POOL_H

#include <ccan/list/list.h>
#include <stddef.h>
#include <compiler.h>

struct pool {
	void *buf;
	size_t obj_size;
	struct list_head free_list;
	int free_count;
	int reserved;
};

enum pool_priority {POOL_NORMAL, POOL_HIGH};

void* pool_get(struct pool *pool, enum pool_priority priority) __warn_unused_result;
void pool_free_object(struct pool *pool, void *obj);
int pool_init(struct pool *pool, size_t obj_size, int count, int reserved) __warn_unused_result;

#endif /* __POOL_H */