}
-
size_t kblock_read(struct KBlock *b, block_idx_t idx, void *buf, size_t offset, size_t size)
{
ASSERT(b);
}
+int kblock_trim(struct KBlock *b, block_idx_t start, block_idx_t count)
+{
+ ASSERT(start + count <= b->blk_cnt);
+
+ if (kblock_buffered(b))
+ {
+ if (!kblock_loadPage(b, start))
+ return EOF;
+ }
+
+ b->priv.blk_start += start;
+ b->priv.curr_blk = 0; // adjust logical address
+ b->blk_cnt = count;
+ return 0;
+}
+
+
size_t kblock_write(struct KBlock *b, block_idx_t idx, const void *buf, size_t offset, size_t size)
{
ASSERT(b);