summaryrefslogtreecommitdiff
path: root/libstore
diff options
context:
space:
mode:
authorMarcus Brinkmann <marcus@gnu.org>2001-01-08 22:33:11 +0000
committerMarcus Brinkmann <marcus@gnu.org>2001-01-08 22:33:11 +0000
commitda2495949dfd41675ac36a62ad9034d6bed8b618 (patch)
tree5baeb61430ac310af949ac23c7d34c0058d8767e /libstore
parent5cb8c15669c5ac51b5aa9e33671fef7dcc0916b5 (diff)
doc/
2001-01-08 Marcus Brinkmann <marcus@gnu.org> * hurd.texi (Store Management): Replace off_t with store_offset_t. (Store I/O): Likewise. (Store Classes): Likewise. ext2fs/ 2001-01-08 Marcus Brinkmann <marcus@gnu.org> * ext2fs.c (main): Use %Ld instead %ld to print store->size. * hyper.c (get_hypermetadata): Likewise. libstore/ 2001-01-08 Marcus Brinkmann <marcus@gnu.org> * zero.c (zero_remap): Change type of variables length, old_length to store_offset_t. (zero_decode): Change type of variable size to store_offset_t. (zero_open): Likewise. Use strtoull instead strtoul to parse size argument from name. Use store_offset_t for max_offs and its calculation. (store_zero_create): Use store_offset_t type for size argument. * derive.c (_store_derive): Use store_offset_t as type for variable last_part_base. * stripe.c (addr_adj): Change types of addr argument and return value to store_offset_t. (store_ileave_create): Change type of interleave argument and variables min_end and end to store_offset_t, but type of variable block_size to size_t. (store_concat_create): Change type of variable block_size to size_t. * make.c (_store_create): Change end argument type to store_offset_t. * store.h: New type store_offset_t, define to off64_t. (struct store_run): Change type of start and length to store_offset_t. (struct store): Change type of end, wrap_src, wrap_dst, blocks, size to store_offset_t. Change type of addr arg in store_read_meth_t and store_write_meth_t to store_offset_t, as well as in declarations for store_read and store_write. Change type of argument end in _store_create declaration to store_offset_t. Change type of argument size in store_zero_create to store_offset_t. Change type of argument interleace in store_ileace_create to store_offset_t. * rdwr.c (store_find_first_run): Change type of return value, addr and *base arguments, and variables wrap_src and run_blocks to store_offset_t. (store_next_run): Change type of *base argument to store_offset_t. (store_write): Change type of addr argument and variable base to store_offset_t. (store_read): Likewise, also for addr argument of local function seg_read. Change type of len argument to size_t. * copy.c (copy_read): Change type of addr argument to store_offset_t. (copy_write): Likewise. * device.c (dev_read): Likewise. (dev_write): Likewise. * file.c (file_read): Likewise. (file_write): Likewise. (file_byte_read): Likewise. (file_byte_write): Likewise. * mvol.c (mvol_read): Likewise. (mvol_write): Likewise. * remap.c (remap_read): Likewise. (remap_write): Likewise. * stripe.c (stripe_read): Likewise. (stripe_write): Likewise. * task.c (task_read): Likewise. (task_write): Likewise. * zero.c (zero_read): Likewise. (zero_write): Likewise. * remap.c (store_remap_runs): Change type of addr and len arguments of local function add_run and of local variables addr, length, baddr, blen and len to store_offset_t. (remap_open): Cast -1 to store_offset_t, not off_t. * argp.c (struct store_parsed): Change type of interleave from off_t to store_offset_t. (store_parsed_append_args): Use %Ld instead %ld to print interleave value. (store_parsed_name): Likewise. ufs/ 2001-01-08 Marcus Brinkmann <marcus@gnu.org> * main.c (main): Use %Ld instead %ld to print store->size. * hyper.c (get_hypermetadata): Likewise. * inode.c (diskfs_S_file_get_storage_info): Change type of variables start and length from off_t to store_offset_t. utils/ 2001-01-08 Marcus Brinkmann <marcus@gnu.org> * storeread.c (main): Change type of addr to store_offset_t, also for first argument of local function dump. Add comment about store->size as len parameter for store_read. Use atoll instead atoi for addr argument. * storeinfo.c (print_store): Remove local function pint, add two similar functions psiz and poff, accepting and printing a size_t or store_offset_t respectively. Use psiz to print block_size, poff to print blocks and size of store. Use %Ld instead %ld to print runs. * storecat.c (main): Change type of addr and left to store_offset_t.
Diffstat (limited to 'libstore')
-rw-r--r--libstore/ChangeLog76
-rw-r--r--libstore/argp.c6
-rw-r--r--libstore/copy.c4
-rw-r--r--libstore/derive.c2
-rw-r--r--libstore/device.c4
-rw-r--r--libstore/file.c10
-rw-r--r--libstore/make.c4
-rw-r--r--libstore/mvol.c4
-rw-r--r--libstore/rdwr.c22
-rw-r--r--libstore/remap.c18
-rw-r--r--libstore/store.h30
-rw-r--r--libstore/stripe.c18
-rw-r--r--libstore/task.c4
-rw-r--r--libstore/zero.c17
14 files changed, 153 insertions, 66 deletions
diff --git a/libstore/ChangeLog b/libstore/ChangeLog
index fe1405fc..4b1fd92b 100644
--- a/libstore/ChangeLog
+++ b/libstore/ChangeLog
@@ -1,3 +1,79 @@
+2001-01-08 Marcus Brinkmann <marcus@gnu.org>
+
+ * zero.c (zero_remap): Change type of variables length, old_length
+ to store_offset_t.
+ (zero_decode): Change type of variable size to store_offset_t.
+ (zero_open): Likewise. Use strtoull instead strtoul to parse
+ size argument from name. Use store_offset_t for max_offs and
+ its calculation.
+ (store_zero_create): Use store_offset_t type for size argument.
+
+ * derive.c (_store_derive): Use store_offset_t as type for
+ variable last_part_base.
+
+ * stripe.c (addr_adj): Change types of addr argument and return
+ value to store_offset_t.
+ (store_ileave_create): Change type of interleave argument and
+ variables min_end and end to store_offset_t, but type of variable
+ block_size to size_t.
+ (store_concat_create): Change type of variable block_size to
+ size_t.
+
+ * make.c (_store_create): Change end argument type to store_offset_t.
+
+ * store.h: New type store_offset_t, define to off64_t.
+ (struct store_run): Change type of start and length to
+ store_offset_t.
+ (struct store): Change type of end, wrap_src, wrap_dst, blocks,
+ size to store_offset_t.
+ Change type of addr arg in store_read_meth_t and
+ store_write_meth_t to store_offset_t, as well as in declarations
+ for store_read and store_write.
+ Change type of argument end in _store_create declaration to
+ store_offset_t.
+ Change type of argument size in store_zero_create to
+ store_offset_t. Change type of argument interleace in
+ store_ileace_create to store_offset_t.
+
+ * rdwr.c (store_find_first_run): Change type of return value, addr
+ and *base arguments, and variables wrap_src and run_blocks to
+ store_offset_t.
+ (store_next_run): Change type of *base argument to store_offset_t.
+ (store_write): Change type of addr argument and variable base to
+ store_offset_t.
+ (store_read): Likewise, also for addr argument of local function seg_read.
+ Change type of len argument to size_t.
+
+ * copy.c (copy_read): Change type of addr argument to store_offset_t.
+ (copy_write): Likewise.
+ * device.c (dev_read): Likewise.
+ (dev_write): Likewise.
+ * file.c (file_read): Likewise.
+ (file_write): Likewise.
+ (file_byte_read): Likewise.
+ (file_byte_write): Likewise.
+ * mvol.c (mvol_read): Likewise.
+ (mvol_write): Likewise.
+ * remap.c (remap_read): Likewise.
+ (remap_write): Likewise.
+ * stripe.c (stripe_read): Likewise.
+ (stripe_write): Likewise.
+ * task.c (task_read): Likewise.
+ (task_write): Likewise.
+ * zero.c (zero_read): Likewise.
+ (zero_write): Likewise.
+
+ * remap.c (store_remap_runs): Change type of addr and len
+ arguments of local function add_run and of local variables addr,
+ length, baddr, blen and len to store_offset_t.
+ (remap_open): Cast -1 to store_offset_t, not off_t.
+
+ * argp.c (struct store_parsed): Change type of interleave from
+ off_t to store_offset_t.
+ (store_parsed_append_args): Use %Ld instead %ld to print
+ interleave value.
+ (store_parsed_name): Likewise.
+
2001-01-07 Marcus Brinkmann <marcus@gnu.org>
* copy.c: Include <mach.h>. New macro page_aligned.
diff --git a/libstore/argp.c b/libstore/argp.c
index 97640e19..1ebd32a2 100644
--- a/libstore/argp.c
+++ b/libstore/argp.c
@@ -59,7 +59,7 @@ struct store_parsed
/* DEFAULT_TYPE field passed to parser. */
const struct store_class *default_type;
- off_t interleave; /* --interleave value */
+ store_offset_t interleave; /* --interleave value */
int layer : 1; /* --layer specified */
};
@@ -85,7 +85,7 @@ store_parsed_append_args (const struct store_parsed *parsed,
if (!err && num_names > 1 && (parsed->interleave || parsed->layer))
{
if (parsed->interleave)
- snprintf (buf, sizeof buf, "--interleave=%ld", parsed->interleave);
+ snprintf (buf, sizeof buf, "--interleave=%Ld", parsed->interleave);
else
snprintf (buf, sizeof buf, "--layer=%d", parsed->layer);
err = argz_add (args, args_len, buf);
@@ -128,7 +128,7 @@ store_parsed_name (const struct store_parsed *parsed, char **name)
{
if (parsed->interleave)
{
- snprintf (buf, sizeof buf, "interleave(%ld,", parsed->interleave);
+ snprintf (buf, sizeof buf, "interleave(%Ld,", parsed->interleave);
pfx = buf;
}
else if (parsed->layer)
diff --git a/libstore/copy.c b/libstore/copy.c
index 6a4d0d5a..25ea1259 100644
--- a/libstore/copy.c
+++ b/libstore/copy.c
@@ -32,7 +32,7 @@
static error_t
copy_read (struct store *store,
- off_t addr, size_t index, size_t amount, void **buf, size_t *len)
+ store_offset_t addr, size_t index, size_t amount, void **buf, size_t *len)
{
char *data = store->hook + (addr * store->block_size);
@@ -59,7 +59,7 @@ copy_read (struct store *store,
static error_t
copy_write (struct store *store,
- off_t addr, size_t index, void *buf, size_t len, size_t *amount)
+ store_offset_t addr, size_t index, void *buf, size_t len, size_t *amount)
{
char *data = store->hook + (addr * store->block_size);
diff --git a/libstore/derive.c b/libstore/derive.c
index 8c0b2790..41bcbaca 100644
--- a/libstore/derive.c
+++ b/libstore/derive.c
@@ -50,7 +50,7 @@ _store_derive (struct store *store)
to include all iterations. */
{
size_t num_iters = store->end / store->wrap_src;
- off_t last_part_base = num_iters * store->wrap_src;
+ store_offset_t last_part_base = num_iters * store->wrap_src;
store->blocks *= num_iters;
diff --git a/libstore/device.c b/libstore/device.c
index 986ca25b..ac7555f6 100644
--- a/libstore/device.c
+++ b/libstore/device.c
@@ -48,7 +48,7 @@ dev_error (error_t err)
static error_t
dev_read (struct store *store,
- off_t addr, size_t index, mach_msg_type_number_t amount,
+ store_offset_t addr, size_t index, mach_msg_type_number_t amount,
void **buf, mach_msg_type_number_t *len)
{
return dev_error (device_read (store->port, 0, addr, amount,
@@ -57,7 +57,7 @@ dev_read (struct store *store,
static error_t
dev_write (struct store *store,
- off_t addr, size_t index, void *buf, mach_msg_type_number_t len,
+ store_offset_t addr, size_t index, void *buf, mach_msg_type_number_t len,
mach_msg_type_number_t *amount)
{
return dev_error (device_write (store->port, 0, addr,
diff --git a/libstore/file.c b/libstore/file.c
index e952a91e..4f9a1b6e 100644
--- a/libstore/file.c
+++ b/libstore/file.c
@@ -29,7 +29,8 @@
static error_t
file_read (struct store *store,
- off_t addr, size_t index, size_t amount, void **buf, size_t *len)
+ store_offset_t addr, size_t index, size_t amount, void **buf,
+ size_t *len)
{
size_t bsize = store->block_size;
return io_read (store->port, (char **)buf, len, addr * bsize, amount);
@@ -37,7 +38,8 @@ file_read (struct store *store,
static error_t
file_write (struct store *store,
- off_t addr, size_t index, void *buf, size_t len, size_t *amount)
+ store_offset_t addr, size_t index, void *buf, size_t len,
+ size_t *amount)
{
size_t bsize = store->block_size;
return io_write (store->port, buf, len, addr * bsize, amount);
@@ -197,7 +199,7 @@ store_file_class =
static error_t
file_byte_read (struct store *store,
- off_t addr, size_t index, size_t amount,
+ store_offset_t addr, size_t index, size_t amount,
void **buf, size_t *len)
{
return io_read (store->port, (char **)buf, len, addr, amount);
@@ -205,7 +207,7 @@ file_byte_read (struct store *store,
static error_t
file_byte_write (struct store *store,
- off_t addr, size_t index, void *buf, size_t len,
+ store_offset_t addr, size_t index, void *buf, size_t len,
size_t *amount)
{
return io_write (store->port, buf, len, addr, amount);
diff --git a/libstore/make.c b/libstore/make.c
index ed476ba4..8f289533 100644
--- a/libstore/make.c
+++ b/libstore/make.c
@@ -27,8 +27,8 @@
error_t
_store_create (const struct store_class *class,
mach_port_t port, int flags, size_t block_size,
- const struct store_run *runs, size_t num_runs, off_t end,
- struct store **store)
+ const struct store_run *runs, size_t num_runs,
+ store_offset_t end, struct store **store)
{
if ((block_size & (block_size - 1)) || (block_size == 0 && num_runs > 0))
return EINVAL; /* block size not a power of two. */
diff --git a/libstore/mvol.c b/libstore/mvol.c
index b0753dac..18eacf40 100644
--- a/libstore/mvol.c
+++ b/libstore/mvol.c
@@ -50,7 +50,7 @@ ensure_vol (struct store *store, size_t vol)
static error_t
mvol_read (struct store *store,
- off_t addr, size_t index, size_t amount,
+ store_offset_t addr, size_t index, size_t amount,
void **buf, size_t *len)
{
error_t err = ensure_vol (store, index);
@@ -61,7 +61,7 @@ mvol_read (struct store *store,
static error_t
mvol_write (struct store *store,
- off_t addr, size_t index, void *buf, size_t len,
+ store_offset_t addr, size_t index, void *buf, size_t len,
size_t *amount)
{
error_t err = ensure_vol (store, index);
diff --git a/libstore/rdwr.c b/libstore/rdwr.c
index 85d2ba2b..e79f56a2 100644
--- a/libstore/rdwr.c
+++ b/libstore/rdwr.c
@@ -27,13 +27,13 @@
ADDR, and is not a hole, and in RUNS_END a pointer pointing at the end of
the run list. Returns the offset within it at which ADDR occurs. Also
returns BASE, which should be added to offsets from RUNS. */
-static inline off_t
-store_find_first_run (struct store *store, off_t addr,
+static inline store_offset_t
+store_find_first_run (struct store *store, store_offset_t addr,
struct store_run **run, struct store_run **runs_end,
- off_t *base, size_t *index)
+ store_offset_t *base, size_t *index)
{
struct store_run *tail = store->runs, *tail_end = tail + store->num_runs;
- off_t wrap_src = store->wrap_src;
+ store_offset_t wrap_src = store->wrap_src;
if (addr >= wrap_src && addr < store->end)
/* Locate the correct position within a repeating pattern of runs. */
@@ -49,7 +49,7 @@ store_find_first_run (struct store *store, off_t addr,
binary search or something. */
while (tail < tail_end)
{
- off_t run_blocks = tail->length;
+ store_offset_t run_blocks = tail->length;
if (run_blocks > addr)
{
@@ -72,7 +72,7 @@ store_find_first_run (struct store *store, off_t addr,
things are still kosher. */
static inline int
store_next_run (struct store *store, struct store_run *runs_end,
- struct store_run **run, off_t *base, size_t *index)
+ struct store_run **run, store_offset_t *base, size_t *index)
{
(*run)++;
(*index)++;
@@ -95,11 +95,11 @@ store_next_run (struct store *store, struct store_run *runs_end,
in AMOUNT. ADDR is in BLOCKS (as defined by STORE->block_size). */
error_t
store_write (struct store *store,
- off_t addr, void *buf, size_t len, size_t *amount)
+ store_offset_t addr, void *buf, size_t len, size_t *amount)
{
error_t err;
size_t index;
- off_t base;
+ store_offset_t base;
struct store_run *run, *runs_end;
int block_shift = store->log2_block_size;
store_write_meth_t write = store->class->write;
@@ -172,10 +172,10 @@ store_write (struct store *store,
(as defined by STORE->block_size). */
error_t
store_read (struct store *store,
- off_t addr, size_t amount, void **buf, size_t *len)
+ store_offset_t addr, size_t amount, void **buf, size_t *len)
{
size_t index;
- off_t base;
+ store_offset_t base;
struct store_run *run, *runs_end;
int block_shift = store->log2_block_size;
store_read_meth_t read = store->class->read;
@@ -204,7 +204,7 @@ store_read (struct store *store,
/* Read LEN bytes from the store address ADDR into BUF_END. BUF_END
and AMOUNT are adjusted by the amount actually read. Whether or not
the amount read is the same as what was request is returned in ALL. */
- inline error_t seg_read (off_t addr, off_t len, int *all)
+ inline error_t seg_read (store_offset_t addr, size_t len, int *all)
{
/* SEG_BUF and SEG_LEN are the buffer for a particular bit of the
whole (within one run). */
diff --git a/libstore/remap.c b/libstore/remap.c
index e1965ea5..6dd104e8 100644
--- a/libstore/remap.c
+++ b/libstore/remap.c
@@ -27,7 +27,7 @@
static error_t
remap_read (struct store *store,
- off_t addr, size_t index, size_t amount,
+ store_offset_t addr, size_t index, size_t amount,
void **buf, size_t *len)
{
return store_read (store->children[0], addr, amount, buf, len);
@@ -35,7 +35,7 @@ remap_read (struct store *store,
static error_t
remap_write (struct store *store,
- off_t addr, size_t index, void *buf, size_t len,
+ store_offset_t addr, size_t index, void *buf, size_t len,
size_t *amount)
{
return store_write (store->children[0], addr, buf, len, amount);
@@ -120,7 +120,7 @@ remap_open (const char *name, int flags,
/* Syntax "100+" means block 100 to the end of the store.
Since we don't know the size yet, we use -1 as a marker
for the code below. */
- runs[nruns++].length = (off_t) -1;
+ runs[nruns++].length = (store_offset_t) -1;
break;
}
runs[nruns].length = strtoul (p, &endp, 0);
@@ -144,7 +144,7 @@ remap_open (const char *name, int flags,
and update them to use the actual size of the store. */
size_t i;
for (i = 0; i < nruns; ++i)
- if (runs[i].length == (off_t) -1)
+ if (runs[i].length == (store_offset_t) -1)
runs[i].length = from->blocks - runs[i].start;
/* Now do the remapping according to RUNS. */
@@ -241,7 +241,7 @@ store_remap_runs (const struct store_run *runs, size_t num_runs,
size_t xruns_alloced = num_runs + num_base_runs;
/* Add the single run [ADDR, LEN) to *XRUNS, returning true if successful. */
- int add_run (off_t addr, off_t len)
+ int add_run (store_offset_t addr, store_offset_t len)
{
if (*num_xruns == xruns_alloced)
/* Make some more space in *XRUNS. */
@@ -266,13 +266,13 @@ store_remap_runs (const struct store_run *runs, size_t num_runs,
for (i = 0; i < num_runs; i++)
{
- off_t addr = runs[i].start, left = runs[i].length;
+ store_offset_t addr = runs[i].start, left = runs[i].length;
if (addr >= 0)
for (j = 0; j < num_base_runs && left > 0; j++)
{
- off_t baddr = base_runs[j].start;
- off_t blen = base_runs[j].length;
+ store_offset_t baddr = base_runs[j].start;
+ store_offset_t blen = base_runs[j].length;
if (addr >= blen)
addr -= blen;
@@ -282,7 +282,7 @@ store_remap_runs (const struct store_run *runs, size_t num_runs,
else
/* Add another output run. */
{
- off_t len = blen - addr; /* Size of next output run. */
+ store_offset_t len = blen - addr; /* Size of next output run. */
if (! add_run (baddr + addr, len > left ? left : len))
ERR (ENOMEM);
addr = 0;
diff --git a/libstore/store.h b/libstore/store.h
index c7789373..9c5e5bfd 100644
--- a/libstore/store.h
+++ b/libstore/store.h
@@ -39,10 +39,13 @@
#endif
+/* Type for addresses inside the store. */
+typedef off64_t store_offset_t;
+
/* A portion of a store. If START == -1, it's a hole. */
struct store_run
{
- off_t start, length;
+ store_offset_t start, length;
};
struct store
@@ -57,13 +60,13 @@ struct store
size_t num_runs; /* Length of RUNS. */
/* Maximum valid offset. This is the same as SIZE, but in blocks. */
- off_t end;
+ store_offset_t end;
/* WRAP_SRC is the sum of the run lengths in RUNS. If this is less than
END, then RUNS describes a repeating pattern, of length WRAP_SRC -- each
successive iteration having an additional offset of WRAP_DST. */
- off_t wrap_src;
- off_t wrap_dst; /* Only meaningful if WRAP_SRC < END */
+ store_offset_t wrap_src;
+ store_offset_t wrap_dst; /* Only meaningful if WRAP_SRC < END */
/* Handles for the underlying storage. */
char *name; /* Malloced */
@@ -73,9 +76,9 @@ struct store
size_t block_size;
/* The number of blocks (of size BLOCK_SIZE) in this storage. */
- off_t blocks;
+ store_offset_t blocks;
/* The number of bytes in this storage, including holes. */
- off_t size;
+ store_offset_t size;
/* Log_2 (BLOCK_SIZE) or 0 if not a power of 2. */
unsigned log2_block_size;
@@ -121,11 +124,11 @@ struct store
| ~(STORE_BACKEND_SPEC_BASE - 1))
typedef error_t (*store_write_meth_t)(struct store *store,
- off_t addr, size_t index,
+ store_offset_t addr, size_t index,
void *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, size_t index,
+ store_offset_t addr, size_t index,
mach_msg_type_number_t amount,
void **buf, mach_msg_type_number_t *len);
@@ -229,7 +232,7 @@ error_t
_store_create (const struct store_class *class, mach_port_t port,
int flags, size_t block_size,
const struct store_run *runs, size_t num_runs,
- off_t end, struct store **store);
+ store_offset_t end, struct store **store);
/* Set STORE's current runs list to (a copy of) RUNS and NUM_RUNS. */
error_t store_set_runs (struct store *store,
@@ -293,13 +296,13 @@ error_t store_remap (struct store *source,
/* 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, void *buf, size_t len, size_t *amount);
+ store_offset_t addr, void *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). Note that LEN is in bytes. */
error_t store_read (struct store *store,
- off_t addr, size_t amount, void **buf, size_t *len);
+ store_offset_t addr, size_t amount, void **buf, size_t *len);
/* If STORE was created using store_create, remove the reference to the
source from which it was created. */
@@ -322,7 +325,7 @@ error_t store_create_pager (struct store *store, vm_prot_t prot, ...,
/* Creating specific types of stores. */
/* Return a new zero store SIZE bytes long in STORE. */
-error_t store_zero_create (off_t size, int flags, struct store **store);
+error_t store_zero_create (store_offset_t size, int flags, struct store **store);
/* Return a new store in STORE referring to the mach device DEVICE. Consumes
the send right DEVICE. */
@@ -388,7 +391,8 @@ error_t store_typed_open (const char *name, int flags,
consumed -- that is, will be freed when this store is (however, the
*array* STRIPES is copied, and so should be freed by the caller). */
error_t store_ileave_create (struct store * const *stripes, size_t num_stripes,
- off_t interleave, int flags, struct store **store);
+ store_offset_t interleave, int flags,
+ struct store **store);
/* Return a new store in STORE that concatenates all the stores in STORES
(NUM_STORES of them). The stores in STRIPES are consumed -- that is, will
diff --git a/libstore/stripe.c b/libstore/stripe.c
index 59fb504e..52a596df 100644
--- a/libstore/stripe.c
+++ b/libstore/stripe.c
@@ -27,8 +27,8 @@ extern long lcm (long p, long q);
/* Return ADDR adjust for any block size difference between STORE and
STRIPE. We assume that STORE's block size is no less than STRIPE's. */
-static inline off_t
-addr_adj (off_t addr, struct store *store, struct store *stripe)
+static inline store_offset_t
+addr_adj (store_offset_t addr, struct store *store, struct store *stripe)
{
unsigned common_bs = store->log2_block_size;
unsigned stripe_bs = stripe->log2_block_size;
@@ -40,7 +40,7 @@ addr_adj (off_t addr, struct store *store, struct store *stripe)
static error_t
stripe_read (struct store *store,
- off_t addr, size_t index, size_t amount,
+ store_offset_t addr, size_t index, size_t amount,
void **buf, size_t *len)
{
struct store *stripe = store->children[index];
@@ -49,7 +49,7 @@ stripe_read (struct store *store,
static error_t
stripe_write (struct store *store,
- off_t addr, size_t index, void *buf, size_t len,
+ store_offset_t addr, size_t index, void *buf, size_t len,
size_t *amount)
{
struct store *stripe = store->children[index];
@@ -160,11 +160,13 @@ store_concat_class =
*array* STRIPES is copied, and so should be freed by the caller). */
error_t
store_ileave_create (struct store *const *stripes, size_t num_stripes,
- off_t interleave, int flags, struct store **store)
+ store_offset_t interleave, int flags,
+ struct store **store)
{
size_t i;
error_t err;
- off_t block_size = 1, min_end = 0;
+ size_t block_size = 1;
+ store_offset_t min_end = 0;
struct store_run runs[num_stripes];
int common_flags = STORE_BACKEND_FLAGS;
@@ -180,7 +182,7 @@ store_ileave_create (struct store *const *stripes, size_t num_stripes,
for (i = 0; i < num_stripes; i++)
{
/* The stripe's end adjusted to the common block size. */
- off_t end = stripes[i]->end;
+ store_offset_t end = stripes[i]->end;
runs[i].start = 0;
runs[i].length = interleave;
@@ -222,7 +224,7 @@ store_concat_create (struct store * const *stores, size_t num_stores,
{
size_t i;
error_t err;
- off_t block_size = 1;
+ size_t block_size = 1;
int common_flags = STORE_BACKEND_FLAGS;
struct store_run runs[num_stores];
diff --git a/libstore/task.c b/libstore/task.c
index d2cce5f3..aad91c2c 100644
--- a/libstore/task.c
+++ b/libstore/task.c
@@ -56,7 +56,7 @@ tclose (struct store *store)
static error_t
task_read (struct store *store,
- off_t addr, size_t index, size_t amount, void **buf, size_t *len)
+ store_offset_t addr, size_t index, size_t amount, void **buf, size_t *len)
{
size_t bsize = store->block_size;
return vm_read (store->port, addr * bsize, amount, (vm_address_t *)buf, len);
@@ -64,7 +64,7 @@ task_read (struct store *store,
static error_t
task_write (struct store *store,
- off_t addr, size_t index, void *buf, size_t len, size_t *amount)
+ store_offset_t addr, size_t index, void *buf, size_t len, size_t *amount)
{
size_t bsize = store->block_size;
error_t err = vm_write (store->port, addr * bsize, (vm_address_t)buf, len);
diff --git a/libstore/zero.c b/libstore/zero.c
index f0a23276..4452179b 100644
--- a/libstore/zero.c
+++ b/libstore/zero.c
@@ -29,7 +29,8 @@
static error_t
zero_read (struct store *store,
- off_t addr, size_t index, size_t amount, void **buf, size_t *len)
+ store_offset_t addr, size_t index, size_t amount, void **buf,
+ size_t *len)
{
if (*len < amount)
{
@@ -48,7 +49,8 @@ zero_read (struct store *store,
static error_t
zero_write (struct store *store,
- off_t addr, size_t index, void *buf, size_t len, size_t *amount)
+ store_offset_t addr, size_t index, void *buf, size_t len,
+ size_t *amount)
{
return 0;
}
@@ -63,7 +65,7 @@ zero_remap (struct store *source,
run; here we simply count up the number of blocks specified by RUNS, and
modify SOURCE's one run to reflect that. */
int i;
- off_t length = 0, old_length = source->runs[0].length;
+ store_offset_t length = 0, old_length = source->runs[0].length;
for (i = 0; i < num_runs; i++)
if (runs[i].start < 0 || runs[i].start + runs[i].length >= old_length)
return EINVAL;
@@ -95,7 +97,7 @@ error_t
zero_decode (struct store_enc *enc, const struct store_class *const *classes,
struct store **store)
{
- off_t size;
+ store_offset_t size;
int type, flags;
if (enc->cur_int + 2 > enc->num_ints
@@ -117,7 +119,7 @@ zero_open (const char *name, int flags,
if (name)
{
char *end;
- off_t size = strtoul (name, &end, 0);
+ store_offset_t size = strtoull (name, &end, 0);
if (end == name || end == NULL)
return EINVAL;
switch (*end)
@@ -142,7 +144,8 @@ zero_open (const char *name, int flags,
}
else
{
- off_t max_offs = ~((off_t)1 << (CHAR_BIT * sizeof (off_t) - 1));
+ store_offset_t max_offs = ~((store_offset_t)1
+ << (CHAR_BIT * sizeof (store_offset_t) - 1));
return store_zero_create (max_offs, flags, store);
}
}
@@ -178,7 +181,7 @@ store_zero_class =
/* Return a new zero store SIZE bytes long in STORE. */
error_t
-store_zero_create (off_t size, int flags, struct store **store)
+store_zero_create (store_offset_t size, int flags, struct store **store)
{
struct store_run run = { 0, size };
return