Some musings on what to do.
This commit is contained in:
@@ -11,8 +11,8 @@ import (
|
|||||||
//
|
//
|
||||||
//Info holds the actual Inode. Due to each inode type being a different type, it's store as an interface{}
|
//Info holds the actual Inode. Due to each inode type being a different type, it's store as an interface{}
|
||||||
type Inode struct {
|
type Inode struct {
|
||||||
Info interface{} //Info is the parsed specific data. It's type is defined by Type.
|
|
||||||
Header
|
Header
|
||||||
|
Info interface{} //Info is the parsed specific data. It's type is defined by Type.
|
||||||
}
|
}
|
||||||
|
|
||||||
//ProcessInode tries to read an inode from the BlockReader
|
//ProcessInode tries to read an inode from the BlockReader
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ type Writer struct {
|
|||||||
uidGUIDTable []int
|
uidGUIDTable []int
|
||||||
frags []fragment
|
frags []fragment
|
||||||
superblock superblock
|
superblock superblock
|
||||||
|
rootInode inode.Inode
|
||||||
//since we need some information from the actually compressed and writen data for tables
|
//since we need some information from the actually compressed and writen data for tables
|
||||||
//we need to write the data FIRST, but make sure there's enough space for the tables.
|
//we need to write the data FIRST, but make sure there's enough space for the tables.
|
||||||
dataOffset int
|
dataOffset int
|
||||||
|
|||||||
+6
-8
@@ -3,6 +3,8 @@ package squashfs
|
|||||||
import (
|
import (
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"io"
|
"io"
|
||||||
|
|
||||||
|
"github.com/CalebQ42/squashfs/internal/inode"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (w *Writer) countInodes() (out uint32) {
|
func (w *Writer) countInodes() (out uint32) {
|
||||||
@@ -13,14 +15,10 @@ func (w *Writer) countInodes() (out uint32) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *Writer) calculateInodeTableSize() (out int, err error) {
|
func (w *Writer) setupInodes() (size int, err error) {
|
||||||
for _, files := range w.structure {
|
w.rootInode.Type = inode.DirType
|
||||||
for i := range files {
|
//setup
|
||||||
_ = i
|
size += binary.Size(w.rootInode)
|
||||||
//set up each file's inode and add it's binary.size to out
|
|
||||||
out += binary.Size(files[i].inode)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -45,7 +45,8 @@ func (w *Writer) WriteTo(write io.WriterAt) (int64, error) {
|
|||||||
}
|
}
|
||||||
w.dataOffset = 96 //superblock size
|
w.dataOffset = 96 //superblock size
|
||||||
//write compression options
|
//write compression options
|
||||||
w.calculateInodeTableSize()
|
//write/calculate compressed data sizes
|
||||||
|
|
||||||
return 0, errors.New("i said don't")
|
return 0, errors.New("i said don't")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user