From af422dc5991fe3c96be5f449f38a78589d81d03f Mon Sep 17 00:00:00 2001 From: Miles Bader Date: Sat, 14 Sep 1996 17:47:24 +0000 Subject: (store_std_leaf_allocate_encoding): NUM_OFFSETS is NUM_RUNS * 2. (store_return): New function. --- libstore/encode.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) 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; +} -- cgit v1.2.3