]> Cypherpunks repositories - gostls13.git/commitdiff
archive/tar: document Header fields and Type flags
authorMike Rosset <mike.rosset@gmail.com>
Sat, 17 Sep 2011 18:43:06 +0000 (11:43 -0700)
committerBrad Fitzpatrick <bradfitz@golang.org>
Sat, 17 Sep 2011 18:43:06 +0000 (11:43 -0700)
Documentation more along the lines of os.FileInfo
Fixes #2180.

R=golang-dev, dsymonds
CC=golang-dev, mike.rosset
https://golang.org/cl/4958055

src/pkg/archive/tar/common.go

index 52885876589cd0ca6275a8c9c11979046af2d82b..67355086a639af3286692360ace5a4c727d74a58 100644 (file)
@@ -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)