dovecot-2.2: lib-fs: Added flag for iteration returning object IDs.

dovecot at dovecot.org dovecot at dovecot.org
Tue Feb 17 18:44:33 UTC 2015


details:   http://hg.dovecot.org/dovecot-2.2/rev/29bd2bcd56d6
changeset: 18257:29bd2bcd56d6
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Feb 17 20:42:59 2015 +0200
description:
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).

diffstat:

 src/lib-fs/fs-api.c |  3 +++
 src/lib-fs/fs-api.h |  9 ++++++++-
 2 files changed, 11 insertions(+), 1 deletions(-)

diffs (39 lines):

diff -r f13c6f9e0174 -r 29bd2bcd56d6 src/lib-fs/fs-api.c
--- a/src/lib-fs/fs-api.c	Tue Feb 17 16:02:49 2015 +0200
+++ b/src/lib-fs/fs-api.c	Tue Feb 17 20:42:59 2015 +0200
@@ -712,6 +712,9 @@
 {
 	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 -r f13c6f9e0174 -r 29bd2bcd56d6 src/lib-fs/fs-api.h
--- a/src/lib-fs/fs-api.h	Tue Feb 17 16:02:49 2015 +0200
+++ b/src/lib-fs/fs-api.h	Tue Feb 17 20:42:59 2015 +0200
@@ -28,6 +28,8 @@
 	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 @@
 	/* 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 <objectid>/<object name>.
+	   If this isn't supported, the <objectid> 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 {


More information about the dovecot-cvs mailing list