Kernel: Changed stat values from func to be field
- Removed virtual functions for all of the stat stuff. This did however introduce some issues, mainly with /proc becoming out of sync if you changed your ID. I propose we do the linux thing and just have a stat update function which is optional, but allows dynamic updates of stat fields for cases such as those in uid/gid in /proc. - Simplified the API, although still kind of annoying it is a bit simpler. - Moved some of the FS structure from having the FS inode inside the in memory inode to a Serialise <-> Deserialise model where Inodes are deserialised from disk into in memory ones and then back into on disk ones when it comes time for syncing. This makes it semantically better in my opinion, as it explicitly separates disk and non-disk functionality.
This commit is contained in:
@@ -65,8 +65,9 @@ namespace Kernel
|
||||
PseudoTerminalMaster::PseudoTerminalMaster(BAN::UniqPtr<VirtualRange> buffer, mode_t mode, uid_t uid, gid_t gid)
|
||||
: CharacterDevice(mode, uid, gid)
|
||||
, m_buffer(BAN::move(buffer))
|
||||
, m_rdev(makedev(DeviceNumber::PTSMaster, s_pts_master_minor++))
|
||||
{ }
|
||||
{
|
||||
m_rdev = makedev(DeviceNumber::PTSMaster, s_pts_master_minor++);
|
||||
}
|
||||
|
||||
PseudoTerminalMaster::~PseudoTerminalMaster()
|
||||
{
|
||||
|
||||
@@ -72,9 +72,9 @@ namespace Kernel
|
||||
|
||||
TTY::TTY(termios termios, mode_t mode, uid_t uid, gid_t gid)
|
||||
: CharacterDevice(mode, uid, gid)
|
||||
, m_rdev(next_tty_rdev())
|
||||
, m_termios(termios)
|
||||
{
|
||||
m_rdev = next_tty_rdev();
|
||||
m_output.buffer = MUST(ByteRingBuffer::create(PAGE_SIZE));
|
||||
}
|
||||
|
||||
@@ -158,16 +158,15 @@ namespace Kernel
|
||||
{
|
||||
// FIXME: make this atomic
|
||||
ASSERT((mode & Inode::Mode::TYPE_MASK) == 0);
|
||||
m_inode_info.mode &= Inode::Mode::TYPE_MASK;
|
||||
m_inode_info.mode |= mode;
|
||||
m_mode &= Inode::Mode::TYPE_MASK;
|
||||
m_mode |= mode;
|
||||
return {};
|
||||
}
|
||||
|
||||
BAN::ErrorOr<void> TTY::chown_impl(uid_t uid, gid_t gid)
|
||||
{
|
||||
// FIXME: make this atomic
|
||||
m_inode_info.uid = uid;
|
||||
m_inode_info.gid = gid;
|
||||
m_uid = uid;
|
||||
m_gid = gid;
|
||||
return {};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user