From 4fafb35ccf4e1db52ad92c0f1fea8b4e43ec37bb Mon Sep 17 00:00:00 2001 From: Chaskiel M Grundman Date: Wed, 11 Apr 2001 20:17:51 +0000 Subject: [PATCH] better-type-guessing-for-readdir-hint-20010411 instead of just saying unknown, if we know for sure, provide the info --- src/afs/LINUX/osi_vnodeops.c | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c index 3d71b9df4..e89704d72 100644 --- a/src/afs/LINUX/osi_vnodeops.c +++ b/src/afs/LINUX/osi_vnodeops.c @@ -231,7 +231,37 @@ tagain: /* filldir returns -EINVAL when the buffer is full. */ #ifdef AFS_LINUX24_ENV - code = (*filldir)(dirbuf, de->name, len, offset, ino, DT_UNKNOWN); + { + unsigned int type=DT_UNKNOWN; + struct VenusFid afid; + struct vcache *tvc; + int vtype; + afid.Cell=avc->fid.Cell; + afid.Fid.Volume=avc->fid.Fid.Volume; + afid.Fid.Vnode=ntohl(de->fid.vnode); + afid.Fid.Unique=ntohl(de->fid.vunique); + if ((avc->states & CForeign) == 0 && + (ntohl(de->fid.vnode) & 1)) { + type=DT_DIR; + } else if ((tvc=afs_FindVCache(&afid,0,0,0,0))) { + if (tvc->mvstat) { + type=DT_DIR; + } else if (((tvc->states) & (CStatd|CTruth))) { + /* CTruth will be set if the object has + *ever* been statd */ + vtype=vType(tvc); + if (vtype == VDIR) + type=DT_DIR; + else if (vtype == VREG) + type=DT_REG; + /* Don't do this until we're sure it can't be a mtpt */ + /* else if (vtype == VLNK) + type=DT_LNK; */ + /* what other types does AFS support? */ + } + } + code = (*filldir)(dirbuf, de->name, len, offset, ino, type); + } #else code = (*filldir)(dirbuf, de->name, len, offset, ino); #endif -- 2.39.5