Crinit -- Configurable Rootfs Init
|
Implementation of the crinitFileSeriesFromDir() unit test group. More...
#include "utest-file-series-from-dir.h"
#include <dirent.h>
#include <sys/types.h>
#include "common.h"
#include "fseries.h"
#include "unit_test.h"
Functions | |
int | crinitInitFileSeries (crinitFileSeries_t *fse, size_t numElements, const char *baseDir) |
void | crinitDestroyFileSeries (crinitFileSeries_t *fse) |
void | crinitFreeScandirList (struct dirent **scanList, int size) |
int | main (void) |
Implementation of the crinitFileSeriesFromDir() unit test group.
void crinitDestroyFileSeries | ( | crinitFileSeries_t * | fse | ) |
Frees memory associated with an crinitFileSeries_t.
fse | The crinitFileSeries_t whose memory shall be deallocated. |
void crinitFreeScandirList | ( | struct dirent ** | scanList, |
int | size | ||
) |
Free return pointer(s) from scandir().
Will free everything, scandir() has allocated according to the scandir(3) man page.
int crinitInitFileSeries | ( | crinitFileSeries_t * | fse, |
size_t | numElements, | ||
const char * | baseDir | ||
) |
Initialize an crinitFileSeries_t with a given number of empty pointers.
Sets initial state and then uses crinitResizeFileSeries() internally to allocate space for the pointers.
fse | The crinitFileSeries_t to initialize. |
numElements | The number of pointers in crinitFileSeries_t::fnames to allocate. No memory for the backing string is allocated at this point. |
baseDir | Base directory of the new file series to be set. |
int main | ( | void | ) |
Runs the unit test group for crinitFileSeriesFromDir using the cmocka API.