|
ginnOS
The reference: libc, the libraries and the kernel
|
librat: read and check a package file (gzip, then ustar), and unpack its files and links into a stage folder. More...
#include "internal.h"#include <errno.h>#include <fcntl.h>#include <stdlib.h>#include <string.h>#include <sys/stat.h>#include <unistd.h>#include <zlib.h>#include "sha2.h"Macros | |
| #define | BLOCK 512 |
Functions | |
| int | rat_package_unpack (const char *path, const char *arch, const char *stage, rat_package_t *package, rat_error_t *err) |
| read and check a package file, as rat_package_read. | |
| int | rat_package_read (const char *path, const char *arch, rat_package_t *package, rat_error_t *err) |
| read and check a package file. | |
| void | rat_package_free (rat_package_t *package) |
| release the memory of a package (not the struct itself). | |
| void | rat_stage_name (const char *path, char out[RAT_STAGE_NAME_MAX]) |
| the name of a path in the stage folder: 'f' and the SHA-256 of the path | |
librat: read and check a package file (gzip, then ustar), and unpack its files and links into a stage folder.
the reader takes only what mkpkg makes: POSIX ustar headers (magic "ustar", version "00"), with regular files, folders and symbolic links. it refuses GNU and pax extensions, hard links, devices and named pipes.
| #define BLOCK 512 |
| int rat_package_unpack | ( | const char * | path, |
| const char * | arch, | ||
| const char * | stage, | ||
| rat_package_t * | package, | ||
| rat_error_t * | err ) |
read and check a package file, as rat_package_read.
with a stage folder, also write each file and link there, under the name that rat_stage_name gives for its path.
| stage | the stage folder (it must exist), or NULL. |
| int rat_package_read | ( | const char * | path, |
| const char * | arch, | ||
| rat_package_t * | package, | ||
| rat_error_t * | err ) |
read and check a package file.
nothing is written.
| arch | the architecture the package must have ("any" also matches), or NULL for every architecture. |
| void rat_package_free | ( | rat_package_t * | package | ) |
release the memory of a package (not the struct itself).
| void rat_stage_name | ( | const char * | path, |
| char | out[RAT_STAGE_NAME_MAX] ) |
the name of a path in the stage folder: 'f' and the SHA-256 of the path