+ return kblock_flush(b) | b->priv.vt->close(b);
+}
+
+/**
+ * \return true if the device \a b is buffered, false otherwise.
+ * \param b KBlock device.
+ * \sa kblock_cachedBlock(), kblock_cacheDirty().
+ */
+INLINE bool kblock_buffered(struct KBlock *b)
+{
+ ASSERT(b);
+ return (b->priv.flags & KB_BUFFERED);
+}
+
+
+/**
+ * \return The current cached block number if the device is buffered.
+ * \param b KBlock device.
+ * \note This function will throw an ASSERT if called on a non buffered KBlock.
+ * \sa kblock_buffered(), kblock_cacheDirty().
+ */
+INLINE block_idx_t kblock_cachedBlock(struct KBlock *b)
+{
+ ASSERT(kblock_buffered(b));
+ return b->priv.curr_blk;
+}
+
+
+/**
+ * Return the status of the internal cache.
+ *
+ * \param b KBlock device.
+ * \return If the device supports buffering, returns true if the cache is dirty,
+ * false if the cache is clean and coherent with device content.
+ * \note This function will throw an ASSERT if called on a non buffered KBlock.
+ * \sa kblock_cachedBlock(), kblock_buffered().
+ */
+INLINE bool kblock_cacheDirty(struct KBlock *b)
+{
+ ASSERT(kblock_buffered(b));
+ return kblock_buffered(b) && (b->priv.flags & KB_CACHE_DIRTY);