[haiku-commits] haiku: hrev54454 - src/add-ons/kernel/file_systems/btrfs

  • From: waddlesplash <waddlesplash@xxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Tue, 21 Jul 2020 22:26:20 -0400 (EDT)

hrev54454 adds 1 changeset to branch 'master'
old head: 385d1b54e1774904b28175298876231030b591b8
new head: 4316066974baea9f14c83e957dbc432fb764a0e2
overview: 
https://git.haiku-os.org/haiku/log/?qt=range&q=4316066974ba+%5E385d1b54e177

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

4316066974ba: Revert "btrfs: partially implemented btrfs_write_stat"
  
  This reverts commit f16979003a9740ca3fa54ebe0b64aa627b6f69f1.
  
  Reason for revert: Broke the build.
  
  Change-Id: I60ed4a4c4532810c32c6c5029a21ba8d31f92aa9
  Reviewed-on: https://review.haiku-os.org/c/haiku/+/3055
  Reviewed-by: waddlesplash <waddlesplash@xxxxxxxxx>

                                   [ waddlesplash <waddlesplash@xxxxxxxxx> ]

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

Revision:    hrev54454
Commit:      4316066974baea9f14c83e957dbc432fb764a0e2
URL:         https://git.haiku-os.org/haiku/commit/?id=4316066974ba
Author:      waddlesplash <waddlesplash@xxxxxxxxx>
Date:        Wed Jul 22 02:26:00 2020 UTC

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

2 files changed, 1 insertion(+), 95 deletions(-)
src/add-ons/kernel/file_systems/btrfs/Inode.h    |  1 -
.../file_systems/btrfs/kernel_interface.cpp      | 95 +-------------------

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

diff --git a/src/add-ons/kernel/file_systems/btrfs/Inode.h 
b/src/add-ons/kernel/file_systems/btrfs/Inode.h
index cdfebbadd0..a970304516 100644
--- a/src/add-ons/kernel/file_systems/btrfs/Inode.h
+++ b/src/add-ons/kernel/file_systems/btrfs/Inode.h
@@ -46,7 +46,6 @@ public:
                                                        { return 
S_ISLNK(Mode()); }
                        status_t        CheckPermissions(int accessMode) const;
 
-                       btrfs_inode&    Node() { return fNode; }
                        mode_t          Mode() const { return fNode.Mode(); }
                        off_t           Size() const { return fNode.Size(); }
                        uid_t           UserID() const { return fNode.UserID(); 
}
diff --git a/src/add-ons/kernel/file_systems/btrfs/kernel_interface.cpp 
b/src/add-ons/kernel/file_systems/btrfs/kernel_interface.cpp
index b87118b7e8..bbe0c32b6d 100644
--- a/src/add-ons/kernel/file_systems/btrfs/kernel_interface.cpp
+++ b/src/add-ons/kernel/file_systems/btrfs/kernel_interface.cpp
@@ -399,99 +399,6 @@ btrfs_read_stat(fs_volume* _volume, fs_vnode* _node, 
struct stat* stat)
 }
 
 
-static status_t
-btrfs_write_stat(fs_volume* _volume, fs_vnode* _node, const struct stat* stat,
-       uint32 mask)
-{
-       FUNCTION();
-
-       Volume* volume = (Volume*)_volume->private_volume;
-       Inode* inode = (Inode*)_node->private_node;
-
-       if (volume->IsReadOnly())
-               return B_READ_ONLY_DEVICE;
-
-       btrfs_inode& node = inode->Node();
-       bool updateTime = false;
-       uid_t uid = geteuid();
-
-       bool isOwnerOrRoot = uid == 0 || uid == (uid_t)node.UserID();
-       bool hasWriteAccess = inode->CheckPermissions(W_OK) == B_OK;
-
-       Transaction transaction(volume);
-
-       if ((mask & B_STAT_SIZE) != 0 && inode->Size() != stat->st_size) {
-               if (inode->IsDirectory())
-                       return B_IS_A_DIRECTORY;
-               if (!inode->IsFile())
-                       return B_BAD_VALUE;
-               if (!hasWriteAccess)
-                       RETURN_ERROR(B_NOT_ALLOWED);
-
-               //TODO: implement file shrinking/growing
-               return B_NOT_SUPPORTED;
-       }
-
-       if ((mask & B_STAT_UID) != 0) {
-               if (uid != 0)
-                       RETURN_ERROR(B_NOT_ALLOWED);
-               node.uid = B_HOST_TO_LENDIAN_INT32(stat->st_uid);
-               updateTime = true;
-       }
-
-       if ((mask & B_STAT_GID) != 0) {
-               if (!isOwnerOrRoot)
-                       RETURN_ERROR(B_NOT_ALLOWED);
-               node.gid = B_HOST_TO_LENDIAN_INT32(stat->st_gid);
-               updateTime = true;
-       }
-
-       if ((mask & B_STAT_MODE) != 0) {
-               if (!isOwnerOrRoot)
-                       RETURN_ERROR(B_NOT_ALLOWED);
-               PRINT(("original mode = %ld, stat->st_mode = %d\n", node.Mode(),
-                       stat->st_mode));
-               node.mode = B_HOST_TO_LENDIAN_INT32((node.Mode() & ~S_IUMSK)
-                       | (stat->st_mode & S_IUMSK));
-               updateTime = true;
-       }
-
-       if ((mask & B_STAT_CREATION_TIME) != 0) {
-               if (!isOwnerOrRoot && !hasWriteAccess)
-                       RETURN_ERROR(B_NOT_ALLOWED);
-               btrfs_inode::SetTime(node.change_time, stat->st_crtim);
-       }
-
-       if ((mask & B_STAT_MODIFICATION_TIME) != 0) {
-               if (!isOwnerOrRoot && !hasWriteAccess)
-                       RETURN_ERROR(B_NOT_ALLOWED);
-               btrfs_inode::SetTime(node.change_time, stat->st_mtim);
-       }
-
-       if ((mask & B_STAT_CHANGE_TIME) != 0 || updateTime) {
-               if (!isOwnerOrRoot && !hasWriteAccess)
-                       RETURN_ERROR(B_NOT_ALLOWED);
-               if ((mask & B_STAT_CHANGE_TIME) == 0) {
-                       uint64_t microseconds = real_time_clock_usecs();
-                       struct timespec t;
-                       t.tv_sec = microseconds / 1000000;
-                       t.tv_usecs = microseconds % 1000000;
-                       btrfs_inode::SetTime(node.change_time, t);
-               } else
-                       btrfs_inode::SetTime(node.change_time, stat->st_ctim);
-       }
-
-       status_t status = transaction.Done();
-       if (status == B_OK) {
-               ino_t pid;
-               inode->FindParent(&pid);
-               notify_stat_changed(volume->ID(), pid, inode->ID(), mask);
-       }
-
-       return status;
-}
-
-
 static status_t
 btrfs_open(fs_volume* /*_volume*/, fs_vnode* _node, int openMode,
        void** _cookie)
@@ -1137,7 +1044,7 @@ fs_vnode_ops gBtrfsVnodeOps = {
 
        &btrfs_access,
        &btrfs_read_stat,
-       &btrfs_write_stat,
+       NULL,   // fs_write_stat,
        NULL,   // fs_preallocate
 
        /* file operations */


Other related posts:

  • » [haiku-commits] haiku: hrev54454 - src/add-ons/kernel/file_systems/btrfs - waddlesplash