ChangeLog, link.c, mkdir.c, newdir.c:
  mkdir.c (ext2fs_mkdir): Pass EXT2_FT_DIR flag to ext2fs_link().
  link.c (ext2fs_link): This call now uses the low three bits of the
  	flags parameter to pass the directory filetype information; it will
  	set the directory entry FILETYPE information if the filesystem
  	supports it.
  newdir.c (ext2fs_new_dir_block): If the FILETYPE superblock option is
  	set, then create the '.' and '..' entries with the filetype set to
  	EXT2_FT_DIR.

diff --git a/lib/ext2fs/mkdir.c b/lib/ext2fs/mkdir.c
index b2e8094..06fd903 100644
--- a/lib/ext2fs/mkdir.c
+++ b/lib/ext2fs/mkdir.c
@@ -31,6 +31,10 @@
 
 #include "ext2fs.h"
 
+#ifndef EXT2_FT_DIR
+#define EXT2_FT_DIR		2
+#endif
+
 errcode_t ext2fs_mkdir(ext2_filsys fs, ino_t parent, ino_t inum,
 		       const char *name)
 {
@@ -116,7 +120,7 @@
 		}
 		if (retval != EXT2_ET_FILE_NOT_FOUND)
 			goto cleanup;
-		retval = ext2fs_link(fs, parent, name, ino, 0);
+		retval = ext2fs_link(fs, parent, name, ino, EXT2_FT_DIR);
 		if (retval)
 			goto cleanup;
 	}