Index: uspace/srv/fs/fat/fat_dentry.c
===================================================================
--- uspace/srv/fs/fat/fat_dentry.c	(revision 9553d7d87cd577b119b96a55a3bfb106c2d072e8)
+++ uspace/srv/fs/fat/fat_dentry.c	(revision 2e839ddab357f0150521eba037d01dacdcea3472)
@@ -394,4 +394,64 @@
 }
 
+bool fat_lfn_valid_char(uint16_t c)
+{
+	char valid[] = {"_.$%\'-@~!(){}^#&"};
+	size_t idx=0;
+
+	if (c > 0xff) return false;
+	if (isdigit(c) || (isalpha(c) && isupper(c)))
+		return true;	
+	while(valid[idx]!=0)
+		if (c == valid[idx++])
+			return true;
+
+	return false;
+}
+
+bool fat_lfn_valid_str(const uint16_t *str)
+{
+	uint16_t c;
+	size_t idx=0;
+	if (str[idx] == 0 || str[idx] == '.')
+		return false;
+	while ((c=str[idx++]) != 0) {
+		if (!fat_lfn_valid_char(c))
+			return false;
+	}
+	return true;
+}
+
+/** Get number of characters in a wide string.
+ *
+ * @param str NULL-terminated wide string.
+ *
+ * @return Number of characters in @a str.
+ *
+ */
+size_t utf16_length(const uint16_t *wstr)
+{
+	size_t len = 0;
+	
+	while (*wstr++ != 0)
+		len++;
+	return len;
+}
+
+bool fat_dentry_is_sfn(const uint16_t *str)
+{
+	/* 1. Length <= 11 characters */
+	if (utf16_length(str) > (FAT_NAME_LEN + FAT_EXT_LEN))
+		return false;
+	/* 
+	 * 2. All characters in string should be ASCII
+	 * 3. All letters must be uppercase
+	 * 4. String should not contain invalid characters
+	 */
+	if (!fat_lfn_valid_str(str))
+		return false;
+	
+	return true;
+}
+
 
 /**
Index: uspace/srv/fs/fat/fat_dentry.h
===================================================================
--- uspace/srv/fs/fat/fat_dentry.h	(revision 9553d7d87cd577b119b96a55a3bfb106c2d072e8)
+++ uspace/srv/fs/fat/fat_dentry.h	(revision 2e839ddab357f0150521eba037d01dacdcea3472)
@@ -140,6 +140,11 @@
 extern size_t fat_lfn_copy_part(const uint16_t *, size_t, uint16_t *, size_t *);
 extern size_t fat_lfn_copy_entry(const fat_dentry_t *, uint16_t *, size_t *);
+
 extern int utf16_to_str(char *, size_t, const uint16_t *);
 extern int str_to_utf16(uint16_t *, size_t, const char *);
+extern bool fat_lfn_valid_char(uint16_t);
+extern bool fat_lfn_valid_str(const uint16_t *);
+extern size_t utf16_length(const uint16_t *);
+extern bool fat_dentry_is_sfn(const uint16_t *);
 
 
Index: uspace/srv/fs/fat/fat_directory.c
===================================================================
--- uspace/srv/fs/fat/fat_directory.c	(revision 9553d7d87cd577b119b96a55a3bfb106c2d072e8)
+++ uspace/srv/fs/fat/fat_directory.c	(revision 2e839ddab357f0150521eba037d01dacdcea3472)
@@ -254,4 +254,11 @@
 }
 
+int fat_directory_write(fat_directory_t *di, char *name, fat_dentry_t *de)
+{
+	/* TODO: create LFN records if necessarry and create SFN record */
+	return EOK;
+}
+
+
 
 /**
Index: uspace/srv/fs/fat/fat_directory.h
===================================================================
--- uspace/srv/fs/fat/fat_directory.h	(revision 9553d7d87cd577b119b96a55a3bfb106c2d072e8)
+++ uspace/srv/fs/fat/fat_directory.h	(revision 2e839ddab357f0150521eba037d01dacdcea3472)
@@ -67,4 +67,5 @@
 
 extern int fat_directory_read(fat_directory_t *, char *, fat_dentry_t **);
+extern int fat_directory_write(fat_directory_t *, char *, fat_dentry_t *);
 extern int fat_directory_erase(fat_directory_t *);
 
