1 | /* $Id: zone.h 98103 2023-01-17 14:15:46Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * NAT - this file is for sharing zone declaration with emu emulation and logging routines.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2023 Oracle and/or its affiliates.
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox base platform packages, as
|
---|
10 | * available from https://www.virtualbox.org.
|
---|
11 | *
|
---|
12 | * This program is free software; you can redistribute it and/or
|
---|
13 | * modify it under the terms of the GNU General Public License
|
---|
14 | * as published by the Free Software Foundation, in version 3 of the
|
---|
15 | * License.
|
---|
16 | *
|
---|
17 | * This program is distributed in the hope that it will be useful, but
|
---|
18 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
20 | * General Public License for more details.
|
---|
21 | *
|
---|
22 | * You should have received a copy of the GNU General Public License
|
---|
23 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
24 | *
|
---|
25 | * SPDX-License-Identifier: GPL-3.0-only
|
---|
26 | */
|
---|
27 |
|
---|
28 | #ifndef __ZONE_H__
|
---|
29 | # define __ZONE_H__
|
---|
30 |
|
---|
31 | # define ITEM_MAGIC 0xdead0001
|
---|
32 | struct item
|
---|
33 | {
|
---|
34 | uint32_t magic;
|
---|
35 | uma_zone_t zone;
|
---|
36 | uint32_t ref_count;
|
---|
37 | LIST_ENTRY(item) list;
|
---|
38 | };
|
---|
39 |
|
---|
40 | # define ZONE_MAGIC 0xdead0002
|
---|
41 | struct uma_zone
|
---|
42 | {
|
---|
43 | uint32_t magic;
|
---|
44 | PNATState pData; /* to minimize changes in the rest of UMA emulation code */
|
---|
45 | RTCRITSECT csZone;
|
---|
46 | const char *name;
|
---|
47 | size_t size; /* item size */
|
---|
48 | ctor_t pfCtor;
|
---|
49 | dtor_t pfDtor;
|
---|
50 | zinit_t pfInit;
|
---|
51 | zfini_t pfFini;
|
---|
52 | uma_alloc_t pfAlloc;
|
---|
53 | uma_free_t pfFree;
|
---|
54 | int max_items;
|
---|
55 | int cur_items;
|
---|
56 | LIST_HEAD(RT_NOTHING, item) used_items;
|
---|
57 | LIST_HEAD(RT_NOTHING, item) free_items;
|
---|
58 | uma_zone_t master_zone;
|
---|
59 | void *area;
|
---|
60 | /** Needs call pfnXmitPending when memory becomes available if @c true.
|
---|
61 | * @remarks Only applies to the master zone (master_zone == NULL) */
|
---|
62 | bool fDoXmitPending;
|
---|
63 | };
|
---|
64 | #endif
|
---|