diff --git a/compressionoptions.go b/compressionoptions.go index 06ed4f5..65e604b 100644 --- a/compressionoptions.go +++ b/compressionoptions.go @@ -1,6 +1,6 @@ package squashfs -//CompressionOptions +//TODO: implement decompress for each type of Options type CompressionOptions interface { Decompress([]byte) []byte } diff --git a/unsquash.go b/unsquash.go index 0a41480..bcc3c20 100644 --- a/unsquash.go +++ b/unsquash.go @@ -7,17 +7,19 @@ import ( //Squashfs is a squashfs backed by a ReadSeeker. type Squashfs struct { - rdr *io.ReaderAt //underlying reader + rdr *io.ReadSeeker //underlying reader super Superblock } //NewSquashfs creates a new Squashfs backed by the given reader -func NewSquashfs(reader io.ReaderAt) (*Squashfs, error) { +func NewSquashfs(reader io.ReadSeeker) (*Squashfs, error) { var superblock Superblock - err := binary.Read(io.NewSectionReader(reader, 0, int64(binary.Size(superblock))), binary.LittleEndian, &superblock) + err := binary.Read(reader, binary.LittleEndian, &superblock) if err != nil { return nil, err } + //TODO: check magic + //TODO: parse more info return &Squashfs{ rdr: &reader, super: superblock,