Crinit -- Configurable Rootfs Init
fseries.h
Go to the documentation of this file.
1 // SPDX-License-Identifier: MIT
6 #ifndef __FSERIES_H__
7 #define __FSERIES_H__
8 
9 #ifdef CRINIT_FSERIES_TESTING
10 #define TESTABLE __attribute__((weak))
11 #else
12 #define TESTABLE
13 #endif
14 
15 #include <stdbool.h>
16 #include <stddef.h>
17 
21 typedef struct crinitFileSeries_t {
22  char **fnames;
24  size_t size;
25  char *baseDir;
27 
42 int crinitFileSeriesFromDir(crinitFileSeries_t *fse, const char *path, const char *fileSuffix, bool followLinks);
58 int crinitFileSeriesFromStrArr(crinitFileSeries_t *fse, const char *baseDir, char **strArr);
77 TESTABLE int crinitInitFileSeries(crinitFileSeries_t *fse, size_t numElements, const char *baseDir);
90 int crinitResizeFileSeries(crinitFileSeries_t *fse, size_t numElements);
91 
92 #endif /* __FSERIES_H__ */
const char * fileSuffix
The extension of the files we want to scan for.
Definition: fseries.c:32
bool followLinks
Definition: fseries.c:33
void crinitDestroyFileSeries(crinitFileSeries_t *fse)
Definition: fseries.c:80
#define TESTABLE
Definition: fseries.h:12
TESTABLE int crinitInitFileSeries(crinitFileSeries_t *fse, size_t numElements, const char *baseDir)
Definition: fseries.c:95
int crinitResizeFileSeries(crinitFileSeries_t *fse, size_t numElements)
Definition: fseries.c:113
int crinitFileSeriesFromStrArr(crinitFileSeries_t *fse, const char *baseDir, char **strArr)
Definition: fseries.c:217
int crinitFileSeriesFromDir(crinitFileSeries_t *fse, const char *path, const char *fileSuffix, bool followLinks)
Definition: fseries.c:139
struct crinitFileSeries_t crinitFileSeries_t
Definition: fseries.h:21
char * baseDir
The dirname of the filenames in fnames.
Definition: fseries.h:25
char ** fnames
Definition: fseries.h:22
size_t size
Number of valid (allocated and non-NULL) pointers in fnames.
Definition: fseries.h:24