Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/ufs/ext2fs actually pass the d_type from the on-disk dir...



details:   https://anonhg.NetBSD.org/src/rev/0b24e0282d82
branches:  trunk
changeset: 346913:0b24e0282d82
user:      jdolecek <jdolecek%NetBSD.org@localhost>
date:      Sat Aug 06 21:39:48 2016 +0000

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

diffstat:

 sys/ufs/ext2fs/ext2fs_dir.h    |  26 +++++++++++++++++++++++++-
 sys/ufs/ext2fs/ext2fs_lookup.c |   7 ++++---
 sys/ufs/ext2fs/ext2fs_rename.c |   5 +++--
 3 files changed, 32 insertions(+), 6 deletions(-)

diffs (94 lines):

diff -r b1ed658a6882 -r 0b24e0282d82 sys/ufs/ext2fs/ext2fs_dir.h
--- a/sys/ufs/ext2fs/ext2fs_dir.h       Sat Aug 06 21:13:30 2016 +0000
+++ b/sys/ufs/ext2fs/ext2fs_dir.h       Sat Aug 06 21:39:48 2016 +0000
@@ -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 @@
        }
 }
 
+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).
diff -r b1ed658a6882 -r 0b24e0282d82 sys/ufs/ext2fs/ext2fs_lookup.c
--- a/sys/ufs/ext2fs/ext2fs_lookup.c    Sat Aug 06 21:13:30 2016 +0000
+++ b/sys/ufs/ext2fs/ext2fs_lookup.c    Sat Aug 06 21:39:48 2016 +0000
@@ -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 @@
        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
        /*
diff -r b1ed658a6882 -r 0b24e0282d82 sys/ufs/ext2fs/ext2fs_rename.c
--- a/sys/ufs/ext2fs/ext2fs_rename.c    Sat Aug 06 21:13:30 2016 +0000
+++ b/sys/ufs/ext2fs/ext2fs_rename.c    Sat Aug 06 21:39:48 2016 +0000
@@ -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 @@
 #include <sys/namei.h>
 #include <sys/vnode.h>
 #include <sys/vnode_if.h>
+#include <sys/dirent.h>
 
 #include <miscfs/genfs/genfs.h>
 



Home | Main Index | Thread Index | Old Index