dovecot-2.2: lib-fs: fs-metawrap now fully wraps fs_iter_* to fi...

dovecot at dovecot.org dovecot at dovecot.org
Mon Sep 15 21:43:51 UTC 2014


details:   http://hg.dovecot.org/dovecot-2.2/rev/1010f2ba9f2d
changeset: 17806:1010f2ba9f2d
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Sep 16 00:43:36 2014 +0300
description:
lib-fs: fs-metawrap now fully wraps fs_iter_* to fix tracking struct fs.iters

diffstat:

 src/lib-fs/fs-metawrap.c |  36 ++++++++++++++++++++++++++++++++----
 1 files changed, 32 insertions(+), 4 deletions(-)

diffs (60 lines):

diff -r 98f937eed2e5 -r 1010f2ba9f2d src/lib-fs/fs-metawrap.c
--- a/src/lib-fs/fs-metawrap.c	Tue Sep 16 00:21:52 2014 +0300
+++ b/src/lib-fs/fs-metawrap.c	Tue Sep 16 00:43:36 2014 +0300
@@ -28,6 +28,11 @@
 	bool metadata_read;
 };
 
+struct metawrap_fs_iter {
+	struct fs_iter iter;
+	struct fs_iter *super;
+};
+
 static struct fs *fs_metawrap_alloc(void)
 {
 	struct metawrap_fs *fs;
@@ -406,9 +411,32 @@
 
 static struct fs_iter *
 fs_metawrap_iter_init(struct fs *_fs, const char *path,
-			  enum fs_iter_flags flags)
+		      enum fs_iter_flags flags)
 {
-	return fs_iter_init(_fs->parent, path, flags);
+	struct metawrap_fs_iter *iter;
+
+	iter = i_new(struct metawrap_fs_iter, 1);
+	iter->iter.fs = _fs;
+	iter->iter.flags = flags;
+	iter->super = fs_iter_init(_fs->parent, path, flags);
+	return &iter->iter;
+}
+
+static const char *fs_metawrap_iter_next(struct fs_iter *_iter)
+{
+	struct metawrap_fs_iter *iter = (struct metawrap_fs_iter *)_iter;
+
+	return fs_iter_next(iter->super);
+}
+
+static int fs_metawrap_iter_deinit(struct fs_iter *_iter)
+{
+	struct metawrap_fs_iter *iter = (struct metawrap_fs_iter *)_iter;
+	int ret;
+
+	ret = fs_iter_deinit(&iter->super);
+	i_free(iter);
+	return ret;
 }
 
 const struct fs fs_class_metawrap = {
@@ -440,7 +468,7 @@
 		fs_metawrap_rename,
 		fs_metawrap_delete,
 		fs_metawrap_iter_init,
-		NULL,
-		NULL
+		fs_metawrap_iter_next,
+		fs_metawrap_iter_deinit
 	}
 };


More information about the dovecot-cvs mailing list