/build/sourc...ode_helpers.c(3)
π NAME π
hey bestie! welcome to the liberasurecode manual page for /build/sourc...ode_helpers.c(3). The NAME on this one is straight-up:
/build/source/src/erasurecode_helpers.c
Thatβs the source file this whole page is about, periodt. π
β¨ SYNOPSIS β¨
okay so first you gotta include all of these headers, exactly like this:
#include <assert.h>
#include <stdio.h>
#include <stdarg.h>
#include <zlib.h>
#include 'erasurecode_backend.h'
#include 'erasurecode_helpers.h'
#include 'erasurecode_helpers_ext.h'
#include 'erasurecode_stdinc.h'
#include 'erasurecode_version.h'
#include 'alg_sig.h'
#include 'erasurecode_log.h'
π§ Functions π§
hereβs the function lineup the page lists, with every signature kept exactly:
static bool is_fragment (char *buf)β a static bool cutie, listed right up top.__attribute__ ((visibility('internal')))β the docs put this right afteris_fragment, and then the noteMemory Management Methods.sits under it.void * alloc_and_set_buffer (int size, int value)β allocate a buffer of a specific size and set its contents to the specified value.char * get_data_ptr_from_fragment (char *buf)β listed here with just the signature.int get_libec_version (char *buf, uint32_t *ver)β listed here with just the signature.int get_backend_id (char *buf, ec_backend_id_t *id)β listed here with just the signature.int get_backend_version (char *buf, uint32_t *version)β listed here with just the signature.
π Function Documentation π
π§ __attribute__ ((visibility('internal')) ) π§
okay this subsection is a lil memory-management grab bag, so buckle up:
Memory Management Methods.Compute a size aligned to the number of data and the underlying wordsize of the EC algorithm.- Return total fragment length (on-disk, on-wire).
- Deallocate memory buffer if itβs not
NULL. - Allocate a zero-ed buffer of a specific size.
- The following methods provide wrappers for allocating and deallocating memory.
Parameters
sizeβ integer size in bytes of buffer to allocate.
Returns
- pointer to start of allocated buffer or
NULLon error.
This method returns NULL so that you can free and reset a buffer using a single line as follows:
my_ptr = check_and_free_buffer(my_ptr);
Returns
NULL
Parameters
bufβ pointer to fragment buffer.
Returns
- fragment size on disk.
Parameters
instanceβec_backend_tinstance (to extract args).data_lenβ integer length of data in bytes.
Returns
- integer data length aligned with wordsize of EC algorithm.
Ensure all memory is aligned to 16-byte boundaries to support 128-bit operations.
Definition at line 61 of file erasurecode_helpers.c.
π¦ void * alloc_and_set_buffer (int size, int value) π¦
Allocate a buffer of a specific size and set its contents to the specified value.
Parameters
sizeβ integer size in bytes of buffer to allocate.valueβ the original just saysvaluehere, no extra description.
Returns
- pointer to start of allocated buffer or
NULLon error.
Definition at line 99 of file erasurecode_helpers.c.
Referenced by liberasurecode_decode(), and liberasurecode_reconstruct_fragment().
π int get_backend_id (char * buf, ec_backend_id_t * id) π
Definition at line 452 of file erasurecode_helpers.c.
References is_fragment().
π int get_backend_version (char * buf, uint32_t * version) π
Definition at line 473 of file erasurecode_helpers.c.
References is_fragment().
πΈ char * get_data_ptr_from_fragment (char * buf) πΈ
Definition at line 218 of file erasurecode_helpers.c.
Referenced by __attribute__(), and liberasurecode_get_fragment_metadata().
π int get_libec_version (char * buf, uint32_t * ver) π
Definition at line 431 of file erasurecode_helpers.c.
References is_fragment().
Referenced by is_invalid_fragment().
π bool is_fragment (char * buf) [static] π
Definition at line 43 of file erasurecode_helpers.c.
Referenced by get_backend_id(), get_backend_version(), and get_libec_version().
πΈ Author πΈ
This page was generated automatically by Doxygen for liberasurecode from the source code. iconic, honestly. β¨
thatβs the whole page, bestie π«Ά β liberasurecode Version 1.8.0, Tue Jan 1 1980 00:00, for /build/sourc...ode_helpers.c(3). bye and slay π
π
π¦ where this page comes from
- nixpkgs unstable: liberasurecode 1.8.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms