vfs: add current time to new node's structs

This commit is contained in:
Matheus
2022-10-17 14:47:42 -03:00
parent ef782edab2
commit 7aa645fd7b
+7
View File
@@ -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;
}