Kernel: Remove /dev/uptime

This information can now be fetched with clock_gettime.
This commit is contained in:
apio 2022-10-30 10:16:53 +01:00
parent 6df5b8a703
commit af0f4d2037
3 changed files with 0 additions and 41 deletions

View File

@ -1,9 +0,0 @@
#pragma once
#include "fs/VFS.h"
namespace UptimeDevice
{
VFS::Node* create_new(const char* devname);
ssize_t read(VFS::Node* node, size_t offset, size_t size, char* buffer);
}

View File

@ -4,7 +4,6 @@
#include "fs/devices/NullDevice.h"
#include "fs/devices/Random.h"
#include "fs/devices/Serial.h"
#include "fs/devices/Uptime.h"
#include "fs/devices/Version.h"
#include "std/stdlib.h"
#include "std/string.h"
@ -37,7 +36,6 @@ VFS::Node* DeviceFS::get()
devfs_files[devfs_file_count++] = SerialDevice::create_new("serial");
devfs_files[devfs_file_count++] = RandomDevice::create_new("random");
devfs_files[devfs_file_count++] = KeyboardDevice::create_new("kbd");
devfs_files[devfs_file_count++] = UptimeDevice::create_new("uptime");
devfs_files[devfs_file_count++] = NullDevice::create_new("null");
devfs_root->length = devfs_file_count;
return devfs_root;

View File

@ -1,30 +0,0 @@
#include "fs/devices/Uptime.h"
#include "std/stdio.h"
#include "std/stdlib.h"
#include "std/string.h"
#include "thread/PIT.h"
extern uint64_t clock_boot();
VFS::Node* UptimeDevice::create_new(const char* devname)
{
VFS::Node* dev = new VFS::Node;
dev->read_func = UptimeDevice::read;
dev->inode = 0;
dev->length = 0;
dev->type = VFS_DEVICE;
dev->flags = 0;
dev->uid = dev->gid = 0;
dev->mode = 0444;
dev->atime = dev->ctime = dev->mtime = clock_boot();
strncpy(dev->name, devname, sizeof(dev->name));
return dev;
}
ssize_t UptimeDevice::read(VFS::Node* node, size_t offset, size_t size, char* buffer)
{
if (!node) return -1;
if (offset > 0) return 0; // EOF after first read (FIXME: Should be only if everything was read)
snprintf(buffer, size + 1, "%ld", PIT::ms_since_boot); // FIXME: Support offseting this read
return (ssize_t)size;
}