diff options
author | Miklos Szeredi <miklos@szeredi.hu> | 2004-11-26 12:15:06 +0000 |
---|---|---|
committer | Miklos Szeredi <miklos@szeredi.hu> | 2004-11-26 12:15:06 +0000 |
commit | fb28c5ebe1efdc3e3b125aad1a19f1a240519345 (patch) | |
tree | cfe63db63bc515c36886dad956ee8c171167d496 /lib | |
parent | 97de5118b5c240063f634e9fa41998dc72708b56 (diff) |
API change
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Makefile.am | 2 | ||||
-rw-r--r-- | lib/fuse.c | 40 | ||||
-rw-r--r-- | lib/fuse_i.h | 1 |
3 files changed, 32 insertions, 11 deletions
diff --git a/lib/Makefile.am b/lib/Makefile.am index 8dcd5a8..e370ef4 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -9,4 +9,4 @@ libfuse_la_SOURCES = \ mount.c \ fuse_i.h -libfuse_la_LDFLAGS = -lpthread -version-number 2:1:0 +libfuse_la_LDFLAGS = -lpthread -version-number 3:0:0 @@ -1058,13 +1058,16 @@ static void do_open(struct fuse *f, struct fuse_in_header *in, int res; char *path; struct fuse_open_out outarg; + struct fuse_file_info fi; + memset(&fi, 0, sizeof(fi)); + fi.flags = arg->flags; res = -ENOENT; path = get_path(f, in->nodeid); if (path != NULL) { res = -ENOSYS; if (f->op.open) - res = f->op.open(path, arg->flags); + res = f->op.open(path, &fi); } if (res == 0) { int res2; @@ -1074,8 +1077,7 @@ static void do_open(struct fuse *f, struct fuse_in_header *in, races with rename/unlink, against which the kernel can't protect */ pthread_mutex_lock(&f->lock); - f->fh_ctr ++; - outarg.fh = f->fh_ctr; + outarg.fh = fi.fh; if (f->flags & FUSE_DEBUG) { printf("OPEN[%lu] flags: 0x%x\n", outarg.fh, arg->flags); fflush(stdout); @@ -1085,7 +1087,7 @@ static void do_open(struct fuse *f, struct fuse_in_header *in, if(res2 == -ENOENT) { /* The open syscall was interrupted, so it must be cancelled */ if(f->op.release) - f->op.release(path, arg->flags); + f->op.release(path, &fi); } else get_node(f, in->nodeid)->open_count ++; pthread_mutex_unlock(&f->lock); @@ -1102,7 +1104,10 @@ static void do_flush(struct fuse *f, struct fuse_in_header *in, { char *path; int res; + struct fuse_file_info fi; + memset(&fi, 0, sizeof(fi)); + fi.fh = arg->fh; res = -ENOENT; path = get_path(f, in->nodeid); if (path != NULL) { @@ -1112,7 +1117,7 @@ static void do_flush(struct fuse *f, struct fuse_in_header *in, } res = -ENOSYS; if (f->op.flush) - res = f->op.flush(path); + res = f->op.flush(path, &fi); free(path); } send_reply(f, in, res, NULL, 0); @@ -1123,6 +1128,11 @@ static void do_release(struct fuse *f, struct fuse_in_header *in, { struct node *node; char *path; + struct fuse_file_info fi; + + memset(&fi, 0, sizeof(fi)); + fi.flags = arg->flags; + fi.fh = arg->fh; pthread_mutex_lock(&f->lock); node = get_node(f, in->nodeid); @@ -1136,7 +1146,7 @@ static void do_release(struct fuse *f, struct fuse_in_header *in, fflush(stdout); } if (f->op.release) - f->op.release(path, arg->flags); + f->op.release(path, &fi); if(node->is_hidden && node->open_count == 0) /* can now clean up this hidden file */ @@ -1160,7 +1170,11 @@ static void do_read(struct fuse *f, struct fuse_in_header *in, char *buf = outbuf + sizeof(struct fuse_out_header); size_t size; size_t outsize; + struct fuse_file_info fi; + memset(&fi, 0, sizeof(fi)); + fi.fh = arg->fh; + res = -ENOENT; path = get_path(f, in->nodeid); if (path != NULL) { @@ -1172,7 +1186,7 @@ static void do_read(struct fuse *f, struct fuse_in_header *in, res = -ENOSYS; if (f->op.read) - res = f->op.read(path, buf, arg->size, arg->offset); + res = f->op.read(path, buf, arg->size, arg->offset, &fi); free(path); } @@ -1201,6 +1215,10 @@ static void do_write(struct fuse *f, struct fuse_in_header *in, int res; char *path; struct fuse_write_out outarg; + struct fuse_file_info fi; + + memset(&fi, 0, sizeof(fi)); + fi.fh = arg->fh; res = -ENOENT; path = get_path(f, in->nodeid); @@ -1214,7 +1232,7 @@ static void do_write(struct fuse *f, struct fuse_in_header *in, res = -ENOSYS; if (f->op.write) - res = f->op.write(path, PARAM(arg), arg->size, arg->offset); + res = f->op.write(path, PARAM(arg), arg->size, arg->offset, &fi); free(path); } @@ -1267,6 +1285,10 @@ static void do_fsync(struct fuse *f, struct fuse_in_header *in, { int res; char *path; + struct fuse_file_info fi; + + memset(&fi, 0, sizeof(fi)); + fi.fh = inarg->fh; res = -ENOENT; path = get_path(f, in->nodeid); @@ -1277,7 +1299,7 @@ static void do_fsync(struct fuse *f, struct fuse_in_header *in, } res = -ENOSYS; if (f->op.fsync) - res = f->op.fsync(path, inarg->datasync); + res = f->op.fsync(path, inarg->datasync, &fi); free(path); } send_reply(f, in, res, NULL, 0); diff --git a/lib/fuse_i.h b/lib/fuse_i.h index ca230a9..b9ea903 100644 --- a/lib/fuse_i.h +++ b/lib/fuse_i.h @@ -51,7 +51,6 @@ struct fuse { nodeid_t ctr; unsigned int generation; unsigned int hidectr; - unsigned long fh_ctr; pthread_mutex_t lock; int numworker; int numavail; |