Skip to content
This repository has been archived by the owner on May 2, 2018. It is now read-only.

Commit

Permalink
archive/tar: document Header fields and Type flags
Browse files Browse the repository at this point in the history
Documentation more along the lines of os.FileInfo
Fixes #2180.

R=golang-dev, dsymonds
CC=golang-dev, mike.rosset
https://golang.org/cl/4958055
  • Loading branch information
mrosset authored and bradfitz committed Sep 17, 2011
1 parent 6bc0346 commit b71a805
Showing 1 changed file with 26 additions and 25 deletions.
51 changes: 26 additions & 25 deletions src/pkg/archive/tar/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit b71a805

Please sign in to comment.