dovecot-2.2: lib-fs: fs_wait_async() can now return an error.
dovecot at dovecot.org
dovecot at dovecot.org
Mon Nov 26 23:03:18 EET 2012
details: http://hg.dovecot.org/dovecot-2.2/rev/38f3bd4bf6e3
changeset: 15396:38f3bd4bf6e3
user: Timo Sirainen <tss at iki.fi>
date: Mon Nov 26 22:59:37 2012 +0200
description:
lib-fs: fs_wait_async() can now return an error.
diffstat:
src/lib-fs/fs-api-private.h | 2 +-
src/lib-fs/fs-api.c | 8 +++++---
src/lib-fs/fs-api.h | 5 +++--
src/lib-fs/fs-sis-queue.c | 4 ++--
src/lib-fs/fs-sis.c | 4 ++--
5 files changed, 13 insertions(+), 10 deletions(-)
diffs (80 lines):
diff -r fa32c5f9cf71 -r 38f3bd4bf6e3 src/lib-fs/fs-api-private.h
--- a/src/lib-fs/fs-api-private.h Sat Nov 24 00:32:56 2012 +0200
+++ b/src/lib-fs/fs-api-private.h Mon Nov 26 22:59:37 2012 +0200
@@ -19,7 +19,7 @@
void (*set_async_callback)(struct fs_file *file,
fs_file_async_callback_t *callback,
void *context);
- void (*wait_async)(struct fs *fs);
+ int (*wait_async)(struct fs *fs);
void (*set_metadata)(struct fs_file *file, const char *key,
const char *value);
diff -r fa32c5f9cf71 -r 38f3bd4bf6e3 src/lib-fs/fs-api.c
--- a/src/lib-fs/fs-api.c Sat Nov 24 00:32:56 2012 +0200
+++ b/src/lib-fs/fs-api.c Mon Nov 26 22:59:37 2012 +0200
@@ -190,10 +190,12 @@
callback(context);
}
-void fs_wait_async(struct fs *fs)
+int fs_wait_async(struct fs *fs)
{
- if (fs->v.wait_async != NULL)
- fs->v.wait_async(fs);
+ if (fs->v.wait_async == NULL)
+ return 0;
+ else
+ return fs->v.wait_async(fs);
}
int fs_lock(struct fs_file *file, unsigned int secs, struct fs_lock **lock_r)
diff -r fa32c5f9cf71 -r 38f3bd4bf6e3 src/lib-fs/fs-api.h
--- a/src/lib-fs/fs-api.h Sat Nov 24 00:32:56 2012 +0200
+++ b/src/lib-fs/fs-api.h Mon Nov 26 22:59:37 2012 +0200
@@ -127,8 +127,9 @@
fs_file_async_callback_t *callback,
void *context);
/* Wait until some file can be read/written to more before returning.
- It's an error to call this when there are no pending async operations. */
-void fs_wait_async(struct fs *fs);
+ It's an error to call this when there are no pending async operations.
+ Returns 0 if ok, -1 if timed out. */
+int fs_wait_async(struct fs *fs);
/* Returns 1 if file exists, 0 if not, -1 if error occurred. */
int fs_exists(struct fs_file *file);
diff -r fa32c5f9cf71 -r 38f3bd4bf6e3 src/lib-fs/fs-sis-queue.c
--- a/src/lib-fs/fs-sis-queue.c Sat Nov 24 00:32:56 2012 +0200
+++ b/src/lib-fs/fs-sis-queue.c Mon Nov 26 22:59:37 2012 +0200
@@ -127,11 +127,11 @@
fs_file_set_async_callback(file->super, callback, context);
}
-static void fs_sis_queue_wait_async(struct fs *_fs)
+static int fs_sis_queue_wait_async(struct fs *_fs)
{
struct sis_queue_fs *fs = (struct sis_queue_fs *)_fs;
- fs_wait_async(fs->super);
+ return fs_wait_async(fs->super);
}
static void
diff -r fa32c5f9cf71 -r 38f3bd4bf6e3 src/lib-fs/fs-sis.c
--- a/src/lib-fs/fs-sis.c Sat Nov 24 00:32:56 2012 +0200
+++ b/src/lib-fs/fs-sis.c Mon Nov 26 22:59:37 2012 +0200
@@ -164,11 +164,11 @@
fs_file_set_async_callback(file->super, callback, context);
}
-static void fs_sis_wait_async(struct fs *_fs)
+static int fs_sis_wait_async(struct fs *_fs)
{
struct sis_fs *fs = (struct sis_fs *)_fs;
- fs_wait_async(fs->super);
+ return fs_wait_async(fs->super);
}
static void
More information about the dovecot-cvs
mailing list