enum fs_posix_lock_method lock_method;
mode_t mode;
bool mode_auto;
+ bool have_dirs;
};
struct posix_fs_file {
fs->path_prefix = i_strdup(arg + 7);
} else if (strcmp(arg, "mode=auto") == 0) {
fs->mode_auto = TRUE;
+ } else if (strcmp(arg, "dirs") == 0) {
+ fs->have_dirs = TRUE;
} else if (strncmp(arg, "mode=", 5) == 0) {
unsigned int mode;
if (str_to_uint_oct(arg+5, &mode) < 0) {
i_free(fs);
}
-static enum fs_properties fs_posix_get_properties(struct fs *fs ATTR_UNUSED)
+static enum fs_properties fs_posix_get_properties(struct fs *_fs)
{
- /* FS_PROPERTY_DIRECTORIES not returned because fs_delete()
- automatically rmdir()s parents. This could be changed later though,
- but SIS code at least would need to be changed to support it. */
- return FS_PROPERTY_LOCKS | FS_PROPERTY_FASTCOPY | FS_PROPERTY_RENAME |
+ struct posix_fs *fs = (struct posix_fs *)_fs;
+ enum fs_properties props =
+ FS_PROPERTY_LOCKS | FS_PROPERTY_FASTCOPY | FS_PROPERTY_RENAME |
FS_PROPERTY_STAT | FS_PROPERTY_ITER | FS_PROPERTY_RELIABLEITER;
+
+ /* FS_PROPERTY_DIRECTORIES is not returned normally because fs_delete()
+ automatically rmdir()s parents. For backwards compatibility
+ (especially with SIS code) we'll do it that way, but optionally with
+ "dirs" parameter enable them. This is especially important to be
+ able to use doveadm fs commands to delete empty directories. */
+ if (fs->have_dirs)
+ props |= FS_PROPERTY_DIRECTORIES;
+ return props;
}
static int
{
const char *p;
+ if (fs->have_dirs)
+ return 0;
if (fs->root_path == NULL && fs->path_prefix == NULL)
return 0;