Index: uspace/srv/fs/fat/fat.h
===================================================================
--- uspace/srv/fs/fat/fat.h	(revision e17d9864c53f11ebc53e09dd580c296a05be77d4)
+++ uspace/srv/fs/fat/fat.h	(revision cb682eb07450f342db8202b36326ce2d82c4b5fe)
@@ -51,5 +51,5 @@
 #define BS_SIZE			512
 
-typedef struct {
+typedef struct fat_bs {
 	uint8_t		ji[3];		/**< Jump instruction. */
 	uint8_t		oem_name[8];
Index: uspace/srv/fs/fat/fat_fat.c
===================================================================
--- uspace/srv/fs/fat/fat_fat.c	(revision e17d9864c53f11ebc53e09dd580c296a05be77d4)
+++ uspace/srv/fs/fat/fat_fat.c	(revision cb682eb07450f342db8202b36326ce2d82c4b5fe)
@@ -47,7 +47,7 @@
 
 block_t *
-_fat_block_get(dev_handle_t dev_handle, fat_cluster_t firstc, off_t offset)
-{
-	block_t *bb;
+_fat_block_get(fat_bs_t *bs, dev_handle_t dev_handle, fat_cluster_t firstc,
+    off_t offset)
+{
 	block_t *b;
 	unsigned bps;
@@ -63,12 +63,10 @@
 	unsigned i;
 
-	bb = block_get(dev_handle, BS_BLOCK, BS_SIZE);
-	bps = uint16_t_le2host(FAT_BS(bb)->bps);
-	spc = FAT_BS(bb)->spc;
-	rscnt = uint16_t_le2host(FAT_BS(bb)->rscnt);
-	fatcnt = FAT_BS(bb)->fatcnt;
-	rde = uint16_t_le2host(FAT_BS(bb)->root_ent_max);
-	sf = uint16_t_le2host(FAT_BS(bb)->sec_per_fat);
-	block_put(bb);
+	bps = uint16_t_le2host(bs->bps);
+	spc = bs->spc;
+	rscnt = uint16_t_le2host(bs->rscnt);
+	fatcnt = bs->fatcnt;
+	rde = uint16_t_le2host(bs->root_ent_max);
+	sf = uint16_t_le2host(bs->sec_per_fat);
 
 	rds = (sizeof(fat_dentry_t) * rde) / bps;
@@ -107,4 +105,5 @@
 /** Return number of blocks allocated to a file.
  *
+ * @param bs		Buffer holding the boot sector for the file.
  * @param dev_handle	Device handle of the device with the file.
  * @param firstc	First cluster of the file.
@@ -115,8 +114,7 @@
  */
 uint16_t 
-_fat_blcks_get(dev_handle_t dev_handle, fat_cluster_t firstc,
+_fat_blcks_get(fat_bs_t *bs, dev_handle_t dev_handle, fat_cluster_t firstc,
     fat_cluster_t *lastc)
 {
-	block_t *bb;
 	block_t *b;
 	unsigned bps;
@@ -126,9 +124,7 @@
 	fat_cluster_t clst = firstc;
 
-	bb = block_get(dev_handle, BS_BLOCK, BS_SIZE);
-	bps = uint16_t_le2host(FAT_BS(bb)->bps);
-	spc = FAT_BS(bb)->spc;
-	rscnt = uint16_t_le2host(FAT_BS(bb)->rscnt);
-	block_put(bb);
+	bps = uint16_t_le2host(bs->bps);
+	spc = bs->spc;
+	rscnt = uint16_t_le2host(bs->rscnt);
 
 	if (firstc == FAT_CLST_RES0) {
@@ -161,19 +157,7 @@
 }
 
-uint16_t fat_bps_get(dev_handle_t dev_handle)
-{
-	block_t *bb;
-	uint16_t bps;
-	
-	bb = block_get(dev_handle, BS_BLOCK, BS_SIZE);
-	assert(bb != NULL);
-	bps = uint16_t_le2host(FAT_BS(bb)->bps);
-	block_put(bb);
-
-	return bps;
-}
-
 /** Fill the gap between EOF and a new file position.
  *
+ * @param bs		Buffer holding the boot sector for nodep.
  * @param nodep		FAT node with the gap.
  * @param mcl		First cluster in an independent cluster chain that will
@@ -183,15 +167,13 @@
  * @param pos		Position in the last node block.
  */
-void fat_fill_gap(fat_node_t *nodep, fat_cluster_t mcl, off_t pos)
+void fat_fill_gap(fat_bs_t *bs, fat_node_t *nodep, fat_cluster_t mcl, off_t pos)
 {
 	uint16_t bps;
 	unsigned spc;
-	block_t *bb, *b;
+	block_t *b;
 	off_t o, boundary;
 
-	bb = block_get(nodep->idx->dev_handle, BS_BLOCK, BS_SIZE);
-	bps = uint16_t_le2host(FAT_BS(bb)->bps);
-	spc = FAT_BS(bb)->spc;
-	block_put(bb);
+	bps = uint16_t_le2host(bs->bps);
+	spc = bs->spc;
 	
 	boundary = ROUND_UP(nodep->size, bps * spc);
@@ -200,5 +182,5 @@
 	for (o = nodep->size - 1; o < pos && o < boundary;
 	    o = ALIGN_DOWN(o + bps, bps)) {
-		b = fat_block_get(nodep, o / bps);
+		b = fat_block_get(bs, nodep, o / bps);
 		memset(b->data + o % bps, 0, bps - o % bps);
 		b->dirty = true;		/* need to sync node */
@@ -211,5 +193,5 @@
 	/* zero out the initial part of the new cluster chain */
 	for (o = boundary; o < pos; o += bps) {
-		b = _fat_block_get(nodep->idx->dev_handle, mcl,
+		b = _fat_block_get(bs, nodep->idx->dev_handle, mcl,
 		    (o - boundary) / bps);
 		memset(b->data, 0, min(bps, pos - o));
@@ -220,45 +202,35 @@
 
 void
-fat_mark_cluster(dev_handle_t dev_handle, unsigned fatno, fat_cluster_t clst,
-    fat_cluster_t value)
-{
-	block_t *bb, *blk;
+fat_mark_cluster(fat_bs_t *bs, dev_handle_t dev_handle, unsigned fatno,
+    fat_cluster_t clst, fat_cluster_t value)
+{
+	block_t *b;
 	uint16_t bps;
 	uint16_t rscnt;
 	uint16_t sf;
-	uint8_t fatcnt;
 	fat_cluster_t *cp;
 
-	bb = block_get(dev_handle, BS_BLOCK, BS_SIZE);
-	bps = uint16_t_le2host(FAT_BS(bb)->bps);
-	rscnt = uint16_t_le2host(FAT_BS(bb)->rscnt);
-	sf = uint16_t_le2host(FAT_BS(bb)->sec_per_fat);
-	fatcnt = FAT_BS(bb)->fatcnt;
-	block_put(bb);
-
-	assert(fatno < fatcnt);
-	blk = block_get(dev_handle, rscnt + sf * fatno +
+	bps = uint16_t_le2host(bs->bps);
+	rscnt = uint16_t_le2host(bs->rscnt);
+	sf = uint16_t_le2host(bs->sec_per_fat);
+
+	assert(fatno < bs->fatcnt);
+	b = block_get(dev_handle, rscnt + sf * fatno +
 	    (clst * sizeof(fat_cluster_t)) / bps, bps);
-	cp = (fat_cluster_t *)blk->data + clst % (bps / sizeof(fat_cluster_t));
+	cp = (fat_cluster_t *)b->data + clst % (bps / sizeof(fat_cluster_t));
 	*cp = host2uint16_t_le(value);
-	blk->dirty = true;		/* need to sync block */
-	block_put(blk);
-}
-
-void fat_alloc_shadow_clusters(dev_handle_t dev_handle, fat_cluster_t *lifo,
-    unsigned nclsts)
-{
-	uint8_t fatcnt;
+	b->dirty = true;		/* need to sync block */
+	block_put(b);
+}
+
+void fat_alloc_shadow_clusters(fat_bs_t *bs, dev_handle_t dev_handle,
+    fat_cluster_t *lifo, unsigned nclsts)
+{
 	uint8_t fatno;
 	unsigned c;
-	block_t *bb;
-
-	bb = block_get(dev_handle, BS_BLOCK, BS_SIZE);
-	fatcnt = FAT_BS(bb)->fatcnt;
-	block_put(bb);
-	
-	for (fatno = FAT1 + 1; fatno < fatcnt; fatno++) {
+
+	for (fatno = FAT1 + 1; fatno < bs->fatcnt; fatno++) {
 		for (c = 0; c < nclsts; c++) {
-			fat_mark_cluster(dev_handle, fatno, lifo[c],
+			fat_mark_cluster(bs, dev_handle, fatno, lifo[c],
 			    c == 0 ? FAT_CLST_LAST1 : lifo[c - 1]);
 		}
@@ -267,11 +239,11 @@
 
 int
-fat_alloc_clusters(dev_handle_t dev_handle, unsigned nclsts, fat_cluster_t *mcl,
-    fat_cluster_t *lcl)
+fat_alloc_clusters(fat_bs_t *bs, dev_handle_t dev_handle, unsigned nclsts,
+    fat_cluster_t *mcl, fat_cluster_t *lcl)
 {
 	uint16_t bps;
 	uint16_t rscnt;
 	uint16_t sf;
-	block_t *bb, *blk;
+	block_t *blk;
 	fat_cluster_t *lifo;	/* stack for storing free cluster numbers */ 
 	unsigned found = 0;	/* top of the free cluster number stack */
@@ -282,9 +254,7 @@
 		return ENOMEM;
 	
-	bb = block_get(dev_handle, BS_BLOCK, BS_SIZE);
-	bps = uint16_t_le2host(FAT_BS(bb)->bps);
-	rscnt = uint16_t_le2host(FAT_BS(bb)->rscnt);
-	sf = uint16_t_le2host(FAT_BS(bb)->sec_per_fat);
-	block_put(bb);
+	bps = uint16_t_le2host(bs->bps);
+	rscnt = uint16_t_le2host(bs->rscnt);
+	sf = uint16_t_le2host(bs->sec_per_fat);
 	
 	/*
@@ -309,6 +279,6 @@
 					block_put(blk);
 					/* update the shadow copies of FAT */
-					fat_alloc_shadow_clusters(dev_handle,
-					    lifo, nclsts);
+					fat_alloc_shadow_clusters(bs,
+					    dev_handle, lifo, nclsts);
 					*mcl = lifo[found - 1];
 					*lcl = lifo[0];
@@ -325,6 +295,8 @@
 	 * we have allocated so far.
 	 */
-	while (found--)
-		fat_mark_cluster(dev_handle, FAT1, lifo[found], FAT_CLST_RES0);
+	while (found--) {
+		fat_mark_cluster(bs, dev_handle, FAT1, lifo[found],
+		    FAT_CLST_RES0);
+	}
 	
 	free(lifo);
@@ -332,11 +304,11 @@
 }
 
-void fat_append_clusters(fat_node_t *nodep, fat_cluster_t mcl)
-{
-	block_t *bb;
+void fat_append_clusters(fat_bs_t *bs, fat_node_t *nodep, fat_cluster_t mcl)
+{
+	dev_handle_t dev_handle = nodep->idx->dev_handle;
 	fat_cluster_t lcl;
-	uint8_t fatcnt, fatno;
-
-	if (_fat_blcks_get(nodep->idx->dev_handle, nodep->firstc, &lcl) == 0) {
+	uint8_t fatno;
+
+	if (_fat_blcks_get(bs, dev_handle, nodep->firstc, &lcl) == 0) {
 		nodep->firstc = host2uint16_t_le(mcl);
 		nodep->dirty = true;		/* need to sync node */
@@ -344,10 +316,6 @@
 	}
 
-	bb = block_get(nodep->idx->dev_handle, BS_BLOCK, BS_SIZE);
-	fatcnt = FAT_BS(bb)->fatcnt;
-	block_put(bb);
-
-	for (fatno = FAT1; fatno < fatcnt; fatno++)
-		fat_mark_cluster(nodep->idx->dev_handle, fatno, lcl, mcl);
+	for (fatno = FAT1; fatno < bs->fatcnt; fatno++)
+		fat_mark_cluster(bs, nodep->idx->dev_handle, fatno, lcl, mcl);
 }
 
Index: uspace/srv/fs/fat/fat_fat.h
===================================================================
--- uspace/srv/fs/fat/fat_fat.h	(revision e17d9864c53f11ebc53e09dd580c296a05be77d4)
+++ uspace/srv/fs/fat/fat_fat.h	(revision cb682eb07450f342db8202b36326ce2d82c4b5fe)
@@ -51,25 +51,29 @@
 #define FAT_CLST_ROOT		FAT_CLST_RES1
 
-
 /* forward declarations */
 struct block;
 struct fat_node;
+struct fat_bs;
 
 typedef uint16_t fat_cluster_t;
 
-#define fat_block_get(np, off) \
-    _fat_block_get((np)->idx->dev_handle, (np)->firstc, (off))
+#define fat_block_get(bs, np, off) \
+    _fat_block_get((bs), (np)->idx->dev_handle, (np)->firstc, (off))
     
-extern struct block *_fat_block_get(dev_handle_t, fat_cluster_t, off_t);
-extern uint16_t _fat_blcks_get(dev_handle_t, fat_cluster_t, fat_cluster_t *);
-extern uint16_t fat_bps_get(dev_handle_t);
+extern struct block *_fat_block_get(struct fat_bs *, dev_handle_t,
+    fat_cluster_t, off_t);
+extern uint16_t _fat_blcks_get(struct fat_bs *, dev_handle_t, fat_cluster_t,
+    fat_cluster_t *);
   
-extern void fat_append_clusters(struct fat_node *, fat_cluster_t);
-extern int fat_alloc_clusters(dev_handle_t, unsigned, fat_cluster_t *,
-    fat_cluster_t *);
-extern void fat_alloc_shadow_clusters(dev_handle_t, fat_cluster_t *, unsigned);
-extern void fat_mark_cluster(dev_handle_t, unsigned, fat_cluster_t,
+extern void fat_append_clusters(struct fat_bs *, struct fat_node *,
     fat_cluster_t);
-extern void fat_fill_gap(struct fat_node *, fat_cluster_t, off_t);
+extern int fat_alloc_clusters(struct fat_bs *, dev_handle_t, unsigned,
+    fat_cluster_t *, fat_cluster_t *);
+extern void fat_alloc_shadow_clusters(struct fat_bs *, dev_handle_t,
+    fat_cluster_t *, unsigned);
+extern void fat_mark_cluster(struct fat_bs *, dev_handle_t, unsigned,
+    fat_cluster_t, fat_cluster_t);
+extern void fat_fill_gap(struct fat_bs *, struct fat_node *, fat_cluster_t,
+    off_t);
 
 #endif
Index: uspace/srv/fs/fat/fat_ops.c
===================================================================
--- uspace/srv/fs/fat/fat_ops.c	(revision e17d9864c53f11ebc53e09dd580c296a05be77d4)
+++ uspace/srv/fs/fat/fat_ops.c	(revision cb682eb07450f342db8202b36326ce2d82c4b5fe)
@@ -126,5 +126,5 @@
 static void *fat_node_get_core(fat_idx_t *idxp)
 {
-	block_t *b;
+	block_t *bb, *b;
 	fat_dentry_t *d;
 	fat_node_t *nodep = NULL;
@@ -179,9 +179,10 @@
 	fat_node_initialize(nodep);
 
-	bps = fat_bps_get(idxp->dev_handle);
+	bb = block_get(idxp->dev_handle, BS_BLOCK, BS_SIZE);
+	bps = uint16_t_le2host(FAT_BS(bb)->bps);
 	dps = bps / sizeof(fat_dentry_t);
 
 	/* Read the block that contains the dentry of interest. */
-	b = _fat_block_get(idxp->dev_handle, idxp->pfc,
+	b = _fat_block_get(bb->data, idxp->dev_handle, idxp->pfc,
 	    (idxp->pdi * sizeof(fat_dentry_t)) / bps);
 	assert(b);
@@ -200,5 +201,5 @@
 		 * size of the directory by walking the FAT.
 		 */
-		nodep->size = bps * _fat_blcks_get(idxp->dev_handle,
+		nodep->size = bps * _fat_blcks_get(bb->data, idxp->dev_handle,
 		    uint16_t_le2host(d->firstc), NULL);
 	} else {
@@ -211,4 +212,5 @@
 
 	block_put(b);
+	block_put(bb);
 
 	/* Link the idx structure with the node structure. */
@@ -276,8 +278,9 @@
 	unsigned blocks;
 	fat_dentry_t *d;
-	block_t *b;
+	block_t *bb, *b;
 
 	futex_down(&parentp->idx->lock);
-	bps = fat_bps_get(parentp->idx->dev_handle);
+	bb = block_get(parentp->idx->dev_handle, BS_BLOCK, BS_SIZE);
+	bps = uint16_t_le2host(FAT_BS(bb)->bps);
 	dps = bps / sizeof(fat_dentry_t);
 	blocks = parentp->size / bps + (parentp->size % bps != 0);
@@ -285,5 +288,5 @@
 		unsigned dentries;
 		
-		b = fat_block_get(parentp, i);
+		b = fat_block_get(bb->data, parentp, i);
 		dentries = (i == blocks - 1) ?
 		    parentp->size % sizeof(fat_dentry_t) :
@@ -296,4 +299,5 @@
 			case FAT_DENTRY_LAST:
 				block_put(b);
+				block_put(bb);
 				futex_up(&parentp->idx->lock);
 				return NULL;
@@ -322,4 +326,5 @@
 					 */
 					block_put(b);
+					block_put(bb);
 					return NULL;
 				}
@@ -327,4 +332,5 @@
 				futex_up(&idx->lock);
 				block_put(b);
+				block_put(bb);
 				return node;
 			}
@@ -332,4 +338,6 @@
 		block_put(b);
 	}
+	block_put(bb);
+
 	futex_up(&parentp->idx->lock);
 	return NULL;
@@ -360,5 +368,5 @@
 	unsigned dps;
 	unsigned blocks;
-	block_t *b;
+	block_t *bb, *b;
 	unsigned i, j;
 
@@ -367,5 +375,6 @@
 
 	futex_down(&nodep->idx->lock);
-	bps = fat_bps_get(nodep->idx->dev_handle);
+	bb = block_get(nodep->idx->dev_handle, BS_BLOCK, BS_SIZE);
+	bps = uint16_t_le2host(FAT_BS(bb)->bps);
 	dps = bps / sizeof(fat_dentry_t);
 
@@ -376,5 +385,5 @@
 		fat_dentry_t *d;
 	
-		b = fat_block_get(nodep, i);
+		b = fat_block_get(bb->data, nodep, i);
 		dentries = (i == blocks - 1) ?
 		    nodep->size % sizeof(fat_dentry_t) :
@@ -387,4 +396,5 @@
 			case FAT_DENTRY_LAST:
 				block_put(b);
+				block_put(bb);
 				futex_up(&nodep->idx->lock);
 				return false;
@@ -392,8 +402,10 @@
 			case FAT_DENTRY_VALID:
 				block_put(b);
+				block_put(bb);
 				futex_up(&nodep->idx->lock);
 				return true;
 			}
 			block_put(b);
+			block_put(bb);
 			futex_up(&nodep->idx->lock);
 			return true;
@@ -401,4 +413,5 @@
 		block_put(b);
 	}
+	block_put(bb);
 
 	futex_up(&nodep->idx->lock);
@@ -553,7 +566,7 @@
 	off_t pos = (off_t)IPC_GET_ARG3(*request);
 	fat_node_t *nodep = (fat_node_t *)fat_node_get(dev_handle, index);
-	uint16_t bps = fat_bps_get(dev_handle);
+	uint16_t bps;
 	size_t bytes;
-	block_t *b;
+	block_t *bb, *b;
 
 	if (!nodep) {
@@ -570,4 +583,7 @@
 		return;
 	}
+
+	bb = block_get(dev_handle, BS_BLOCK, BS_SIZE);
+	bps = uint16_t_le2host(FAT_BS(bb)->bps);
 
 	if (nodep->type == FAT_FILE) {
@@ -578,5 +594,5 @@
 		 */
 		bytes = min(len, bps - pos % bps);
-		b = fat_block_get(nodep, pos / bps);
+		b = fat_block_get(bb->data, nodep, pos / bps);
 		(void) ipc_data_read_finalize(callid, b->data + pos % bps,
 		    bytes);
@@ -602,5 +618,5 @@
 			off_t o;
 
-			b = fat_block_get(nodep, bnum);
+			b = fat_block_get(bb->data, nodep, bnum);
 			for (o = pos % (bps / sizeof(fat_dentry_t));
 			    o < bps / sizeof(fat_dentry_t);
@@ -625,4 +641,5 @@
 miss:
 		fat_node_put(nodep);
+		block_put(bb);
 		ipc_answer_0(callid, ENOENT);
 		ipc_answer_1(rid, ENOENT, 0);
@@ -634,4 +651,5 @@
 
 	fat_node_put(nodep);
+	block_put(bb);
 	ipc_answer_1(rid, EOK, (ipcarg_t)bytes);
 }
@@ -682,5 +700,4 @@
 	bps = uint16_t_le2host(FAT_BS(bb)->bps);
 	spc = FAT_BS(bb)->spc;
-	block_put(bb);
 	
 	boundary = ROUND_UP(nodep->size, bps * spc);
@@ -692,6 +709,6 @@
 		 * next block size boundary.
 		 */
-		fat_fill_gap(nodep, FAT_CLST_RES0, pos);
-		b = fat_block_get(nodep, pos / bps);
+		fat_fill_gap(bb->data, nodep, FAT_CLST_RES0, pos);
+		b = fat_block_get(bb->data, nodep, pos / bps);
 		(void) ipc_data_write_finalize(callid, b->data + pos % bps,
 		    bytes);
@@ -703,4 +720,5 @@
 		}
 		fat_node_put(nodep);
+		block_put(bb);
 		ipc_answer_1(rid, EOK, bytes);	
 		return;
@@ -717,8 +735,10 @@
 		    bps * spc;
 		/* create an independent chain of nclsts clusters in all FATs */
-		status = fat_alloc_clusters(dev_handle, nclsts, &mcl, &lcl);
+		status = fat_alloc_clusters(bb->data, dev_handle, nclsts, &mcl,
+		    &lcl);
 		if (status != EOK) {
 			/* could not allocate a chain of nclsts clusters */
 			fat_node_put(nodep);
+			block_put(bb);
 			ipc_answer_0(callid, status);
 			ipc_answer_0(rid, status);
@@ -726,6 +746,7 @@
 		}
 		/* zero fill any gaps */
-		fat_fill_gap(nodep, mcl, pos);
-		b = _fat_block_get(dev_handle, lcl, (pos / bps) % spc);
+		fat_fill_gap(bb->data, nodep, mcl, pos);
+		b = _fat_block_get(bb->data, dev_handle, lcl,
+		    (pos / bps) % spc);
 		(void) ipc_data_write_finalize(callid, b->data + pos % bps,
 		    bytes);
@@ -736,8 +757,9 @@
 		 * node's cluster chain.
 		 */
-		fat_append_clusters(nodep, mcl);
+		fat_append_clusters(bb->data, nodep, mcl);
 		nodep->size = pos + bytes;
 		nodep->dirty = true;		/* need to sync node */
 		fat_node_put(nodep);
+		block_put(bb);
 		ipc_answer_1(rid, EOK, bytes);
 		return;
