patch-2.4.0-test7 linux/fs/ext2/dir.c

Next file: linux/fs/fat/dir.c
Previous file: linux/fs/exec.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.0-test6/linux/fs/ext2/dir.c linux/fs/ext2/dir.c
@@ -20,6 +20,10 @@
 
 #include <linux/fs.h>
 
+static unsigned char ext2_filetype_table[] = {
+	DT_UNKNOWN, DT_REG, DT_DIR, DT_CHR, DT_BLK, DT_FIFO, DT_SOCK, DT_LNK
+};
+
 static int ext2_readdir(struct file *, void *, filldir_t);
 
 struct file_operations ext2_dir_operations = {
@@ -152,10 +156,15 @@
 				 * during the copy operation.
 				 */
 				unsigned long version = filp->f_version;
+				unsigned char d_type = DT_UNKNOWN;
 
+				if (EXT2_HAS_INCOMPAT_FEATURE(sb, EXT2_FEATURE_INCOMPAT_FILETYPE)
+				    && de->file_type < EXT2_FT_MAX)
+					d_type = ext2_filetype_table[de->file_type];
 				error = filldir(dirent, de->name,
 						de->name_len,
-						filp->f_pos, le32_to_cpu(de->inode));
+						filp->f_pos, le32_to_cpu(de->inode),
+						d_type);
 				if (error)
 					break;
 				if (version != filp->f_version)

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)