MCPcopy Create free account
hub / github.com/Merovius/nbd / decode

Method decode

types.go:578–594  ·  view source on GitHub ↗
(e *encoder)

Source from the content-addressed store, hash-verified

576}
577
578func (r *structuredReply) decode(e *encoder) Error {
579 if e.uint64() != structuredReplyMagic {
580 e.check(errors.New("invalid magic for reply"))
581 }
582 r.flags = e.uint16()
583 r.typ = e.uint16()
584 r.handle = e.uint64()
585 r.length = e.uint32()
586 if r.length > 4<<20 {
587 e.discard(r.length)
588 return EOVERFLOW
589 }
590 buf := make([]byte, r.length)
591 e.read(buf)
592 r.data = buf
593 return nil
594}

Callers

nothing calls this directly

Calls 5

uint64Method · 0.80
uint16Method · 0.80
uint32Method · 0.80
discardMethod · 0.80
readMethod · 0.80

Tested by

no test coverage detected