aboutsummaryrefslogtreecommitdiff
path: root/example
diff options
context:
space:
mode:
authorGravatar Miklos Szeredi <miklos@szeredi.hu>2005-10-26 15:29:06 +0000
committerGravatar Miklos Szeredi <miklos@szeredi.hu>2005-10-26 15:29:06 +0000
commitd9079a75b14b73e7953adf4958709b1e5ab3804c (patch)
tree6c20aef91825f2d4d62e18080579be7a1d54f62e /example
parent2c650415ef3e655dbe1c6d39b8fc65c3a6efe998 (diff)
atomic open+create added
Diffstat (limited to 'example')
-rw-r--r--example/fusexmp_fh.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/example/fusexmp_fh.c b/example/fusexmp_fh.c
index d17699e..262a868 100644
--- a/example/fusexmp_fh.c
+++ b/example/fusexmp_fh.c
@@ -215,6 +215,17 @@ static int xmp_utime(const char *path, struct utimbuf *buf)
return 0;
}
+static int xmp_create(const char *path, mode_t mode, struct fuse_file_info *fi)
+{
+ int fd;
+
+ fd = open(path, fi->flags, mode);
+ if(fd == -1)
+ return -errno;
+
+ fi->fh = fd;
+ return 0;
+}
static int xmp_open(const char *path, struct fuse_file_info *fi)
{
@@ -344,6 +355,7 @@ static struct fuse_operations xmp_oper = {
.chown = xmp_chown,
.truncate = xmp_truncate,
.utime = xmp_utime,
+ .create = xmp_create,
.open = xmp_open,
.read = xmp_read,
.write = xmp_write,