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

This commit is contained in:
jdolecek 2016-08-06 21:39:48 +00:00
parent 76dddc0ed2
commit 8e39032fbb
3 changed files with 32 additions and 6 deletions

View File

@ -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).

View File

@ -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 *e2dir, struct dirent *ffsdir)
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
/*

View File

@ -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_rename.c,v 1.8 2015/03/27 17:27:56 riastradh
#include <sys/namei.h>
#include <sys/vnode.h>
#include <sys/vnode_if.h>
#include <sys/dirent.h>
#include <miscfs/genfs/genfs.h>