Home

OFF-SOFT.net

OFF-SOFT.net

This site is support & information site of WEB,and Software. This site might help you that create software or Web Site…perhaps?[:]

Tar format

Published on| April 10th, 2009 | No Comment.
The content is not necessarily correct. Therefore, please refer.

-------------------------------------------------- -------------------------------
TAR format
-------------------------------------------------- -------------------------------

Offset Length Contents
   0 100 bytes File name ( '\ 0' terminated, 99 maxmum length)
100 8 bytes File mode (in octal ascii)
108 8 bytes User ID (in octal ascii)
116 8 bytes Group ID (in octal ascii)
124 12 bytes File size (s) (in octal ascii)
136 12 bytes Modify time (in octal ascii)
148 8 bytes Header checksum (in octal ascii)
156 1 bytes Link flag
157 100 bytes Linkname ( '\ 0' terminated, 99 maxmum length)
257 8 bytes Magic ( "ustar \ 0")
265 32 bytes User name ( '\ 0' terminated, 31 maxmum length)
297 32 bytes Group name ( '\ 0' terminated, 31 maxmum length)
329 8 bytes Major device ID (in octal ascii)
337 8 bytes Minor device ID (in octal ascii)
345 167 bytes Padding
512 (s + p) bytes File contents (s + p): = (((s) + 511) & ~ 511), round up to 512 bytes


Checksum:
int i, sum;
char * header = tar_header_pointer;
sum = 0;
for (i = 0; i <512; i + +)
     sum + = 0xFF & header [i];


/ * The linkflag defines the type of file * /
# define LF_OLDNORMAL '\ 0' / * Normal disk file, Unix compatible * /
# define LF_NORMAL'0 '/ * Normal disk file * /
# define LF_LINK'1 '/ * Link to previously dumped file * /
# define LF_SYMLINK'2 '/ * Symbolic link * /
# define LF_CHR'3 '/ * Character special file * /
# define LF_BLK'4 '/ * Block special file * /
# define LF_DIR'5 '/ * Directory * /
# define LF_FIFO'6 '/ * FIFO special file * /
# define LF_CONTIG'7 '/ * Contiguous file * /

+---------------------------------+
| header (header portion) 512bytes fixed |
+---------------------------------+
| data (data portion) 512bytes multiples of |
+---------------------------------+
|: |
| Header + data repeatedly in |
|: |
+---------------------------------+
| end of mark 1024bytes |
+---------------------------------+
  End of 1024 * 00 bytes of fill

(Note)
Header information is basically set in ASCII text.
Number is set as a string of decimal

-------------------------------------------------- --
Japanese names
-------------------------------------------------- --
File Name: 100
Attributes: 8
User ID: 8
Group ID: 8
File Size: 12
Updated: 12
Checksum: 8
Type: 1
Destination file name: 100
Magic number code version: 8
Guest Users: 32
Group name: 32
Device Major: 8
Minor device name: 8
Padding: 167

-------------------------------------------------- --
Description of Japanese
-------------------------------------------------- --
File name: ASCII SJIS or 100 bytes (including path name)
User ID / Group ID: "0" will represent the root
Last Modified: ustat () the value of the Last updated obtained that showed a string of eight binary
Checksum: Checksum header of 512 bytes
Magic code / version number: "ustar \ 0" + version number "00"
User / Group name: null terminated ASCII string of
Device Number Major / minor device number
    - The type [3] or [4] use only

Attributes: (UNIX and attributes) / 16 to be registered as an 8-bit binary string
Bit Position
0,1,2: Run the other attributes, write attributes, the attribute reading
3,4,5: run attributes of the group, write attributes, the attribute reading
6,7,8: run attributes of the owner, write attributes, the attribute reading
   9: Sticky bit
  10: Set GID
  11: Set UID
  12: pipe
  13: Special-character file
  14: directory
  15: regular file

Type:
  Character
   0: normal file
   1: Links
   2: symlink
   3: character device
   4: Block device
   5: directory
   6: FIFO Special Files
   7: KONTIGIASU? (Contiguous) file
A-Z: Book



-------------------------------------------------- --
Description of the tar format
-------------------------------------------------- --
tar files in multiple formats such as: mainly.

     * V7 (Version 7 Unix)
     * Town gnu
     * New gnu
     * POSIX.1-1988 (ustar)
     * POSIX.1-2001 (posix)

Of these, the most basic and V7, V7 or other extension header format,
Structure is completely different.

WinZIP normal and when you unpack the tar file
Can handle the file type, file and directory only in most normal
And symbolic links (more than normal files and directories) are largely ignored.
Also, hard links and special files, and also ignores the volume label.





Comments

Leave a Reply







  • はてなブックマークへ追加する
  • Facebookでシェアする
  • twitter でつぶやく
  • Google Plusでシェアする
  • Pocketでシェアする
ページトップへ