Skip to content

Instantly share code, notes, and snippets.

@shugen002
Created September 8, 2022 03:30
Show Gist options
  • Save shugen002/fda92d51a3c75c24e6b7b2e986af9937 to your computer and use it in GitHub Desktop.
Save shugen002/fda92d51a3c75c24e6b7b2e986af9937 to your computer and use it in GitHub Desktop.
tar imhex pattern (not done ye
struct posix_header
{ /* byte offset */
char name[100]; /* 0 */
char mode[8]; /* 100 */
char uid[8]; /* 108 */
char gid[8]; /* 116 */
char size[12]; /* 124 */
char mtime[12]; /* 136 */
char chksum[8]; /* 148 */
char typeflag; /* 156 */
char linkname[100]; /* 157 */
char magic[6]; /* 257 */
char version[2]; /* 263 */
char uname[32]; /* 265 */
char gname[32]; /* 297 */
char devmajor[8]; /* 329 */
char devminor[8]; /* 337 */
char prefix[155]; /* 345 */
/* 500 */
};
struct sparse
{ /* byte offset */
char offset[12]; /* 0 */
char numbytes[12]; /* 12 */
/* 24 */
};
#define SPARSES_IN_EXTRA_HEADER 16
#define SPARSES_IN_OLDGNU_HEADER 4
#define SPARSES_IN_SPARSE_HEADER 21
struct sparse_header
{ /* byte offset */
sparse sp[SPARSES_IN_SPARSE_HEADER];
/* 0 */
char isextended; /* 504 */
/* 505 */
};
struct oldgnu_header
{ /* byte offset */
padding/* unused_pad1*/[345]; /* 0 */
char atime[12]; /* 345 Incr. archive: atime of the file */
char ctime[12]; /* 357 Incr. archive: ctime of the file */
char offset[12]; /* 369 Multivolume archive: the offset of
the start of this volume */
char longnames[4]; /* 381 Not used */
padding/* unused_pad2*/[1]; /* 385 */
sparse sp[SPARSES_IN_OLDGNU_HEADER];
/* 386 */
char isextended; /* 482 Sparse file: Extension sparse header
follows */
char realsize[12]; /* 483 Sparse file: Real size*/
/* 495 */
};
posix_header posix_header@0;
oldgnu_header oldgnu_header@0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment