From: Terje O. <os...@gm...> - 2004-11-10 21:50:24
|
Miklos Szeredi <miklos@...> writes: > I plan intergating something very similar. I'm currently a bit > biased towards an "asynchronous" interface where the filesystem > replies to the request with a function call instead of returning > the result in the arguments. E.g. instead of this: > > int myfs_read(void *user, fino_t ino, char *buf, size_t count, off_t off) > { > char *mydata = lokup_data(ino); > memcpy(buf, mydata+off, count); > return count; > } > > it would look something like this: > > void myfs_read(fuse_req_t req, fino_t ino, size_t count, off_t off) > { > char *mydata = lookup_data(ino); > fuse_reply_read(req, mydata+off, count); > } This is wonderful news for me. I just started working on this, but am quite confused. **************************************** **************************************** **************************************** What I'm thinking is converting this function: static void do_getattr(struct fuse *f, struct fuse_in_header *in) { int res; char *path; struct stat buf; struct fuse_attr_out arg; res = -ENOENT; path = get_path(f, in->ino); if (path != NULL) { res = -ENOSYS; if (f->op.getattr) res = f->op.getattr(path, &buf); free(path); } if (res == 0) { memset(&arg, 0, sizeof(struct fuse_attr_out)); arg.attr_valid = ATTR_REVALIDATE_TIME; arg.attr_valid_nsec = 0; convert_stat(&buf, &arg.attr); } send_reply(f, in, res, &arg, sizeof(arg)); } **************************************** **************************************** **************************************** into these: static int do_getattr_request(struct fuse *f, struct fuse_in_header *in, struct stat *pbuf) { int res; char *path; res = -ENOENT; path = get_path(f, in->ino); if (path != NULL) { res = -ENOSYS; if (f->op.getattr) res = f->op.getattr(path, pbuf); free(path); } return res; } static void do_getattr_reply(struct fuse *f, struct fuse_in_header *in, int res, struct stat *pbuf) { struct fuse_attr_out arg; if (res == 0) { memset(&arg, 0, sizeof(struct fuse_attr_out)); arg.attr_valid = ATTR_REVALIDATE_TIME; arg.attr_valid_nsec = 0; convert_stat(pbuf, &arg.attr); } send_reply(f, in, res, &arg, sizeof(arg)); } static void do_getattr(struct fuse *f, struct fuse_in_header *in) { int res; struct stat buf; res=do_getattr_request(f,in,&buf); do_getattr_reply(f,in,res,&buf); } **************************************** **************************************** **************************************** But I don't believe this change will help me or do what I need to do. My goal is to have an interface similar to the current kernel interface but on another transport medium while continuing to utilize all the inode processing in the current FUSE library. In other words, I would like to ship the usermode fuse operations to a remote location and have an asynchronous interface between them like the current kernel interface, but the simple interface like the current fuse operations interface. At the same time, I'd hope to be able to keep whatever reorganization of the code we come up with compatible with the current interface. So I'm hoping that the new asynchronous library interface could be used to create the current synchronous library interface. I'll try to come up with some use case code as an example of what will work for me before the end of today. Terje |