summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorKevin Greenan <kmgreen2@gmail.com>2014-08-13 21:41:38 -0700
committerKevin Greenan <kmgreen2@gmail.com>2014-08-13 21:41:38 -0700
commitc22312f2d00ae56db499ae142656692a8750e3c9 (patch)
tree626b125aa6080a867e4990bc7308f87c38391ff1 /include
parent5e2108722cb657e2af4edd6947fbf26cd05e9371 (diff)
downloadliberasurecode-c22312f2d00ae56db499ae142656692a8750e3c9.tar.gz
Added cleanup API
Diffstat (limited to 'include')
-rw-r--r--include/erasurecode/erasurecode.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/include/erasurecode/erasurecode.h b/include/erasurecode/erasurecode.h
index 12031ba..2d1e2bb 100644
--- a/include/erasurecode/erasurecode.h
+++ b/include/erasurecode/erasurecode.h
@@ -183,6 +183,23 @@ int liberasurecode_encode(int desc,
uint64_t *fragment_len); /* output */
/**
+ * Cleanup structures allocated by librasurecode_encode
+ *
+ * The caller has no context, so cannot safely free memory
+ * allocated by liberasurecode, so it must pass the
+ * deallocation responsibility back to liberasurecode.
+ *
+ * @param desc - liberasurecode descriptor/handle
+ * from liberasurecode_instance_create()
+ * @param encoded_data - (char **) array of k data
+ * fragments (char *), allocated by liberasurecode_encode
+ * @param encoded_parity - (char **) array of m parity
+ * fragments (char *), allocated by liberasurecode_encode
+ * @return 0 in success; -error otherwise
+ */
+int liberasurecode_encode_cleanup(int desc, char **encoded_data, char **encoded_parity);
+
+/**
* Reconstruct original data from a set of k encoded fragments
*
* @param desc - liberasurecode descriptor/handle
@@ -204,6 +221,21 @@ int liberasurecode_decode(int desc,
char **out_data, uint64_t *out_data_len); /* output */
/**
+ * Cleanup structures allocated by librasurecode_decode
+ *
+ * The caller has no context, so cannot safely free memory
+ * allocated by liberasurecode, so it must pass the
+ * deallocation responsibility back to liberasurecode.
+ *
+ * @param desc - liberasurecode descriptor/handle
+ * from liberasurecode_instance_create()
+ * @param data - (char *) buffer of data decoded by
+ * librasurecode_decode
+ * @return 0 in success; -error otherwise
+ */
+int liberasurecode_decode_cleanup(int desc, char *data);
+
+/**
* Reconstruct a missing fragment from a subset of available fragments
*
* @param desc - liberasurecode descriptor/handle