Index: uspace/lib/block/libblock.c
===================================================================
--- uspace/lib/block/libblock.c	(revision d7f624841a0c08361721eb84bf90ec759b099d68)
+++ uspace/lib/block/libblock.c	(revision 08cba4b8a94988e64d6efb79b32a3f28694a26e9)
@@ -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)
Index: uspace/lib/block/libblock.h
===================================================================
--- uspace/lib/block/libblock.h	(revision d7f624841a0c08361721eb84bf90ec759b099d68)
+++ uspace/lib/block/libblock.h	(revision 08cba4b8a94988e64d6efb79b32a3f28694a26e9)
@@ -97,4 +97,17 @@
 };
 
+typedef struct {
+	uint16_t size;
+	uint8_t first_session;
+	uint8_t last_session;
+	
+	uint8_t res0;
+	uint8_t adr_ctrl;
+	uint8_t first_track;
+	uint8_t res1;
+	
+	uint32_t first_lba;
+} __attribute__((packed)) toc_block_t;
+
 extern int block_init(exch_mgmt_t, service_id_t, size_t);
 extern void block_fini(service_id_t);
@@ -114,5 +127,5 @@
 extern int block_get_bsize(service_id_t, size_t *);
 extern int block_get_nblocks(service_id_t, aoff64_t *);
-extern int block_get_toc(service_id_t, uint8_t, void *);
+extern toc_block_t *block_get_toc(service_id_t, uint8_t);
 extern int block_read_direct(service_id_t, aoff64_t, size_t, void *);
 extern int block_read_bytes_direct(service_id_t, aoff64_t, size_t, void *);
@@ -123,3 +136,2 @@
 /** @}
  */
-
