From b9e369fac6faf4c9d12320227d745418515b52a0 Mon Sep 17 00:00:00 2001 From: Olga Kornievskaia Date: Wed, 30 Mar 2011 14:21:40 -0400 Subject: [PATCH] adding query for FileInternalInformation infoclass this query asks for a file index which is unique identifier for a file which we can satisfy from file attribute called "fileid" --- daemon/from_kernel.h | 3 +++ daemon/getattr.c | 10 ++++++++++ daemon/name_cache.c | 1 + daemon/nfs41_ops.c | 8 +++----- daemon/readdir.c | 2 +- daemon/upcall.h | 1 + sys/nfs41_driver.c | 10 +--------- 7 files changed, 20 insertions(+), 15 deletions(-) diff --git a/daemon/from_kernel.h b/daemon/from_kernel.h index eb8d164..78793bd 100644 --- a/daemon/from_kernel.h +++ b/daemon/from_kernel.h @@ -252,4 +252,7 @@ typedef struct _FILE_FS_FULL_SIZE_INFORMATION { ULONG BytesPerSector; } FILE_FS_FULL_SIZE_INFORMATION, *PFILE_FS_FULL_SIZE_INFORMATION; +typedef struct _FILE_INTERNAL_INFORMATION { + LARGE_INTEGER IndexNumber; +} FILE_INTERNAL_INFORMATION, *PFILE_INTERNAL_INFORMATION; #endif diff --git a/daemon/getattr.c b/daemon/getattr.c index 5e558e6..f3a0767 100644 --- a/daemon/getattr.c +++ b/daemon/getattr.c @@ -116,6 +116,9 @@ static int handle_getattr(nfs41_upcall *upcall) args->tag_info.ReparseTag = info.type == NF4LNK ? IO_REPARSE_TAG_SYMLINK : 0; break; + case FileInternalInformation: + args->intr_info.IndexNumber.QuadPart = info.fileid; + break; default: eprintf("unhandled file query class %d\n", args->query_class); status = ERROR_INVALID_PARAMETER; @@ -153,6 +156,13 @@ static int marshall_getattr(unsigned char *buffer, uint32_t *length, nfs41_upcal status = safe_write(&buffer, length, &args->tag_info, info_len); if (status) goto out; break; + case FileInternalInformation: + info_len = sizeof(args->intr_info); + status = safe_write(&buffer, length, &info_len, sizeof(info_len)); + if (status) goto out; + status = safe_write(&buffer, length, &args->intr_info, info_len); + if (status) goto out; + break; default: eprintf("unknown file query class %d\n", args->query_class); status = 103; diff --git a/daemon/name_cache.c b/daemon/name_cache.c index 3276db1..a7888f1 100644 --- a/daemon/name_cache.c +++ b/daemon/name_cache.c @@ -294,6 +294,7 @@ static void copy_attrs( dst->type = src->type; dst->numlinks = src->numlinks; dst->mode = src->mode; + dst->fileid = src->fileid; } diff --git a/daemon/nfs41_ops.c b/daemon/nfs41_ops.c index 3d0bd9f..9951c42 100644 --- a/daemon/nfs41_ops.c +++ b/daemon/nfs41_ops.c @@ -318,7 +318,7 @@ int nfs41_open( info = &tmp_info; init_getattr_request(&attr_request); - attr_request.arr[0] |= FATTR4_WORD0_FSID | FATTR4_WORD0_FILEID; + attr_request.arr[0] |= FATTR4_WORD0_FSID; compound_init(&compound, argops, resops, "open"); @@ -521,7 +521,6 @@ int nfs41_create( nfs41_restorefh_res restorefh_res; init_getattr_request(&attr_request); - attr_request.arr[0] |= FATTR4_WORD0_FILEID; compound_init(&compound, argops, resops, "create"); @@ -1029,7 +1028,7 @@ void init_getattr_request(bitmap4 *attr_request) { attr_request->count = 2; attr_request->arr[0] = FATTR4_WORD0_TYPE | - FATTR4_WORD0_CHANGE | FATTR4_WORD0_SIZE; + FATTR4_WORD0_CHANGE | FATTR4_WORD0_SIZE | FATTR4_WORD0_FILEID; attr_request->arr[1] = FATTR4_WORD1_NUMLINKS | FATTR4_WORD1_TIME_ACCESS | FATTR4_WORD1_TIME_CREATE | FATTR4_WORD1_TIME_MODIFY | FATTR4_WORD1_MODE | @@ -1338,9 +1337,8 @@ int nfs41_link( ZeroMemory(&info, sizeof(info)); init_getattr_request(&info[0].attrmask); - info[0].attrmask.arr[0] |= FATTR4_WORD0_FILEID; init_getattr_request(&info[1].attrmask); - info[1].attrmask.arr[0] |= FATTR4_WORD0_FILEID | FATTR4_WORD0_FSID; + info[1].attrmask.arr[0] |= FATTR4_WORD0_FSID; compound_init(&compound, argops, resops, "link"); diff --git a/daemon/readdir.c b/daemon/readdir.c index dc95bca..84c1016 100644 --- a/daemon/readdir.c +++ b/daemon/readdir.c @@ -146,7 +146,7 @@ static void readdir_copy_dir_info( IN nfs41_readdir_entry *entry, IN PFILE_DIR_INFO_UNION info) { - info->fdi.FileIndex = 0; + info->fdi.FileIndex = entry->attr_info.fileid; nfs_time_to_file_time(&entry->attr_info.time_create, &info->fdi.CreationTime); nfs_time_to_file_time(&entry->attr_info.time_access, diff --git a/daemon/upcall.h b/daemon/upcall.h index 47991c1..57b813d 100644 --- a/daemon/upcall.h +++ b/daemon/upcall.h @@ -96,6 +96,7 @@ typedef struct __getattr_upcall_args { FILE_BASIC_INFO basic_info; FILE_STANDARD_INFO std_info; FILE_ATTRIBUTE_TAG_INFO tag_info; + FILE_INTERNAL_INFORMATION intr_info; nfs41_root *root; nfs41_open_state *state; int query_class; diff --git a/sys/nfs41_driver.c b/sys/nfs41_driver.c index 0e1f8d8..6d9aefb 100644 --- a/sys/nfs41_driver.c +++ b/sys/nfs41_driver.c @@ -3881,15 +3881,6 @@ NTSTATUS nfs41_QueryFileInformation ( DbgEn(); switch (InfoClass) { - case FileInternalInformation: - { - PFILE_INTERNAL_INFORMATION info = - (PFILE_INTERNAL_INFORMATION)RxContext->Info.Buffer; - info->IndexNumber.QuadPart = 0; - RxContext->Info.LengthRemaining -= sizeof(FILE_INTERNAL_INFORMATION); - status = STATUS_SUCCESS; - goto out; - } case FileEaInformation: { PFILE_EA_INFORMATION info = @@ -3922,6 +3913,7 @@ NTSTATUS nfs41_QueryFileInformation ( case FileBasicInformation: case FileStandardInformation: #endif + case FileInternalInformation: case FileAttributeTagInformation: break; default: