symlink: nfs41_symlink_follow() for readdir and open

added nfs41_file_info.symlink_dir to replace readdir's info.cansettime hack.  when nfs_file_info_to_attributes() finds info.type==NF4LNK, it adds the FILE_ATTRIBUTE_DIRECTORY flag if info.symlink_dir is set

renamed nfs41_symlink_follow() to nfs41_symlink_target()
generalized lookup_symlink() into nfs41_symlink_follow(), which is called by readdir and open (also avoids an extra lookup)

added queries for symlink target type when doing normal GETATTRs (getattr.c) and opens with OPEN_REPARSE_POINT set (open.c)

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
This commit is contained in:
Casey Bodley 2010-10-14 15:20:45 -04:00 committed by unknown
parent a8f66804d5
commit eb9d9bbd4c
7 changed files with 80 additions and 36 deletions

View file

@ -130,9 +130,11 @@ ULONG nfs_file_info_to_attributes(
ULONG attrs = 0;
if (info->type == NF4DIR)
attrs |= FILE_ATTRIBUTE_DIRECTORY;
else if (info->type == NF4LNK)
else if (info->type == NF4LNK) {
attrs |= FILE_ATTRIBUTE_REPARSE_POINT;
else if (info->type != NF4REG)
if (info->symlink_dir)
attrs |= FILE_ATTRIBUTE_DIRECTORY;
} else if (info->type != NF4REG)
dprintf(1, "unhandled file type %d, defaulting to NF4REG\n",
info->type);
@ -162,11 +164,13 @@ void nfs_to_standard_info(
IN const nfs41_file_info *info,
OUT PFILE_STANDARD_INFO std_out)
{
const ULONG FileAttributes = nfs_file_info_to_attributes(info);
std_out->AllocationSize.QuadPart =
std_out->EndOfFile.QuadPart = (LONGLONG)info->size;
std_out->NumberOfLinks = info->numlinks;
std_out->DeletePending = FALSE;
std_out->Directory = info->type == NF4DIR ? TRUE : FALSE;
std_out->Directory = FileAttributes & FILE_ATTRIBUTE_DIRECTORY;
}