loader: remove shouting from ORB's variable name
[hvf.git] / cp / include / spool.h
blob8be15c4bce8ae03f347437dff2f025c3a83f8bf8
1 /*
2 * (C) Copyright 2007-2011 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
4 * This file is released under the GPLv2. See the COPYING file for more
5 * details.
6 */
8 #ifndef __SPOOL_H
9 #define __SPOOL_H
11 #include <list.h>
12 #include <mutex.h>
14 struct spool_rec {
15 u16 len;
16 u8 data[0];
19 #define SPOOL_DATA_SIZE (PAGE_SIZE - sizeof(struct list_head))
20 struct spool_page {
21 struct list_head list;
22 u8 data[SPOOL_DATA_SIZE];
25 struct spool_file {
26 mutex_t lock;
27 struct list_head list;
28 u64 recs;
29 u64 pages;
30 u16 frecoff; /* start of the first record,
31 offset into first page's data */
32 u16 lrecoff; /* end of the last record,
33 offset into last page's data */
36 extern struct spool_file *alloc_spool();
37 extern void free_spool(struct spool_file *f);
38 extern u64 spool_nrecs(struct spool_file *f);
39 extern int spool_grab_rec(struct spool_file *f, u8 *buf, u16 *len);
40 extern int spool_append_rec(struct spool_file *f, u8 *buf, u16 len);
42 #endif