mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-11-01 15:08:21 +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 <arch/spinlock.h>
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <kernel/pipe.h>
|
#include <kernel/pipe.h>
|
||||||
|
#include <arch/timekeeper.h>
|
||||||
|
|
||||||
dirnode_t* vfsroot;
|
dirnode_t* vfsroot;
|
||||||
hashtable fsfuncs;
|
hashtable fsfuncs;
|
||||||
@@ -330,6 +331,8 @@ int vfs_mount(dirnode_t* ref, char* device, char* mountpoint, char* fs, int moun
|
|||||||
return result;
|
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* vfs_newnode(char* name, fs_t* fs, void* fsdata){
|
||||||
vnode_t* node = alloc(sizeof(vnode_t));
|
vnode_t* node = alloc(sizeof(vnode_t));
|
||||||
if(!node) return NULL;
|
if(!node) return NULL;
|
||||||
@@ -343,6 +346,8 @@ vnode_t* vfs_newnode(char* name, fs_t* fs, void* fsdata){
|
|||||||
node->fsdata = fsdata;
|
node->fsdata = fsdata;
|
||||||
strcpy(node->name, name);
|
strcpy(node->name, name);
|
||||||
|
|
||||||
|
ADDTIMETOSTAT(node->st);
|
||||||
|
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -374,6 +379,8 @@ dirnode_t* vfs_newdirnode(char* name, fs_t* fs, void* fsdata, dirnode_t* parent)
|
|||||||
vnode->fsdata = fsdata;
|
vnode->fsdata = fsdata;
|
||||||
strcpy(vnode->name, name);
|
strcpy(vnode->name, name);
|
||||||
|
|
||||||
|
ADDTIMETOSTAT(vnode->st);
|
||||||
|
|
||||||
return node;
|
return node;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user