aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2001-07-08 22:01:03 +0000
committerH. Peter Anvin <hpa@zytor.com>2001-07-08 22:01:03 +0000
commita5c4ef9ffa36590b5786e2983a95309a49b69bc3 (patch)
tree1c8131e392de745035d399b00733eedcc3743fd5
parent7be4b5ec6f20e3ffe13e2a574549e8028faba526 (diff)
downloadlpsm-a5c4ef9ffa36590b5786e2983a95309a49b69bc3.tar.gz
lpsm-a5c4ef9ffa36590b5786e2983a95309a49b69bc3.tar.xz
lpsm-a5c4ef9ffa36590b5786e2983a95309a49b69bc3.zip
Split the internals into a separate header file.
-rw-r--r--alloc.c2
-rw-r--r--arena.c2
-rw-r--r--internals.h56
-rw-r--r--lpsm.h40
4 files changed, 59 insertions, 41 deletions
diff --git a/alloc.c b/alloc.c
index 398ec2b..8736bed 100644
--- a/alloc.c
+++ b/alloc.c
@@ -24,8 +24,8 @@
#include <inttypes.h>
#include <limits.h>
-#define OBJSTORE_INTERNALS 1
#include "objstore.h"
+#include "internals.h"
#define OBJSTORE_ARENA_MAGIC 0xd8319f45
diff --git a/arena.c b/arena.c
index 60f9602..d7d3c1b 100644
--- a/arena.c
+++ b/arena.c
@@ -33,8 +33,8 @@
#include <sys/stat.h>
#include <sched.h>
-#define OBJSTORE_INTERNALS 1
#include "objstore.h"
+#include "internals.h"
enum page_status {
page_unread = 0,
diff --git a/internals.h b/internals.h
new file mode 100644
index 0000000..1ef7f35
--- /dev/null
+++ b/internals.h
@@ -0,0 +1,56 @@
+#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 General Public License as published by
+ * the Free Software Foundation, Inc., 675 Mass Ave, Cambridge MA 02139,
+ * USA; either version 2 of the License, or (at your option) any later
+ * version; incorporated herein by reference.
+ *
+ * ----------------------------------------------------------------------- */
+
+/*
+ * internals.h
+ *
+ * Internals for object store
+ */
+
+#ifndef OBJSTORE_INTERNALS_H
+#define OBJSTORE_INTERNALS_H
+
+#include "objstore.h" /* Main include file */
+#include "system.h" /* System-specific constants */
+
+struct ObjStore {
+ int main_fd; /* Primary file descriptor */
+ int log_fd; /* Log file descriptor */
+ int pagesize; /* Page size */
+ int pageshift; /* log2(pagesize) */
+ void *arena; /* Mapped memory zone */
+ size_t arena_len; /* Length of arena */
+ char *pageinfo; /* Page info pointer */
+ size_t loaded_count; /* Loaded pages count (accounting) */
+ size_t dirty_count; /* Dirty pages count (accounting) */
+ struct sigaction oldact; /* Previous signal action */
+ size_t fork_seq; /* Sequence number of forked processes */
+};
+
+enum ObjStore_RecordType {
+ osrec_page, /* Page data */
+ osrec_commit, /* Commit record */
+};
+
+#define LOGRECORD_MAGIC 0x9247746e
+
+struct ObjStore_LogRecord {
+ unsigned int magic; /* Magic number; for verification */
+ unsigned int record_type; /* Record */
+ size_t size; /* Data byte count (sequence # for commit) */
+ off_t offset; /* Offset of data */
+};
+
+extern struct ObjStore *objstore_os_struct;
+
+#endif
diff --git a/lpsm.h b/lpsm.h
index 6d80df6..b014b20 100644
--- a/lpsm.h
+++ b/lpsm.h
@@ -1,7 +1,7 @@
#ident "$Id$"
/* ----------------------------------------------------------------------- *
*
- * Copyright 2000 H. Peter Anvin - All Rights Reserved
+ * 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 General Public License as published by
@@ -24,46 +24,8 @@
#include <signal.h>
#include <inttypes.h>
-#ifdef OBJSTORE_INTERNALS
-
-#include "system.h" /* System-specific constants */
-
-struct ObjStore {
- int main_fd; /* Primary file descriptor */
- int log_fd; /* Log file descriptor */
- int pagesize; /* Page size */
- int pageshift; /* log2(pagesize) */
- void *arena; /* Mapped memory zone */
- size_t arena_len; /* Length of arena */
- char *pageinfo; /* Page info pointer */
- size_t loaded_count; /* Loaded pages count (accounting) */
- size_t dirty_count; /* Dirty pages count (accounting) */
- struct sigaction oldact; /* Previous signal action */
- size_t fork_seq; /* Sequence number of forked processes */
-};
-
-enum ObjStore_RecordType {
- osrec_page, /* Page data */
- osrec_commit, /* Commit record */
-};
-
-#define LOGRECORD_MAGIC 0x9247746e
-
-struct ObjStore_LogRecord {
- unsigned int magic; /* Magic number; for verification */
- unsigned int record_type; /* Record */
- size_t size; /* Data byte count (sequence # for commit) */
- off_t offset; /* Offset of data */
-};
-
-extern struct ObjStore *objstore_os_struct;
-
-#else /* not OBJSTORE_INTERNALS */
-
struct Objstore;
-#endif /* not OBJSTORE_INTERNALS */
-
void *objstore_init(char *main_file, char *log_file, size_t *arena_len);
int objstore_checkpoint(double gc_factor);
int objstore_extend(size_t new_size);