Re-write data fullreader & reader
Moved directory and the rest of the inodes to manual decoding
This commit is contained in:
+36
-12
@@ -10,18 +10,31 @@ type Device struct {
|
||||
Dev uint32
|
||||
}
|
||||
|
||||
func ReadDevice(r io.Reader) (d Device, err error) {
|
||||
dat := make([]byte, 8)
|
||||
_, err = r.Read(dat)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
d.LinkCount = binary.LittleEndian.Uint32(dat)
|
||||
d.Dev = binary.LittleEndian.Uint32(dat[4:])
|
||||
return
|
||||
}
|
||||
|
||||
type EDevice struct {
|
||||
Device
|
||||
XattrInd uint32
|
||||
}
|
||||
|
||||
func ReadDevice(r io.Reader) (d Device, err error) {
|
||||
err = binary.Read(r, binary.LittleEndian, &d)
|
||||
return
|
||||
}
|
||||
|
||||
func ReadEDevice(r io.Reader) (d EDevice, err error) {
|
||||
err = binary.Read(r, binary.LittleEndian, &d)
|
||||
dat := make([]byte, 12)
|
||||
_, err = r.Read(dat)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
d.LinkCount = binary.LittleEndian.Uint32(dat)
|
||||
d.Dev = binary.LittleEndian.Uint32(dat[4:])
|
||||
d.XattrInd = binary.LittleEndian.Uint32(dat[8:])
|
||||
return
|
||||
}
|
||||
|
||||
@@ -29,17 +42,28 @@ type IPC struct {
|
||||
LinkCount uint32
|
||||
}
|
||||
|
||||
func ReadIPC(r io.Reader) (i IPC, err error) {
|
||||
dat := make([]byte, 4)
|
||||
_, err = r.Read(dat)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
i.LinkCount = binary.LittleEndian.Uint32(dat)
|
||||
return
|
||||
}
|
||||
|
||||
type EIPC struct {
|
||||
IPC
|
||||
XattrInd uint32
|
||||
}
|
||||
|
||||
func ReadIPC(r io.Reader) (i IPC, err error) {
|
||||
err = binary.Read(r, binary.LittleEndian, &i)
|
||||
return
|
||||
}
|
||||
|
||||
func ReadEIPC(r io.Reader) (i EIPC, err error) {
|
||||
err = binary.Read(r, binary.LittleEndian, &i)
|
||||
dat := make([]byte, 8)
|
||||
_, err = r.Read(dat)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
i.LinkCount = binary.LittleEndian.Uint32(dat)
|
||||
i.XattrInd = binary.LittleEndian.Uint32(dat[4:])
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user