]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-fs: Add FS_METADATA_ORIG_PATH
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Fri, 31 Mar 2017 09:28:56 +0000 (12:28 +0300)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Mon, 3 Apr 2017 11:00:04 +0000 (14:00 +0300)
This allows fs backends to keep track of the original filename and use it
for logging purposes and such.

src/lib-fs/fs-api.c
src/lib-fs/fs-api.h

index d3030edd070a40b907cb7fa945c05e156fc258bb..4e74e53769e305f6af886dd23e0d253160e00703 100644 (file)
@@ -234,6 +234,8 @@ struct fs_file *fs_file_init(struct fs *fs, const char *path, int mode_flags)
        file->flags = mode_flags & ~FS_OPEN_MODE_MASK;
        fs->files_open_count++;
        DLLIST_PREPEND(&fs->files, file);
+
+       fs_set_metadata(file, FS_METADATA_ORIG_PATH, path);
        return file;
 }
 
index 4fd3cce780daa9ec625a92210d642ae1e5a338b0..84f53c149bcdf9a8285c816ba5123e9d374de0fc 100644 (file)
@@ -17,6 +17,10 @@ struct hash_method;
    This can be useful if you don't know the final filename before writing it
    (e.g. filename contains the file size). */
 #define FS_METADATA_WRITE_FNAME FS_METADATA_INTERNAL_PREFIX"WriteFilename"
+/* Original path of the file. The path that's eventually visible to a fs
+   backend may be something different, e.g. object ID. This allows the backend
+   to still access the original path. */
+#define FS_METADATA_ORIG_PATH FS_METADATA_INTERNAL_PREFIX"OrigPath"
 
 enum fs_properties {
        FS_PROPERTY_METADATA    = 0x01,