Index: uspace/app/mkexfat/Makefile
===================================================================
--- uspace/app/mkexfat/Makefile	(revision 39aa8ced119bf7e09823acd7771b7350177a3149)
+++ uspace/app/mkexfat/Makefile	(revision 39aa8ced119bf7e09823acd7771b7350177a3149)
@@ -0,0 +1,37 @@
+#
+# Copyright (c) 2012 Maurizio Lombardi
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# - Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+# - Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in the
+#   documentation and/or other materials provided with the distribution.
+# - The name of the author may not be used to endorse or promote products
+#   derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+USPACE_PREFIX = ../..
+LIBS = $(LIBBLOCK_PREFIX)/libblock.a
+EXTRA_CFLAGS = -I$(LIBBLOCK_PREFIX)
+BINARY = mkexfat
+
+SOURCES = \
+	mkexfat.c
+
+include $(USPACE_PREFIX)/Makefile.common
Index: uspace/app/mkexfat/exfat.h
===================================================================
--- uspace/app/mkexfat/exfat.h	(revision 39aa8ced119bf7e09823acd7771b7350177a3149)
+++ uspace/app/mkexfat/exfat.h	(revision 39aa8ced119bf7e09823acd7771b7350177a3149)
@@ -0,0 +1,179 @@
+/*
+ * Copyright (c) 2010 Jiri Svoboda
+ * Copyright (c) 2012 Maurizio Lombardi
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup fs
+ * @{
+ */
+
+#include <sys/types.h>
+#include <stdint.h>
+#include <bool.h>
+
+#define EXFAT_FILENAME_LEN	255
+#define EXFAT_NAME_PART_LEN	15
+
+#define EXFAT_TYPE_UNUSED	0x00
+#define EXFAT_TYPE_USED		0x80
+#define EXFAT_TYPE_VOLLABEL	0x83
+#define EXFAT_TYPE_BITMAP	0x81
+#define EXFAT_TYPE_UCTABLE	0x82
+#define EXFAT_TYPE_GUID		0xA0
+#define EXFAT_TYPE_FILE		0x85
+#define EXFAT_TYPE_STREAM	0xC0
+#define EXFAT_TYPE_NAME		0xC1
+
+#define EXFAT_ATTR_RDONLY	0x01
+#define EXFAT_ATTR_HIDDEN	0x02
+#define EXFAT_ATTR_SYSTEM	0x04
+#define EXFAT_ATTR_SUBDIR	0x10
+#define EXFAT_ATTR_ARCHIVE	0x20
+
+
+/* All dentry structs should have 31 byte size */
+typedef struct {
+	uint8_t 	size;
+	uint16_t 	label[11];
+	uint8_t 	_reserved[8];
+} __attribute__ ((packed)) exfat_vollabel_dentry_t;
+
+typedef struct {
+	uint8_t 	flags;
+	uint8_t 	_reserved[18];
+	uint32_t 	firstc;
+	uint64_t 	size;
+} __attribute__ ((packed)) exfat_bitmap_dentry_t;
+
+typedef struct {
+	uint8_t 	_reserved1[3];
+	uint32_t 	checksum;
+	uint8_t 	_reserved2[12];
+	uint32_t 	firstc;
+	uint64_t 	size;
+} __attribute__ ((packed)) exfat_uctable_dentry_t;
+
+typedef struct {
+	uint8_t 	count; /* Always zero */ 
+	uint16_t 	checksum;
+	uint16_t 	flags;
+	uint8_t 	guid[16];
+	uint8_t 	_reserved[10];
+} __attribute__ ((packed)) exfat_guid_dentry_t;
+
+typedef struct {
+	uint8_t 	count;
+	uint16_t 	checksum;
+	uint16_t 	attr;
+	uint8_t 	_reserved1[2];
+	uint32_t 	ctime;
+	uint32_t 	mtime;
+	uint32_t 	atime;
+	uint8_t 	ctime_fine;
+	uint8_t 	mtime_fine;
+	uint8_t 	ctime_tz;
+	uint8_t 	mtime_tz;
+	uint8_t 	atime_tz;
+	uint8_t 	_reserved2[7];
+} __attribute__ ((packed)) exfat_file_dentry_t;
+
+typedef struct {
+	uint8_t 	flags;
+	uint8_t 	_reserved1[1];
+	uint8_t 	name_size;
+	uint16_t 	hash;
+	uint8_t 	_reserved2[2];
+	uint64_t 	valid_data_size;
+	uint8_t 	_reserved3[4];
+	uint32_t 	firstc;
+	uint64_t 	data_size;
+} __attribute__ ((packed)) exfat_stream_dentry_t;
+
+typedef struct {
+	uint8_t 	flags;
+	uint16_t 	name[EXFAT_NAME_PART_LEN];
+} __attribute__ ((packed)) exfat_name_dentry_t;
+
+
+typedef struct {
+	uint8_t type;
+	union {
+		exfat_vollabel_dentry_t	vollabel;
+		exfat_bitmap_dentry_t 	bitmap;
+		exfat_uctable_dentry_t 	uctable;
+		exfat_guid_dentry_t 	guid;
+		exfat_file_dentry_t 	file;
+		exfat_stream_dentry_t 	stream;
+		exfat_name_dentry_t 	name;
+	};
+} __attribute__ ((packed)) exfat_dentry_t;
+
+
+typedef enum {
+	EXFAT_DENTRY_SKIP,
+	EXFAT_DENTRY_LAST,
+	EXFAT_DENTRY_FREE,
+	EXFAT_DENTRY_VOLLABEL,
+	EXFAT_DENTRY_BITMAP,
+	EXFAT_DENTRY_UCTABLE,
+	EXFAT_DENTRY_GUID,
+	EXFAT_DENTRY_FILE,
+	EXFAT_DENTRY_STREAM,
+	EXFAT_DENTRY_NAME
+} exfat_dentry_clsf_t;
+
+
+typedef struct exfat_bs {
+	uint8_t jump[3];            /* 0x00 jmp and nop instructions */
+	uint8_t oem_name[8];        /* 0x03 "EXFAT   " */
+	uint8_t	__reserved[53];     /* 0x0B always 0 */
+	uint64_t volume_start;      /* 0x40 partition first sector */
+	uint64_t volume_count;      /* 0x48 partition sectors count */
+	uint32_t fat_sector_start;  /* 0x50 FAT first sector */
+	uint32_t fat_sector_count;  /* 0x54 FAT sectors count */
+	uint32_t data_start_sector; /* 0x58 Data region first cluster sector */
+	uint32_t data_clusters;     /* 0x5C total clusters count */
+	uint32_t rootdir_cluster;   /* 0x60 first cluster of the root dir */
+	uint32_t volume_serial;     /* 0x64 volume serial number */
+	struct {                    /* 0x68 FS version */
+		uint8_t minor;
+		uint8_t major;
+	} __attribute__ ((packed)) version;
+	uint16_t volume_flags;     /* 0x6A volume state flags */
+	uint8_t bytes_per_sector;  /* 0x6C sector size as (1 << n) */
+	uint8_t sec_per_cluster;   /* 0x6D sectors per cluster as (1 << n) */
+	uint8_t fat_count;         /* 0x6E always 1 */
+	uint8_t drive_no;          /* 0x6F always 0x80 */
+	uint8_t allocated_percent; /* 0x70 percentage of allocated space */
+	uint8_t _reserved2[7];     /* 0x71 reserved */
+	uint8_t bootcode[390];     /* Boot code */
+	uint16_t signature;        /* the value of 0xAA55 */
+} __attribute__((__packed__)) exfat_bs_t;
+
+/**
+ * @}
+ */
Index: uspace/app/mkexfat/mkexfat.c
===================================================================
--- uspace/app/mkexfat/mkexfat.c	(revision 39aa8ced119bf7e09823acd7771b7350177a3149)
+++ uspace/app/mkexfat/mkexfat.c	(revision 39aa8ced119bf7e09823acd7771b7350177a3149)
@@ -0,0 +1,169 @@
+/*
+ * Copyright (c) 2012 Maurizio Lombardi
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup fs
+ * @{
+ */
+
+/**
+ * @file	mkexfat.c
+ * @brief	Tool for creating new exFAT file systems.
+ *
+ */
+
+#include <stdio.h>
+#include <libblock.h>
+
+#define NAME    "mkexfat"
+
+/** First sector of the FAT */
+#define FAT_SECTOR_START 128
+
+/** Divide and round up. */
+#define div_round_up(a, b) (((a) + (b) - 1) / (b))
+
+typedef struct exfat_cfg {
+	uint64_t volume_start;
+	uint64_t volume_count;
+	uint32_t fat_sector_count;
+	uint32_t data_start_sector;
+	uint32_t data_cluster;
+	uint32_t rootdir_cluster;
+	unsigned bytes_per_sector;
+	unsigned sec_per_cluster;
+} exfat_cfg_t;
+
+static void usage(void)
+{
+	printf("Usage: mkexfat <device>\n");
+}
+
+/** Initialize the exFAT params structure.
+ *
+ * @param cfg Pointer to the exFAT params structure to initialize.
+ */
+static void
+cfg_params_initialize(exfat_cfg_t *cfg)
+{
+}
+
+/** Initialize the Volume Boot Record fields.
+ *
+ * @param vbr Pointer to the Volume Boot Record structure.
+ * @param cfg Pointer to the exFAT configuration structure.
+ */
+static void
+vbr_initialize(exfat_bs_t *vbr, exfat_cfg_t *cfg)
+{
+	/* Fill the structure with zeroes */
+	memset(vbr, 0, sizeof(exfat_bs_t));
+
+	/* Init Jump Boot section */
+	vbr->jump[0] = 0xEB;
+	vbr->jump[1] = 0x76;
+	vbr->jump[2] = 0x90;
+
+	/* Set the filesystem name */
+	memcpy(vbr->oem_name, "EXFAT   ", sizeof(vbr->oem_name));
+
+	vbr->volume_start = host2uint64_t_le(cfg->volume_start);
+	vbr->volume_count = host2uint64_t_le(cfg->volume_count);
+	vbr->fat_sector_start = host2uint32_t_le(FAT_SECTOR_START);
+	vbr->fat_sector_count = host2uint32_t_le(cfg->fat_sector_count);
+	vbr->version.major = 1;
+	vbr->version.minor = 0;
+	vbr->volume_flags = host2uint16_t_le(0);
+	vbr->bytes_per_sector = cfg->bytes_per_sectors;
+	vbr->sec_per_cluster = cfg->sec_per_cluster;
+	vbr->fat_count = 1;
+	vbr->drive_no = 0x80;
+	vbr->allocated_percent = 0;
+	vbr->signature = host2uint16_t_le(0xAA55);
+}
+
+int main (int argc, char **argv)
+{
+	exfat_cfg_t cfg;
+	aoff64_t dev_nblocks;
+	char *dev_path;
+	service_id_t service_id;
+	size_t sector_size;
+	int rc;
+
+	if (argc < 2) {
+		printf(NAME ": Error, argument missing\n");
+		usage();
+		return 1;
+	}
+
+	/* The fist sector of the partition is zero */
+	cfg.volume_start = 0;
+
+	/* TODO: Add parameters */
+
+	++argv;
+	dev_path = *argv;
+
+	printf(NAME ": Device = %s\n", dev_path);
+
+	rc = loc_service_get_id(dev_path, &service_id, 0);
+	if (rc != EOK) {
+		printf(NAME ": Error resolving device `%s'.\n");
+		return 2;
+	}
+
+	rc = block_init(EXCHANGE_SERIALIZE, service_id, 2048);
+	if (rc != EOK) {
+		printf(NAME ": Error initializing libblock.\n");
+		return 2;
+	}
+
+	rc = block_get_bsize(service_id, &sector_size);
+	if (rc != EOK) {
+		printf(NAME ": Error determining device block size.\n");
+		return 2;
+	}
+
+	rc = block_get_nblocks(service_id, &dev_nblocks);
+	if (rc != EOK) {
+		printf(NAME ": Warning, failed to obtain device block size.\n");
+		/* FIXME: the user should specify the filesystem size */
+		return 1;
+	} else {
+		printf(NAME ": Block device has %" PRIuOFF64 " blocks.\n",
+		    dev_nblocks);
+
+		cfg.volume_count = dev_nblocks;
+	}
+
+	cfg_params_initialize(&cfg);
+
+
+	return 0;
+}
+
Index: uspace/srv/fs/exfat/exfat_bitmap.c
===================================================================
--- uspace/srv/fs/exfat/exfat_bitmap.c	(revision c01bb5f96a155bdec60146b151e214e7cd17f2c4)
+++ uspace/srv/fs/exfat/exfat_bitmap.c	(revision 39aa8ced119bf7e09823acd7771b7350177a3149)
@@ -48,5 +48,5 @@
 
 
-int bitmap_is_free(exfat_bs_t *bs, service_id_t service_id, 
+int exfat_bitmap_is_free(exfat_bs_t *bs, service_id_t service_id, 
     exfat_cluster_t clst)
 {
@@ -89,5 +89,5 @@
 }
 
-int bitmap_set_cluster(exfat_bs_t *bs, service_id_t service_id, 
+int exfat_bitmap_set_cluster(exfat_bs_t *bs, service_id_t service_id, 
     exfat_cluster_t clst)
 {
@@ -124,5 +124,5 @@
 }
 
-int bitmap_clear_cluster(exfat_bs_t *bs, service_id_t service_id, 
+int exfat_bitmap_clear_cluster(exfat_bs_t *bs, service_id_t service_id, 
     exfat_cluster_t clst)
 {
@@ -160,5 +160,5 @@
 }
 
-int bitmap_set_clusters(exfat_bs_t *bs, service_id_t service_id, 
+int exfat_bitmap_set_clusters(exfat_bs_t *bs, service_id_t service_id, 
     exfat_cluster_t firstc, exfat_cluster_t count)
 {
@@ -168,8 +168,8 @@
 
 	while (clst < firstc + count ) {
-		rc = bitmap_set_cluster(bs, service_id, clst);
+		rc = exfat_bitmap_set_cluster(bs, service_id, clst);
 		if (rc != EOK) {
 			if (clst - firstc > 0)
-				(void) bitmap_clear_clusters(bs, service_id,
+				(void) exfat_bitmap_clear_clusters(bs, service_id,
 				    firstc, clst - firstc);
 			return rc;
@@ -180,5 +180,5 @@
 }
 
-int bitmap_clear_clusters(exfat_bs_t *bs, service_id_t service_id, 
+int exfat_bitmap_clear_clusters(exfat_bs_t *bs, service_id_t service_id, 
     exfat_cluster_t firstc, exfat_cluster_t count)
 {
@@ -188,5 +188,5 @@
 
 	while (clst < firstc + count) {
-		rc = bitmap_clear_cluster(bs, service_id, clst);
+		rc = exfat_bitmap_clear_cluster(bs, service_id, clst);
 		if (rc != EOK)
 			return rc;
@@ -196,5 +196,5 @@
 }
 
-int bitmap_alloc_clusters(exfat_bs_t *bs, service_id_t service_id, 
+int exfat_bitmap_alloc_clusters(exfat_bs_t *bs, service_id_t service_id, 
     exfat_cluster_t *firstc, exfat_cluster_t count)
 {
@@ -204,8 +204,8 @@
 	while (startc < DATA_CNT(bs) + 2) {
 		endc = startc;
-		while (bitmap_is_free(bs, service_id, endc) == EOK) {
+		while (exfat_bitmap_is_free(bs, service_id, endc) == EOK) {
 			if ((endc - startc) + 1 == count) {
 				*firstc = startc;
-				return bitmap_set_clusters(bs, service_id, startc, count);
+				return exfat_bitmap_set_clusters(bs, service_id, startc, count);
 			} else
 				endc++;
@@ -217,9 +217,9 @@
 
 
-int bitmap_append_clusters(exfat_bs_t *bs, exfat_node_t *nodep, 
+int exfat_bitmap_append_clusters(exfat_bs_t *bs, exfat_node_t *nodep, 
     exfat_cluster_t count)
 {
 	if (nodep->firstc == 0) {
-		return bitmap_alloc_clusters(bs, nodep->idx->service_id, 
+		return exfat_bitmap_alloc_clusters(bs, nodep->idx->service_id, 
 		    &nodep->firstc, count);
 	} else {
@@ -228,7 +228,7 @@
 
 		clst = lastc + 1;
-		while (bitmap_is_free(bs, nodep->idx->service_id, clst) == EOK) {
+		while (exfat_bitmap_is_free(bs, nodep->idx->service_id, clst) == EOK) {
 			if (clst - lastc == count){
-				return bitmap_set_clusters(bs, nodep->idx->service_id, 
+				return exfat_bitmap_set_clusters(bs, nodep->idx->service_id, 
 				    lastc + 1, count);
 			} else
@@ -240,5 +240,5 @@
 
 
-int bitmap_free_clusters(exfat_bs_t *bs, exfat_node_t *nodep, 
+int exfat_bitmap_free_clusters(exfat_bs_t *bs, exfat_node_t *nodep, 
     exfat_cluster_t count)
 {
@@ -247,9 +247,9 @@
 	lastc -= count;
 
-	return bitmap_clear_clusters(bs, nodep->idx->service_id, lastc + 1, count);
-}
-
-
-int bitmap_replicate_clusters(exfat_bs_t *bs, exfat_node_t *nodep)
+	return exfat_bitmap_clear_clusters(bs, nodep->idx->service_id, lastc + 1, count);
+}
+
+
+int exfat_bitmap_replicate_clusters(exfat_bs_t *bs, exfat_node_t *nodep)
 {
 	int rc;
Index: uspace/srv/fs/exfat/exfat_bitmap.h
===================================================================
--- uspace/srv/fs/exfat/exfat_bitmap.h	(revision c01bb5f96a155bdec60146b151e214e7cd17f2c4)
+++ uspace/srv/fs/exfat/exfat_bitmap.h	(revision 39aa8ced119bf7e09823acd7771b7350177a3149)
@@ -42,20 +42,20 @@
 struct exfat_bs;
 
-extern int bitmap_alloc_clusters(struct exfat_bs *, service_id_t, 
+extern int exfat_bitmap_alloc_clusters(struct exfat_bs *, service_id_t, 
     exfat_cluster_t *, exfat_cluster_t);
-extern int bitmap_append_clusters(struct exfat_bs *, struct exfat_node *, 
+extern int exfat_bitmap_append_clusters(struct exfat_bs *, struct exfat_node *, 
     exfat_cluster_t);
-extern int bitmap_free_clusters(struct exfat_bs *, struct exfat_node *, 
+extern int exfat_bitmap_free_clusters(struct exfat_bs *, struct exfat_node *, 
     exfat_cluster_t);
-extern int bitmap_replicate_clusters(struct exfat_bs *, struct exfat_node *); 
+extern int exfat_bitmap_replicate_clusters(struct exfat_bs *, struct exfat_node *); 
 
-extern int bitmap_is_free(struct exfat_bs *, service_id_t, exfat_cluster_t);
-extern int bitmap_set_cluster(struct exfat_bs *, service_id_t, exfat_cluster_t);
-extern int bitmap_clear_cluster(struct exfat_bs *, service_id_t, 
+extern int exfat_bitmap_is_free(struct exfat_bs *, service_id_t, exfat_cluster_t);
+extern int exfat_bitmap_set_cluster(struct exfat_bs *, service_id_t, exfat_cluster_t);
+extern int exfat_bitmap_clear_cluster(struct exfat_bs *, service_id_t, 
     exfat_cluster_t);
 
-extern int bitmap_set_clusters(struct exfat_bs *, service_id_t, 
+extern int exfat_bitmap_set_clusters(struct exfat_bs *, service_id_t, 
     exfat_cluster_t, exfat_cluster_t);
-extern int bitmap_clear_clusters(struct exfat_bs *, service_id_t, 
+extern int exfat_bitmap_clear_clusters(struct exfat_bs *, service_id_t, 
     exfat_cluster_t, exfat_cluster_t);
 
Index: uspace/srv/fs/exfat/exfat_dentry.c
===================================================================
--- uspace/srv/fs/exfat/exfat_dentry.c	(revision c01bb5f96a155bdec60146b151e214e7cd17f2c4)
+++ uspace/srv/fs/exfat/exfat_dentry.c	(revision 39aa8ced119bf7e09823acd7771b7350177a3149)
@@ -130,5 +130,5 @@
 }
 
-size_t utf16_length(const uint16_t *wstr)
+size_t exfat_utf16_length(const uint16_t *wstr)
 {
 	size_t len = 0;
Index: uspace/srv/fs/exfat/exfat_dentry.h
===================================================================
--- uspace/srv/fs/exfat/exfat_dentry.h	(revision c01bb5f96a155bdec60146b151e214e7cd17f2c4)
+++ uspace/srv/fs/exfat/exfat_dentry.h	(revision 39aa8ced119bf7e09823acd7771b7350177a3149)
@@ -160,5 +160,5 @@
 extern bool exfat_valid_name(const char *);
 
-extern size_t utf16_length(const uint16_t *);
+extern size_t exfat_utf16_length(const uint16_t *);
 
 
Index: uspace/srv/fs/exfat/exfat_directory.c
===================================================================
--- uspace/srv/fs/exfat/exfat_directory.c	(revision c01bb5f96a155bdec60146b151e214e7cd17f2c4)
+++ uspace/srv/fs/exfat/exfat_directory.c	(revision 39aa8ced119bf7e09823acd7771b7350177a3149)
@@ -371,5 +371,5 @@
 	ds.stream.valid_data_size = 0;
 	ds.stream.data_size = 0;
-	ds.stream.name_size = utf16_length(wname);
+	ds.stream.name_size = exfat_utf16_length(wname);
 	ds.stream.hash = host2uint16_t_le(exfat_name_hash(wname, uctable, 
 	    uctable_chars));
Index: uspace/srv/fs/exfat/exfat_fat.c
===================================================================
--- uspace/srv/fs/exfat/exfat_fat.c	(revision c01bb5f96a155bdec60146b151e214e7cd17f2c4)
+++ uspace/srv/fs/exfat/exfat_fat.c	(revision 39aa8ced119bf7e09823acd7771b7350177a3149)
@@ -314,5 +314,5 @@
 	    clst++) {
 		/* Need to rewrite because of multiple exfat_bitmap_get calls */
-		if (bitmap_is_free(bs, service_id, clst) == EOK) {
+		if (exfat_bitmap_is_free(bs, service_id, clst) == EOK) {
 			/*
 			 * The cluster is free. Put it into our stack
@@ -325,5 +325,5 @@
 				goto exit_error;
 			found++;
-			rc = bitmap_set_cluster(bs, service_id, clst);
+			rc = exfat_bitmap_set_cluster(bs, service_id, clst);
 			if (rc != EOK)
 				goto exit_error;
@@ -346,5 +346,5 @@
 	/* If something wrong - free the clusters */
 	while (found--) {
-		(void) bitmap_clear_cluster(bs, service_id, lifo[found]);
+		(void) exfat_bitmap_clear_cluster(bs, service_id, lifo[found]);
 		(void) exfat_set_cluster(bs, service_id, lifo[found], 0);
 	}
@@ -378,5 +378,5 @@
 		if (rc != EOK)
 			return rc;
-		rc = bitmap_clear_cluster(bs, service_id, firstc);
+		rc = exfat_bitmap_clear_cluster(bs, service_id, firstc);
 		if (rc != EOK)
 			return rc;
Index: uspace/srv/fs/exfat/exfat_ops.c
===================================================================
--- uspace/srv/fs/exfat/exfat_ops.c	(revision c01bb5f96a155bdec60146b151e214e7cd17f2c4)
+++ uspace/srv/fs/exfat/exfat_ops.c	(revision 39aa8ced119bf7e09823acd7771b7350177a3149)
@@ -405,5 +405,5 @@
 
 	if (!nodep->fragmented) {
-		rc = bitmap_append_clusters(bs, nodep, clusters);
+		rc = exfat_bitmap_append_clusters(bs, nodep, clusters);
 		if (rc != ENOSPC)
 			return rc;
@@ -411,5 +411,5 @@
 			nodep->fragmented = true;
 			nodep->dirty = true;		/* need to sync node */
-			rc = bitmap_replicate_clusters(bs, nodep);
+			rc = exfat_bitmap_replicate_clusters(bs, nodep);
 			if (rc != EOK)
 				return rc;
@@ -457,5 +457,5 @@
 
 		clsts = prev_clsts - new_clsts;
-		rc = bitmap_free_clusters(bs, nodep, clsts);
+		rc = exfat_bitmap_free_clusters(bs, nodep, clsts);
 		if (rc != EOK)
 			return rc;
@@ -704,5 +704,5 @@
 				nodep->firstc);
 		else
-			rc = bitmap_free_clusters(bs, nodep, 
+			rc = exfat_bitmap_free_clusters(bs, nodep, 
 			    ROUND_UP(nodep->size, BPC(bs)) / BPC(bs));
 	} 
@@ -758,9 +758,5 @@
 
 	fibril_mutex_unlock(&parentp->idx->lock);
-	if (rc != EOK)
-		return rc;
-
 	fibril_mutex_lock(&childp->idx->lock);
-
 
 	childp->idx->pfc = parentp->firstc;
@@ -1463,5 +1459,8 @@
 	}
 
-	(void) exfat_node_put(fn);
+	int rc2 = exfat_node_put(fn);
+	if (rc == EOK && rc2 != EOK)
+		rc = rc2;
+
 	return rc;
 }
