summaryrefslogtreecommitdiff
path: root/libhurd-mm/storage.h
diff options
context:
space:
mode:
authorneal <neal>2007-11-16 14:18:05 +0000
committerneal <neal>2007-11-16 14:18:05 +0000
commita4efc641a17b5ea8707c649a01b1985fa77046ea (patch)
treeafb02e6a85015c96102d30b8809edd433420991b /libhurd-mm/storage.h
parente46ff816c662bc8b47dfc00bbe5501dbeffd93bb (diff)
2007-11-16 Neal H. Walfield <neal@gnu.org>
* Makefile.am (includehurd_HEADERS): Remove vm.h. Add storage.h and as.h. (AM_CPPFLAGS): Rename from this... (COMMON_CPPFLAGS): ... to this. (libhurd_mm_a_SOURCES): Remove vm.h, vm.c, priv.h, store.c, map.c, memory.c, pager.c, core.c, anonymous.c, anonymous.h, physmem-user.h and physmem-user.c. Add capalloc.h, capalloc.c, storage.h, storage.c, as.h and mmap.c. * headers.m4: Don't link $(BUILDDIR)/include/hurd/vm.h to vm.h or $(BUILDDIR)/include/hurd/anonymous.h to anonymous.h. Link $(BUILDDIR)/include/hurd/as.h to as.h, $(BUILDDIR)/include/hurd/storage.h to storage.h, and $(BUILDDIR)/include/hurd/capalloc.h to libhurd-mm/capalloc.h. * mm-init.c: Rewrite. * mm.h: Likewise. * as.c: Likewise. * as.h: New file. * capalloc.h: Likewise. * capalloc.c: Likewise. * mmap.c: Likewise. * storage.h: Likewise. * storage.c: Likewise. * physmem-user.h: Remove file. * physmem-user.c: Remove file.
Diffstat (limited to 'libhurd-mm/storage.h')
-rw-r--r--libhurd-mm/storage.h64
1 files changed, 64 insertions, 0 deletions
diff --git a/libhurd-mm/storage.h b/libhurd-mm/storage.h
new file mode 100644
index 0000000..f4d27a1
--- /dev/null
+++ b/libhurd-mm/storage.h
@@ -0,0 +1,64 @@
+/* storage.h - Storage allocation functions.
+ Copyright (C) 2007 Free Software Foundation, Inc.
+ Written by Neal H. Walfield <neal@gnu.org>.
+
+ This file is part of the GNU Hurd.
+
+ The GNU Hurd is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU Hurd is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _HURD_STORAGE_H
+#define _HURD_STORAGE_H
+
+#include <hurd/addr.h>
+#include <hurd/cap.h>
+
+enum storage_expectancy
+ {
+ /* Storage with an unknown life expectancy. */
+ STORAGE_UNKNOWN = 0,
+ /* Storage that is likely to be deallocated quickly (seconds to a
+ couple of minutes). */
+ STORAGE_EPHEMERAL,
+ /* Storage that is likely to be deallocated at some time, but
+ program will continue running much longer. */
+ STORAGE_MEDIUM_LIVED,
+ /* Storage with an expected long-life (storage will most likely
+ not be deallocated). */
+ STORAGE_LONG_LIVED,
+ };
+
+/* Allocate an object of type TYPE. The object has a life expectancy
+ of EXPECTANCY. If ADDR is not ADDR_VOID, a capability to the
+ storage will be saved at ADDR. On success, the address of the
+ storage object is returned. Otherwise, ADDR_VOID. ACTIVITY is the
+ activity to use to account the memory. */
+extern addr_t storage_alloc (addr_t activity,
+ enum cap_type type,
+ enum storage_expectancy expectancy,
+ addr_t addr);
+
+/* Frees the storage at STORAGE. STORAGE must be the address returned
+ by storage_alloc (NOT the address provided to storage_alloc). If
+ UNMAP_NOW is not true, revoking the storage may be delayed. */
+extern void storage_free (addr_t storage, bool unmap_now);
+
+/* Initialize the storage sub-system. */
+extern void storage_init (void);
+
+/* Used by as_init to initialize a folio's shadow object. */
+extern void storage_shadow_setup (struct cap *cap, addr_t folio);
+
+#endif /* _HURD_STORAGE_H */