[haiku-commits] BRANCH pdziepak-github.nfs4 - src/add-ons/kernel/file_systems/nfs4

  • From: pdziepak-github.nfs4 <community@xxxxxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 9 Aug 2012 19:49:36 +0200 (CEST)

added 1 changeset to branch 'refs/remotes/pdziepak-github/nfs4'
old head: 8afd81bae22fa09e14593b6fd5dd07695604a77c
new head: 2314d073afc14b7a0e5a1eb27925658b9f2cc212

----------------------------------------------------------------------------

2314d07: nfs4: Inode::GetDirSnapshot should not require OpenDirCookie

                                    [ Pawel Dziepak <pdziepak@xxxxxxxxxxx> ]

----------------------------------------------------------------------------

Commit:      2314d073afc14b7a0e5a1eb27925658b9f2cc212

Author:      Pawel Dziepak <pdziepak@xxxxxxxxxxx>
Date:        Thu Aug  9 17:24:32 2012 UTC

----------------------------------------------------------------------------

5 files changed, 13 insertions(+), 9 deletions(-)
.../kernel/file_systems/nfs4/DirectoryCache.cpp    |    3 ++-
src/add-ons/kernel/file_systems/nfs4/Inode.h       |    2 +-
src/add-ons/kernel/file_systems/nfs4/InodeDir.cpp  |    9 +++++----
src/add-ons/kernel/file_systems/nfs4/NFS4Inode.cpp |    5 +++--
src/add-ons/kernel/file_systems/nfs4/NFS4Inode.h   |    3 ++-

----------------------------------------------------------------------------

diff --git a/src/add-ons/kernel/file_systems/nfs4/DirectoryCache.cpp 
b/src/add-ons/kernel/file_systems/nfs4/DirectoryCache.cpp
index eb8ca9a..909f629 100644
--- a/src/add-ons/kernel/file_systems/nfs4/DirectoryCache.cpp
+++ b/src/add-ons/kernel/file_systems/nfs4/DirectoryCache.cpp
@@ -190,7 +190,8 @@ DirectoryCache::Revalidate()
        Trash();
 
        DirectoryCacheSnapshot* newSnapshot;
-       status_t result = fInode->GetDirSnapshot(&newSnapshot, NULL, &fChange);
+       status_t result = fInode->GetDirSnapshot(&newSnapshot, NULL, &fChange,
+               fAttrDir);
        if (result != B_OK) {
                oldSnapshot->ReleaseReference();
                return B_OK;
diff --git a/src/add-ons/kernel/file_systems/nfs4/Inode.h 
b/src/add-ons/kernel/file_systems/nfs4/Inode.h
index 03a03ac..62fffcf 100644
--- a/src/add-ons/kernel/file_systems/nfs4/Inode.h
+++ b/src/add-ons/kernel/file_systems/nfs4/Inode.h
@@ -94,7 +94,7 @@ public:
 
                                        status_t        
GetDirSnapshot(DirectoryCacheSnapshot**
                                                                        
_snapshot, OpenDirCookie* cookie,
-                                                                       uint64* 
_change);
+                                                                       uint64* 
_change, bool attribute);
 
 protected:
                                                                Inode();
diff --git a/src/add-ons/kernel/file_systems/nfs4/InodeDir.cpp 
b/src/add-ons/kernel/file_systems/nfs4/InodeDir.cpp
index 08eb38b..ac80441 100644
--- a/src/add-ons/kernel/file_systems/nfs4/InodeDir.cpp
+++ b/src/add-ons/kernel/file_systems/nfs4/InodeDir.cpp
@@ -145,7 +145,7 @@ Inode::ReadDirUp(struct dirent* de, uint32 pos, uint32 size)
 
 status_t
 Inode::GetDirSnapshot(DirectoryCacheSnapshot** _snapshot,
-       OpenDirCookie* cookie, uint64* _change)
+       OpenDirCookie* cookie, uint64* _change, bool attribute)
 {
        DirectoryCacheSnapshot* snapshot = new DirectoryCacheSnapshot;
        if (snapshot == NULL)
@@ -161,7 +161,7 @@ Inode::GetDirSnapshot(DirectoryCacheSnapshot** _snapshot,
                DirEntry* dirents;
 
                status_t result = ReadDirOnce(&dirents, &count, cookie, &eof, 
&change,
-                       &dirCookie, &dirCookieVerf);
+                       &dirCookie, &dirCookieVerf, attribute);
                if (result != B_OK) {
                        delete snapshot;
                        return result;
@@ -177,7 +177,7 @@ Inode::GetDirSnapshot(DirectoryCacheSnapshot** _snapshot,
                                continue;
 
                        ino_t id;
-                       if (!cookie->fAttrDir) {
+                       if (!attribute) {
                                if (dirents[i].fAttrCount == 2)
                                        id = 
FileIdToInoT(dirents[i].fAttrs[1].fData.fValue64);
                                else
@@ -228,7 +228,8 @@ Inode::ReadDir(void* _buffer, uint32 size, uint32* _count,
                cookie->fSnapshot = cache->GetSnapshot();
                if (cookie->fSnapshot == NULL) {
                        uint64 change;
-                       result = GetDirSnapshot(&cookie->fSnapshot, cookie, 
&change);
+                       result = GetDirSnapshot(&cookie->fSnapshot, cookie, 
&change,
+                               cookie->fAttrDir);
                        if (result != B_OK) {
                                cache->Unlock();
                                fFileSystem->Revalidator().Unlock();
diff --git a/src/add-ons/kernel/file_systems/nfs4/NFS4Inode.cpp 
b/src/add-ons/kernel/file_systems/nfs4/NFS4Inode.cpp
index aca6514..a026e18 100644
--- a/src/add-ons/kernel/file_systems/nfs4/NFS4Inode.cpp
+++ b/src/add-ons/kernel/file_systems/nfs4/NFS4Inode.cpp
@@ -810,14 +810,15 @@ NFS4Inode::RemoveObject(const char* name, FileType type, 
ChangeInfo* changeInfo,
 
 status_t
 NFS4Inode::ReadDirOnce(DirEntry** dirents, uint32* count, OpenDirCookie* 
cookie,
-       bool* eof, uint64* change, uint64* dirCookie, uint64* dirCookieVerf)
+       bool* eof, uint64* change, uint64* dirCookie, uint64* dirCookieVerf,
+       bool attribute)
 {
        do {
                RPC::Server* serv = fFileSystem->Server();
                Request request(serv);
                RequestBuilder& req = request.Builder();
 
-               if (cookie->fAttrDir)
+               if (attribute)
                        req.PutFH(fInfo.fAttrDir);
                else
                        req.PutFH(fInfo.fHandle);
diff --git a/src/add-ons/kernel/file_systems/nfs4/NFS4Inode.h 
b/src/add-ons/kernel/file_systems/nfs4/NFS4Inode.h
index d7cd366..fad2e89 100644
--- a/src/add-ons/kernel/file_systems/nfs4/NFS4Inode.h
+++ b/src/add-ons/kernel/file_systems/nfs4/NFS4Inode.h
@@ -66,7 +66,8 @@ protected:
 
                        status_t        ReadDirOnce(DirEntry** dirents, uint32* 
count,
                                                        OpenDirCookie* cookie, 
bool* eof, uint64* change,
-                                                       uint64* dirCookie, 
uint64* dirCookieVerf);
+                                                       uint64* dirCookie, 
uint64* dirCookieVerf,
+                                                       bool attribute);
 
                        status_t        OpenAttrDir(FileHandle* handle);
 


Other related posts: