Added more necessary parts to compression.

This commit is contained in:
Caleb Gardner
2021-02-24 05:58:18 -06:00
parent 8a91e1a1c1
commit a123935250
5 changed files with 66 additions and 6 deletions
+23
View File
@@ -0,0 +1,23 @@
package squashfs
func (w *Writer) countInodes() (out uint32) {
for _, files := range w.structure {
out++
out += uint32(len(files))
}
return
}
//intilialize the block sizes. These values will be overwritten with their compressed sizes later.
func (w *Writer) calculateBlockSizes(fil *fileHolder) {
tmp := fil.size
for {
if tmp < uint64(w.BlockSize) {
fil.blockSizes = append(fil.blockSizes, uint32(tmp))
break
}
tmp -= uint64(w.BlockSize)
fil.blockSizes = append(fil.blockSizes, w.BlockSize)
}
return
}