1
0
mirror of https://github.com/golang/go synced 2024-11-22 04:04:40 -07:00

archive/tar: document Header fields and Type flags

Documentation more along the lines of os.FileInfo
Fixes #2180.

R=golang-dev, dsymonds
CC=golang-dev, mike.rosset
https://golang.org/cl/4958055
This commit is contained in:
Mike Rosset 2011-09-17 11:43:06 -07:00 committed by Brad Fitzpatrick
parent 6bc0346e28
commit b71a805cd5

View File

@ -15,36 +15,37 @@ const (
blockSize = 512 blockSize = 512
// Types // Types
TypeReg = '0' TypeReg = '0' // regular file.
TypeRegA = '\x00' TypeRegA = '\x00' // regular file.
TypeLink = '1' TypeLink = '1' // hard link.
TypeSymlink = '2' TypeSymlink = '2' // symbolic link.
TypeChar = '3' TypeChar = '3' // character device node.
TypeBlock = '4' TypeBlock = '4' // block device node.
TypeDir = '5' TypeDir = '5' // directory.
TypeFifo = '6' TypeFifo = '6' // fifo node.
TypeCont = '7' TypeCont = '7' // reserved.
TypeXHeader = 'x' TypeXHeader = 'x' // extended header.
TypeXGlobalHeader = 'g' TypeXGlobalHeader = 'g' // global extended header.
) )
// A Header represents a single header in a tar archive. // A Header represents a single header in a tar archive.
// Some fields may not be populated. // Some fields may not be populated.
type Header struct { type Header struct {
Name string Name string // name of header file entry.
Mode int64 Mode int64 // permission and mode bits.
Uid int Uid int // user id of owner.
Gid int Gid int // group id of owner.
Size int64 Size int64 // length in bytes.
Mtime int64 Mtime int64 // modified time; seconds since epoch.
Typeflag byte Typeflag byte // type of header entry.
Linkname string Linkname string // target name of link.
Uname string Uname string // user name of owner.
Gname string Gname string // group name of owner.
Devmajor int64 Devmajor int64 // major number of character or block device.
Devminor int64 Devminor int64 // minor number of character or block device.
Atime int64 Atime int64 // access time; seconds since epoch.
Ctime int64 Ctime int64 // status change time; seconds since epoch.
} }
var zeroBlock = make([]byte, blockSize) var zeroBlock = make([]byte, blockSize)