Index: uspace/lib/label/src/gpt.c
===================================================================
--- uspace/lib/label/src/gpt.c	(revision 6a66923cb1c677426a3e4763010f7be9d81a0449)
+++ uspace/lib/label/src/gpt.c	(revision 9e7615d35069136ff63e031e297b82ddbd2e00b0)
@@ -35,5 +35,4 @@
 
 #include <adt/checksum.h>
-#include <block.h>
 #include <byteorder.h>
 #include <errno.h>
@@ -47,6 +46,6 @@
 #include "gpt.h"
 
-static int gpt_open(service_id_t, label_t **);
-static int gpt_create(service_id_t, label_t **);
+static int gpt_open(label_bd_t *, label_t **);
+static int gpt_create(label_bd_t *, label_t **);
 static void gpt_close(label_t *);
 static int gpt_destroy(label_t *);
@@ -71,6 +70,6 @@
 static int gpt_hdr_get_crc(gpt_header_t *, size_t, uint32_t *);
 
-static int gpt_pmbr_create(service_id_t, size_t, uint64_t);
-static int gpt_pmbr_destroy(service_id_t, size_t);
+static int gpt_pmbr_create(label_bd_t *, size_t, uint64_t);
+static int gpt_pmbr_destroy(label_bd_t *, size_t);
 
 const uint8_t efi_signature[8] = {
@@ -93,5 +92,5 @@
 };
 
