From: Timo Sirainen Date: Tue, 17 Feb 2015 18:42:59 +0000 (+0200) Subject: lib-fs: Added flag for iteration returning object IDs. X-Git-Tag: 2.2.16.rc1~49 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8656b625c110d849ece2d040d7880eec20058694;p=thirdparty%2Fdovecot%2Fcore.git lib-fs: Added flag for iteration returning object IDs. The flag is only allowed to be used if FS_PROPERTY_OBJECTIDS is set (to avoid writing extra code for backends that don't support this). --- diff --git a/src/lib-fs/fs-api.c b/src/lib-fs/fs-api.c index 96febffcf0..986e253562 100644 --- a/src/lib-fs/fs-api.c +++ b/src/lib-fs/fs-api.c @@ -712,6 +712,9 @@ fs_iter_init(struct fs *fs, const char *path, enum fs_iter_flags flags) { struct fs_iter *iter; + i_assert((flags & FS_ITER_FLAG_OBJECTIDS) == 0 || + (fs_get_properties(fs) & FS_PROPERTY_OBJECTIDS) != 0); + T_BEGIN { iter = fs->v.iter_init(fs, path, flags); } T_END; diff --git a/src/lib-fs/fs-api.h b/src/lib-fs/fs-api.h index 56ac863944..caa3f3303a 100644 --- a/src/lib-fs/fs-api.h +++ b/src/lib-fs/fs-api.h @@ -28,6 +28,8 @@ enum fs_properties { FS_PROPERTY_COPY_METADATA = 0x400, /* Backend support asynchronous file operations. */ FS_PROPERTY_ASYNC = 0x800, + /* Backend supports FS_ITER_FLAG_OBJECTIDS. */ + FS_PROPERTY_OBJECTIDS = 0x1000 }; enum fs_open_mode { @@ -71,7 +73,12 @@ enum fs_iter_flags { /* Iterate only directories, not files */ FS_ITER_FLAG_DIRS = 0x01, /* Request asynchronous iteration. */ - FS_ITER_FLAG_ASYNC = 0x02 + FS_ITER_FLAG_ASYNC = 0x02, + /* Instead of returning object names, return /. + If this isn't supported, the is returned empty. The + object IDs are always hex-encoded data. This flag can be used only + if FS_PROPERTY_OBJECTIDS is enabled. */ + FS_ITER_FLAG_OBJECTIDS = 0x04 }; struct fs_settings {