Improved data structure for structs.
Thanks gopls with VS Code
This commit is contained in:
+3
-3
@@ -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
|
||||
|
||||
@@ -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
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user