1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
|
#define FUSE_USE_VERSION 26
#include <stdio.h> #include <fuse.h>
static int test_readdir(const char* path, void* buf, fuse_fill_dir_t filler, off_t offset, struct fuse_file_info* fi) { printf("tfs_readdir path: %s \r\n ", path); return filler(buf, "Hello-world", NULL,0); }
static int test_getattr(const char* path, struct stat* stbuff) { printf("test_getattr path:%s \r\n ", path); if(strcmp(path, "/") == 0) stbuff->st_mode = 0755 | S_IFDIR; else stbuff->st_mode = 0644 | S_IFREG; return 0; }
static struct fuse_operations tfs_ops = { .readdir = test_readdir, .getattr = test_getattr, };
int main(int argc, char* argv[]) { int ret = 0; ret = fuse_main(argc,argv,&tfs_ops,NULL); return ret; }
|