38 #define CPIO_DEFAULT_MODE 0644 41 #define CPIO_DEFAULT_DIR_MODE 0755 73 for ( p =
'/' ; ( ( ( c = *(
name++) ) ) && ( c !=
' ' ) ) ; p = c ) {
74 if ( ( p ==
'/' ) && ( c !=
'/' ) )
99 for (
len = 0, p =
'/' ; ( ( ( c =
name[
len] ) ) && ( c !=
' ' ) ) ;
101 if ( ( c ==
'/' ) && ( p !=
'/' ) && ( --depth == 0 ) )
116 unsigned int *
count ) {
127 if ( *
end && ( *
end !=
' ' ) ) {
128 DBGC (
image,
"CPIO %s strange \"mode=\" " 136 if ( *
end && ( *
end !=
' ' ) ) {
137 DBGC (
image,
"CPIO %s strange \"mkdir=\" " 183 if (
name[name_len] ==
'/' ) {
193 memset ( cpio,
'0',
sizeof ( *cpio ) );
200 for ( i = 0 ; i < name_len ; i++ )
206 return (
sizeof ( *cpio ) + name_len );
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
unsigned long strtoul(const char *string, char **endp, int base)
Convert string to numeric value.
#define CPIO_MODE_FILE
CPIO type for regular files.
uint16_t mode
Acceleration mode.
#define CPIO_DEFAULT_DIR_MODE
CPIO directory mode.
#define CPIO_DEFAULT_MODE
CPIO default file mode.
static size_t cpio_name_len(struct image *image, unsigned int depth)
Get CPIO image filename.
void * memcpy(void *dest, const void *src, size_t len) __nonnull
size_t cpio_header(struct image *image, unsigned int index, struct cpio_header *cpio)
Construct CPIO header for image, if applicable.
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
pseudo_bit_t value[0x00020]
static unsigned int cpio_max(struct image *image)
Get maximum number of CPIO headers (i.e.
static unsigned int count
Number of entries.
static void cpio_set_field(char *field, unsigned long value)
Set field within a CPIO header.
size_t len
Length of raw file image.
#define CPIO_MAGIC
CPIO magic.
const char * image_argument(struct image *image, const char *key)
Find argument within image command line.
uint32_t end
Ending offset.
static void cpio_parse_cmdline(struct image *image, unsigned int *mode, unsigned int *count)
Parse CPIO image parameters.
int snprintf(char *buf, size_t size, const char *fmt,...)
Write a formatted string to a buffer.
#define CPIO_MODE_DIR
CPIO type for directories.
#define NULL
NULL pointer (VOID *)
void * memset(void *dest, int character, size_t len) __nonnull
static const char * cpio_name(struct image *image)
Get CPIO image name.