-static int gpt_open(service_id_t sid, label_t **rlabel)
+static int gpt_open(label_bd_t *bd, label_t **rlabel)
 {
 	label_t *label = NULL;
@@ -118,5 +117,5 @@
 	etable[1] = NULL;
 
-	rc = block_get_bsize(sid, &bsize);
+	rc = bd->ops->get_bsize(bd->arg, &bsize);
 	if (rc != EOK) {
 		rc = EIO;
@@ -141,5 +140,5 @@
 	}
 
-	rc = block_read_direct(sid, gpt_hdr_ba, 1, gpt_hdr[0]);
+	rc = bd->ops->read(bd->arg, gpt_hdr_ba, 1, gpt_hdr[0]);
 	if (rc != EOK) {
 		rc = EIO;
@@ -149,5 +148,5 @@
 	h1ba = uint64_t_le2host(gpt_hdr[0]->alternate_lba);
 
-	rc = block_read_direct(sid, h1ba, 1, gpt_hdr[1]);
+	rc = bd->ops->read(bd->arg, h1ba, 1, gpt_hdr[1]);
 	if (rc != EOK) {
 		rc = EIO;
@@ -277,5 +276,5 @@
 		}
 
-		rc = block_read_direct(sid, ptba[j], pt_blocks / 2, etable[j]);
+		rc = bd->ops->read(bd->arg, ptba[j], pt_blocks / 2, etable[j]);
 		if (rc != EOK) {
 			rc = EIO;
@@ -308,5 +307,5 @@
 	label->ops = &gpt_label_ops;
 	label->ltype = lt_gpt;
-	label->svc_id = sid;
+	label->bd = *bd;
 	label->ablock0 = ba_min;
 	label->anblocks = ba_max - ba_min + 1;
@@ -334,5 +333,5 @@
 }
 
-static int gpt_create(service_id_t sid, label_t **rlabel)
+static int gpt_create(label_bd_t *bd, label_t **rlabel)
 {
 	label_t *label = NULL;
@@ -353,5 +352,5 @@
 	int rc;
 
-	rc = block_get_bsize(sid, &bsize);
+	rc = bd->ops->get_bsize(bd->arg, &bsize);
 	if (rc != EOK) {
 		rc = EIO;
@@ -364,5 +363,5 @@
 	}
 
-	rc = block_get_nblocks(sid, &nblocks);
+	rc = bd->ops->get_nblocks(bd->arg, &nblocks);
 	if (rc != EOK) {
 		rc = EIO;
@@ -380,5 +379,5 @@
 	}
 
-	rc = gpt_pmbr_create(sid, bsize, nblocks);
+	rc = gpt_pmbr_create(bd, bsize, nblocks);
 	if (rc != EOK) {
 		rc = EIO;
@@ -405,5 +404,5 @@
 		}
 
-		rc = block_write_direct(sid, ptba[i], pt_blocks, etable);
+		rc = bd->ops->write(bd->arg, ptba[i], pt_blocks, etable);
 		if (rc != EOK) {
 			rc = EIO;
@@ -440,5 +439,5 @@
 		gpt_hdr_compute_crc(gpt_hdr, sizeof(gpt_header_t));
 
-		rc = block_write_direct(sid, hdr_ba[i], 1, gpt_hdr);
+		rc = bd->ops->write(bd->arg, hdr_ba[i], 1, gpt_hdr);
 		if (rc != EOK) {
 			rc = EIO;
@@ -460,5 +459,5 @@
 	label->ops = &gpt_label_ops;
 	label->ltype = lt_gpt;
-	label->svc_id = sid;
+	label->bd = *bd;
 	label->ablock0 = ba_min;
 	label->anblocks = ba_max - ba_min + 1;
@@ -520,5 +519,5 @@
 		}
 
-		rc = block_write_direct(label->svc_id, label->lt.gpt.hdr_ba[i],
+		rc = label->bd.ops->write(label->bd.arg, label->lt.gpt.hdr_ba[i],
 		    1, gpt_hdr);
 		if (rc != EOK) {
@@ -537,5 +536,5 @@
 		}
 
-		rc = block_write_direct(label->svc_id,
+		rc = label->bd.ops->write(label->bd.arg,
 		    label->lt.gpt.ptable_ba[i], label->lt.gpt.pt_blocks,
 		    etable);
@@ -549,5 +548,5 @@
 	}
 
-	rc = gpt_pmbr_destroy(label->svc_id, label->block_size);
+	rc = gpt_pmbr_destroy(&label->bd, label->block_size);
 	if (rc != EOK)
 		goto error;
@@ -871,5 +870,5 @@
 		nblocks = label->lt.gpt.pt_blocks;
 
-		rc = block_read_direct(label->svc_id, ba, nblocks, buf);
+		rc = label->bd.ops->read(label->bd.arg, ba, nblocks, buf);
 		if (rc != EOK) {
 			rc = EIO;
@@ -888,5 +887,5 @@
 		*e = *pte;
 
-		rc = block_write_direct(label->svc_id, ba, nblocks, buf);
+		rc = label->bd.ops->write(label->bd.arg, ba, nblocks, buf);
 		if (rc != EOK) {
 			rc = EIO;
@@ -923,5 +922,5 @@
 
 	for (i = 0; i < 2; i++) {
-		rc = block_read_direct(label->svc_id,
+		rc = label->bd.ops->read(label->bd.arg,
 		    label->lt.gpt.hdr_ba[i], 1, gpt_hdr);
 		if (rc != EOK) {
@@ -933,5 +932,5 @@
 		gpt_hdr_compute_crc(gpt_hdr, label->lt.gpt.hdr_size);
 
-		rc = block_write_direct(label->svc_id,
+		rc = label->bd.ops->write(label->bd.arg,
 		    label->lt.gpt.hdr_ba[i], 1, gpt_hdr);
 		if (rc != EOK) {
@@ -940,7 +939,7 @@
 		}
 	}
-	
+
 	rc = EOK;
-	
+
 exit:
 	free(gpt_hdr);
@@ -974,5 +973,5 @@
 
 /** Create GPT Protective MBR */
-static int gpt_pmbr_create(service_id_t sid, size_t bsize, uint64_t nblocks)
+static int gpt_pmbr_create(label_bd_t *bd, size_t bsize, uint64_t nblocks)
 {
 	mbr_br_block_t *pmbr = NULL;
@@ -998,5 +997,5 @@
 	pmbr->signature = host2uint16_t_le(mbr_br_signature);
 
-	rc = block_write_direct(sid, mbr_ba, 1, pmbr);
+	rc = bd->ops->write(bd->arg, mbr_ba, 1, pmbr);
 	if (rc != EOK) {
 		rc = EIO;
@@ -1012,5 +1011,5 @@
 
 /** Destroy GPT Protective MBR */
-static int gpt_pmbr_destroy(service_id_t sid, size_t bsize)
+static int gpt_pmbr_destroy(label_bd_t *bd, size_t bsize)
 {
 	mbr_br_block_t *pmbr = NULL;
@@ -1023,5 +1022,5 @@
 	}
 
-	rc = block_write_direct(sid, mbr_ba, 1, pmbr);
+	rc = bd->ops->write(bd->arg, mbr_ba, 1, pmbr);
 	if (rc != EOK) {
 		rc = EIO;
