Commit d393b67d authored by Jonas Termansen's avatar Jonas Termansen

Fix st_blksize and st_blocks kernel values.

parent 13658db6
......@@ -123,7 +123,8 @@ void StatInode(Inode* inode, struct stat* st)
st->st_mtim.tv_sec = inode->data->i_mtime;
st->st_mtim.tv_nsec = 0;
st->st_blksize = inode->filesystem->block_size;
st->st_blocks = inode->data->i_blocks;
st->st_blocks = ((uint64_t) inode->data->i_blocks *
(uint64_t) inode->filesystem->block_size) / 512;
}
static void compact_arguments(int* argc, char*** argv)
......
......@@ -44,7 +44,6 @@ Full::Full(dev_t dev, ino_t ino, uid_t owner, gid_t group, mode_t mode)
this->stat_gid = group;
this->stat_mode = (mode & S_SETABLE) | this->type;
this->stat_size = 0;
this->stat_blksize = 1;
this->dev = dev;
this->ino = ino;
}
......
......@@ -122,7 +122,6 @@ File::File(InodeType inode_type, mode_t type, dev_t dev, ino_t ino, uid_t owner,
this->stat_gid = group;
this->stat_mode = (mode & S_SETABLE) | this->type;
this->stat_size = 0;
this->stat_blksize = 1;
this->dev = dev;
this->ino = ino;
this->supports_iovec = true;
......
......@@ -41,7 +41,6 @@ Null::Null(dev_t dev, ino_t ino, uid_t owner, gid_t group, mode_t mode)
this->stat_gid = group;
this->stat_mode = (mode & S_SETABLE) | this->type;
this->stat_size = 0;
this->stat_blksize = 1;
this->dev = dev;
this->ino = ino;
}
......
......@@ -44,7 +44,6 @@ DevRandom::DevRandom(dev_t dev, ino_t ino, uid_t owner, gid_t group,
this->stat_gid = group;
this->stat_mode = (mode & S_SETABLE) | this->type;
this->stat_size = 0;
this->stat_blksize = 1;
this->dev = dev;
this->ino = ino;
}
......
......@@ -46,7 +46,6 @@ UtilMemoryBuffer::UtilMemoryBuffer(dev_t dev, ino_t ino, uid_t owner,
this->stat_gid = group;
this->type = S_IFREG;
this->stat_mode = (mode & S_SETABLE) | this->type;
this->stat_blksize = 1;
this->stat_size = bufsize;
this->dev = dev;
this->ino = ino ? ino : (ino_t) this;
......
......@@ -43,7 +43,6 @@ Zero::Zero(dev_t dev, ino_t ino, uid_t owner, gid_t group, mode_t mode)
this->stat_gid = group;
this->stat_mode = (mode & S_SETABLE) | this->type;
this->stat_size = 0;
this->stat_blksize = 1;
this->dev = dev;
this->ino = ino;
}
......
......@@ -33,6 +33,7 @@
#include <sortix/kernel/ioctx.h>
#include <sortix/kernel/kernel.h>
#include <sortix/kernel/kthread.h>
#include <sortix/kernel/memorymanagement.h>
#include <sortix/kernel/refcount.h>
#include <sortix/kernel/time.h>
......@@ -50,7 +51,7 @@ AbstractInode::AbstractInode()
stat_atim = Time::Get(CLOCK_REALTIME);
stat_ctim = Time::Get(CLOCK_REALTIME);
stat_mtim = Time::Get(CLOCK_REALTIME);
stat_blksize = 0;
stat_blksize = Page::Size();
stat_blocks = 0;
supports_iovec = false;
}
......
......@@ -119,7 +119,7 @@ int Partition::stat(ioctx_t* ctx, struct stat* st)
if ( !ctx->copy_from_src(&myst, st, sizeof(myst)) )
return -1;
myst.st_size = length;
myst.st_blocks = length / (myst.st_blksize ? myst.st_blksize : 1);
myst.st_blocks = length / 512;
if ( !ctx->copy_to_dest(st, &myst, sizeof(myst)) )
return -1;
return 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment