summaryrefslogtreecommitdiff
path: root/mysys/mf_iocache.c
diff options
context:
space:
mode:
authorunknown <monty@mysql.com>2005-01-15 14:09:45 +0200
committerunknown <monty@mysql.com>2005-01-15 14:09:45 +0200
commit0cbd58c52b3810da467ec04e5d578ce3c845f125 (patch)
treee8856cd37d5a43bd18c06a8834fbfff83c0f4998 /mysys/mf_iocache.c
parent5168d25f3509cd205b3db8222446b16d34c45781 (diff)
parent193eae3bece02daa473f0e264d235ea3e407a88d (diff)
downloadmariadb-git-0cbd58c52b3810da467ec04e5d578ce3c845f125.tar.gz
Merge with 4.1
BitKeeper/etc/ignore: auto-union Build-tools/Do-compile: Auto merged client/mysqladmin.cc: Auto merged heap/hp_create.c: Auto merged heap/hp_write.c: Auto merged include/my_sys.h: Auto merged innobase/data/data0type.c: Auto merged innobase/include/row0mysql.h: Auto merged innobase/os/os0file.c: Auto merged innobase/rem/rem0cmp.c: Auto merged innobase/row/row0sel.c: Auto merged innobase/srv/srv0start.c: Auto merged mysql-test/r/ctype_latin1_de.result: Auto merged mysql-test/r/ctype_tis620.result: Auto merged mysql-test/r/ctype_ucs.result: Auto merged mysql-test/r/ctype_ujis.result: Auto merged mysql-test/r/ctype_utf8.result: Auto merged mysql-test/r/func_gconcat.result: Auto merged mysql-test/r/func_sapdb.result: Auto merged mysql-test/r/show_check.result: Auto merged mysql-test/r/type_float.result.es: Auto merged mysql-test/r/type_float.result: Auto merged mysql-test/r/type_timestamp.result: Auto merged mysql-test/t/ctype_ucs.test: Auto merged mysql-test/t/func_sapdb.test: Auto merged mysql-test/t/show_check.test: Auto merged mysql-test/t/type_float.test: Auto merged mysql-test/t/type_timestamp.test: Auto merged mysys/mf_iocache.c: Auto merged ndb/src/kernel/vm/Configuration.cpp: Auto merged scripts/mysql_install_db.sh: Auto merged sql/field.cc: Auto merged sql/ha_berkeley.cc: Auto merged sql/ha_innodb.cc: Auto merged sql/item_sum.h: Auto merged sql/sql_base.cc: Auto merged sql/sql_class.h: Auto merged sql/sql_parse.cc: Auto merged sql/sql_prepare.cc: Auto merged sql/sql_table.cc: Auto merged sql/sql_yacc.yy: Auto merged strings/ctype-big5.c: Auto merged strings/ctype-bin.c: Auto merged strings/ctype-czech.c: Auto merged strings/ctype-gbk.c: Auto merged strings/ctype-latin1.c: Auto merged strings/ctype-mb.c: Auto merged strings/ctype-simple.c: Auto merged strings/ctype-sjis.c: Auto merged strings/ctype-tis620.c: Auto merged strings/ctype-uca.c: Auto merged strings/ctype-ucs2.c: Auto merged strings/ctype-utf8.c: Auto merged strings/ctype-win1250ch.c: Auto merged configure.in: Use local values mysql-test/r/ps_1general.result: Update results mysql-test/t/func_gconcat.test: no changes mysql-test/t/ps_1general.test: Use local code ndb/src/common/util/version.c: Use local code sql/filesort.cc: Empty line changes sql/ha_heap.cc: Merge sql/item_timefunc.cc: Keep local code sql/mysql_priv.h: Update to 5.0 sql/sql_show.cc: Hand merge support-files/mysql.spec.sh: No changes
Diffstat (limited to 'mysys/mf_iocache.c')
-rw-r--r--mysys/mf_iocache.c49
1 files changed, 35 insertions, 14 deletions
diff --git a/mysys/mf_iocache.c b/mysys/mf_iocache.c
index 7466ae24675..b86e9daf92d 100644
--- a/mysys/mf_iocache.c
+++ b/mysys/mf_iocache.c
@@ -70,9 +70,40 @@ static void my_aiowait(my_aio_result *result);
#define IO_ROUND_UP(X) (((X)+IO_SIZE-1) & ~(IO_SIZE-1))
#define IO_ROUND_DN(X) ( (X) & ~(IO_SIZE-1))
+
+/*
+ Setup internal pointers inside IO_CACHE
+
+ SYNOPSIS
+ setup_io_cache()
+ info IO_CACHE handler
+
+ NOTES
+ This is called on automaticly on init or reinit of IO_CACHE
+ It must be called externally if one moves or copies an IO_CACHE
+ object.
+*/
+
+void setup_io_cache(IO_CACHE* info)
+{
+ /* Ensure that my_b_tell() and my_b_bytes_in_cache works */
+ if (info->type == WRITE_CACHE)
+ {
+ info->current_pos= &info->write_pos;
+ info->current_end= &info->write_end;
+ }
+ else
+ {
+ info->current_pos= &info->read_pos;
+ info->current_end= &info->read_end;
+ }
+}
+
+
static void
-init_functions(IO_CACHE* info, enum cache_type type)
+init_functions(IO_CACHE* info)
{
+ enum cache_type type= info->type;
switch (type) {
case READ_NET:
/*
@@ -96,17 +127,7 @@ init_functions(IO_CACHE* info, enum cache_type type)
info->write_function = _my_b_write;
}
- /* Ensure that my_b_tell() and my_b_bytes_in_cache works */
- if (type == WRITE_CACHE)
- {
- info->current_pos= &info->write_pos;
- info->current_end= &info->write_end;
- }
- else
- {
- info->current_pos= &info->read_pos;
- info->current_end= &info->read_end;
- }
+ setup_io_cache(info);
}
@@ -236,7 +257,7 @@ int init_io_cache(IO_CACHE *info, File file, uint cachesize,
info->end_of_file= end_of_file;
info->error=0;
info->type= type;
- init_functions(info,type);
+ init_functions(info);
#ifdef HAVE_AIOWAIT
if (use_async_io && ! my_disable_async_io)
{
@@ -358,7 +379,7 @@ my_bool reinit_io_cache(IO_CACHE *info, enum cache_type type,
}
info->type=type;
info->error=0;
- init_functions(info,type);
+ init_functions(info);
#ifdef HAVE_AIOWAIT
if (use_async_io && ! my_disable_async_io &&