Index: uspace/lib/block/libblock.c
===================================================================
--- uspace/lib/block/libblock.c	(revision 7a72ce1ab265026a13cd7dddf26ba40f3ffa652a)
+++ uspace/lib/block/libblock.c	(revision 26e7d6da331e8d35b5e83880a9740de5e9e4bd99)
@@ -93,5 +93,4 @@
 static int get_block_size(async_sess_t *, size_t *);
 static int get_num_blocks(async_sess_t *, aoff64_t *);
-static int read_toc(async_sess_t *, uint8_t);
 static aoff64_t ba_ltop(devcon_t *, aoff64_t);
 
@@ -896,24 +895,35 @@
  * @param service_id Service ID of the block device.
  * @param session    Starting session.
- * @param data       Buffer to read TOC into.
- *
- * @return EOK on success.
- * @return Error code on failure.
- *
- */
-int block_get_toc(service_id_t service_id, uint8_t session, void *data)
+ *
+ * @return Allocated TOC structure.
+ * @return NULL on failure.
+ *
+ */
+toc_block_t *block_get_toc(service_id_t service_id, uint8_t session)
 {
 	devcon_t *devcon = devcon_search(service_id);
 	assert(devcon);
 	
+	toc_block_t *toc = NULL;
+	
 	fibril_mutex_lock(&devcon->comm_area_lock);
 	
-	int rc = read_toc(devcon->sess, session);
-	if (rc == EOK)
-		memcpy(data, devcon->comm_area, devcon->pblock_size);
+	async_exch_t *exch = async_exchange_begin(devcon->sess);
+	int rc = async_req_1_0(exch, BD_READ_TOC, session);
+	async_exchange_end(exch);
+	
+	if (rc == EOK) {
+		toc = (toc_block_t *) malloc(sizeof(toc_block_t));
+		if (toc != NULL) {
+			memset(toc, 0, sizeof(toc_block_t));
+			memcpy(toc, devcon->comm_area,
+			    min(devcon->pblock_size, sizeof(toc_block_t)));
+		}
+	}
+	
 	
 	fibril_mutex_unlock(&devcon->comm_area_lock);
 	
-	return rc;
+	return toc;
 }
 
@@ -1008,14 +1018,4 @@
 }
 
-/** Get TOC from block device. */
-static int read_toc(async_sess_t *sess, uint8_t session)
-{
-	async_exch_t *exch = async_exchange_begin(sess);
-	int rc = async_req_1_0(exch, BD_READ_TOC, session);
-	async_exchange_end(exch);
-
-	return rc;
-}
-
 /** Convert logical block address to physical block address. */
 static aoff64_t ba_ltop(devcon_t *devcon, aoff64_t lba)
