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