summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>1996-09-14 17:47:24 +0000
committerMiles Bader <miles@gnu.org>1996-09-14 17:47:24 +0000
commitaf422dc5991fe3c96be5f449f38a78589d81d03f (patch)
tree592eae40afded103c749d06ad024213a107edd9a
parentd45815624ff8237db06e4e7d386855ccacf66819 (diff)
(store_std_leaf_allocate_encoding): NUM_OFFSETS is NUM_RUNS * 2.
(store_return): New function.
-rw-r--r--libstore/encode.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/libstore/encode.c b/libstore/encode.c
index 38490cc0..29e370d2 100644
--- a/libstore/encode.c
+++ b/libstore/encode.c
@@ -32,7 +32,7 @@ store_std_leaf_allocate_encoding (const struct store *store,
{
enc->num_ports++;
enc->num_ints += 6;
- enc->num_offsets += store->num_runs;
+ enc->num_offsets += store->num_runs * 2;
if (store->name)
enc->data_len += strlen (store->name) + 1;
enc->data_len += store->misc_len;
@@ -125,3 +125,26 @@ store_encode (const struct store *store, struct store_enc *enc)
return err;
}
+
+/* Encode STORE into the given return variables, suitably for returning from a
+ file_get_storage_info rpc. */
+error_t
+store_return (const struct store *store,
+ mach_port_t **ports, mach_msg_type_number_t *num_ports,
+ int **ints, mach_msg_type_number_t *num_ints,
+ off_t **offsets, mach_msg_type_number_t *num_offsets,
+ char **data, mach_msg_type_number_t *data_len)
+{
+ error_t err;
+ struct store_enc enc;
+
+ store_enc_init (&enc, *ports, *num_ports, *ints, *num_ints,
+ *offsets, *num_offsets, *data, *data_len);
+ err = store_encode (store, &enc);
+ if (err)
+ store_enc_dealloc (&enc);
+ else
+ store_enc_return (&enc, ports, num_ports, ints, num_ints,
+ offsets, num_offsets, data, data_len);
+ return err;
+}