/* * $ gcc warn.c -o warn -D_FILE_OFFSET_BITS=64 -DFUSE_USE_VERSION=26 -lfuse * * $ mkdir mnt * $ ./warn mnt * $ rm mnt/foo */ #include static int readdir_op(const char *path, void *buf, fuse_fill_dir_t filler, off_t offset, struct fuse_file_info *fi) { struct stat st = {.st_mode = S_IFREG | 0666}; filler(buf, "foo", &st, 0); return 0; } static int getattr_op(const char *path, struct stat *st) { if (strcmp(path, "/") == 0) st->st_mode = S_IFDIR | 0777; else st->st_mode = S_IFREG | 0666; return 0; } static int unlink_op(const char *path) { return 0; } static struct fuse_operations ops = { .readdir = readdir_op, .getattr = getattr_op, .unlink = unlink_op, }; int main(int argc, char *argv[]) { return fuse_main(argc, argv, &ops, NULL); }