diff options
author | Kota Tsuyuzaki <bloodeagle40234@gmail.com> | 2015-02-05 20:15:57 -0800 |
---|---|---|
committer | Kota Tsuyuzaki <bloodeagle40234@gmail.com> | 2015-02-27 15:44:37 +0900 |
commit | 57f5c565e64f8c33d3e299a8542de6d0f083b840 (patch) | |
tree | 2560935514eaa6b18c9f7752a6f60c2c3ae861e2 /include | |
parent | aa0c9605048153f640b8b871da9e483347e4b70f (diff) | |
download | liberasurecode-57f5c565e64f8c33d3e299a8542de6d0f083b840.tar.gz |
Ensure fragment pointers passed to cleanup
This patch achieves a couple of things as follows:
- Undoing the liberasurecode_encode_cleanup specification to
expect "fragment" pointers as its arguments.
- Ensuring liberasurecode_encode to pass "fratment" pointers to
liberasurecode_encode_cleanup.
liberasurecode_encode_cleanup is used also in pyeclib so that
it is expected that the argument pointers (i.e. encoded_data and
encoded_parity) should be the collection of the heads of "fragment"
pointers.
However, when the backend encode fails, liberasurecode keeps "data"
pointers behind of fragment_header, and then, goes to "out:" statement
to cleanup its memories. It causes invalid pointer failure.
This patch adds a translation function from "data" pointers to "fragment"
pointers and ensure liberasurecode_encode to pass correct pointers to
libersurecode_encode_cleanup.
Diffstat (limited to 'include')
-rw-r--r-- | include/erasurecode/erasurecode_helpers.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/erasurecode/erasurecode_helpers.h b/include/erasurecode/erasurecode_helpers.h index 93a8b6f..9c4e50d 100644 --- a/include/erasurecode/erasurecode_helpers.h +++ b/include/erasurecode/erasurecode_helpers.h @@ -126,6 +126,8 @@ int get_aligned_data_size(ec_backend_t instance, int data_len); char *get_data_ptr_from_fragment(char *buf); int get_data_ptr_array_from_fragments(char **data_array, char **fragments, int num_fragments); +int get_fragment_ptr_array_from_data(char **frag_array, char **data, + int num_data); char *get_fragment_ptr_from_data_novalidate(char *buf); char *get_fragment_ptr_from_data(char *buf); uint64_t get_fragment_size(char *buf); |