33 lines
710 B
C
33 lines
710 B
C
#include <stdio.h>
|
|
#include <string.h>
|
|
#include <errno.h>
|
|
#include <fcntl.h>
|
|
|
|
#include "network.h"
|
|
#include "fuse_local.h"
|
|
|
|
static struct fuse_operations fs_oper = {
|
|
.getattr = fs_getattr,
|
|
.readdir = fs_readdir,
|
|
.open = fs_open,
|
|
.read = fs_read,
|
|
};
|
|
|
|
static int fs_getattr(const char *path, struct stat *stbuf)
|
|
{
|
|
int res = 0;
|
|
|
|
memset(stbuf, 0, sizeof(struct stat));
|
|
if (strcmp(path, "/") == 0) {
|
|
stbuf->st_mode = S_IFDIR | 0755;
|
|
stbuf->st_nlink = 2;
|
|
} else if (strcmp(path, hello_path) == 0) {
|
|
stbuf->st_mode = S_IFREG | 0444;
|
|
stbuf->st_nlink = 1;
|
|
stbuf->st_size = strlen(hello_str);
|
|
} else
|
|
res = -ENOENT;
|
|
|
|
return res;
|
|
}
|