diff options
author | Miles Bader <miles@gnu.org> | 1996-03-16 05:54:14 +0000 |
---|---|---|
committer | Miles Bader <miles@gnu.org> | 1996-03-16 05:54:14 +0000 |
commit | 2a8d867070cacea4a8f903f3cb43f139d188990b (patch) | |
tree | 5463538b25909b364f1a635b53d8ed7e02780401 /libstore | |
parent | 141d78969dea23b2a898a18f718d83af1ed269dd (diff) |
Formerly store.h.~7~
Diffstat (limited to 'libstore')
-rw-r--r-- | libstore/store.h | 45 |
1 files changed, 36 insertions, 9 deletions
diff --git a/libstore/store.h b/libstore/store.h index 35a65ef1..10416d49 100644 --- a/libstore/store.h +++ b/libstore/store.h @@ -41,7 +41,12 @@ struct store /* Address ranges in the underlying storage which make up our contiguous address space. In units of BLOCK_SIZE, below. */ off_t *runs; /* Malloced */ - size_t runs_len; + size_t runs_len; /* Length of RUNS. */ + off_t end; /* Maximum valid offset. */ + off_t wrap; /* If 0, no wrap, otherwise RUNS describes a + repeating pattern, of length WRAP -- each + successive iteration having an additional + offset of WRAP. */ /* Handles for the underlying storage. */ char *name; /* Malloced */ @@ -63,24 +68,29 @@ struct store void *misc; struct store_meths *meths; + + void *hook; /* Type specific noise. */ }; typedef error_t (*store_write_meth_t)(struct store *store, - off_t addr, + off_t addr, size_t index, char *buf, mach_msg_type_number_t len, mach_msg_type_number_t *amount); typedef error_t (*store_read_meth_t)(struct store *store, - off_t addr, mach_msg_type_number_t amount, + off_t addr, size_t index, + mach_msg_type_number_t amount, char **buf, mach_msg_type_number_t *len); struct store_meths { /* Read up to AMOUNT bytes at the underlying address ADDR from the storage - into BUF and LEN. */ + into BUF and LEN. INDEX varies from 0 to the number of runs in STORE. */ store_read_meth_t read; /* Write up to LEN bytes from BUF to the storage at the underlying address - ADDR. */ + ADDR. INDEX varies from 0 to the number of runs in STORE. */ store_write_meth_t write; + /* Called just before deallocating STORE. */ + void (*cleanup) (struct store *store); }; /* Return a new store in STORE, which refers to the storage underlying @@ -108,6 +118,23 @@ error_t _store_file_create (file_t file, size_t block_size, off_t *runs, size_t runs_len, struct store **store); +/* Return a new store in STORE that interleaves all the stores in STRIPES + (NUM_STRIPES of them) every INTERLEAVE blocks (every store in STRIPES must + have the same block size). If DEALLOC is true, then the striped stores + are freed when this store is (in any case, the array STRIPES is copied, + and so should be freed by the caller). */ +error_t store_ileave_create (struct store **stripes, size_t num_stripes, + int dealloc, + off_t interleave, struct store **store); + +/* Return a new store in STORE that concatenates all the stores in STORES + (NUM_STORES of them) every store in STRIPES must have the same block size. + If DEALLOC is true, then the sub-stores are freed when this store is (in + any case, the array STORES is copied, and so should be freed by the + caller). */ +error_t store_concat_create (struct store **stores, size_t num_stores, + int dealloc, struct store **store); + void store_free (struct store *store); /* Allocate a new store structure of class CLASS, with meths METHS, and the @@ -115,7 +142,7 @@ void store_free (struct store *store); 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); /* Set STORE's current runs list to (a copy of) RUNS and RUNS_LEN. */ error_t store_set_runs (struct store *store, off_t *runs, size_t runs_len); @@ -127,14 +154,14 @@ error_t store_set_name (struct store *store, char *name); the set of runs & the block size. */ void _store_derive (struct store *store); -/* Write LEN bytes from BUF to STORE at ADDR. Returns the amount written - in AMOUNT. ADDR is in BLOCKS (as defined by STORE->block_size). */ +/* Write LEN bytes from BUF to STORE at ADDR. Returns the amount written in + AMOUNT (in bytes). ADDR is in BLOCKS (as defined by STORE->block_size). */ error_t store_write (struct store *store, off_t addr, char *buf, size_t len, size_t *amount); /* Read AMOUNT bytes from STORE at ADDR into BUF & LEN (which following the usual mach buffer-return semantics) to STORE at ADDR. ADDR is in BLOCKS - (as defined by STORE->block_size). */ + (as defined by STORE->block_size). Note that LEN is in bytes. */ error_t store_read (struct store *store, off_t addr, size_t amount, char **buf, size_t *len); |