Improved data structure for structs.

Thanks gopls with VS Code
This commit is contained in:
Caleb Gardner
2020-12-28 11:50:56 -06:00
parent 89ec7eb0fb
commit 47c28baf87
4 changed files with 14 additions and 13 deletions
+3 -3
View File
@@ -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
+8 -7
View File
@@ -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
+1 -1
View File
@@ -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
}
+2 -2
View File
@@ -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