dovecot: Split o_stream_create_file() to _create_fd() and _creat...
dovecot at dovecot.org
dovecot at dovecot.org
Thu Aug 2 19:06:39 EEST 2007
details: http://hg.dovecot.org/dovecot/rev/c62f7ee79446
changeset: 6161:c62f7ee79446
user: Timo Sirainen <tss at iki.fi>
date: Thu Aug 02 18:23:22 2007 +0300
description:
Split o_stream_create_file() to _create_fd() and _create_fd_file().
diffstat:
34 files changed, 100 insertions(+), 72 deletions(-)
src/auth/auth-client-connection.c | 3
src/auth/auth-master-connection.c | 2
src/auth/auth-worker-client.c | 3
src/auth/auth-worker-server.c | 2
src/deliver/auth-client.c | 2
src/deliver/duplicate.c | 2
src/dict/dict-server.c | 2
src/imap-login/client.c | 2
src/imap/client.c | 2
src/lib-auth/auth-server-connection.c | 2
src/lib-dict/dict-client.c | 2
src/lib-index/mail-cache-compress.c | 2
src/lib-index/mailbox-list-index-sync.c | 2
src/lib-storage/index/cydir/cydir-save.c | 2
src/lib-storage/index/dbox/dbox-sync-expunge.c | 2
src/lib-storage/index/dbox/dbox-uidlist.c | 6 -
src/lib-storage/index/maildir/maildir-save.c | 2
src/lib-storage/index/maildir/maildir-uidlist.c | 2
src/lib-storage/index/mbox/mbox-save.c | 4 -
src/lib-storage/index/mbox/mbox-sync-rewrite.c | 2
src/lib-storage/list/subscription-file.c | 3
src/lib/file-copy.c | 2
src/lib/ostream-file.c | 76 ++++++++++++++++-------
src/lib/ostream.h | 6 +
src/login-common/login-proxy.c | 2
src/master/auth-process.c | 2
src/master/login-process.c | 5 -
src/plugins/acl/acl-backend-vfile-acllist.c | 2
src/plugins/expire/auth-client.c | 2
src/plugins/fts-squat/squat-trie.c | 10 ---
src/plugins/fts-squat/squat-uidlist.c | 5 -
src/pop3-login/client.c | 2
src/pop3/client.c | 2
src/util/rawlog.c | 5 -
diffs (truncated from 567 to 300 lines):
diff -r fe1e6e895d8f -r c62f7ee79446 src/auth/auth-client-connection.c
--- a/src/auth/auth-client-connection.c Thu Aug 02 17:35:04 2007 +0300
+++ b/src/auth/auth-client-connection.c Thu Aug 02 18:23:22 2007 +0300
@@ -276,8 +276,7 @@ auth_client_connection_create(struct aut
conn->fd = fd;
conn->input =
i_stream_create_file(fd, AUTH_CLIENT_MAX_LINE_LENGTH, FALSE);
- conn->output =
- o_stream_create_file(fd, (size_t)-1, FALSE);
+ conn->output = o_stream_create_fd(fd, (size_t)-1, FALSE);
o_stream_set_flush_callback(conn->output, auth_client_output, conn);
conn->io = io_add(fd, IO_READ, auth_client_input, conn);
diff -r fe1e6e895d8f -r c62f7ee79446 src/auth/auth-master-connection.c
--- a/src/auth/auth-master-connection.c Thu Aug 02 17:35:04 2007 +0300
+++ b/src/auth/auth-master-connection.c Thu Aug 02 18:23:22 2007 +0300
@@ -243,7 +243,7 @@ auth_master_connection_create(struct aut
conn->refcount = 1;
conn->fd = fd;
conn->input = i_stream_create_file(fd, MAX_INBUF_SIZE, FALSE);
- conn->output = o_stream_create_file(fd, (size_t)-1, FALSE);
+ conn->output = o_stream_create_fd(fd, (size_t)-1, FALSE);
o_stream_set_flush_callback(conn->output, master_output, conn);
conn->io = io_add(fd, IO_READ, master_input, conn);
diff -r fe1e6e895d8f -r c62f7ee79446 src/auth/auth-worker-client.c
--- a/src/auth/auth-worker-client.c Thu Aug 02 17:35:04 2007 +0300
+++ b/src/auth/auth-worker-client.c Thu Aug 02 18:23:22 2007 +0300
@@ -469,8 +469,7 @@ auth_worker_client_create(struct auth *a
client->fd = fd;
client->input =
i_stream_create_file(fd, AUTH_WORKER_MAX_LINE_LENGTH, FALSE);
- client->output =
- o_stream_create_file(fd, (size_t)-1, FALSE);
+ client->output = o_stream_create_fd(fd, (size_t)-1, FALSE);
o_stream_set_flush_callback(client->output, auth_worker_output, client);
client->io = io_add(fd, IO_READ, auth_worker_input, client);
diff -r fe1e6e895d8f -r c62f7ee79446 src/auth/auth-worker-server.c
--- a/src/auth/auth-worker-server.c Thu Aug 02 17:35:04 2007 +0300
+++ b/src/auth/auth-worker-server.c Thu Aug 02 18:23:22 2007 +0300
@@ -81,7 +81,7 @@ static struct auth_worker_connection *au
conn->fd = fd;
conn->input = i_stream_create_file(fd, AUTH_WORKER_MAX_LINE_LENGTH,
FALSE);
- conn->output = o_stream_create_file(fd, (size_t)-1, FALSE);
+ conn->output = o_stream_create_fd(fd, (size_t)-1, FALSE);
conn->io = io_add(fd, IO_READ, worker_input, conn);
conn->requests = buffer_create_dynamic(default_pool, 128);
diff -r fe1e6e895d8f -r c62f7ee79446 src/deliver/auth-client.c
--- a/src/deliver/auth-client.c Thu Aug 02 17:35:04 2007 +0300
+++ b/src/deliver/auth-client.c Thu Aug 02 18:23:22 2007 +0300
@@ -180,7 +180,7 @@ static struct auth_connection *auth_conn
conn = i_new(struct auth_connection, 1);
conn->fd = fd;
conn->input = i_stream_create_file(fd, MAX_INBUF_SIZE, FALSE);
- conn->output = o_stream_create_file(fd, MAX_OUTBUF_SIZE, FALSE);
+ conn->output = o_stream_create_fd(fd, MAX_OUTBUF_SIZE, FALSE);
conn->io = io_add(fd, IO_READ, auth_input, conn);
return conn;
}
diff -r fe1e6e895d8f -r c62f7ee79446 src/deliver/duplicate.c
--- a/src/deliver/duplicate.c Thu Aug 02 17:35:04 2007 +0300
+++ b/src/deliver/duplicate.c Thu Aug 02 18:23:22 2007 +0300
@@ -218,7 +218,7 @@ void duplicate_flush(void)
if (duplicate_file == NULL || !file->changed || file->new_fd == -1)
return;
- output = o_stream_create_file(file->new_fd, 4096, FALSE);
+ output = o_stream_create_fd_file(file->new_fd, 0, FALSE);
iter = hash_iterate_init(file->hash);
while (hash_iterate(iter, &key, &value)) {
struct duplicate *d = value;
diff -r fe1e6e895d8f -r c62f7ee79446 src/dict/dict-server.c
--- a/src/dict/dict-server.c Thu Aug 02 17:35:04 2007 +0300
+++ b/src/dict/dict-server.c Thu Aug 02 18:23:22 2007 +0300
@@ -448,7 +448,7 @@ dict_client_connection_init(struct dict_
conn->fd = fd;
conn->input = i_stream_create_file(fd, DICT_CLIENT_MAX_LINE_LENGTH,
FALSE);
- conn->output = o_stream_create_file(fd, 128*1024, FALSE);
+ conn->output = o_stream_create_fd(fd, 128*1024, FALSE);
conn->io = io_add(fd, IO_READ, dict_client_connection_input, conn);
return conn;
}
diff -r fe1e6e895d8f -r c62f7ee79446 src/imap-login/client.c
--- a/src/imap-login/client.c Thu Aug 02 17:35:04 2007 +0300
+++ b/src/imap-login/client.c Thu Aug 02 18:23:22 2007 +0300
@@ -69,7 +69,7 @@ static void client_open_streams(struct i
static void client_open_streams(struct imap_client *client, int fd)
{
client->input = i_stream_create_file(fd, MAX_INBUF_SIZE, FALSE);
- client->output = o_stream_create_file(fd, MAX_OUTBUF_SIZE, FALSE);
+ client->output = o_stream_create_fd(fd, MAX_OUTBUF_SIZE, FALSE);
client->parser = imap_parser_create(client->input, client->output,
MAX_IMAP_LINE);
}
diff -r fe1e6e895d8f -r c62f7ee79446 src/imap/client.c
--- a/src/imap/client.c Thu Aug 02 17:35:04 2007 +0300
+++ b/src/imap/client.c Thu Aug 02 18:23:22 2007 +0300
@@ -32,7 +32,7 @@ struct client *client_create(int fd_in,
client->fd_out = fd_out;
client->input =
i_stream_create_file(fd_in, imap_max_line_length, FALSE);
- client->output = o_stream_create_file(fd_out, (size_t)-1, FALSE);
+ client->output = o_stream_create_fd(fd_out, (size_t)-1, FALSE);
o_stream_set_flush_callback(client->output, _client_output, client);
diff -r fe1e6e895d8f -r c62f7ee79446 src/lib-auth/auth-server-connection.c
--- a/src/lib-auth/auth-server-connection.c Thu Aug 02 17:35:04 2007 +0300
+++ b/src/lib-auth/auth-server-connection.c Thu Aug 02 18:23:22 2007 +0300
@@ -228,7 +228,7 @@ auth_server_connection_new(struct auth_c
conn->io = io_add(fd, IO_READ, auth_client_input, conn);
conn->input = i_stream_create_file(fd, AUTH_CLIENT_MAX_LINE_LENGTH,
FALSE);
- conn->output = o_stream_create_file(fd, (size_t)-1, FALSE);
+ conn->output = o_stream_create_fd(fd, (size_t)-1, FALSE);
conn->requests = hash_create(default_pool, pool, 100, NULL, NULL);
conn->auth_mechs_buf = buffer_create_dynamic(default_pool, 256);
diff -r fe1e6e895d8f -r c62f7ee79446 src/lib-dict/dict-client.c
--- a/src/lib-dict/dict-client.c Thu Aug 02 17:35:04 2007 +0300
+++ b/src/lib-dict/dict-client.c Thu Aug 02 18:23:22 2007 +0300
@@ -245,7 +245,7 @@ static int client_dict_connect(struct cl
net_set_nonblock(dict->fd, FALSE);
dict->input = i_stream_create_file(dict->fd, (size_t)-1, FALSE);
- dict->output = o_stream_create_file(dict->fd, 4096, FALSE);
+ dict->output = o_stream_create_fd(dict->fd, 4096, FALSE);
dict->transaction_id_counter = 0;
t_push();
diff -r fe1e6e895d8f -r c62f7ee79446 src/lib-index/mail-cache-compress.c
--- a/src/lib-index/mail-cache-compress.c Thu Aug 02 17:35:04 2007 +0300
+++ b/src/lib-index/mail-cache-compress.c Thu Aug 02 18:23:22 2007 +0300
@@ -138,7 +138,7 @@ mail_cache_copy(struct mail_cache *cache
}
cache_view = mail_cache_view_open(cache, view);
- output = o_stream_create_file(fd, 0, FALSE);
+ output = o_stream_create_fd_file(fd, 0, FALSE);
memset(&hdr, 0, sizeof(hdr));
hdr.version = MAIL_CACHE_VERSION;
diff -r fe1e6e895d8f -r c62f7ee79446 src/lib-index/mailbox-list-index-sync.c
--- a/src/lib-index/mailbox-list-index-sync.c Thu Aug 02 17:35:04 2007 +0300
+++ b/src/lib-index/mailbox-list-index-sync.c Thu Aug 02 18:23:22 2007 +0300
@@ -850,7 +850,7 @@ mailbox_list_index_sync_write(struct mai
int ret = 0;
if (ctx->index->mmap_base == NULL) {
- ctx->output = o_stream_create_file(ctx->index->fd, 0, FALSE);
+ ctx->output = o_stream_create_fd_file(ctx->index->fd, 0, FALSE);
ctx->output_buf = buffer_create_dynamic(default_pool, 4096);
o_stream_seek(ctx->output, ctx->hdr.used_space);
}
diff -r fe1e6e895d8f -r c62f7ee79446 src/lib-storage/index/cydir/cydir-save.c
--- a/src/lib-storage/index/cydir/cydir-save.c Thu Aug 02 17:35:04 2007 +0300
+++ b/src/lib-storage/index/cydir/cydir-save.c Thu Aug 02 18:23:22 2007 +0300
@@ -85,7 +85,7 @@ int cydir_save_init(struct mailbox_trans
path = cydir_get_save_path(ctx, ctx->mail_count);
ctx->fd = open(path, O_WRONLY | O_CREAT | O_EXCL, 0660);
if (ctx->fd != -1) {
- output = o_stream_create_file(ctx->fd, 0, FALSE);
+ output = o_stream_create_fd_file(ctx->fd, 0, FALSE);
ctx->output = o_stream_create_crlf(output);
o_stream_unref(&output);
o_stream_cork(ctx->output);
diff -r fe1e6e895d8f -r c62f7ee79446 src/lib-storage/index/dbox/dbox-sync-expunge.c
--- a/src/lib-storage/index/dbox/dbox-sync-expunge.c Thu Aug 02 17:35:04 2007 +0300
+++ b/src/lib-storage/index/dbox/dbox-sync-expunge.c Thu Aug 02 18:23:22 2007 +0300
@@ -145,7 +145,7 @@ static int dbox_sync_expunge_copy(struct
/* try again with another file name */
}
- output = o_stream_create_file(fd, 0, FALSE);
+ output = o_stream_create_fd_file(fd, 0, FALSE);
lock_path = file_dotlock_get_lock_path(dotlock);
memset(&dest_entry, 0, sizeof(dest_entry));
diff -r fe1e6e895d8f -r c62f7ee79446 src/lib-storage/index/dbox/dbox-uidlist.c
--- a/src/lib-storage/index/dbox/dbox-uidlist.c Thu Aug 02 17:35:04 2007 +0300
+++ b/src/lib-storage/index/dbox/dbox-uidlist.c Thu Aug 02 18:23:22 2007 +0300
@@ -559,7 +559,7 @@ static int dbox_uidlist_full_rewrite(str
return 0;
}
- output = o_stream_create_file(uidlist->lock_fd, 0, FALSE);
+ output = o_stream_create_fd_file(uidlist->lock_fd, 0, FALSE);
t_push();
str = t_str_new(256);
@@ -739,7 +739,7 @@ static int dbox_uidlist_append_changes(s
"lseek(%s) failed: %m", ctx->uidlist->path);
return -1;
}
- output = o_stream_create_file(ctx->uidlist->fd, 0, FALSE);
+ output = o_stream_create_fd_file(ctx->uidlist->fd, 0, FALSE);
uid_start = ctx->uidlist->last_uid + 1;
@@ -968,7 +968,7 @@ dbox_file_append(struct dbox_uidlist_app
file->fd = fd;
file->input = i_stream_create_file(file->fd, 65536, FALSE);
- file->output = o_stream_create_file(file->fd, 0, FALSE);
+ file->output = o_stream_create_fd_file(file->fd, 0, FALSE);
if ((uoff_t)st->st_size < sizeof(struct dbox_file_header)) {
if (dbox_file_write_header(mbox, file) < 0) {
dbox_file_close(file);
diff -r fe1e6e895d8f -r c62f7ee79446 src/lib-storage/index/maildir/maildir-save.c
--- a/src/lib-storage/index/maildir/maildir-save.c Thu Aug 02 17:35:04 2007 +0300
+++ b/src/lib-storage/index/maildir/maildir-save.c Thu Aug 02 18:23:22 2007 +0300
@@ -377,7 +377,7 @@ int maildir_save_init(struct mailbox_tra
ctx->received_date = received_date;
ctx->input = input;
- output = o_stream_create_file(ctx->fd, 0, FALSE);
+ output = o_stream_create_fd_file(ctx->fd, 0, FALSE);
ctx->output = (ctx->mbox->storage->storage.flags &
MAIL_STORAGE_FLAG_SAVE_CRLF) != 0 ?
o_stream_create_crlf(output) : o_stream_create_lf(output);
diff -r fe1e6e895d8f -r c62f7ee79446 src/lib-storage/index/maildir/maildir-uidlist.c
--- a/src/lib-storage/index/maildir/maildir-uidlist.c Thu Aug 02 17:35:04 2007 +0300
+++ b/src/lib-storage/index/maildir/maildir-uidlist.c Thu Aug 02 18:23:22 2007 +0300
@@ -804,7 +804,7 @@ static int maildir_uidlist_write_fd(stru
i_assert(fd != -1);
- output = o_stream_create_file(fd, 0, FALSE);
+ output = o_stream_create_fd_file(fd, (uoff_t)-1, FALSE);
str = t_str_new(512);
if (output->offset == 0) {
diff -r fe1e6e895d8f -r c62f7ee79446 src/lib-storage/index/mbox/mbox-save.c
--- a/src/lib-storage/index/mbox/mbox-save.c Thu Aug 02 17:35:04 2007 +0300
+++ b/src/lib-storage/index/mbox/mbox-save.c Thu Aug 02 18:23:22 2007 +0300
@@ -321,7 +321,9 @@ mbox_save_init_file(struct mbox_save_con
if (mbox_seek_to_end(ctx, &ctx->append_offset) < 0)
return -1;
- ctx->output = o_stream_create_file(mbox->mbox_fd, 0, FALSE);
+ ctx->output = o_stream_create_fd_file(mbox->mbox_fd,
+ ctx->append_offset,
+ FALSE);
}
return 0;
}
diff -r fe1e6e895d8f -r c62f7ee79446 src/lib-storage/index/mbox/mbox-sync-rewrite.c
--- a/src/lib-storage/index/mbox/mbox-sync-rewrite.c Thu Aug 02 17:35:04 2007 +0300
+++ b/src/lib-storage/index/mbox/mbox-sync-rewrite.c Thu Aug 02 18:23:22 2007 +0300
@@ -26,7 +26,7 @@ int mbox_move(struct mbox_sync_context *
i_stream_sync(sync_ctx->input);
- output = o_stream_create_file(sync_ctx->write_fd, 4096, FALSE);
+ output = o_stream_create_fd_file(sync_ctx->write_fd, (uoff_t)-1, FALSE);
i_stream_seek(sync_ctx->file_input, source);
if (o_stream_seek(output, dest) < 0) {
mbox_set_syscall_error(sync_ctx->mbox,
diff -r fe1e6e895d8f -r c62f7ee79446 src/lib-storage/list/subscription-file.c
--- a/src/lib-storage/list/subscription-file.c Thu Aug 02 17:35:04 2007 +0300
+++ b/src/lib-storage/list/subscription-file.c Thu Aug 02 18:23:22 2007 +0300
@@ -115,8 +115,7 @@ int subsfile_set_subscribed(struct mailb
input = fd_in == -1 ? NULL :
i_stream_create_file(fd_in, list->mailbox_name_max_length+1,
TRUE);
- output = o_stream_create_file(fd_out, list->mailbox_name_max_length+1,
- FALSE);
+ output = o_stream_create_fd_file(fd_out, 0, FALSE);
found = FALSE;
while ((line = next_line(list, path, input,
&failed, FALSE)) != NULL) {
diff -r fe1e6e895d8f -r c62f7ee79446 src/lib/file-copy.c
--- a/src/lib/file-copy.c Thu Aug 02 17:35:04 2007 +0300
+++ b/src/lib/file-copy.c Thu Aug 02 18:23:22 2007 +0300
@@ -69,7 +69,7 @@ static int file_copy_to_tmp(const char *
(void)fchown(fd_out, (uid_t)-1, st.st_gid);
input = i_stream_create_file(fd_in, 0, FALSE);
- output = o_stream_create_file(fd_out, 0, FALSE);
+ output = o_stream_create_fd_file(fd_out, 0, FALSE);
while ((ret = o_stream_send_istream(output, input)) > 0) ;
diff -r fe1e6e895d8f -r c62f7ee79446 src/lib/ostream-file.c
--- a/src/lib/ostream-file.c Thu Aug 02 17:35:04 2007 +0300
+++ b/src/lib/ostream-file.c Thu Aug 02 18:23:22 2007 +0300
@@ -733,17 +733,13 @@ static off_t _send_istream(struct _ostre
return io_stream_copy_backwards(outstream, instream, in_size);
}
-struct ostream *
-o_stream_create_file(int fd, size_t max_buffer_size, bool autoclose_fd)
+static struct file_ostream *
+o_stream_create_fd_common(int fd, bool autoclose_fd)
{
struct file_ostream *fstream;
More information about the dovecot-cvs
mailing list