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

  • From: pdziepak-github.nfs4 <community@xxxxxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Fri, 10 Aug 2012 00:49:13 +0200 (CEST)

added 4 changesets to branch 'refs/remotes/pdziepak-github/nfs4'
old head: 20d1b02eefc137b62fac748323e6747c7f9e6ef3
new head: 0e0d53c7995f23e83364ec628c9623041e2b22bc

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

775a18c: nfs4: Fix WriteState when state == NULL

ad5adda: nfs4: Fix assignment to temporary

1fdcacc: AVLTreeMap::MakeEmpty should set fTree.fRoot to NULL

0e0d53c: nfs4: Fill struct stat st_blksize and st_blocks fields

                                    [ Pawel Dziepak <pdziepak@xxxxxxxxxxx> ]

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

4 files changed, 14 insertions(+), 5 deletions(-)
headers/private/kernel/util/AVLTreeMap.h           |    1 +
src/add-ons/kernel/file_systems/nfs4/Inode.cpp     |    4 ++++
.../kernel/file_systems/nfs4/MetadataCache.cpp     |    6 ++++--
src/add-ons/kernel/file_systems/nfs4/NFS4Inode.cpp |    8 +++++---

############################################################################

Commit:      775a18c15539d65febd73c7f9858fb118bb6faff

Author:      Pawel Dziepak <pdziepak@xxxxxxxxxxx>
Date:        Thu Aug  9 21:54:22 2012 UTC

nfs4: Fix WriteState when state == NULL

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

diff --git a/src/add-ons/kernel/file_systems/nfs4/NFS4Inode.cpp 
b/src/add-ons/kernel/file_systems/nfs4/NFS4Inode.cpp
index 9c09532..565b502 100644
--- a/src/add-ons/kernel/file_systems/nfs4/NFS4Inode.cpp
+++ b/src/add-ons/kernel/file_systems/nfs4/NFS4Inode.cpp
@@ -287,11 +287,13 @@ NFS4Inode::WriteStat(OpenState* state, AttrValue* attrs, 
uint32 attrCount)
                Request request(serv);
                RequestBuilder& req = request.Builder();
 
-               req.PutFH(state->fInfo.fHandle);
-               if (state != NULL)
+               if (state != NULL) {
+                       req.PutFH(state->fInfo.fHandle);
                        req.SetAttr(state->fStateID, state->fStateSeq, attrs, 
attrCount);
-               else
+               } else {
+                       req.PutFH(fInfo.fHandle);
                        req.SetAttr(NULL, 0, attrs, attrCount);
+               }
 
                status_t result = request.Send();
                if (result != B_OK)

############################################################################

Commit:      ad5adda8e7a704244a13beec503c41d16854e0ab

Author:      Pawel Dziepak <pdziepak@xxxxxxxxxxx>
Date:        Thu Aug  9 21:57:31 2012 UTC

nfs4: Fix assignment to temporary

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

diff --git a/src/add-ons/kernel/file_systems/nfs4/MetadataCache.cpp 
b/src/add-ons/kernel/file_systems/nfs4/MetadataCache.cpp
index d561e29..6429e6e 100644
--- a/src/add-ons/kernel/file_systems/nfs4/MetadataCache.cpp
+++ b/src/add-ons/kernel/file_systems/nfs4/MetadataCache.cpp
@@ -84,7 +84,7 @@ MetadataCache::GetAccess(uid_t uid, uint32* allowed)
                return B_ENTRY_NOT_FOUND;
 
        if (!fForceValid)
-               it.Current().fForceValid = false;
+               it.CurrentValuePointer()->fForceValid = false;
 
        if (!it.Current().fForceValid && it.Current().fExpire < time(NULL)) {
                it.Remove();
@@ -167,3 +167,4 @@ MetadataCache::NotifyChanges(const struct stat* oldStat,
 
        notify_stat_changed(fInode->GetFileSystem()->DevId(), fInode->ID(), 
flags);
 }
+

############################################################################

Commit:      1fdcaccf17782c690dc056f8655e68ccdb85e8c1

Author:      Pawel Dziepak <pdziepak@xxxxxxxxxxx>
Date:        Thu Aug  9 22:01:15 2012 UTC

AVLTreeMap::MakeEmpty should set fTree.fRoot to NULL

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

diff --git a/headers/private/kernel/util/AVLTreeMap.h 
b/headers/private/kernel/util/AVLTreeMap.h
index ea436be..051f4e7 100644
--- a/headers/private/kernel/util/AVLTreeMap.h
+++ b/headers/private/kernel/util/AVLTreeMap.h
@@ -269,6 +269,7 @@ _AVL_TREE_MAP_CLASS_NAME::MakeEmpty()
 {
        AVLTreeNode* root = fTree.Root();
        _FreeTree(root);
+       fTree.MakeEmpty();
 }
 
 

############################################################################

Commit:      0e0d53c7995f23e83364ec628c9623041e2b22bc

Author:      Pawel Dziepak <pdziepak@xxxxxxxxxxx>
Date:        Thu Aug  9 22:18:37 2012 UTC

nfs4: Fill struct stat st_blksize and st_blocks fields

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

diff --git a/src/add-ons/kernel/file_systems/nfs4/Inode.cpp 
b/src/add-ons/kernel/file_systems/nfs4/Inode.cpp
index b0af354..cd7f14b 100644
--- a/src/add-ons/kernel/file_systems/nfs4/Inode.cpp
+++ b/src/add-ons/kernel/file_systems/nfs4/Inode.cpp
@@ -534,6 +534,10 @@ Inode::GetStat(struct stat* st, OpenAttrCookie* attr)
                memset(&st->st_mtim, 0, sizeof(timespec));
        delete[] values;
 
+       st->st_blksize = fFileSystem->Root()->IOSize();
+       st->st_blocks = st->st_size / st->st_blksize;
+       st->st_blocks += st->st_size % st->st_blksize == 0 ? 0 : 1;
+
        return B_OK;
 }
 
diff --git a/src/add-ons/kernel/file_systems/nfs4/MetadataCache.cpp 
b/src/add-ons/kernel/file_systems/nfs4/MetadataCache.cpp
index 6429e6e..3c0f9b6 100644
--- a/src/add-ons/kernel/file_systems/nfs4/MetadataCache.cpp
+++ b/src/add-ons/kernel/file_systems/nfs4/MetadataCache.cpp
@@ -46,7 +46,8 @@ MetadataCache::GetStat(struct stat* st)
                st->st_ctim = fStatCache.st_ctim;
                st->st_crtim = fStatCache.st_crtim;
                st->st_mtim = fStatCache.st_mtim;
-
+               st->st_blksize = fStatCache.st_blksize;
+               st->st_blocks = fStatCache.st_blocks;
                return B_OK;
        }
 


Other related posts:

  • » [haiku-commits] BRANCH pdziepak-github.nfs4 - src/add-ons/kernel/file_systems/nfs4 headers/private/kernel/util - pdziepak-github . nfs4