mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-10-27 12:48:22 +00:00
vfs: add current time to new node's structs
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
#include <arch/spinlock.h>
|
||||
#include <dirent.h>
|
||||
#include <kernel/pipe.h>
|
||||
#include <arch/timekeeper.h>
|
||||
|
||||
dirnode_t* vfsroot;
|
||||
hashtable fsfuncs;
|
||||
@@ -330,6 +331,8 @@ int vfs_mount(dirnode_t* ref, char* device, char* mountpoint, char* fs, int moun
|
||||
return result;
|
||||
}
|
||||
|
||||
#define ADDTIMETOSTAT(st) st.st_atim = st.st_ctim = st.st_mtim = arch_timekeeper_gettime()
|
||||
|
||||
vnode_t* vfs_newnode(char* name, fs_t* fs, void* fsdata){
|
||||
vnode_t* node = alloc(sizeof(vnode_t));
|
||||
if(!node) return NULL;
|
||||
@@ -343,6 +346,8 @@ vnode_t* vfs_newnode(char* name, fs_t* fs, void* fsdata){
|
||||
node->fsdata = fsdata;
|
||||
strcpy(node->name, name);
|
||||
|
||||
ADDTIMETOSTAT(node->st);
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
@@ -374,6 +379,8 @@ dirnode_t* vfs_newdirnode(char* name, fs_t* fs, void* fsdata, dirnode_t* parent)
|
||||
vnode->fsdata = fsdata;
|
||||
strcpy(vnode->name, name);
|
||||
|
||||
ADDTIMETOSTAT(vnode->st);
|
||||
|
||||
return node;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user