2017-03-07 16:54:23 +00:00
|
|
|
#ifndef _CPIO_H_
|
|
|
|
#define _CPIO_H_
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
2017-07-02 13:36:09 +00:00
|
|
|
#include "list.h"
|
|
|
|
|
2017-09-14 02:47:10 +00:00
|
|
|
typedef struct cpio_entry {
|
2017-03-07 16:54:23 +00:00
|
|
|
// uint32_t ino;
|
|
|
|
uint32_t mode;
|
|
|
|
uint32_t uid;
|
|
|
|
uint32_t gid;
|
|
|
|
// uint32_t nlink;
|
|
|
|
// uint32_t mtime;
|
|
|
|
uint32_t filesize;
|
|
|
|
// uint32_t devmajor;
|
|
|
|
// uint32_t devminor;
|
|
|
|
// uint32_t rdevmajor;
|
|
|
|
// uint32_t rdevminor;
|
|
|
|
uint32_t namesize;
|
|
|
|
// uint32_t check;
|
|
|
|
char *filename;
|
2017-03-09 20:08:17 +00:00
|
|
|
char *data;
|
2017-03-07 16:54:23 +00:00
|
|
|
int remove;
|
2017-09-14 02:47:10 +00:00
|
|
|
} cpio_entry;
|
2017-03-07 16:54:23 +00:00
|
|
|
|
2017-07-02 13:36:09 +00:00
|
|
|
typedef struct line_list {
|
|
|
|
char *line;
|
|
|
|
int isNew;
|
|
|
|
struct list_head pos;
|
|
|
|
} line_list;
|
|
|
|
|
2017-03-07 16:54:23 +00:00
|
|
|
typedef struct cpio_newc_header {
|
|
|
|
char magic[6];
|
|
|
|
char ino[8];
|
|
|
|
char mode[8];
|
|
|
|
char uid[8];
|
|
|
|
char gid[8];
|
|
|
|
char nlink[8];
|
|
|
|
char mtime[8];
|
|
|
|
char filesize[8];
|
|
|
|
char devmajor[8];
|
|
|
|
char devminor[8];
|
|
|
|
char rdevmajor[8];
|
|
|
|
char rdevminor[8];
|
|
|
|
char namesize[8];
|
|
|
|
char check[8];
|
|
|
|
} cpio_newc_header;
|
|
|
|
|
2017-09-07 11:22:30 +00:00
|
|
|
typedef enum {
|
|
|
|
NONE,
|
|
|
|
RM,
|
|
|
|
MKDIR,
|
|
|
|
ADD,
|
2017-09-09 15:05:50 +00:00
|
|
|
MV,
|
2017-09-07 11:22:30 +00:00
|
|
|
EXTRACT,
|
|
|
|
TEST,
|
|
|
|
PATCH,
|
|
|
|
BACKUP,
|
|
|
|
RESTORE,
|
|
|
|
STOCKSHA1
|
|
|
|
} command_t;
|
|
|
|
|
2017-03-07 16:54:23 +00:00
|
|
|
#endif
|