Compare commits
No commits in common. "e640c6e2457e92e2c10608584a05ca8db0a436b8" and "e705810af3e0398818fc9e4ed882d9087217728f" have entirely different histories.
e640c6e245
...
e705810af3
@ -2,7 +2,6 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/stat.h>
|
||||
#include <time.h>
|
||||
|
||||
const char* mode_to_string(mode_t mode)
|
||||
{
|
||||
@ -56,10 +55,6 @@ int main(int argc, char** argv)
|
||||
printf("Owned by: %s\n", own->pw_name);
|
||||
printf("Mode: %s\n", mode_to_string(st.st_mode));
|
||||
|
||||
printf("Accessed on: %s", ctime(&st.st_atime));
|
||||
printf("Modified on: %s", ctime(&st.st_mtime));
|
||||
printf("Changed on: %s", ctime(&st.st_ctime));
|
||||
|
||||
endpwent();
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
|
@ -41,9 +41,6 @@ namespace VFS
|
||||
Node* link;
|
||||
int uid;
|
||||
int gid;
|
||||
uint64_t atime;
|
||||
uint64_t ctime;
|
||||
uint64_t mtime;
|
||||
mode_t mode;
|
||||
};
|
||||
|
||||
|
@ -5,8 +5,6 @@
|
||||
#include "std/stdlib.h"
|
||||
#include "std/string.h"
|
||||
|
||||
extern uint64_t clock_boot();
|
||||
|
||||
VFS::Node* ConsoleDevice::create_new(const char* devname)
|
||||
{
|
||||
VFS::Node* dev = new VFS::Node;
|
||||
@ -18,7 +16,6 @@ VFS::Node* ConsoleDevice::create_new(const char* devname)
|
||||
dev->tty = 1;
|
||||
dev->uid = dev->gid = 0;
|
||||
dev->mode = 0222;
|
||||
dev->atime = dev->ctime = dev->mtime = clock_boot();
|
||||
strncpy(dev->name, devname, sizeof(dev->name));
|
||||
return dev;
|
||||
}
|
||||
|
@ -16,8 +16,6 @@ VFS::Node* devfs_root = nullptr;
|
||||
VFS::Node* devfs_files[DEVFS_MAX_FILES];
|
||||
int devfs_file_count = 0;
|
||||
|
||||
extern uint64_t clock_boot();
|
||||
|
||||
VFS::Node* DeviceFS::get()
|
||||
{
|
||||
if (devfs_root) return devfs_root;
|
||||
@ -29,7 +27,6 @@ VFS::Node* DeviceFS::get()
|
||||
devfs_root->readdir_func = DeviceFS::readdir;
|
||||
devfs_root->mode = 0755;
|
||||
devfs_root->uid = devfs_root->gid = 0;
|
||||
devfs_root->atime = devfs_root->ctime = devfs_root->mtime = clock_boot();
|
||||
strncpy(devfs_root->name, "dev", sizeof(devfs_root->name));
|
||||
|
||||
devfs_files[devfs_file_count++] = VersionDevice::create_new("version");
|
||||
|
@ -16,8 +16,6 @@ int KeyboardDevice::would_block(VFS::Node*)
|
||||
return kbd_bufsize == 0;
|
||||
}
|
||||
|
||||
extern uint64_t clock_boot();
|
||||
|
||||
VFS::Node* KeyboardDevice::create_new(const char* devname)
|
||||
{
|
||||
VFS::Node* dev = new VFS::Node;
|
||||
@ -30,7 +28,6 @@ VFS::Node* KeyboardDevice::create_new(const char* devname)
|
||||
dev->tty = 1;
|
||||
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;
|
||||
}
|
||||
|
@ -3,8 +3,6 @@
|
||||
#include "std/stdlib.h"
|
||||
#include "std/string.h"
|
||||
|
||||
extern uint64_t clock_boot();
|
||||
|
||||
VFS::Node* NullDevice::create_new(const char* devname)
|
||||
{
|
||||
VFS::Node* dev = new VFS::Node;
|
||||
@ -16,7 +14,6 @@ VFS::Node* NullDevice::create_new(const char* devname)
|
||||
dev->flags = 0;
|
||||
dev->uid = dev->gid = 0;
|
||||
dev->mode = 0666;
|
||||
dev->atime = dev->ctime = dev->mtime = clock_boot();
|
||||
strncpy(dev->name, devname, sizeof(dev->name));
|
||||
return dev;
|
||||
}
|
||||
|
@ -6,8 +6,6 @@
|
||||
#include "std/stdlib.h"
|
||||
#include "std/string.h"
|
||||
|
||||
extern uint64_t clock_boot();
|
||||
|
||||
VFS::Node* RandomDevice::create_new(const char* devname)
|
||||
{
|
||||
VFS::Node* dev = new VFS::Node;
|
||||
@ -18,7 +16,6 @@ VFS::Node* RandomDevice::create_new(const char* devname)
|
||||
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;
|
||||
}
|
||||
|
@ -5,8 +5,6 @@
|
||||
#include "std/stdlib.h"
|
||||
#include "std/string.h"
|
||||
|
||||
extern uint64_t clock_boot();
|
||||
|
||||
VFS::Node* SerialDevice::create_new(const char* devname)
|
||||
{
|
||||
VFS::Node* dev = new VFS::Node;
|
||||
@ -17,7 +15,6 @@ VFS::Node* SerialDevice::create_new(const char* devname)
|
||||
dev->flags = 0;
|
||||
dev->uid = dev->gid = 0;
|
||||
dev->mode = 0200;
|
||||
dev->atime = dev->ctime = dev->mtime = clock_boot();
|
||||
strncpy(dev->name, devname, sizeof(dev->name));
|
||||
return dev;
|
||||
}
|
||||
|
@ -4,8 +4,6 @@
|
||||
#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;
|
||||
@ -16,7 +14,6 @@ VFS::Node* UptimeDevice::create_new(const char* devname)
|
||||
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;
|
||||
}
|
||||
|
@ -4,8 +4,6 @@
|
||||
#include "std/stdlib.h"
|
||||
#include "std/string.h"
|
||||
|
||||
extern uint64_t clock_boot();
|
||||
|
||||
VFS::Node* VersionDevice::create_new(const char* devname)
|
||||
{
|
||||
VFS::Node* dev = new VFS::Node;
|
||||
@ -16,7 +14,6 @@ VFS::Node* VersionDevice::create_new(const char* devname)
|
||||
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;
|
||||
}
|
||||
|
@ -18,9 +18,6 @@ static bool initrd_initialized = false;
|
||||
|
||||
static VFS::Node initrd_root;
|
||||
|
||||
extern uint64_t clock_boot(); // defined in sys/clock.cpp
|
||||
extern uint64_t clock_now();
|
||||
|
||||
bool InitRD::is_initialized()
|
||||
{
|
||||
return initrd_initialized;
|
||||
@ -237,7 +234,6 @@ int initrd_mkdir(VFS::Node* node, const char* name, mode_t mode) // FIXME: Retur
|
||||
new_node.type = VFS_DIRECTORY;
|
||||
new_node.mode = mode;
|
||||
new_node.uid = new_node.gid = 0;
|
||||
new_node.atime = new_node.ctime = new_node.mtime = clock_now();
|
||||
strncpy(new_node.name, name, sizeof(new_node.name));
|
||||
InitRD::Directory dir;
|
||||
strncpy(dir.name, name, sizeof(dir.name));
|
||||
@ -297,7 +293,6 @@ static bool initrd_register_dir(InitRD::Directory& dir, uint64_t inode)
|
||||
node.length = 0;
|
||||
node.mode = 0755;
|
||||
node.uid = node.gid = 0;
|
||||
node.atime = node.ctime = node.mtime = clock_boot();
|
||||
strncpy(node.name, buffer, sizeof(node.name));
|
||||
strncpy(dir.name, buffer, sizeof(dir.name));
|
||||
|
||||
@ -359,7 +354,6 @@ static bool initrd_register_file(InitRD::File& f, uint64_t inode)
|
||||
node.type = VFS_FILE;
|
||||
node.mode = f.mode & 07555; // don't allow writing
|
||||
node.uid = node.gid = 0;
|
||||
node.atime = node.ctime = node.mtime = clock_boot();
|
||||
strncpy(node.name, buffer, sizeof(node.name));
|
||||
strncpy(f.name, buffer, sizeof(f.name));
|
||||
|
||||
@ -404,7 +398,6 @@ static void initrd_initialize_root()
|
||||
initrd_root.type |= VFS_DIRECTORY;
|
||||
initrd_root.mode = 0755;
|
||||
initrd_root.uid = initrd_root.gid = 0;
|
||||
initrd_root.atime = initrd_root.ctime = initrd_root.mtime = clock_boot();
|
||||
InitRD::Directory& root = dirs[0];
|
||||
total_dirs++;
|
||||
strncpy(initrd_root.name, "initrd", sizeof(initrd_root.name));
|
||||
|
@ -228,7 +228,6 @@ int sprintf(char* __s, const char* fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
if (__s) *__s = 0;
|
||||
int written = internal_printf(
|
||||
fmt,
|
||||
[&](const char* s) {
|
||||
@ -243,7 +242,6 @@ int snprintf(char* __s, size_t max, const char* fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
if (__s && max) *__s = 0;
|
||||
int written = internal_printf(
|
||||
fmt,
|
||||
[&](const char* s) {
|
||||
@ -268,7 +266,6 @@ int vkprintf(const char* fmt, va_list ap)
|
||||
|
||||
int vsprintf(char* __s, const char* fmt, va_list ap)
|
||||
{
|
||||
*__s = 0;
|
||||
return internal_printf(
|
||||
fmt,
|
||||
[&](const char* s) {
|
||||
@ -279,7 +276,6 @@ int vsprintf(char* __s, const char* fmt, va_list ap)
|
||||
|
||||
int vsnprintf(char* __s, size_t max, const char* fmt, va_list ap)
|
||||
{
|
||||
if (max) *__s = 0;
|
||||
return internal_printf(
|
||||
fmt,
|
||||
[&](const char* s) {
|
||||
|
@ -71,13 +71,3 @@ void clock_init()
|
||||
{
|
||||
unix_boot_time = unix_boottime(bootboot.datetime);
|
||||
}
|
||||
|
||||
uint64_t clock_now()
|
||||
{
|
||||
return unix_boot_time + (PIT::ms_since_boot / 1000);
|
||||
}
|
||||
|
||||
uint64_t clock_boot()
|
||||
{
|
||||
return unix_boot_time;
|
||||
}
|
@ -16,9 +16,9 @@ struct stat // FIXME: This struct is quite stubbed out.
|
||||
int st_dev; // FIXME: Implement this.
|
||||
uid_t st_uid;
|
||||
gid_t st_gid;
|
||||
time_t st_atime;
|
||||
time_t st_mtime;
|
||||
time_t st_ctime;
|
||||
time_t st_atime; // Not implemented.
|
||||
time_t st_mtime; // Not implemented.
|
||||
time_t st_ctime; // Not implemented.
|
||||
};
|
||||
|
||||
void do_stat(Context* context, VFS::Node* node, struct stat* buf)
|
||||
@ -34,9 +34,6 @@ void do_stat(Context* context, VFS::Node* node, struct stat* buf)
|
||||
kstat->st_size = node->length;
|
||||
kstat->st_uid = node->uid;
|
||||
kstat->st_gid = node->gid;
|
||||
kstat->st_atime = node->atime;
|
||||
kstat->st_ctime = node->ctime;
|
||||
kstat->st_mtime = node->mtime;
|
||||
release_user_ref(kstat);
|
||||
context->rax = 0;
|
||||
}
|
||||
|
@ -12,9 +12,9 @@ struct stat // FIXME: This struct is quite stubbed out.
|
||||
int st_dev; // Not implemented.
|
||||
uid_t st_uid;
|
||||
gid_t st_gid;
|
||||
time_t st_atime;
|
||||
time_t st_mtime;
|
||||
time_t st_ctime;
|
||||
time_t st_atime; // Not implemented.
|
||||
time_t st_mtime; // Not implemented.
|
||||
time_t st_ctime; // Not implemented.
|
||||
};
|
||||
|
||||
/* Type of file. */
|
||||
|
@ -261,7 +261,6 @@ extern "C"
|
||||
|
||||
int vsprintf(char* str, const char* format, va_list ap)
|
||||
{
|
||||
if (str) *str = 0; // so strncat starts from the beginning
|
||||
return internal_printf(
|
||||
format,
|
||||
[&](const char* s) {
|
||||
@ -272,7 +271,6 @@ extern "C"
|
||||
|
||||
int vsnprintf(char* str, size_t max, const char* format, va_list ap)
|
||||
{
|
||||
if (max && str) *str = 0; // so strncat starts from the beginning
|
||||
return internal_printf(
|
||||
format,
|
||||
[&](const char* s) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user