set mode accordingly to file type (similarily to what nfs_filestat() does)

file type is now viewed correctly for files on ntfs
This commit is contained in:
jdolecek 2000-02-04 10:13:54 +00:00
parent 0f09f8dd2b
commit 55fa2666be
1 changed files with 15 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: ntfs.c,v 1.3 1999/11/01 19:56:20 jdolecek Exp $ */
/* $NetBSD: ntfs.c,v 1.4 2000/02/04 10:13:54 jdolecek Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__RCSID("$NetBSD: ntfs.c,v 1.3 1999/11/01 19:56:20 jdolecek Exp $");
__RCSID("$NetBSD: ntfs.c,v 1.4 2000/02/04 10:13:54 jdolecek Exp $");
#include <sys/param.h>
#include <sys/time.h>
@ -64,6 +64,7 @@ ntfs_filestat(vp, fsp)
struct ntnode ntnode;
struct fnode fn;
struct ntfsmount ntm;
mode_t mode;
/* to get the ntnode, we have to go in two steps - firstly
* to read appropriate struct fnode and then getting the address
@ -84,7 +85,18 @@ ntfs_filestat(vp, fsp)
fsp->fsid = ntnode.i_dev & 0xffff;
fsp->fileid = (long)ntnode.i_number;
fsp->mode = (mode_t)ntm.ntm_mode;
mode = (mode_t)ntm.ntm_mode;
switch (vp->v_type) {
case VREG:
mode |= S_IFREG;
break;
case VDIR:
mode |= S_IFDIR;
break;
default:
break;
}
fsp->mode = mode;
fsp->size = fn.f_size;
fsp->rdev = 0; /* XXX */
return 1;