#ident "$Id$" /* ----------------------------------------------------------------------- * * * Copyright 2000-2001 H. Peter Anvin - All Rights Reserved * * This program 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, Inc., * 59 Temple Place Ste 330, Boston MA 02111-1307, USA, version 2.1, * incorporated herein by reference. * * ----------------------------------------------------------------------- */ /* * lpsm.h * * Public header file for the Linux Persistent Memory */ #ifndef LPSM_H #define LPSM_H #include #include #include #include #ifdef __cplusplus extern "C" { #endif /* Low-level core routines */ /* When checkpointing, specify the level of synchronicity required */ enum psmsync { PSMSYNC_NONE, /* No synchronicity */ PSMSYNC_SKIP, /* Skip if previous writeback still running */ PSMSYNC_WAIT, /* Wait if previous writeback still running */ PSMSYNC_SYNC /* Wait until this writeback finishes */ }; void *lpsm_arena_init(const char *, const char *, size_t *, void *); pid_t lpsm_checkpoint(double, enum psmsync); int lpsm_extend(size_t); void lpsm_shutdown(void); int lpsm_recover(const char *, const char *); extern sig_atomic_t lpsm_need_checkpoint; /* Arena management routines */ /* The allocator gives us this many "root pointers" for our own use. They are initialized to NULL when a new arena is created, and are intended to be used to find all the data structures. lpsm_arena_init() returns a pointer to this array (if successful). */ #define LPSM_ROOT_POINTERS 32 void **lpsm_init(const char *, const char *); void *lpsm_malloc(size_t); void lpsm_free(void *); void *lpsm_realloc(void *, size_t); struct lpsm_alloc_stats { size_t size; size_t free; size_t alloc; }; void *lpsm_zalloc(size_t); #ifdef __GNUC__ extern inline void *lpsm_calloc(size_t __nmemb, size_t __size) { return lpsm_zalloc(__nmemb * __size); } #else #define lpsm_calloc(__nmemb, __size) lpsm_zalloc((size_t)(__nmemb)*(size_t)(__size)) #endif struct lpsm_alloc_stats *lpsm_alloc_stats(void); #ifdef __cplusplus } #endif #endif /* LPSM_H */