/* FUSE: Filesystem in Userspace Copyright (C) 2001-2007 Miklos Szeredi This program can be distributed under the terms of the GNU GPL. See the file COPYING. gcc -Wall `pkg-config fuse --cflags --libs` hello.c -o hello */ #define FUSE_USE_VERSION 26 #include #include #include #include #include #include "client.h" int sock; static int hello_getattr(const char *path, struct stat *stbuf) { int res = 0; if (strcmp(path,"/")==0){ stbuf->st_mode = S_IFDIR | 0755; stbuf->st_nlink = 2; }else{ char res[4]; net_getattr(sock,path,res); if (strcmp(res,"dir")==0){ stbuf->st_mode = S_IFDIR | 0755; stbuf->st_nlink = 2; }else{ stbuf->st_mode = S_IFREG | 0444; stbuf->st_nlink = 1; } } return res; } static int hello_readdir(const char *path, void *buf, fuse_fill_dir_t filler, off_t offset, struct fuse_file_info *fi) { (void) offset; (void) fi; char* results[MAX_RESULTS]; int nb=net_readdir(sock,path,results); filler(buf, ".", NULL, 0); filler(buf, "..", NULL, 0); int i; for (i=0; i