aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Nikolaus Rath <Nikolaus@rath.org>2017-05-25 13:12:06 -0700
committerGravatar Nikolaus Rath <Nikolaus@rath.org>2017-05-25 13:12:06 -0700
commit6ac254c00fc6026fd462b7b93aaa9dc4aa676f69 (patch)
tree1bed45a16bd4c6bebed390e25df197c66356e90f
parent8641db4af724682fb1c922cbecf6c7e1dfe1a71c (diff)
Document RENAME_EXCHANGE and RENAME_NOREPLACE flags.
-rw-r--r--ChangeLog.rst4
-rw-r--r--include/fuse.h12
-rw-r--r--include/fuse_lowlevel.h7
3 files changed, 21 insertions, 2 deletions
diff --git a/ChangeLog.rst b/ChangeLog.rst
index 3bf56b7..560ad98 100644
--- a/ChangeLog.rst
+++ b/ChangeLog.rst
@@ -3,6 +3,10 @@ Unreleased Changes
* `fuse_main()` / `fuse_remove_signal_handlers()`: do not reset
`SIGPIPE` handler to `SIG_DFL` it was not set by us.
+* Documented the `RENAME_EXCHANGE` and `RENAME_NOREPLACE` flags that
+ may be passed to the `rename` handler of both the high- and
+ low-level API. Filesystem authors are strongly encouraged to check
+ that these flags are handled correctly.
libfuse 3.0.2 (2017-05-24)
==========================
diff --git a/include/fuse.h b/include/fuse.h
index 754303f..0c5741f 100644
--- a/include/fuse.h
+++ b/include/fuse.h
@@ -339,8 +339,16 @@ struct fuse_operations {
/** Create a symbolic link */
int (*symlink) (const char *, const char *);
- /** Rename a file */
- int (*rename) (const char *, const char *, unsigned int);
+ /** Rename a file
+ *
+ * *flags* may be `RENAME_EXCHANGE` or `RENAME_NOREPLACE`. If
+ * RENAME_NOREPLACE is specified, the filesystem must not
+ * overwrite *newname* if it exists and return an error
+ * instead. If `RENAME_EXCHANGE` is specified, the filesystem
+ * must atomically exchange the two files, i.e. both must
+ * exist and neither may be deleted.
+ */
+ int (*rename) (const char *, const char *, unsigned int flags);
/** Create a hard link to a file */
int (*link) (const char *, const char *);
diff --git a/include/fuse_lowlevel.h b/include/fuse_lowlevel.h
index 987b24d..fd8bc1a 100644
--- a/include/fuse_lowlevel.h
+++ b/include/fuse_lowlevel.h
@@ -408,6 +408,13 @@ struct fuse_lowlevel_ops {
* future bmap requests will fail with EINVAL without being
* send to the filesystem process.
*
+ * *flags* may be `RENAME_EXCHANGE` or `RENAME_NOREPLACE`. If
+ * RENAME_NOREPLACE is specified, the filesystem must not
+ * overwrite *newname* if it exists and return an error
+ * instead. If `RENAME_EXCHANGE` is specified, the filesystem
+ * must atomically exchange the two files, i.e. both must
+ * exist and neither may be deleted.
+ *
* Valid replies:
* fuse_reply_err
*