static void compiz_readdir(fuse_req_t req, fuse_ino_t ino, size_t size, off_t off, struct fuse_file_info *fi) { CompDisplay *d = (CompDisplay *)fuse_req_userdata(req); FuseInode *inode, *c; struct dirbuf b; inode = fuseFindInode(inodes, ino, DIR_MASK); if (!inode) { fuse_reply_err(req, ENOTDIR); return; } memset(&b, 0, sizeof (b)); dirbuf_add(req, &b, ".", ino); dirbuf_add(req, &b, "..", inode->parent ? inode->parent->ino : ino); if (!inode->child || !(inode->type & CONST_DIR_MASK)) fuseUpdateInode(d, inode); for (c = inode->child; c; c = c->sibling) dirbuf_add(req, &b, c->name, c->ino); reply_buf_limited(req, b.p, b.size, off, size); free(b.p); }
static void lfs_ll_readdir(fuse_req_t req, fuse_ino_t ino, size_t size, off_t off, struct fuse_file_info *fi){ (void) fi; if (ino != 1) fuse_reply_err(req, ENOTDIR); else { struct dirbuf b; memset(&b, 0, sizeof(b)); dirbuf_add(req, &b, ".", 1); dirbuf_add(req, &b, "..", 1); dirbuf_add(req, &b, hello_name, 2); reply_buf_limited(req, b.p, b.size, off, size); free(b.p); } }
void blob_ll_readdir(fuse_req_t req, fuse_ino_t ino, size_t size, off_t off, struct fuse_file_info */*fi*/) { struct stat stbuf; memset(&stbuf, 0, sizeof(stbuf)); int result = blob_stat(ino, &stbuf); if (result != 0) { fuse_reply_err(req, result); return; } if ((stbuf.st_mode & S_IFDIR) == 0) { fuse_reply_err(req, ENOTDIR); return; } DBG("read_dir ino = " << ino); dirbuf b; memset(&b, 0, sizeof(b)); dirbuf_add(req, &b, ".", ino); dirbuf_add(req, &b, "..", 1); if (ino == 1) // root directory for (unsigned int i = 2; i < stbuf.st_nlink; i++) { ostringstream s; s << "blob-" << (i - 1); dirbuf_add(req, &b, s.str().c_str(), build_ino(i - 1, 0)); } else // blob id for (unsigned int i = 2; i < stbuf.st_nlink; i++) { ostringstream s("version-"); s << "version-" << (i - 1); dirbuf_add(req, &b, s.str().c_str(), build_ino(ino_id(ino), i - 1)); } reply_buf_limited(req, b.p, b.size, off, size); free(b.p); }