Implemented getattr and source_stat.

Now filesystem implements getattr through source_stat,
which is a wrapper for an fstatat with
`dirfd == handle.root_path`.
This commit is contained in:
2024-11-20 10:32:33 +01:00
parent e48cbc62f1
commit 8fcfebe3f9
3 changed files with 45 additions and 1 deletions

View File

@@ -1,8 +1,9 @@
#define _GNU_SOURCE
#include "sourcefs.h"
#include <fcntl.h>
#include <stdio.h>
#include <sys/stat.h>
static struct source_files_handle {
int root_fd;
@@ -19,3 +20,9 @@ int source_init(const char *root_path) {
return 0;
}
// Currently this literally is a fstatat wrapper.
int source_stat(const char *restrict pathname, struct stat *restrict statbuf) {
int statret = fstatat(handle.root_fd, pathname, statbuf, 0);
return statret;
}