mirror of
https://gitlab.com/sortix/sortix.git
synced 2023-02-13 20:55:38 -05:00
Fix st_blksize and st_blocks kernel values.
This commit is contained in:
parent
13658db632
commit
d393b67d72
9 changed files with 5 additions and 9 deletions
|
@ -123,7 +123,8 @@ void StatInode(Inode* inode, struct stat* st)
|
||||||
st->st_mtim.tv_sec = inode->data->i_mtime;
|
st->st_mtim.tv_sec = inode->data->i_mtime;
|
||||||
st->st_mtim.tv_nsec = 0;
|
st->st_mtim.tv_nsec = 0;
|
||||||
st->st_blksize = inode->filesystem->block_size;
|
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)
|
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_gid = group;
|
||||||
this->stat_mode = (mode & S_SETABLE) | this->type;
|
this->stat_mode = (mode & S_SETABLE) | this->type;
|
||||||
this->stat_size = 0;
|
this->stat_size = 0;
|
||||||
this->stat_blksize = 1;
|
|
||||||
this->dev = dev;
|
this->dev = dev;
|
||||||
this->ino = ino;
|
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_gid = group;
|
||||||
this->stat_mode = (mode & S_SETABLE) | this->type;
|
this->stat_mode = (mode & S_SETABLE) | this->type;
|
||||||
this->stat_size = 0;
|
this->stat_size = 0;
|
||||||
this->stat_blksize = 1;
|
|
||||||
this->dev = dev;
|
this->dev = dev;
|
||||||
this->ino = ino;
|
this->ino = ino;
|
||||||
this->supports_iovec = true;
|
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_gid = group;
|
||||||
this->stat_mode = (mode & S_SETABLE) | this->type;
|
this->stat_mode = (mode & S_SETABLE) | this->type;
|
||||||
this->stat_size = 0;
|
this->stat_size = 0;
|
||||||
this->stat_blksize = 1;
|
|
||||||
this->dev = dev;
|
this->dev = dev;
|
||||||
this->ino = ino;
|
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_gid = group;
|
||||||
this->stat_mode = (mode & S_SETABLE) | this->type;
|
this->stat_mode = (mode & S_SETABLE) | this->type;
|
||||||
this->stat_size = 0;
|
this->stat_size = 0;
|
||||||
this->stat_blksize = 1;
|
|
||||||
this->dev = dev;
|
this->dev = dev;
|
||||||
this->ino = ino;
|
this->ino = ino;
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,6 @@ UtilMemoryBuffer::UtilMemoryBuffer(dev_t dev, ino_t ino, uid_t owner,
|
||||||
this->stat_gid = group;
|
this->stat_gid = group;
|
||||||
this->type = S_IFREG;
|
this->type = S_IFREG;
|
||||||
this->stat_mode = (mode & S_SETABLE) | this->type;
|
this->stat_mode = (mode & S_SETABLE) | this->type;
|
||||||
this->stat_blksize = 1;
|
|
||||||
this->stat_size = bufsize;
|
this->stat_size = bufsize;
|
||||||
this->dev = dev;
|
this->dev = dev;
|
||||||
this->ino = ino ? ino : (ino_t) this;
|
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_gid = group;
|
||||||
this->stat_mode = (mode & S_SETABLE) | this->type;
|
this->stat_mode = (mode & S_SETABLE) | this->type;
|
||||||
this->stat_size = 0;
|
this->stat_size = 0;
|
||||||
this->stat_blksize = 1;
|
|
||||||
this->dev = dev;
|
this->dev = dev;
|
||||||
this->ino = ino;
|
this->ino = ino;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
#include <sortix/kernel/ioctx.h>
|
#include <sortix/kernel/ioctx.h>
|
||||||
#include <sortix/kernel/kernel.h>
|
#include <sortix/kernel/kernel.h>
|
||||||
#include <sortix/kernel/kthread.h>
|
#include <sortix/kernel/kthread.h>
|
||||||
|
#include <sortix/kernel/memorymanagement.h>
|
||||||
#include <sortix/kernel/refcount.h>
|
#include <sortix/kernel/refcount.h>
|
||||||
#include <sortix/kernel/time.h>
|
#include <sortix/kernel/time.h>
|
||||||
|
|
||||||
|
@ -50,7 +51,7 @@ AbstractInode::AbstractInode()
|
||||||
stat_atim = Time::Get(CLOCK_REALTIME);
|
stat_atim = Time::Get(CLOCK_REALTIME);
|
||||||
stat_ctim = Time::Get(CLOCK_REALTIME);
|
stat_ctim = Time::Get(CLOCK_REALTIME);
|
||||||
stat_mtim = Time::Get(CLOCK_REALTIME);
|
stat_mtim = Time::Get(CLOCK_REALTIME);
|
||||||
stat_blksize = 0;
|
stat_blksize = Page::Size();
|
||||||
stat_blocks = 0;
|
stat_blocks = 0;
|
||||||
supports_iovec = false;
|
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)) )
|
if ( !ctx->copy_from_src(&myst, st, sizeof(myst)) )
|
||||||
return -1;
|
return -1;
|
||||||
myst.st_size = length;
|
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)) )
|
if ( !ctx->copy_to_dest(st, &myst, sizeof(myst)) )
|
||||||
return -1;
|
return -1;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in a new issue