diff --git a/datareader.go b/datareader.go index 60f2d5a..822b429 100644 --- a/datareader.go +++ b/datareader.go @@ -18,11 +18,11 @@ var ( //DataReader reads data from data blocks. type dataReader struct { r *Reader - offset int64 //offset relative to the beginning of the squash file blocks []dataBlock - curBlock int //Which block in sizes is currently cached curData []byte - curReadOffset int //offset relative to the currently cached data + offset int64 //offset relative to the beginning of the squash file + curBlock int //Which block in sizes is currently cached + curReadOffset int //offset relative to the currently cached data } //DataBlock holds info about a given data block from it's size diff --git a/file.go b/file.go index d5aec36..112c8aa 100644 --- a/file.go +++ b/file.go @@ -30,13 +30,14 @@ var ( // //Implements os.FileInfo and io.ReadCloser type File struct { - Parent *File //The parent directory. Should ALWAYS be a folder. If it's the root directory, will be nil - Reader io.Reader //Underlying reader. When writing, will probably be an os.File. When reading this is kept nil UNTIL reading to save memory. - name string //The name of the file or folder. Root folder will not have a name ("") - path string //The path to the folder the File is located in. - r *Reader //The squashfs.Reader where this file is contained. - in *inode.Inode //Underlyting inode when reading. - filType int //The file's type, using inode types. + Reader io.Reader + Parent *File + r *Reader //Underlying reader. When writing, will probably be an os.File. When reading this is kept nil UNTIL reading to save memory. + in *inode.Inode + name string + path string + filType int //The file's type, using inode types. + } //get a File from a directory.entry diff --git a/metadata.go b/metadata.go index e0d2cd5..ca57df7 100644 --- a/metadata.go +++ b/metadata.go @@ -16,9 +16,9 @@ type metadata struct { //MetadataReader is a block reader for metadata. It will automatically read the next block, when it reaches the end of a block. type metadataReader struct { s *Reader - offset int64 headers []*metadata data []byte + offset int64 readOffset int } diff --git a/reader.go b/reader.go index 17f4006..992676a 100644 --- a/reader.go +++ b/reader.go @@ -29,11 +29,11 @@ var ( //Reader processes and reads a squashfs archive. type Reader struct { r io.ReaderAt - super superblock - flags superblockFlags decompressor compression.Decompressor fragOffsets []uint64 idTable []uint32 + super superblock + flags superblockFlags } //NewSquashfsReader returns a new squashfs.Reader from an io.ReaderAt