Module Name:    src
Committed By:   jdolecek
Date:           Sat Aug  6 21:39:48 UTC 2016

Modified Files:
        src/sys/ufs/ext2fs: ext2fs_dir.h ext2fs_lookup.c ext2fs_rename.c

Log Message:
actually pass the d_type from the on-disk directory entry to the lookup results


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/ufs/ext2fs/ext2fs_dir.h
cvs rdiff -u -r1.80 -r1.81 src/sys/ufs/ext2fs/ext2fs_lookup.c
cvs rdiff -u -r1.8 -r1.9 src/sys/ufs/ext2fs/ext2fs_rename.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/ufs/ext2fs/ext2fs_dir.h
diff -u src/sys/ufs/ext2fs/ext2fs_dir.h:1.20 src/sys/ufs/ext2fs/ext2fs_dir.h:1.21
--- src/sys/ufs/ext2fs/ext2fs_dir.h:1.20	Fri Jun 24 17:21:30 2016
+++ src/sys/ufs/ext2fs/ext2fs_dir.h	Sat Aug  6 21:39:48 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: ext2fs_dir.h,v 1.20 2016/06/24 17:21:30 christos Exp $	*/
+/*	$NetBSD: ext2fs_dir.h,v 1.21 2016/08/06 21:39:48 jdolecek Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -167,6 +167,30 @@ inot2ext2dt(uint16_t type)
 	}
 }
 
+static __inline uint8_t ext2dt2dt(uint8_t) __unused;
+static __inline uint8_t
+ext2dt2dt(uint8_t type)
+{
+	switch (type) {
+	case EXT2_FT_REG_FILE:
+		return DT_FIFO;
+	case EXT2_FT_DIR:
+		return DT_DIR;
+	case EXT2_FT_CHRDEV:
+		return DT_CHR;
+	case EXT2_FT_BLKDEV:
+		return DT_BLK;
+	case EXT2_FT_FIFO:
+		return DT_FIFO;
+	case EXT2_FT_SOCK:
+		return DT_SOCK;
+	case EXT2_FT_SYMLINK:
+		return DT_LNK;
+	default:
+		return DT_UNKNOWN;
+	}
+}
+
 /*
  * The EXT2FS_DIRSIZ macro gives the minimum record length which will hold
  * the directory entryfor a name len "len" (without the terminating null byte).

Index: src/sys/ufs/ext2fs/ext2fs_lookup.c
diff -u src/sys/ufs/ext2fs/ext2fs_lookup.c:1.80 src/sys/ufs/ext2fs/ext2fs_lookup.c:1.81
--- src/sys/ufs/ext2fs/ext2fs_lookup.c:1.80	Fri Jun 24 17:21:30 2016
+++ src/sys/ufs/ext2fs/ext2fs_lookup.c	Sat Aug  6 21:39:48 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: ext2fs_lookup.c,v 1.80 2016/06/24 17:21:30 christos Exp $	*/
+/*	$NetBSD: ext2fs_lookup.c,v 1.81 2016/08/06 21:39:48 jdolecek Exp $	*/
 
 /*
  * Modified for NetBSD 1.2E
@@ -48,7 +48,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ext2fs_lookup.c,v 1.80 2016/06/24 17:21:30 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ext2fs_lookup.c,v 1.81 2016/08/06 21:39:48 jdolecek Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -99,7 +99,8 @@ ext2fs_dirconv2ffs(struct ext2fs_direct 
 	ffsdir->d_fileno = fs2h32(e2dir->e2d_ino);
 	ffsdir->d_namlen = e2dir->e2d_namlen;
 
-	ffsdir->d_type = DT_UNKNOWN;		/* don't know more here */
+	ffsdir->d_type = ext2dt2dt(e2dir->e2d_type);
+
 #ifdef DIAGNOSTIC
 #if MAXNAMLEN < E2FS_MAXNAMLEN
 	/*

Index: src/sys/ufs/ext2fs/ext2fs_rename.c
diff -u src/sys/ufs/ext2fs/ext2fs_rename.c:1.8 src/sys/ufs/ext2fs/ext2fs_rename.c:1.9
--- src/sys/ufs/ext2fs/ext2fs_rename.c:1.8	Fri Mar 27 17:27:56 2015
+++ src/sys/ufs/ext2fs/ext2fs_rename.c	Sat Aug  6 21:39:48 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: ext2fs_rename.c,v 1.8 2015/03/27 17:27:56 riastradh Exp $	*/
+/*	$NetBSD: ext2fs_rename.c,v 1.9 2016/08/06 21:39:48 jdolecek Exp $	*/
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ext2fs_rename.c,v 1.8 2015/03/27 17:27:56 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ext2fs_rename.c,v 1.9 2016/08/06 21:39:48 jdolecek Exp $");
 
 #include <sys/param.h>
 #include <sys/buf.h>
@@ -44,6 +44,7 @@ __KERNEL_RCSID(0, "$NetBSD: ext2fs_renam
 #include <sys/namei.h>
 #include <sys/vnode.h>
 #include <sys/vnode_if.h>
+#include <sys/dirent.h>
 
 #include <miscfs/genfs/genfs.h>
 

Reply via email to