summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>1996-03-16 02:13:40 +0000
committerMiles Bader <miles@gnu.org>1996-03-16 02:13:40 +0000
commit3f2a6e1461c0bf87d684b1bf0a4e4345f1b3c3de (patch)
tree63ad8ceb6134c87b0f02628d2114588e0fca0f4e
parent9654dbe0a3569c9a991b6eb37a61b858e7d2df6e (diff)
Formerly make.c.~4~
-rw-r--r--libstore/make.c49
1 files changed, 30 insertions, 19 deletions
diff --git a/libstore/make.c b/libstore/make.c
index fe951527..e5073607 100644
--- a/libstore/make.c
+++ b/libstore/make.c
@@ -29,36 +29,47 @@
struct store *
_make_store (enum file_storage_class class, struct store_meths *meths,
mach_port_t port, size_t block_size,
- off_t *runs, size_t runs_len)
+ off_t *runs, size_t runs_len, off_t end)
{
- struct store *store = malloc (sizeof (struct store));
- if (store)
+ if (block_size & (block_size - 1))
+ return 0; /* block size not a power of two. */
+ else
{
- store->name = 0;
- store->port = port;
- store->runs = 0;
- store->runs_len = 0;
- store->block_size = block_size;
- store->source = MACH_PORT_NULL;
- store->blocks = 0;
- store->size = 0;
- store->log2_block_size = 0;
- store->log2_blocks_per_page = 0;
+ struct store *store = malloc (sizeof (struct store));
+ if (store)
+ {
+ store->name = 0;
+ store->port = port;
+ store->runs = 0;
+ store->runs_len = 0;
+ store->wrap = 0;
+ store->end = end;
+ store->block_size = block_size;
+ store->source = MACH_PORT_NULL;
+ store->blocks = 0;
+ store->size = 0;
+ store->log2_block_size = 0;
+ store->log2_blocks_per_page = 0;
+ store->misc = 0;
+ store->hook = 0;
- store->class = class;
- store->meths = meths;
+ store->class = class;
+ store->meths = meths;
- store_set_runs (store, runs, runs_len); /* Also calls _store_derive(). */
+ store_set_runs (store, runs, runs_len); /* Calls _store_derive() */
+ }
+ return store;
}
- return store;
}
void
store_free (struct store *store)
{
- if (store->port)
+ if (store->meths->cleanup)
+ (*store->meths->cleanup) (store);
+ if (store->port != MACH_PORT_NULL)
mach_port_deallocate (mach_task_self (), store->port);
- if (store->source)
+ if (store->source != MACH_PORT_NULL)
mach_port_deallocate (mach_task_self (), store->source);
if (store->name)
free (store->name);