Report time in getattr: add and use kos_time_to_epoch.

This commit is contained in:
2018-04-24 19:51:48 +03:00
parent 48a782e407
commit 9513eebc59
4 changed files with 22 additions and 1 deletions
+16
View File
@@ -44,6 +44,21 @@ ends
purge section,mov,add,sub
section '.text' executable align 16
;uint32_t kos_time_to_epoch(uint8_t *time);
public kos_time_to_epoch
kos_time_to_epoch:
push ebx esi edi ebp
mov esi, [esp + 0x14]
call fsCalculateTime
add eax, 978307200 ; epoch to 2001.01.01
pop ebp edi esi ebx
ret
;void *kos_fuse_init(int fd);
public kos_fuse_init
kos_fuse_init:
push ebx esi edi ebp
@@ -76,6 +91,7 @@ kos_fuse_init:
pop ebp edi esi ebx
ret
;char *hello_readdir(const char *path, off_t offset)
public kos_fuse_readdir
kos_fuse_readdir:
+1
View File
@@ -23,6 +23,7 @@ struct bdfe {
#define KF_LABEL 0x08
#define KF_FOLDER 0x10
uint32_t kos_time_to_epoch(uint32_t *time);
void *kos_fuse_init(int fd);
uint8_t *kos_fuse_readdir(const char *path, off_t offset);
void *kos_fuse_getattr(const char *path);
+4
View File
@@ -7,6 +7,7 @@
#include <fcntl.h>
#include <stddef.h>
#include <stdlib.h>
#include <time.h>
#include <assert.h>
#include "kocdecl.h"
@@ -19,6 +20,9 @@ static void bdfe_to_stat(struct bdfe *kf, struct stat *st) {
st->st_nlink = 1;
st->st_size = kf->size;
}
st->st_atim = (struct timespec){kos_time_to_epoch(&(kf->atime)), 0};
st->st_mtim = (struct timespec){kos_time_to_epoch(&(kf->mtime)), 0};
st->st_ctim = (struct timespec){kos_time_to_epoch(&(kf->ctime)), 0};
}
static void *hello_init(struct fuse_conn_info *conn,
+1 -1
View File
@@ -11,7 +11,7 @@ kofu: kofu.o kocdecl.o
kofuse: kofuse.o kocdecl.o
$(CC) $(LDFLAGS) $^ -o $@ `pkg-config fuse3 --libs`
kocdecl.o: kocdecl.asm $(KERNEL_TRUNK)/fs/xfs.inc $(KERNEL_TRUNK)/fs/xfs.asm
kocdecl.o: kocdecl.asm kocdecl.h $(KERNEL_TRUNK)/fs/xfs.inc $(KERNEL_TRUNK)/fs/xfs.asm
INCLUDE="$(KERNEL_TRUNK);$(KERNEL_TRUNK)/fs" $(FASM) $< $@
kofu.o: kofu.c kocdecl.h