Add journaling restart support, required to produce a robust journaling
[dragonfly.git] / sys / vm / vm_zone.h
1 /*
2  * Copyright (c) 1997, 1998 John S. Dyson
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *      notice immediately at the beginning of the file, without modification,
10  *      this list of conditions, and the following disclaimer.
11  * 2. Absolutely no warranty of function or purpose is made by the author
12  *      John S. Dyson.
13  *
14  * $FreeBSD: src/sys/vm/vm_zone.h,v 1.13.2.2 2002/10/10 19:50:16 dillon Exp $
15  * $DragonFly: src/sys/vm/vm_zone.h,v 1.6 2004/10/26 04:33:11 dillon Exp $
16  */
17
18 #ifndef _SYS_ZONE_H
19
20 #define _SYS_ZONE_H
21
22 #define ZONE_INTERRUPT 0x0001   /* If you need to allocate at int time */
23 #define ZONE_PANICFAIL 0x0002   /* panic if the zalloc fails */
24 #define ZONE_SPECIAL   0x0004   /* special vm_map_entry zone, see zget() */
25 #define ZONE_BOOT      0x0010   /* Internal flag used by zbootinit */
26 #define ZONE_USE_RESERVE 0x0020 /* use reserve memory if necessary */
27
28 #ifndef _SYS_THREAD_H_
29 #include <sys/thread.h>
30 #endif
31
32 #include        <machine/lock.h>
33
34 typedef struct vm_zone {
35         struct lwkt_token zlock;        /* lock for data structure */
36         void            *zitems;        /* linked list of items */
37         int             zfreecnt;       /* free entries */
38         int             zfreemin;       /* minimum number of free entries */
39         int             znalloc;        /* number of allocations */
40         vm_offset_t     zkva;           /* Base kva of zone */
41         int             zpagecount;     /* Total # of allocated pages */
42         int             zpagemax;       /* Max address space */
43         int             zmax;           /* Max number of entries allocated */
44         int             ztotal;         /* Total entries allocated now */
45         int             zsize;          /* size of each entry */
46         int             zalloc;         /* hint for # of pages to alloc */
47         int             zflags;         /* flags for zone */
48         int             zallocflag;     /* flag for allocation */
49         struct vm_object *zobj;         /* object to hold zone */
50         char            *zname;         /* name for diags */
51         struct vm_zone  *znext;         /* list of zones for sysctl */
52 } *vm_zone_t;
53
54
55 void            zerror (int) __dead2;
56 vm_zone_t       zinit (char *name, int size, int nentries, int flags,
57                            int zalloc);
58 int             zinitna (vm_zone_t z, struct vm_object *obj, char *name,
59                              int size, int nentries, int flags, int zalloc);
60 void *          zalloc (vm_zone_t z);
61 void            zfree (vm_zone_t z, void *item);
62 void            zbootinit (vm_zone_t z, char *name, int size, void *item,
63                                int nitems);
64
65 #endif /* _SYS_ZONE_H */