dovecot-2.2: lib-fs: Fixes to async APIs.

dovecot at dovecot.org dovecot at dovecot.org
Sun Oct 21 07:29:16 EEST 2012


details:   http://hg.dovecot.org/dovecot-2.2/rev/260b1ec12f41
changeset: 15229:260b1ec12f41
user:      Timo Sirainen <tss at iki.fi>
date:      Sun Oct 21 07:29:04 2012 +0300
description:
lib-fs: Fixes to async APIs.

diffstat:

 src/lib-fs/fs-api.c |  10 ++++++++++
 src/lib-fs/fs-api.h |   5 ++++-
 2 files changed, 14 insertions(+), 1 deletions(-)

diffs (50 lines):

diff -r b21fe1a1c7ad -r 260b1ec12f41 src/lib-fs/fs-api.c
--- a/src/lib-fs/fs-api.c	Thu Oct 18 06:58:01 2012 +0300
+++ b/src/lib-fs/fs-api.c	Sun Oct 21 07:29:04 2012 +0300
@@ -167,6 +167,11 @@
 	return file->fs->v.write_stream_finish(file, TRUE);
 }
 
+int fs_write_stream_finish_async(struct fs_file *file)
+{
+	return file->fs->v.write_stream_finish(file, TRUE);
+}
+
 void fs_write_stream_abort(struct fs_file *file, struct ostream **output)
 {
 	i_assert(*output == file->output);
@@ -220,6 +225,11 @@
 	return src->fs->v.copy(src, dest);
 }
 
+int fs_copy_finish_async(struct fs_file *dest)
+{
+	return dest->fs->v.copy(NULL, dest);
+}
+
 int fs_rename(struct fs_file *src, struct fs_file *dest)
 {
 	i_assert(src->fs == dest->fs);
diff -r b21fe1a1c7ad -r 260b1ec12f41 src/lib-fs/fs-api.h
--- a/src/lib-fs/fs-api.h	Thu Oct 18 06:58:01 2012 +0300
+++ b/src/lib-fs/fs-api.h	Sun Oct 21 07:29:04 2012 +0300
@@ -115,8 +115,9 @@
 /* Finish writing via stream. The file will be created/replaced/appended only
    after this call, same as with fs_write(). Anything written to the stream
    won't be visible earlier. Returns 1 if ok, 0 if async write isn't finished
-   yet (retry calling this), -1 if error */
+   yet (retry calling fs_write_stream_finish_async()), -1 if error */
 int fs_write_stream_finish(struct fs_file *file, struct ostream **output);
+int fs_write_stream_finish_async(struct fs_file *file);
 /* Abort writing via stream. Anything written to the stream is discarded. */
 void fs_write_stream_abort(struct fs_file *file, struct ostream **output);
 
@@ -142,6 +143,8 @@
    directories are created automatically. Returns 0 if ok, -1 if error
    occurred. */
 int fs_copy(struct fs_file *src, struct fs_file *dest);
+/* Try to finish asynchronous fs_copy() */
+int fs_copy_finish_async(struct fs_file *dest);
 /* Atomically rename a file. Destination parent directories are created
    automatically. Returns 0 if ok, -1 if error occurred. */
 int fs_rename(struct fs_file *src, struct fs_file *dest);


More information about the dovecot-cvs mailing list