<cpio.h>¶
Finding files in a cpio archive (new ASCII format), as used for the initrd.
#include <cpio.h>
Structures¶
cpio_hdr_t¶
A cpio member header: 110 bytes, numbers as 8 hex digits.
| Field | Type | Description |
|---|---|---|
magic |
char |
"070701". |
ino |
char |
Inode number. |
mode |
char |
File mode. |
uid |
char |
Owner. |
gid |
char |
Group. |
nlink |
char |
Link count. |
mtime |
char |
Modification time. |
filesize |
char |
Size of the file data. |
devmajor |
char |
Major number of the device holding the file. |
devminor |
char |
Minor number of that device. |
rdevmajor |
char |
Major number, for device files. |
rdevminor |
char |
Minor number, for device files. |
namesize |
char |
Length of the name that follows, including the NUL. |
check |
char |
Always 0. |
Functions¶
CpioFind¶
bool CpioFind(const void *base, size_t size, const char *name, const void **data_out, size_t *size_out);
Finds a file in a CPIO archive.
| Parameter | Direction | Description |
|---|---|---|
base |
in | Start of the archive in memory. |
size |
in | Size of the archive in bytes. |
name |
in | Name of the file to find. |
data_out |
out | Receives a pointer to the file's data, inside the archive. |
size_out |
out | Receives the size of the file's data. |
Returns: true if the file was found, false otherwise.