示例#1
0
func readBlock(file file.BlockDevice, key int64) (blk *block, err error) {
	bytes, err := file.ReadBlock(key)
	if err != nil {
		return nil, err
	}
	return load_block(key, bytes), err
}
示例#2
0
func load_list_block(file file.BlockDevice, key int64) (self *list_block, err error) {
	bytes, err := file.ReadBlock(key)
	if err != nil {
		return nil, err
	}
	data := bytes[LIST_HEADER_LEN:]
	header := load_list_header(bytes)
	self = &list_block{
		file:   file,
		key:    key,
		bytes:  bytes,
		data:   data,
		header: header,
	}
	return self, nil
}