/build/sourc...ode_helpers.c(3)

πŸ“¦
version 1.8.0 Β· 2 versions
, in nixpkgs unstable

πŸ’– 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 after is_fragment, and then the note Memory 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 NULL on 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_t instance (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 says value here, no extra description.

Returns

  • pointer to start of allocated buffer or NULL on 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