Document RENAME_EXCHANGE and RENAME_NOREPLACE flags.
authorNikolaus Rath <Nikolaus@rath.org>
Thu, 25 May 2017 20:12:06 +0000 (13:12 -0700)
committerNikolaus Rath <Nikolaus@rath.org>
Thu, 25 May 2017 20:12:06 +0000 (13:12 -0700)
ChangeLog.rst
include/fuse.h
include/fuse_lowlevel.h

index 3bf56b7dd7349d44bab8e1194571d0bc46bff612..560ad98e2c0ffd2944bc7476ae227498801b79c0 100644 (file)
@@ -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)
 ==========================
index 754303f082dc317b262c518e52b2e90f73b0f766..0c5741fc9038b489516452b1af7e684b95a92954 100644 (file)
@@ -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 *);
index 987b24d984e7dfb1ff11a42076ea802357f04f0f..fd8bc1a2177ff35303afa8ef2c9df49aee5abb63 100644 (file)
@@ -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
         *