From 7d94788c1ad489f57f339066396259941e05d577 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 16 Sep 2004 00:47:45 +0600 Subject: [PATCH 01/28] WL#964 porting mysql_test_run on Linux and Windows client/mysqltest.c: added windows code mysql-test/Makefile.am: added code of creating make file mysql-test/r/fulltext.result: added FORMAT() for compatible with Windows version mysql-test/r/fulltext_cache.result: added FORMAT() mysql-test/r/fulltext_multi.result: added FORMAT() mysql-test/r/fulltext_order_by.result: added FORMAT() mysql-test/r/type_float.result: added --replace-result mysql-test/t/fulltext.test: added FORMAT() mysql-test/t/fulltext_cache.test: added FORMAT() mysql-test/t/fulltext_multi.test: added FORMAT() mysql-test/t/fulltext_order_by.test: added FORMAT() mysql-test/t/innodb.test: added --replace-result mysql-test/t/insert.test: added --replace_result mysql-test/t/type_float.test: added --replace-result mysql-test/t/variables.test: added --replace_result --- client/mysqltest.c | 36 +- mysql-test/Makefile.am | 5 + mysql-test/my_manage.c | 860 ++++++++++++ mysql-test/my_manage.h | 135 ++ mysql-test/mysql_test_run.c | 1728 +++++++++++++++++++++++++ mysql-test/r/fulltext.result | 6 +- mysql-test/r/fulltext_cache.result | 36 +- mysql-test/r/fulltext_multi.result | 30 +- mysql-test/r/fulltext_order_by.result | 54 +- mysql-test/r/type_float.result | 4 +- mysql-test/t/fulltext.test | 2 +- mysql-test/t/fulltext_cache.test | 4 +- mysql-test/t/fulltext_multi.test | 6 +- mysql-test/t/fulltext_order_by.test | 12 +- mysql-test/t/innodb.test | 1 + mysql-test/t/insert.test | 11 + mysql-test/t/type_float.test | 3 + mysql-test/t/variables.test | 1 + 18 files changed, 2842 insertions(+), 92 deletions(-) create mode 100644 mysql-test/my_manage.c create mode 100644 mysql-test/my_manage.h create mode 100644 mysql-test/mysql_test_run.c diff --git a/client/mysqltest.c b/client/mysqltest.c index f638053b515..a42b4698b3c 100644 --- a/client/mysqltest.c +++ b/client/mysqltest.c @@ -180,9 +180,9 @@ typedef struct int alloced; } VAR; -#ifdef __NETWARE__ +#if defined(__NETWARE__) || defined(__WIN__) /* - Netware doesn't proved environment variable substitution that is done + Netware and Windows don't proved environment variable substitution that is done by the shell in unix environments. We do this in the following function: */ @@ -479,7 +479,7 @@ static void free_used_memory() free_defaults(default_argv); mysql_server_end(); my_end(MY_CHECK_ERROR); - DBUG_VOID_RETURN; +// DBUG_VOID_RETURN; } static void die(const char* fmt, ...) @@ -885,8 +885,8 @@ int do_exec(struct st_query* q) char buf[1024]; FILE *res_file; char *cmd= q->first_argument; + DBUG_ENTER("do_exec"); - while (*cmd && my_isspace(charset_info, *cmd)) cmd++; if (!*cmd) @@ -935,8 +935,11 @@ int do_exec(struct st_query* q) if (ds == &ds_tmp) dynstr_free(&ds_tmp); } +#ifndef __WIN__ pclose(res_file); - +#else + _pclose(res_file); +#endif DBUG_RETURN(error); } @@ -1517,8 +1520,8 @@ void init_manager() die("Failed in mysql_manager_init()"); if (!mysql_manager_connect(manager,manager_host,manager_user, manager_pass,manager_port)) - die("Could not connect to MySQL manager: %s(%d)",manager->last_error, - manager->last_errno); + die("Could not connect to MySQL manager: %s(%d) %d",manager->last_error, + manager->last_errno, manager_port); } #endif @@ -1575,7 +1578,7 @@ int do_connect(struct st_query* q) if (*con_port_str == '$') { if (!(var_port = var_get(con_port_str, 0, 0, 0))) - die("Unknown variable '%s'", con_port_str+1); + die("Unknown variable '%s'", con_port_str+1); con_port = var_port->int_val; } else @@ -1584,9 +1587,9 @@ int do_connect(struct st_query* q) if (*con_sock == '$') { if (!(var_sock = var_get(con_sock, 0, 0, 0))) - die("Unknown variable '%s'", con_sock+1); + die("Unknown variable '%s'", con_sock+1); if (!(con_sock = (char*)my_malloc(var_sock->str_val_len+1, MYF(0)))) - die("Out of memory"); + die("Out of memory"); free_con_sock = 1; memcpy(con_sock, var_sock->str_val, var_sock->str_val_len); con_sock[var_sock->str_val_len] = 0; @@ -1617,8 +1620,8 @@ int do_connect(struct st_query* q) if ((safe_connect(&next_con->mysql, con_host, con_user, con_pass, con_db, con_port, con_sock ? con_sock: 0))) - die("Could not open connection '%s': %s", con_name, - mysql_error(&next_con->mysql)); + die("Could not open connection '%s': %s %d", con_name, + mysql_error(&next_con->mysql),con_port); if (!(next_con->name = my_strdup(con_name, MYF(MY_WME)))) die(NullS); @@ -3686,8 +3689,7 @@ static void get_replace_column(struct st_query *q) my_free(start, MYF(0)); } -#ifdef __NETWARE__ - +#if defined(__NETWARE__) || defined(__WIN__) /* Substitute environment variables with text. @@ -3778,9 +3780,13 @@ FILE *my_popen(const char *cmd, const char *mode __attribute__((unused))) FILE *res_file; subst_cmd= subst_env_var(cmd); +#ifndef __WIN__ res_file= popen(subst_cmd, "r0"); +#else + res_file= _popen(subst_cmd, "r0"); +#endif my_free(subst_cmd, MYF(0)); return res_file; } -#endif /* __NETWARE__ */ +#endif /* __NETWARE__ or __WIN__*/ diff --git a/mysql-test/Makefile.am b/mysql-test/Makefile.am index 6ec8c293a9c..1f57dedc4c5 100644 --- a/mysql-test/Makefile.am +++ b/mysql-test/Makefile.am @@ -29,6 +29,11 @@ test_SCRIPTS = mysql-test-run install_test_db test_DATA = std_data/client-key.pem std_data/client-cert.pem std_data/cacert.pem CLEANFILES = $(test_SCRIPTS) $(test_DATA) +INCLUDES = -I$(srcdir)/../include -I../include -I.. +bin_PROGRAMS = mysql_test_run +mysql_test_run_SOURCES= mysql_test_run.c my_manage.c + + dist-hook: mkdir -p $(distdir)/t $(distdir)/r $(distdir)/include \ $(distdir)/std_data diff --git a/mysql-test/my_manage.c b/mysql-test/my_manage.c new file mode 100644 index 00000000000..e23d4f2227e --- /dev/null +++ b/mysql-test/my_manage.c @@ -0,0 +1,860 @@ +/* + Copyright (c) 2003 Novell, Inc. All Rights Reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#include +#include +#ifndef __WIN__ +#include +#endif +#include +#ifdef __NETWARE__ +#include +#include +#else +#include +#ifndef __WIN__ +#include +#include +#else +#include +#include +#include +#endif +#endif +#include +#include +#include +#include + +#include "my_manage.h" + +#ifndef __NETWARE__ +#define ASSERT assert +extern char **environ; +#endif + + + +/****************************************************************************** + + macros + +******************************************************************************/ + +/****************************************************************************** + + global variables + +******************************************************************************/ + +/****************************************************************************** + + functions + +******************************************************************************/ + +/****************************************************************************** + + init_args() + + Init an argument list. + +******************************************************************************/ +void init_args(arg_list_t *al) +{ + ASSERT(al != NULL); + + al->argc = 0; + al->size = ARG_BUF; + al->argv = malloc(al->size * sizeof(char *)); + ASSERT(al->argv != NULL); + + return; +} + +/****************************************************************************** + + add_arg() + + Add an argument to a list. + +******************************************************************************/ +void add_arg(arg_list_t *al, const char *format, ...) +{ + va_list ap; + char temp[PATH_MAX]; + + ASSERT(al != NULL); + + // increase size + if (al->argc >= (int)al->size) + { + al->size += ARG_BUF; + al->argv = realloc(al->argv, al->size * sizeof(char *)); + ASSERT(al->argv != NULL); + } + + if (format) + { + va_start(ap, format); + vsprintf(temp, format, ap); + va_end(ap); + + al->argv[al->argc] = malloc(strlen(temp)+1); + ASSERT(al->argv[al->argc] != NULL); + strcpy(al->argv[al->argc], temp); + + ++(al->argc); + } + else + { + al->argv[al->argc] = NULL; + } + + return; +} + +/****************************************************************************** + + free_args() + + Free an argument list. + +******************************************************************************/ +void free_args(arg_list_t *al) +{ + int i; + + ASSERT(al != NULL); + + for(i = 0; i < al->argc; i++) + { + ASSERT(al->argv[i] != NULL); + free(al->argv[i]); + al->argv[i] = NULL; + } + + free(al->argv); + al->argc = 0; + al->argv = NULL; + + return; +} + +/****************************************************************************** + + sleep_until_file_deleted() + + Sleep until the given file is no longer found. + +******************************************************************************/ +#ifndef __WIN__ +int sleep_until_file_deleted(char *pid_file) +#else +int sleep_until_file_deleted(HANDLE pid_file) +#endif +{ + int err; +#ifndef __WIN__ + struct stat buf; + int i; + + for(i = 0; (i < TRY_MAX) && (err = !stat(pid_file, &buf)); i++) sleep(1); + + if (err != 0) err = errno; +#else + err= (WaitForSingleObject(pid_file, TRY_MAX*1000) == WAIT_TIMEOUT); +#endif + return err; +} + +/****************************************************************************** + + sleep_until_file_exists() + + Sleep until the given file exists. + +******************************************************************************/ +#ifndef __WIN__ +int sleep_until_file_exists(char *pid_file) +#else +int sleep_until_file_exists(HANDLE pid_file) +#endif +{ + int err; +#ifndef __WIN__ + struct stat buf; + int i; + + for(i = 0; (i < TRY_MAX) && (err = stat(pid_file, &buf)); i++) sleep(1); + + if (err != 0) err = errno; +#else + err= (WaitForSingleObject(pid_file, TRY_MAX*1000) == WAIT_TIMEOUT); +#endif + return err; +} + +/****************************************************************************** + + wait_for_server_start() + + Wait for the server on the given port to start. + +******************************************************************************/ +int wait_for_server_start(char *bin_dir, char *mysqladmin_file, char *user, char *password, int port,char *tmp_dir) +{ + arg_list_t al; + int err, i; + char trash[PATH_MAX]; + + // mysqladmin file + snprintf(trash, PATH_MAX, "%s/trash.out",tmp_dir); + + // args + init_args(&al); + add_arg(&al, "%s", mysqladmin_file); + add_arg(&al, "--no-defaults"); + add_arg(&al, "--port=%u", port); + add_arg(&al, "--user=%s", user); + add_arg(&al, "--password=%s", password); + add_arg(&al, "--silent"); + +//#ifdef NOT_USED +#ifndef __NETWARE__ + add_arg(&al, "-O"); + add_arg(&al, "connect_timeout=10"); + add_arg(&al, "-w"); +#endif + + add_arg(&al, "--host=localhost"); +#ifndef __NETWARE__ + add_arg(&al, "--protocol=tcp"); +#endif + add_arg(&al, "ping"); + + // NetWare does not support the connect timeout in the TCP/IP stack + // -- we will try the ping multiple times +#ifndef __WIN__ + for(i = 0; (i < TRY_MAX) + && (err = spawn(mysqladmin_file, &al, TRUE, NULL, + trash, NULL, NULL)); i++) sleep(1); +#else + err = spawn(mysqladmin_file, &al, TRUE, NULL,trash, NULL, NULL); +#endif + + // free args + free_args(&al); + + return err; +} + +/****************************************************************************** + + spawn() + + Spawn the given path with the given arguments. + +******************************************************************************/ +#ifdef __NETWARE__ +int spawn(char *path, arg_list_t *al, int join, char *input, + char *output, char *error, char *pid_file) +{ + pid_t pid; + int result = 0; + wiring_t wiring = { FD_UNUSED, FD_UNUSED, FD_UNUSED }; + unsigned long flags = PROC_CURRENT_SPACE | PROC_INHERIT_CWD; + + // open wiring + if (input) + wiring.infd = open(input, O_RDONLY); + + if (output) + wiring.outfd = open(output, O_WRONLY | O_CREAT | O_TRUNC); + + if (error) + wiring.errfd = open(error, O_WRONLY | O_CREAT | O_TRUNC); + + // procve requires a NULL + add_arg(al, NULL); + + // go + pid = procve(path, flags, NULL, &wiring, NULL, NULL, 0, + NULL, (const char **)al->argv); + + // close wiring + if (wiring.infd != -1) + close(wiring.infd); + + if (wiring.outfd != -1) + close(wiring.outfd); + + if (wiring.errfd != -1) + close(wiring.errfd); + + return result; +} +#elif __WIN__ + +int spawn(char *path, arg_list_t *al, int join, char *input, + char *output, char *error, HANDLE *pid) +{ + intptr_t result; + int i; + STARTUPINFO startup_info; + PROCESS_INFORMATION process_information; + DWORD exit_code; + char win_args[1024]= ""; + char command_line[1024]= ""; + + /* + Skip the first parameter + */ + for(i = 1; i < al->argc; i++) + { + ASSERT(al->argv[i] != NULL); + strcat(win_args,al->argv[i]); + strcat(win_args," "); + } + + memset(&startup_info,0,sizeof(STARTUPINFO)); + startup_info.cb = sizeof(STARTUPINFO); + + if (input) + freopen(input, "rb", stdin); + + if (output) + freopen(output, "wb", stdout); + + if (error) + freopen(error, "wb", stderr); + + result= CreateProcess( + path, + (LPSTR)&win_args, + NULL, + NULL, + TRUE, + 0, + NULL, + NULL, + &startup_info, + &process_information + ); + + if (result && process_information.hProcess) + { + if (join) + { + if (WaitForSingleObject(process_information.hProcess, mysqld_timeout) == WAIT_TIMEOUT) + { + exit_code= -1; + } + else + { + GetExitCodeProcess(process_information.hProcess, &exit_code); + } + CloseHandle(process_information.hProcess); + } + else + { + exit_code= 0; + } + if (pid != NULL) + *pid= process_information.hProcess; + } + else + { + exit_code= -1; + } + if (input) + freopen("CONIN$","rb",stdin); + if (output) + freopen("CONOUT$","wb",stdout); + if (error) + freopen("CONOUT$","wb",stderr); + + return exit_code; +} +#else +int spawn(char *path, arg_list_t *al, int join, char *input, + char *output, char *error, char *pid_file) +{ + pid_t pid; + int res_exec = 0; + int result = 0; + + pid = fork(); + + if (pid == -1) + { + fprintf(stderr, "fork was't created\n"); + /* + We can't create the fork...exit with error + */ + return EXIT_FAILURE; + } + + if (pid > 0) + { + /* + The parent process is waiting for child process if join is not zero + */ + if (join) + { + waitpid(pid, &result, 0); + if (WIFEXITED(result) != 0) + { + result = WEXITSTATUS(result); + } + else + { + result = EXIT_FAILURE; + } + } + } + else + { + + /* + Child process + */ + + add_arg(al, NULL); + + + /* + Reassign streams + */ + if (input) + freopen(input, "r", stdin); + + + if (output) + freopen(output, "w", stdout); + + + if (error) + freopen(error, "w", stderr); + + /* Spawn the process */ + if ((res_exec = execve(path, al->argv, environ)) < 0) + { + exit(EXIT_FAILURE); + } + + /* + Restore streams + */ + if (input) + freopen("/dev/tty", "r", stdin); + + if (output) + freopen("/dev/tty", "w", stdout); + + if (error) + freopen("/dev/tty", "w", stderr); + + exit(0); + } + + return result; +} +#endif +/****************************************************************************** + + stop_server() + + Stop the server with the given port and pid file. + +******************************************************************************/ +#ifndef __WIN__ +int stop_server(char *bin_dir, char *mysqladmin_file, char *user, char *password, int port, + char *pid_file,char *tmp_dir) +#else +int stop_server(char *bin_dir, char *mysqladmin_file, char *user, char *password, int port, + HANDLE pid_file,char *tmp_dir) +#endif +{ + arg_list_t al; + int err = 0; + char trash[PATH_MAX]; + + snprintf(trash, PATH_MAX, "%s/trash.out",tmp_dir); + + // args + init_args(&al); + add_arg(&al, "%s", mysqladmin_file); + add_arg(&al, "--no-defaults"); + add_arg(&al, "--port=%u", port); + add_arg(&al, "--user=%s", user); + add_arg(&al, "--password=%s", password); + add_arg(&al, "-O"); + add_arg(&al, "shutdown_timeout=20"); +#ifndef __NETWARE__ + add_arg(&al, "--protocol=tcp"); +#endif + add_arg(&al, "shutdown"); + + // spawn + if ((err = spawn(mysqladmin_file, &al, TRUE, NULL, + trash, NULL, NULL)) == 0) + { + sleep_until_file_deleted(pid_file); + } + else + { +#ifndef __WIN__ + pid_t pid = get_server_pid(pid_file); + + // shutdown failed - kill server + kill_server(pid); + + sleep(TRY_MAX); + + // remove pid file if possible + err = remove(pid_file); +#else + TerminateProcess(pid_file,err); +#endif + } + + // free args + free_args(&al); + + return err; +} + +/****************************************************************************** + + get_server_pid() + + Get the VM id with the given pid file. + +******************************************************************************/ +#ifndef __WIN__ +pid_t get_server_pid(char *pid_file) +{ + char buf[PATH_MAX]; + int fd, err; + char *p; + pid_t id = 0; + + // discover id + fd = open(pid_file, O_RDONLY); + + err = read(fd, buf, PATH_MAX); + + close(fd); + + if (err > 0) + { + // terminate string + if ((p = strchr(buf, '\n')) != NULL) + { + *p = '\0'; + + // check for a '\r' + if ((p = strchr(buf, '\r')) != NULL) + { + *p = '\0'; + } + } + else + { + buf[err] = '\0'; + } + + id = strtol(buf, NULL, 0); + } + + return id; +} + +/****************************************************************************** + + kill_server() + + Force a kill of the server with the given pid. + +******************************************************************************/ +void kill_server(pid_t pid) +{ + if (pid > 0) + { +#if !defined(__NETWARE__) + /* Send SIGTERM to pid */ + kill(pid, SIGTERM); +#else /* __NETWARE__ */ + /* destroy vm */ + NXVmDestroy(pid); +#endif + } +} +#endif +/****************************************************************************** + + del_tree() + + Delete the directory and subdirectories. + +******************************************************************************/ +void del_tree(char *dir) +{ +#ifndef __WIN__ + DIR *parent = opendir(dir); + struct dirent *entry; + char temp[PATH_MAX]; + + if (parent == NULL) + { + return; + } + + while((entry = readdir(parent)) != NULL) + { + // create long name + snprintf(temp, PATH_MAX, "%s/%s", dir, entry->d_name); + + if (entry->d_name[0] == '.') + { + // Skip + } + else + if (S_ISDIR(entry->d_type)) + { + // delete subdirectory + del_tree(temp); + } + else + { + // remove file + remove(temp); + } + } + // remove directory + rmdir(dir); +#else + struct _finddata_t parent; + intptr_t handle; + char temp[PATH_MAX]; + char mask[PATH_MAX]; + + snprintf(mask,MAX_PATH,"%s/*.*",dir); + + if ((handle=_findfirst(mask,&parent)) == -1L) + { + return; + } + + do + { + // create long name + snprintf(temp, PATH_MAX, "%s/%s", dir, parent.name); + if (parent.name[0] == '.') + { + // Skip + } + else + if (parent.attrib & _A_SUBDIR) + { + // delete subdirectory + del_tree(temp); + } + else + { + // remove file + remove(temp); + } + } while (_findnext(handle,&parent) == 0); + + _findclose(handle); + + // remove directory + _rmdir(dir); +#endif +} + +/****************************************************************************** + + removef() + +******************************************************************************/ +int removef(const char *format, ...) +{ +#ifdef __NETWARE__ + va_list ap; + char path[PATH_MAX]; + + va_start(ap, format); + + vsnprintf(path, PATH_MAX, format, ap); + + va_end(ap); + return remove(path); + +#eldef __WIN__ + { + va_list ap; + char path[PATH_MAX]; + struct _finddata_t parent; + intptr_t handle; + char temp[PATH_MAX]; + char *p; + + va_start(ap, format); + + vsnprintf(path, PATH_MAX, format, ap); + + va_end(ap); + + p = path + strlen(path); + while (*p != '\\' && *p != '/' && p > path) p--; + + if ((handle=_findfirst(path,&parent)) == -1L) + { + /* + if there is not files....it's ok. + */ + return 0; + } + + *p = '\0'; + + do + { + if (! (parent.attrib & _A_SUBDIR)) + { + snprintf(temp, PATH_MAX, "%s/%s", path, parent.name); + remove(temp); + } + }while (_findnext(handle,&parent) == 0); + + _findclose(handle); + } +#else + DIR *parent; + struct dirent *entry; + char temp[PATH_MAX]; + va_list ap; + char path[PATH_MAX]; + char *p; + /* + Get path with mask + */ + va_start(ap, format); + + vsnprintf(path, PATH_MAX, format, ap); + + va_end(ap); + + p = path + strlen(path); + while (*p != '\\' && *p != '/' && p > path) p--; + *p = '\0'; + p++; + + parent = opendir(path); + + if (parent == NULL) + { + return; + } + + while((entry = readdir(parent)) != NULL) + { + /* + entry is not directory and entry matches with mask + */ + if (!S_ISDIR(entry->d_type) && !fnmatch(p, entry->d_name,0)) + { + // create long name + snprintf(temp, PATH_MAX, "%s/%s", path, entry->d_name); + // Delete only files + remove(temp); + } + } +#endif + return 0; +} + +/****************************************************************************** + + get_basedir() + +******************************************************************************/ +void get_basedir(char *argv0, char *basedir) +{ + char temp[PATH_MAX]; + char *p; + int position; + + ASSERT(argv0 != NULL); + ASSERT(basedir != NULL); + + strcpy(temp, strlwr(argv0)); + while((p = strchr(temp, '\\')) != NULL) *p = '/'; + + if ((position = strinstr(temp, "/bin/")) != 0) + { + p = temp + position; + *p = '\0'; + strcpy(basedir, temp); + } +} + +#if !defined(__NETWARE__) && !defined(__WIN__) +char *strlwr(const char *s) +{ + return s; +} +#endif + +uint strinstr(reg1 const char *str,reg4 const char *search) +{ + reg2 my_string i,j; + my_string start = (my_string) str; + + skipp: + while (*str != '\0') + { + if (*str++ == *search) + { + i=(my_string) str; j= (my_string) search+1; + while (*j) + if (*i++ != *j++) goto skipp; + return ((uint) (str - start)); + } + } + return (0); +} + +/****************************************************************************** + + remove_empty_file() + +******************************************************************************/ +void remove_empty_file(const char *file_name) +{ + struct stat file; + + if (!stat(file_name,&file)) + { + if (!file.st_size) + remove(file_name); + } +} diff --git a/mysql-test/my_manage.h b/mysql-test/my_manage.h new file mode 100644 index 00000000000..56ba7ce0496 --- /dev/null +++ b/mysql-test/my_manage.h @@ -0,0 +1,135 @@ +/* + Copyright (c) 2002 Novell, Inc. All Rights Reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#ifndef _MY_MANAGE +#define _MY_MANAGE + +/****************************************************************************** + + includes + +******************************************************************************/ + +#include +#ifndef __WIN__ +#include +#endif +#ifndef __NETWARE__ +#include +#include +#include + +#ifndef __WIN__ +#define strnicmp strncasecmp +char *strlwr(const char *s); +#else +int my_vsnprintf_(char *to, size_t n, const char* value, ...); +#endif +#endif + +/****************************************************************************** + + macros + +******************************************************************************/ + +#define ARG_BUF 10 +#define TRY_MAX 5 + +#ifdef __WIN__ +#define PATH_MAX _MAX_PATH +#define NAME_MAX _MAX_FNAME +#define kill(A,B) TerminateProcess((HANDLE)A,0) +#define NOT_NEED_PID 0 +#define MASTER_PID 1 +#define SLAVE_PID 2 +#define mysqld_timeout 60000 + +int pid_mode; +bool run_server; +bool skip_first_param; + +#define snprintf _snprintf +#define vsnprintf _vsnprintf +#endif + + +/****************************************************************************** + + structures + +******************************************************************************/ + +typedef struct +{ + + int argc; + char **argv; + + size_t size; + +} arg_list_t; + +#ifdef __WIN__ +typedef int pid_t; +#endif +/****************************************************************************** + + global variables + +******************************************************************************/ + +/****************************************************************************** + + prototypes + +******************************************************************************/ + +void init_args(arg_list_t *); +void add_arg(arg_list_t *, const char *, ...); +void free_args(arg_list_t *); + +#ifndef __WIN__ +int sleep_until_file_exists(char *); +int sleep_until_file_deleted(char *); +#else +int sleep_until_file_exists(HANDLE); +int sleep_until_file_deleted(HANDLE); +#endif +int wait_for_server_start(char *, char *, char *, char *, int,char *); + +#ifndef __WIN__ +int spawn(char *, arg_list_t *, int, char *, char *, char *, char *); +#else +int spawn(char *, arg_list_t *, int , char *, char *, char *, HANDLE *); +#endif + +#ifndef __WIN__ +int stop_server(char *, char *, char *, char *, int, char *,char *); +pid_t get_server_pid(char *); +void kill_server(pid_t pid); +#else +int stop_server(char *, char *, char *, char *, int, HANDLE,char *); +#endif +void del_tree(char *); +int removef(const char *, ...); + +void get_basedir(char *, char *); +void remove_empty_file(const char *file_name); + +#endif /* _MY_MANAGE */ diff --git a/mysql-test/mysql_test_run.c b/mysql-test/mysql_test_run.c new file mode 100644 index 00000000000..6f388fc4a45 --- /dev/null +++ b/mysql-test/mysql_test_run.c @@ -0,0 +1,1728 @@ +/* + Copyright (c) 2002, 2003 Novell, Inc. All Rights Reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#include +#include +#include +#ifndef __WIN__ +#include +#endif +#include +#ifdef __NETWARE__ +#include +#include +#endif +#include +#include +#ifndef __WIN__ +#include +#endif +#include +#ifdef __NETWARE__ +#include +#endif +#ifdef __WIN__ +#include +#include +#endif + +#include "my_manage.h" + +/****************************************************************************** + + macros + +******************************************************************************/ + +#define HEADER "TEST RESULT \n" +#define DASH "-------------------------------------------------------\n" + +#define NW_TEST_SUFFIX ".nw-test" +#define NW_RESULT_SUFFIX ".nw-result" +#define TEST_SUFFIX ".test" +#define RESULT_SUFFIX ".result" +#define REJECT_SUFFIX ".reject" +#define OUT_SUFFIX ".out" +#define ERR_SUFFIX ".err" + +const char *TEST_PASS = "[ pass ]"; +const char *TEST_SKIP = "[ skip ]"; +const char *TEST_FAIL = "[ fail ]"; +const char *TEST_BAD = "[ bad ]"; +const char *TEST_IGNORE = "[ignore]"; + +/****************************************************************************** + + global variables + +******************************************************************************/ +#ifdef __NETWARE__ +static char base_dir[PATH_MAX] = "sys:/mysql"; +#else +static char base_dir[PATH_MAX] = ".."; +#endif +static char db[PATH_MAX] = "test"; +static char user[PATH_MAX] = "root"; +static char password[PATH_MAX] = ""; + +int master_port = 9306; +int slave_port = 9307; + +#if !defined(__NETWARE__) && !defined(__WIN__) +static char master_socket[PATH_MAX] = "./var/tmp/master.sock"; +static char slave_socket[PATH_MAX] = "./var/tmp/slave.sock"; +#endif + +// comma delimited list of tests to skip or empty string +#ifndef __WIN__ +static char skip_test[PATH_MAX] = " lowercase_table3 , system_mysql_db_fix "; +#else +/* + The most ignore testes contain the calls of system command +*/ +#define MAX_COUNT_TESTES 1024 +/* + lowercase_table3 is disabled by Gerg + system_mysql_db_fix is disabled by Gerg + sp contains a command system + rpl_EE_error contains a command system + rpl_loaddatalocal contains a command system + ndb_autodiscover contains a command system + rpl_rotate_logs contains a command system + repair contains a command system + rpl_trunc_binlog contains a command system + mysqldump contains a command system + rpl000001 makes non-exit loop...temporary skiped +*/ +static char skip_test[PATH_MAX] = " lowercase_table3 , system_mysql_db_fix , sp , rpl_EE_error , rpl_loaddatalocal , ndb_autodiscover , rpl_rotate_logs , repair , rpl_trunc_binlog , mysqldump , rpl000001 "; +#endif +static char ignore_test[PATH_MAX] = ""; + +static char bin_dir[PATH_MAX]; +static char mysql_test_dir[PATH_MAX]; +static char test_dir[PATH_MAX]; +static char mysql_tmp_dir[PATH_MAX]; +static char result_dir[PATH_MAX]; +static char master_dir[PATH_MAX]; +static char slave_dir[PATH_MAX]; +static char lang_dir[PATH_MAX]; +static char char_dir[PATH_MAX]; + +static char mysqladmin_file[PATH_MAX]; +static char mysqld_file[PATH_MAX]; +static char mysqltest_file[PATH_MAX]; +#ifndef __WIN__ +static char master_pid[PATH_MAX]; +static char slave_pid[PATH_MAX]; +static char sh_file[PATH_MAX] = "/bin/sh"; +#else +static HANDLE master_pid; +static HANDLE slave_pid; +#endif + +static char master_opt[PATH_MAX] = ""; +static char slave_opt[PATH_MAX] = ""; + +static char slave_master_info[PATH_MAX] = ""; + +static char master_init_script[PATH_MAX] = ""; +static char slave_init_script[PATH_MAX] = ""; + +// OpenSSL +static char ca_cert[PATH_MAX]; +static char server_cert[PATH_MAX]; +static char server_key[PATH_MAX]; +static char client_cert[PATH_MAX]; +static char client_key[PATH_MAX]; + +int total_skip = 0; +int total_pass = 0; +int total_fail = 0; +int total_test = 0; + +int total_ignore = 0; + +int use_openssl = FALSE; +int master_running = FALSE; +int slave_running = FALSE; +int skip_slave = TRUE; +int single_test = TRUE; + +int restarts = 0; + +FILE *log_fd = NULL; + +/****************************************************************************** + + functions + +******************************************************************************/ + +/****************************************************************************** + + prototypes + +******************************************************************************/ + +void report_stats(); +void install_db(char *); +void mysql_install_db(); +void start_master(); +void start_slave(); +void mysql_start(); +void stop_slave(); +void stop_master(); +void mysql_stop(); +void mysql_restart(); +int read_option(char *, char *); +void run_test(char *); +void setup(char *); +void vlog(const char *, va_list); +void mlog(const char *, ...); +void log_info(const char *, ...); +void log_error(const char *, ...); +void log_errno(const char *, ...); +void die(const char *); +char *str_tok(char *string, const char *delim); +#ifndef __WIN__ +void run_init_script(const char *script_name); +#endif +/****************************************************************************** + + report_stats() + + Report the gathered statistics. + +******************************************************************************/ +void report_stats() +{ + if (total_fail == 0) + { + mlog("\nAll %d test(s) were successful.\n", total_test); + } + else + { + double percent = ((double)total_pass / total_test) * 100; + + mlog("\nFailed %u/%u test(s), %.02f%% successful.\n", + total_fail, total_test, percent); + mlog("\nThe .out and .err files in %s may give you some\n", result_dir); + mlog("hint of what when wrong.\n"); + mlog("\nIf you want to report this error, please first read the documentation\n"); + mlog("at: http://www.mysql.com/doc/M/y/MySQL_test_suite.html\n"); + } +} + +/****************************************************************************** + + install_db() + + Install the a database. + +******************************************************************************/ +void install_db(char *datadir) +{ + arg_list_t al; + int err; + char input[PATH_MAX]; + char output[PATH_MAX]; + char error[PATH_MAX]; + + // input file +#ifdef __NETWARE__ + snprintf(input, PATH_MAX, "%s/bin/init_db.sql", base_dir); +#else + snprintf(input, PATH_MAX, "%s/mysql-test/init_db.sql", base_dir); +#endif + snprintf(output, PATH_MAX, "%s/install.out", datadir); + snprintf(error, PATH_MAX, "%s/install.err", datadir); + + // args + init_args(&al); + add_arg(&al, mysqld_file); + add_arg(&al, "--no-defaults"); + add_arg(&al, "--bootstrap"); + add_arg(&al, "--skip-grant-tables"); + add_arg(&al, "--basedir=%s", base_dir); + add_arg(&al, "--datadir=%s", datadir); + add_arg(&al, "--skip-innodb"); + add_arg(&al, "--skip-bdb"); +#ifndef __NETWARE__ + add_arg(&al, "--character-sets-dir=%s", char_dir); + add_arg(&al, "--language=%s", lang_dir); +#endif + + // spawn + if ((err = spawn(mysqld_file, &al, TRUE, input, output, error, NULL)) != 0) + { + die("Unable to create database."); + } + + // free args + free_args(&al); +} + +/****************************************************************************** + + mysql_install_db() + + Install the test databases. + +******************************************************************************/ +void mysql_install_db() +{ + char temp[PATH_MAX]; + + // var directory + snprintf(temp, PATH_MAX, "%s/var", mysql_test_dir); + + // clean up old direcotry + del_tree(temp); + + // create var directory +#ifndef __WIN__ + mkdir(temp, S_IRWXU); + // create subdirectories + mlog("Creating test-suite folders...\n"); + snprintf(temp, PATH_MAX, "%s/var/run", mysql_test_dir); + mkdir(temp, S_IRWXU); + snprintf(temp, PATH_MAX, "%s/var/tmp", mysql_test_dir); + mkdir(temp, S_IRWXU); + snprintf(temp, PATH_MAX, "%s/var/master-data", mysql_test_dir); + mkdir(temp, S_IRWXU); + snprintf(temp, PATH_MAX, "%s/var/master-data/mysql", mysql_test_dir); + mkdir(temp, S_IRWXU); + snprintf(temp, PATH_MAX, "%s/var/master-data/test", mysql_test_dir); + mkdir(temp, S_IRWXU); + snprintf(temp, PATH_MAX, "%s/var/slave-data", mysql_test_dir); + mkdir(temp, S_IRWXU); + snprintf(temp, PATH_MAX, "%s/var/slave-data/mysql", mysql_test_dir); + mkdir(temp, S_IRWXU); + snprintf(temp, PATH_MAX, "%s/var/slave-data/test", mysql_test_dir); + mkdir(temp, S_IRWXU); +#else + mkdir(temp); + // create subdirectories + mlog("Creating test-suite folders...\n"); + snprintf(temp, PATH_MAX, "%s/var/run", mysql_test_dir); + mkdir(temp); + snprintf(temp, PATH_MAX, "%s/var/tmp", mysql_test_dir); + mkdir(temp); + snprintf(temp, PATH_MAX, "%s/var/master-data", mysql_test_dir); + mkdir(temp); + snprintf(temp, PATH_MAX, "%s/var/master-data/mysql", mysql_test_dir); + mkdir(temp); + snprintf(temp, PATH_MAX, "%s/var/master-data/test", mysql_test_dir); + mkdir(temp); + snprintf(temp, PATH_MAX, "%s/var/slave-data", mysql_test_dir); + mkdir(temp); + snprintf(temp, PATH_MAX, "%s/var/slave-data/mysql", mysql_test_dir); + mkdir(temp); + snprintf(temp, PATH_MAX, "%s/var/slave-data/test", mysql_test_dir); + mkdir(temp); +#endif + + // install databases + mlog("Creating test databases for master... \n"); + install_db(master_dir); + mlog("Creating test databases for slave... \n"); + install_db(slave_dir); +} + +/****************************************************************************** + + start_master() + + Start the master server. + +******************************************************************************/ +void start_master() +{ + arg_list_t al; + int err; + char master_out[PATH_MAX]; + char master_err[PATH_MAX]; +// char temp[PATH_MAX]; + char temp2[PATH_MAX]; + + // remove old berkeley db log files that can confuse the server + removef("%s/log.*", master_dir); + + // remove stale binary logs + removef("%s/var/log/*-bin.*", mysql_test_dir); + + // remove stale binary logs + removef("%s/var/log/*.index", mysql_test_dir); + + // remove master.info file + removef("%s/master.info", master_dir); + + // remove relay files + removef("%s/var/log/*relay*", mysql_test_dir); + + // remove relay-log.info file + removef("%s/relay-log.info", master_dir); + + // init script + if (master_init_script[0] != 0) + { +#ifdef __NETWARE__ + // TODO: use the scripts + if (strinstr(master_init_script, "repair_part2-master.sh") != 0) + { + FILE *fp; + + // create an empty index file + snprintf(temp, PATH_MAX, "%s/test/t1.MYI", master_dir); + fp = fopen(temp, "wb+"); + + fputs("1", fp); + + fclose(fp); + } +#elif !defined(__WIN__) + run_init_script(master_init_script); +#endif + } + + // redirection files + snprintf(master_out, PATH_MAX, "%s/var/run/master%u.out", + mysql_test_dir, restarts); + snprintf(master_err, PATH_MAX, "%s/var/run/master%u.err", + mysql_test_dir, restarts); +#ifndef __WIN__ + snprintf(temp2,PATH_MAX,"%s/var",mysql_test_dir); + mkdir(temp2,S_IRWXU); + snprintf(temp2,PATH_MAX,"%s/var/log",mysql_test_dir); + mkdir(temp2,S_IRWXU); +#else + snprintf(temp2,PATH_MAX,"%s/var",mysql_test_dir); + mkdir(temp2); + snprintf(temp2,PATH_MAX,"%s/var/log",mysql_test_dir); + mkdir(temp2); +#endif + // args + init_args(&al); + add_arg(&al, "%s", mysqld_file); + add_arg(&al, "--no-defaults"); + add_arg(&al, "--log-bin=%s/var/log/master-bin",mysql_test_dir); + add_arg(&al, "--server-id=1"); + add_arg(&al, "--basedir=%s", base_dir); + add_arg(&al, "--port=%u", master_port); +#if !defined(__NETWARE__) && !defined(__WIN__) + add_arg(&al, "--socket=%s",master_socket); +#endif + add_arg(&al, "--local-infile"); + add_arg(&al, "--core"); + add_arg(&al, "--datadir=%s", master_dir); +#ifndef __WIN__ + add_arg(&al, "--pid-file=%s", master_pid); +#endif + add_arg(&al, "--character-sets-dir=%s", char_dir); + add_arg(&al, "--tmpdir=%s", mysql_tmp_dir); + add_arg(&al, "--language=%s", lang_dir); +#ifdef DEBUG //only for debug builds + add_arg(&al, "--debug"); +#endif + + if (use_openssl) + { + add_arg(&al, "--ssl-ca=%s", ca_cert); + add_arg(&al, "--ssl-cert=%s", server_cert); + add_arg(&al, "--ssl-key=%s", server_key); + } + + // $MASTER_40_ARGS + add_arg(&al, "--rpl-recovery-rank=1"); + add_arg(&al, "--init-rpl-role=master"); + + // $SMALL_SERVER + add_arg(&al, "-O"); + add_arg(&al, "key_buffer_size=1M"); + add_arg(&al, "-O"); + add_arg(&al, "sort_buffer=256K"); + add_arg(&al, "-O"); + add_arg(&al, "max_heap_table_size=1M"); + + // $EXTRA_MASTER_OPT + if (master_opt[0] != 0) + { + char *p; + + p = (char *)str_tok(master_opt, " \t"); + if (!strstr(master_opt, "timezone")) + { + while (p) + { + add_arg(&al, "%s", p); + p = (char *)str_tok(NULL, " \t"); + } + } + } + + // remove the pid file if it exists +#ifndef __WIN__ + remove(master_pid); +#endif + + // spawn +#ifdef __WIN__ + if ((err= spawn(mysqld_file, &al, FALSE, NULL, master_out, master_err, &master_pid)) == 0) +#else + if ((err= spawn(mysqld_file, &al, FALSE, NULL, master_out, master_err, master_pid)) == 0) +#endif + { + sleep_until_file_exists(master_pid); + + if ((err = wait_for_server_start(bin_dir, mysqladmin_file, user, password, master_port, + mysql_tmp_dir)) == 0) + { + master_running = TRUE; + } + else + { + log_error("The master server went down early."); + } + } + else + { + log_error("Unable to start master server."); + } + + // free_args + free_args(&al); +} + +/****************************************************************************** + + start_slave() + + Start the slave server. + +******************************************************************************/ +void start_slave() +{ + arg_list_t al; + int err; + char slave_out[PATH_MAX]; + char slave_err[PATH_MAX]; + + // skip? + if (skip_slave) return; + + // remove stale binary logs + removef("%s/*-bin.*", slave_dir); + + // remove stale binary logs + removef("%s/*.index", slave_dir); + + // remove master.info file + removef("%s/master.info", slave_dir); + + // remove relay files + removef("%s/var/log/*relay*", mysql_test_dir); + + // remove relay-log.info file + removef("%s/relay-log.info", slave_dir); + + // init script + if (slave_init_script[0] != 0) + { +#ifdef __NETWARE__ + // TODO: use the scripts + if (strinstr(slave_init_script, "rpl000016-slave.sh") != 0) + { + // create empty master.info file + snprintf(temp, PATH_MAX, "%s/master.info", slave_dir); + close(open(temp, O_WRONLY | O_CREAT,S_IRWXU|S_IRWXG|S_IRWXO)); + } + else if (strinstr(slave_init_script, "rpl000017-slave.sh") != 0) + { + FILE *fp; + + // create a master.info file + snprintf(temp, PATH_MAX, "%s/master.info", slave_dir); + fp = fopen(temp, "wb+"); + + fputs("master-bin.000001\n", fp); + fputs("4\n", fp); + fputs("127.0.0.1\n", fp); + fputs("replicate\n", fp); + fputs("aaaaaaaaaaaaaaab\n", fp); + fputs("9306\n", fp); + fputs("1\n", fp); + fputs("0\n", fp); + + fclose(fp); + } + else if (strinstr(slave_init_script, "rpl_rotate_logs-slave.sh") != 0) + { + // create empty master.info file + snprintf(temp, PATH_MAX, "%s/master.info", slave_dir); + close(open(temp, O_WRONLY | O_CREAT,S_IRWXU|S_IRWXG|S_IRWXO)); + } +#elif !defined(__WIN__) + run_init_script(slave_init_script); +#endif + } + + // redirection files + snprintf(slave_out, PATH_MAX, "%s/var/run/slave%u.out", + mysql_test_dir, restarts); + snprintf(slave_err, PATH_MAX, "%s/var/run/slave%u.err", + mysql_test_dir, restarts); + + // args + init_args(&al); + add_arg(&al, "%s", mysqld_file); + add_arg(&al, "--no-defaults"); + add_arg(&al, "--log-bin=slave-bin"); + add_arg(&al, "--relay_log=slave-relay-bin"); + add_arg(&al, "--basedir=%s", base_dir); + add_arg(&al, "--port=%u", slave_port); +#if !defined(__NETWARE__) && !defined(__WIN__) + add_arg(&al, "--socket=%s",slave_socket); +#endif + add_arg(&al, "--datadir=%s", slave_dir); +#ifndef __WIN__ + add_arg(&al, "--pid-file=%s", slave_pid); +#endif + add_arg(&al, "--character-sets-dir=%s", char_dir); + add_arg(&al, "--core"); + add_arg(&al, "--tmpdir=%s", mysql_tmp_dir); + add_arg(&al, "--language=%s", lang_dir); + + add_arg(&al, "--exit-info=256"); + add_arg(&al, "--log-slave-updates"); + add_arg(&al, "--init-rpl-role=slave"); + add_arg(&al, "--skip-innodb"); + add_arg(&al, "--skip-slave-start"); + add_arg(&al, "--slave-load-tmpdir=../../var/tmp"); + + add_arg(&al, "--report-user=%s", user); + add_arg(&al, "--report-host=127.0.0.1"); + add_arg(&al, "--report-port=%u", slave_port); + + add_arg(&al, "--master-retry-count=10"); + add_arg(&al, "-O"); + add_arg(&al, "slave_net_timeout=10"); +#ifdef DEBUG //only for debug builds + add_arg(&al, "--debug"); +#endif + + if (use_openssl) + { + add_arg(&al, "--ssl-ca=%s", ca_cert); + add_arg(&al, "--ssl-cert=%s", server_cert); + add_arg(&al, "--ssl-key=%s", server_key); + } + + // slave master info + if (slave_master_info[0] != 0) + { + char *p; + + p = (char *)str_tok(slave_master_info, " \t"); + + while(p) + { + add_arg(&al, "%s", p); + + p = (char *)str_tok(NULL, " \t"); + } + } + else + { + add_arg(&al, "--master-user=%s", user); + add_arg(&al, "--master-password=%s", password); + add_arg(&al, "--master-host=127.0.0.1"); + add_arg(&al, "--master-port=%u", master_port); + add_arg(&al, "--master-connect-retry=1"); + add_arg(&al, "--server-id=2"); + add_arg(&al, "--rpl-recovery-rank=2"); + } + + // small server + add_arg(&al, "-O"); + add_arg(&al, "key_buffer_size=1M"); + add_arg(&al, "-O"); + add_arg(&al, "sort_buffer=256K"); + add_arg(&al, "-O"); + add_arg(&al, "max_heap_table_size=1M"); + + + // opt args + if (slave_opt[0] != 0) + { + char *p; + + p = (char *)str_tok(slave_opt, " \t"); + + while(p) + { + add_arg(&al, "%s", p); + + p = (char *)str_tok(NULL, " \t"); + } + } + + // remove the pid file if it exists +#ifndef __WIN__ + remove(slave_pid); +#endif + // spawn +#ifdef __WIN__ + if ((err = spawn(mysqld_file, &al, FALSE, NULL, slave_out, slave_err, &slave_pid)) == 0) +#else + if ((err = spawn(mysqld_file, &al, FALSE, NULL, slave_out, slave_err, slave_pid)) == 0) +#endif + { + sleep_until_file_exists(slave_pid); + + if ((err = wait_for_server_start(bin_dir, mysqladmin_file, user, password, slave_port, + mysql_tmp_dir)) == 0) + { + slave_running = TRUE; + } + else + { + log_error("The slave server went down early."); + } + } + else + { + log_error("Unable to start slave server."); + } + + // free args + free_args(&al); +} + +/****************************************************************************** + + mysql_start() + + Start the mysql servers. + +******************************************************************************/ +void mysql_start() +{ +// log_info("Starting the MySQL server(s): %u", ++restarts); + start_master(); + + start_slave(); + + // activate the test screen +#ifdef __NETWARE__ + ActivateScreen(getscreenhandle()); +#endif +} + +/****************************************************************************** + + stop_slave() + + Stop the slave server. + +******************************************************************************/ +void stop_slave() +{ + int err; + + // running? + if (!slave_running) return; + + // stop + if ((err = stop_server(bin_dir, mysqladmin_file, user, password, slave_port, slave_pid, + mysql_tmp_dir)) == 0) + { + slave_running = FALSE; + } + else + { + log_error("Unable to stop slave server."); + } +} + +/****************************************************************************** + + stop_master() + + Stop the master server. + +******************************************************************************/ +void stop_master() +{ + int err; + + // running? + if (!master_running) return; + + if ((err = stop_server(bin_dir, mysqladmin_file, user, password, master_port, master_pid, + mysql_tmp_dir)) == 0) + { + master_running = FALSE; + } + else + { + log_error("Unable to stop master server."); + } +} + +/****************************************************************************** + + mysql_stop() + + Stop the mysql servers. + +******************************************************************************/ +void mysql_stop() +{ + + stop_master(); + + stop_slave(); + + // activate the test screen +#ifdef __NETWARE__ + ActivateScreen(getscreenhandle()); +#endif +} + +/****************************************************************************** + + mysql_restart() + + Restart the mysql servers. + +******************************************************************************/ +void mysql_restart() +{ +// log_info("Restarting the MySQL server(s): %u", ++restarts); + + mysql_stop(); + + mlog(DASH); + + mysql_start(); +} + +/****************************************************************************** + + read_option() + + Read the option file. + +******************************************************************************/ +int read_option(char *opt_file, char *opt) +{ + int fd, err; + char *p; + char buf[PATH_MAX]; + + // copy current option + strncpy(buf, opt, PATH_MAX); + + // open options file + fd = open(opt_file, O_RDONLY); + + err = read(fd, opt, PATH_MAX); + + close(fd); + + if (err > 0) + { + // terminate string + if ((p = strchr(opt, '\n')) != NULL) + { + *p = 0; + + // check for a '\r' + if ((p = strchr(opt, '\r')) != NULL) + { + *p = 0; + } + } + else + { + opt[err] = 0; + } + + // check for $MYSQL_TEST_DIR + if ((p = strstr(opt, "$MYSQL_TEST_DIR")) != NULL) + { + char temp[PATH_MAX]; + + *p = 0; + + strcpy(temp, p + strlen("$MYSQL_TEST_DIR")); + + strcat(opt, mysql_test_dir); + + strcat(opt, temp); + } + // Check for double backslash and replace it with single bakslash + if ((p = strstr(opt, "\\\\")) != NULL) + { + /* bmove is guranteed to work byte by byte */ + bmove(p, p+1, strlen(p+1)); + } + } + else + { + // clear option + *opt = 0; + } + + // compare current option with previous + return strcmp(opt, buf); +} + +/****************************************************************************** + + run_test() + + Run the given test case. + +******************************************************************************/ +void run_test(char *test) +{ + char temp[PATH_MAX]; + const char *rstr; + int skip = FALSE, ignore=FALSE; + int restart = FALSE; + int flag = FALSE; + struct stat info; + + // skip tests in the skip list + snprintf(temp, PATH_MAX, " %s ", test); + skip = (strinstr(skip_test, temp) != 0); + if (skip == FALSE) + ignore = (strinstr(ignore_test, temp) != 0); + + snprintf(master_init_script, PATH_MAX, "%s/%s-master.sh", test_dir, test); + snprintf(slave_init_script, PATH_MAX, "%s/%s-slave.sh", test_dir, test); +#ifdef __WIN__ + if (! stat(master_init_script, &info)) + skip = TRUE; + if (!stat(slave_init_script, &info)) + skip = TRUE; +#endif + if (ignore) + { + // show test + mlog("%-46s ", test); + + // ignore + rstr = TEST_IGNORE; + ++total_ignore; + } + else if (!skip) // skip test? + { + char test_file[PATH_MAX]; + char master_opt_file[PATH_MAX]; + char slave_opt_file[PATH_MAX]; + char slave_master_info_file[PATH_MAX]; + char result_file[PATH_MAX]; + char reject_file[PATH_MAX]; + char out_file[PATH_MAX]; + char err_file[PATH_MAX]; + int err; + arg_list_t al; +#ifdef __WIN__ + /* + Clean test database + */ + removef("%s/test/*.*", master_dir); + removef("%s/test/*.*", slave_dir); + removef("%s/mysqltest/*.*", master_dir); + removef("%s/mysqltest/*.*", slave_dir); + +#endif + // skip slave? + flag = skip_slave; + skip_slave = (strncmp(test, "rpl", 3) != 0); + if (flag != skip_slave) restart = TRUE; + + // create files + snprintf(master_opt_file, PATH_MAX, "%s/%s-master.opt", test_dir, test); + snprintf(slave_opt_file, PATH_MAX, "%s/%s-slave.opt", test_dir, test); + snprintf(slave_master_info_file, PATH_MAX, "%s/%s.slave-mi", test_dir, test); + snprintf(reject_file, PATH_MAX, "%s/%s%s", result_dir, test, REJECT_SUFFIX); + snprintf(out_file, PATH_MAX, "%s/%s%s", result_dir, test, OUT_SUFFIX); + snprintf(err_file, PATH_MAX, "%s/%s%s", result_dir, test, ERR_SUFFIX); + + // netware specific files + snprintf(test_file, PATH_MAX, "%s/%s%s", test_dir, test, NW_TEST_SUFFIX); + if (stat(test_file, &info)) + { + snprintf(test_file, PATH_MAX, "%s/%s%s", test_dir, test, TEST_SUFFIX); + if (access(test_file,0)) + { + printf("Invalid test name %s, %s file not found\n",test,test_file); + return; + } + } + + snprintf(result_file, PATH_MAX, "%s/%s%s", result_dir, test, NW_RESULT_SUFFIX); + if (stat(result_file, &info)) + { + snprintf(result_file, PATH_MAX, "%s/%s%s", result_dir, test, RESULT_SUFFIX); + } + + // init scripts + if (stat(master_init_script, &info)) + master_init_script[0] = 0; + else + restart = TRUE; + + if (stat(slave_init_script, &info)) + slave_init_script[0] = 0; + else + restart = TRUE; + + // read options + if (read_option(master_opt_file, master_opt)) restart = TRUE; + if (read_option(slave_opt_file, slave_opt)) restart = TRUE; + if (read_option(slave_master_info_file, slave_master_info)) restart = TRUE; + + // cleanup previous run + remove(reject_file); + remove(out_file); + remove(err_file); + + // start or restart? + if (!master_running) mysql_start(); + else if (restart) mysql_restart(); + + // let the system stabalize + sleep(1); + + // show test + mlog("%-46s ", test); + + + // args + init_args(&al); + add_arg(&al, "%s", mysqltest_file); + add_arg(&al, "--no-defaults"); + add_arg(&al, "--port=%u", master_port); +#if !defined(__NETWARE__) && !defined(__WIN__) + add_arg(&al, "--socket=%s", master_socket); + add_arg(&al, "--tmpdir=%s", mysql_tmp_dir); +#endif + add_arg(&al, "--database=%s", db); + add_arg(&al, "--user=%s", user); + add_arg(&al, "--password=%s", password); + add_arg(&al, "--silent"); + add_arg(&al, "--basedir=%s/", mysql_test_dir); + add_arg(&al, "--host=127.0.0.1"); + add_arg(&al, "-v"); + add_arg(&al, "-R"); + add_arg(&al, "%s", result_file); + + if (use_openssl) + { + add_arg(&al, "--ssl-ca=%s", ca_cert); + add_arg(&al, "--ssl-cert=%s", client_cert); + add_arg(&al, "--ssl-key=%s", client_key); + } + + // spawn + err = spawn(mysqltest_file, &al, TRUE, test_file, out_file, err_file, NULL); + + // free args + free_args(&al); + + remove_empty_file(out_file); + remove_empty_file(err_file); + + if (err == 0) + { + // pass + rstr = TEST_PASS; + ++total_pass; + + // increment total + ++total_test; + } + else if (err == 2) + { + // skip + rstr = TEST_SKIP; + ++total_skip; + } + else if (err == 1) + { + // fail + rstr = TEST_FAIL; + ++total_fail; + + // increment total + ++total_test; + } + else + { + rstr = TEST_BAD; + } + } + else // early skips + { + // show test + mlog("%-46s ", test); + + // skip + rstr = TEST_SKIP; + ++total_skip; + } + + // result + mlog("%-14s\n", rstr); +} + +/****************************************************************************** + + vlog() + + Log the message. + +******************************************************************************/ +void vlog(const char *format, va_list ap) +{ + vfprintf(stdout, format, ap); + fflush(stdout); + + if (log_fd) + { + vfprintf(log_fd, format, ap); + fflush(log_fd); + } +} + +/****************************************************************************** + + log() + + Log the message. + +******************************************************************************/ +void mlog(const char *format, ...) +{ + va_list ap; + + va_start(ap, format); + + vlog(format, ap); + + va_end(ap); +} + +/****************************************************************************** + + log_info() + + Log the given information. + +******************************************************************************/ +void log_info(const char *format, ...) +{ + va_list ap; + + va_start(ap, format); + + mlog("-- INFO : "); + vlog(format, ap); + mlog("\n"); + + va_end(ap); +} + +/****************************************************************************** + + log_error() + + Log the given error. + +******************************************************************************/ +void log_error(const char *format, ...) +{ + va_list ap; + + va_start(ap, format); + + mlog("-- ERROR: "); + vlog(format, ap); + mlog("\n"); + + va_end(ap); +} + +/****************************************************************************** + + log_errno() + + Log the given error and errno. + +******************************************************************************/ +void log_errno(const char *format, ...) +{ + va_list ap; + + va_start(ap, format); + + mlog("-- ERROR: (%003u) ", errno); + vlog(format, ap); + mlog("\n"); + + va_end(ap); +} + +/****************************************************************************** + + die() + + Exit the application. + +******************************************************************************/ +void die(const char *msg) +{ + log_error(msg); +#ifdef __NETWARE__ + pressanykey(); +#endif + exit(-1); +} + +/****************************************************************************** + + setup() + + Setup the mysql test enviornment. + +******************************************************************************/ +void setup(char *file) +{ + char temp[PATH_MAX]; + char file_path[PATH_MAX*2]; + char *p; + int position; + + // set the timezone for the timestamp test +#ifdef __WIN__ + _putenv( "TZ=GMT-3" ); +#else + setenv("TZ", "GMT-3", TRUE); +#endif + // find base dir +#ifdef __NETWARE__ + strcpy(temp, strlwr(file)); + while((p = strchr(temp, '\\')) != NULL) *p = '/'; +#else + getcwd(temp, PATH_MAX); + position = strlen(temp); + temp[position] = '/'; + temp[position+1] = 0; +#ifdef __WIN__ + while((p = strchr(temp, '\\')) != NULL) *p = '/'; +#endif +#endif + + if ((position = strinstr(temp, "/mysql-test/")) != 0) + { + p = temp + position - 1; + *p = 0; + strcpy(base_dir, temp); + } + + log_info("Currect directory: %s",base_dir); + +#ifdef __NETWARE__ + // setup paths + snprintf(bin_dir, PATH_MAX, "%s/bin", base_dir); + snprintf(mysql_test_dir, PATH_MAX, "%s/mysql-test", base_dir); + snprintf(test_dir, PATH_MAX, "%s/t", mysql_test_dir); + snprintf(mysql_tmp_dir, PATH_MAX, "%s/var/tmp", mysql_test_dir); + snprintf(result_dir, PATH_MAX, "%s/r", mysql_test_dir); + snprintf(master_dir, PATH_MAX, "%s/var/master-data", mysql_test_dir); + snprintf(slave_dir, PATH_MAX, "%s/var/slave-data", mysql_test_dir); + snprintf(lang_dir, PATH_MAX, "%s/share/english", base_dir); + snprintf(char_dir, PATH_MAX, "%s/share/charsets", base_dir); + +#ifdef HAVE_OPENSSL + use_openssl = TRUE; +#endif // HAVE_OPENSSL + + // OpenSSL paths + snprintf(ca_cert, PATH_MAX, "%s/SSL/cacert.pem", base_dir); + snprintf(server_cert, PATH_MAX, "%s/SSL/server-cert.pem", base_dir); + snprintf(server_key, PATH_MAX, "%s/SSL/server-key.pem", base_dir); + snprintf(client_cert, PATH_MAX, "%s/SSL/client-cert.pem", base_dir); + snprintf(client_key, PATH_MAX, "%s/SSL/client-key.pem", base_dir); + + // setup files + snprintf(mysqld_file, PATH_MAX, "%s/mysqld", bin_dir); + snprintf(mysqltest_file, PATH_MAX, "%s/mysqltest", bin_dir); + snprintf(mysqladmin_file, PATH_MAX, "%s/mysqladmin", bin_dir); + snprintf(master_pid, PATH_MAX, "%s/var/run/master.pid", mysql_test_dir); + snprintf(slave_pid, PATH_MAX, "%s/var/run/slave.pid", mysql_test_dir); +#elif __WIN__ + // setup paths +#ifdef _DEBUG + snprintf(bin_dir, PATH_MAX, "%s/client_debug", base_dir); +#else + snprintf(bin_dir, PATH_MAX, "%s/client_release", base_dir); +#endif + snprintf(mysql_test_dir, PATH_MAX, "%s/mysql-test", base_dir); + snprintf(test_dir, PATH_MAX, "%s/t", mysql_test_dir); + snprintf(mysql_tmp_dir, PATH_MAX, "%s/var/tmp", mysql_test_dir); + snprintf(result_dir, PATH_MAX, "%s/r", mysql_test_dir); + snprintf(master_dir, PATH_MAX, "%s/var/master-data", mysql_test_dir); + snprintf(slave_dir, PATH_MAX, "%s/var/slave-data", mysql_test_dir); + snprintf(lang_dir, PATH_MAX, "%s/share/english", base_dir); + snprintf(char_dir, PATH_MAX, "%s/share/charsets", base_dir); + +#ifdef HAVE_OPENSSL + use_openssl = TRUE; +#endif // HAVE_OPENSSL + + // OpenSSL paths + snprintf(ca_cert, PATH_MAX, "%s/SSL/cacert.pem", base_dir); + snprintf(server_cert, PATH_MAX, "%s/SSL/server-cert.pem", base_dir); + snprintf(server_key, PATH_MAX, "%s/SSL/server-key.pem", base_dir); + snprintf(client_cert, PATH_MAX, "%s/SSL/client-cert.pem", base_dir); + snprintf(client_key, PATH_MAX, "%s/SSL/client-key.pem", base_dir); + + // setup files + snprintf(mysqld_file, PATH_MAX, "%s/mysqld.exe", bin_dir); + snprintf(mysqltest_file, PATH_MAX, "%s/mysqltest.exe", bin_dir); + snprintf(mysqladmin_file, PATH_MAX, "%s/mysqladmin.exe", bin_dir); +#else + // setup paths + snprintf(bin_dir, PATH_MAX, "%s/client", base_dir); + snprintf(mysql_test_dir, PATH_MAX, "%s/mysql-test", base_dir); + snprintf(test_dir, PATH_MAX, "%s/t", mysql_test_dir); + snprintf(mysql_tmp_dir, PATH_MAX, "%s/var/tmp", mysql_test_dir); + snprintf(result_dir, PATH_MAX, "%s/r", mysql_test_dir); + snprintf(master_dir, PATH_MAX, "%s/var/master-data", mysql_test_dir); + snprintf(slave_dir, PATH_MAX, "%s/var/slave-data", mysql_test_dir); + snprintf(lang_dir, PATH_MAX, "%s/sql/share/english", base_dir); + snprintf(char_dir, PATH_MAX, "%s/sql/share/charsets", base_dir); + +#ifdef HAVE_OPENSSL + use_openssl = TRUE; +#endif // HAVE_OPENSSL + + // OpenSSL paths + snprintf(ca_cert, PATH_MAX, "%s/SSL/cacert.pem", base_dir); + snprintf(server_cert, PATH_MAX, "%s/SSL/server-cert.pem", base_dir); + snprintf(server_key, PATH_MAX, "%s/SSL/server-key.pem", base_dir); + snprintf(client_cert, PATH_MAX, "%s/SSL/client-cert.pem", base_dir); + snprintf(client_key, PATH_MAX, "%s/SSL/client-key.pem", base_dir); + + // setup files + snprintf(mysqld_file, PATH_MAX, "%s/sql/mysqld", base_dir); + snprintf(mysqltest_file, PATH_MAX, "%s/mysqltest", bin_dir); + snprintf(mysqladmin_file, PATH_MAX, "%s/mysqladmin", bin_dir); + snprintf(master_pid, PATH_MAX, "%s/var/run/master.pid", mysql_test_dir); + snprintf(slave_pid, PATH_MAX, "%s/var/run/slave.pid", mysql_test_dir); + + snprintf(master_socket,PATH_MAX, "%s/var/tmp/master.sock", mysql_test_dir); + snprintf(slave_socket,PATH_MAX, "%s/var/tmp/slave.sock", mysql_test_dir); + +#endif + // create log file + snprintf(temp, PATH_MAX, "%s/mysql-test-run.log", mysql_test_dir); + if ((log_fd = fopen(temp, "w+")) == NULL) + { + log_errno("Unable to create log file."); + } + + // prepare skip test list + while((p = strchr(skip_test, ',')) != NULL) *p = ' '; + strcpy(temp, strlwr(skip_test)); + snprintf(skip_test, PATH_MAX, " %s ", temp); + + // environment +#ifdef __NETWARE__ + setenv("MYSQL_TEST_DIR", mysql_test_dir, 1); + snprintf(file_path, PATH_MAX*2, "%s/client/mysqldump --no-defaults -u root --port=%u", bin_dir, master_port); + setenv("MYSQL_DUMP", file_path, 1); + snprintf(file_path, PATH_MAX*2, "%s/client/mysqlbinlog --no-defaults --local-load=%s", bin_dir, mysql_tmp_dir); + setenv("MYSQL_BINLOG", file_path, 1); +#elif __WIN__ + snprintf(file_path,MAX_PATH,"MYSQL_TEST_DIR=%s",mysql_test_dir); + _putenv(file_path); + snprintf(file_path, PATH_MAX*2, "MYSQL_DUMP=%s/mysqldump.exe --no-defaults -u root --port=%u", bin_dir, master_port); + _putenv(file_path); + snprintf(file_path, PATH_MAX*2, "MYSQL_BINLOG=%s/mysqlbinlog.exe --no-defaults --local-load=%s", bin_dir, mysql_tmp_dir); + _putenv(file_path); +#else + setenv("MYSQL_TEST_DIR", mysql_test_dir, 1); + snprintf(file_path, PATH_MAX*2, "%s/mysqldump --no-defaults -u root --port=%u --socket=%s", bin_dir, master_port, master_socket); + setenv("MYSQL_DUMP", file_path, 1); + snprintf(file_path, PATH_MAX*2, "%s/mysqlbinlog --no-defaults --local-load=%s", bin_dir, mysql_tmp_dir); + setenv("MYSQL_BINLOG", file_path, 1); +#endif + +#ifndef __WIN__ + setenv("MASTER_MYPORT", "9306", 1); + setenv("SLAVE_MYPORT", "9307", 1); + setenv("MYSQL_TCP_PORT", "3306", 1); +#else + _putenv("MASTER_MYPORT=9306"); + _putenv("SLAVE_MYPORT=9307"); + _putenv("MYSQL_TCP_PORT=3306"); +#endif + +} + +/****************************************************************************** + + main() + +******************************************************************************/ +int main(int argc, char **argv) +{ + int is_ignore_list = 0; + // setup + setup(argv[0]); + + /* The --ignore option is comma saperated list of test cases to skip and + should be very first command line option to the test suite. + + The usage is now: + mysql_test_run --ignore=test1,test2 test3 test4 + where test1 and test2 are test cases to ignore + and test3 and test4 are test cases to run. + */ + if (argc >= 2 && !strnicmp(argv[1], "--ignore=", sizeof("--ignore=")-1)) + { + char *temp, *token; + temp= strdup(strchr(argv[1],'=') + 1); + for (token=str_tok(temp, ","); token != NULL; token=str_tok(NULL, ",")) + { + if (strlen(ignore_test) + strlen(token) + 2 <= PATH_MAX-1) + sprintf(ignore_test+strlen(ignore_test), " %s ", token); + else + { + free(temp); + die("ignore list too long."); + } + } + free(temp); + is_ignore_list = 1; + } + // header +#ifndef __WIN__ + mlog("MySQL Server %s, for %s (%s)\n\n", VERSION, SYSTEM_TYPE, MACHINE_TYPE); +#else + mlog("MySQL Server ---, for %s (%s)\n\n", SYSTEM_TYPE, MACHINE_TYPE); +#endif + + mlog("Initializing Tests...\n"); + + // install test databases + mysql_install_db(); + + mlog("Starting Tests...\n"); + + mlog("\n"); + mlog(HEADER); + mlog(DASH); + + if ( argc > 1 + is_ignore_list ) + { + int i; + + // single test + single_test = TRUE; + + for (i = 1 + is_ignore_list; i < argc; i++) + { + // run given test + run_test(argv[i]); + } + } + else + { + // run all tests +#ifndef __WIN__ + struct dirent **namelist; + int i,n; + char test[NAME_MAX]; + char *p; + int position; + + n = scandir(test_dir, &namelist, 0, alphasort); + if (n < 0) + die("Unable to open tests directory."); + else + { + for (i = 0; i < n; i++) + { + strcpy(test, strlwr(namelist[i]->d_name)); + // find the test suffix + if ((position = strinstr(test, TEST_SUFFIX)) != 0) + { + p = test + position - 1; + // null terminate at the suffix + *p = 0; + // run test + run_test(test); + } + free(namelist[n]); + } + free(namelist); + } +#else + struct _finddata_t dir; + intptr_t handle; + char test[NAME_MAX]; + char mask[PATH_MAX]; + char *p; + int position; + char **names = 0; + char **testes = 0; + int name_index; + int index; + + // single test + single_test = FALSE; + + snprintf(mask,MAX_PATH,"%s/*.test",test_dir); + + if ((handle=_findfirst(mask,&dir)) == -1L) + { + die("Unable to open tests directory."); + } + + names = malloc(MAX_COUNT_TESTES*4); + testes = names; + name_index = 0; + + do + { + if (!(dir.attrib & _A_SUBDIR)) + { + strcpy(test, strlwr(dir.name)); + + // find the test suffix + if ((position = strinstr(test, TEST_SUFFIX)) != 0) + { + p = test + position - 1; + // null terminate at the suffix + *p = 0; + + // insert test + *names = malloc(PATH_MAX); + strcpy(*names,test); + names++; + name_index++; + } + } + }while (_findnext(handle,&dir) == 0); + + _findclose(handle); + + qsort( (void *)testes, name_index, sizeof( char * ), compare ); + + for (index = 0; index <= name_index; index++) + { + run_test(testes[index]); + free(testes[index]); + } + + free(testes); +#endif + } + + // stop server + mysql_stop(); + + mlog(DASH); + mlog("\n"); + + mlog("Ending Tests...\n"); + + // report stats + report_stats(); + + // close log + if (log_fd) fclose(log_fd); + + // keep results up +#ifdef __NETWARE__ + pressanykey(); +#endif + return 0; +} + + +/* + Synopsis: + This function breaks the string into a sequence of tokens. The difference + between this function and strtok is that it respects the quoted string i.e. + it skips any delimiter character within the quoted part of the string. + It return tokens by eliminating quote character. It modifies the input string + passed. It will work with whitespace delimeter but may not work properly with + other delimeter. If the delimeter will contain any quote character, then + function will not tokenize and will return null string. + e.g. if input string is + --init-slave="set global max_connections=500" --skip-external-locking + then the output will two string i.e. + --init-slave=set global max_connections=500 + --skip-external-locking + +Arguments: + string: input string + delim: set of delimiter character +Output: + return the null terminated token of NULL. +*/ + + +char *str_tok(char *string, const char *delim) +{ + char *token; /* current token received from strtok */ + char *qt_token; /* token delimeted by the matching pair of quote */ + /* + if there are any quote chars found in the token then this variable + will hold the concatenated string to return to the caller + */ + char *ptr_token=NULL; + /* pointer to the quote character in the token from strtok */ + char *ptr_quote=NULL; + + /* See if the delimeter contains any quote character */ + if (strchr(delim,'\'') || strchr(delim,'\"')) + return NULL; + + /* repeate till we are getting some token from strtok */ + while ((token = (char*)strtok(string, delim) ) != NULL) + { + /* + make the input string NULL so that next time onward strtok can + be called with NULL input string. + */ + string = NULL; + /* + We don't need to remove any quote character for Windows version + */ +#ifndef __WIN__ + /* check if the current token contain double quote character*/ + if ((ptr_quote = (char*)strchr(token,'\"')) != NULL) + { + /* + get the matching the matching double quote in the remaining + input string + */ + qt_token = (char*)strtok(NULL,"\""); + } + /* check if the current token contain single quote character*/ + else if ((ptr_quote = (char*)strchr(token,'\'')) != NULL) + { + /* + get the matching the matching single quote in the remaining + input string + */ + qt_token = (char*)strtok(NULL,"\'"); + } +#endif + /* + if the current token does not contains any quote character then + return to the caller. + */ + if (ptr_quote == NULL) + { + /* + if there is any earlier token i.e. ptr_token then append the + current token in it and return it else return the current + token directly + */ + return ptr_token ? strcat(ptr_token,token) : token; + } + + /* + remove the quote character i.e. make NULL so that the token will + be devided in two part and later both part can be concatenated + and hence quote will be removed + */ + *ptr_quote= 0; + + /* check if ptr_token has been initialized or not */ + if (ptr_token == NULL) + { + /* initialize the ptr_token with current token */ + ptr_token= token; + /* copy entire string between matching pair of quote*/ + sprintf(ptr_token+strlen(ptr_token),"%s %s", ptr_quote+1, qt_token); + } + else + { + /* + copy the current token and entire string between matching pair + of quote + */ + if (qt_token == NULL) + { + sprintf(ptr_token+strlen(ptr_token),"%s%s", token, ptr_quote+1); + } + else + { + sprintf(ptr_token+strlen(ptr_token),"%s%s %s", token, ptr_quote+1, + qt_token ); + } + } + } + + /* return the concatenated token */ + return ptr_token; +} + +#ifndef __WIN__ + +/* + Synopsis: + This function run scripts files on Linux and Netware + +Arguments: + script_name: name of script file + +Output: + nothing +*/ +void run_init_script(const char *script_name) +{ + arg_list_t al; + int err; + + // args + init_args(&al); + add_arg(&al, sh_file); + add_arg(&al, script_name); + + // spawn + if ((err = spawn(sh_file, &al, TRUE, NULL, NULL, NULL, NULL)) != 0) + { + die("Unable to run script."); + } + + // free args + free_args(&al); +} +#endif diff --git a/mysql-test/r/fulltext.result b/mysql-test/r/fulltext.result index c86a379cccd..4d4b6eee9a4 100644 --- a/mysql-test/r/fulltext.result +++ b/mysql-test/r/fulltext.result @@ -352,9 +352,9 @@ t collation(t) aus Osnabrück utf8_general_ci SELECT t, collation(t) FROM t1 WHERE MATCH t AGAINST ('Osnabrueck'); t collation(t) -SELECT t, collation(t),MATCH t AGAINST ('Osnabruck') FROM t1 WHERE MATCH t AGAINST ('Osnabruck'); -t collation(t) MATCH t AGAINST ('Osnabruck') -aus Osnabrück utf8_general_ci 1.591139793396 +SELECT t, collation(t),FORMAT(MATCH t AGAINST ('Osnabruck'),6) FROM t1 WHERE MATCH t AGAINST ('Osnabruck'); +t collation(t) FORMAT(MATCH t AGAINST ('Osnabruck'),6) +aus Osnabrück utf8_general_ci 1.591140 alter table t1 modify t varchar(200) collate latin1_german2_ci not null; SELECT t, collation(t) FROM t1 WHERE MATCH t AGAINST ('Osnabrück'); t collation(t) diff --git a/mysql-test/r/fulltext_cache.result b/mysql-test/r/fulltext_cache.result index c489bdefeb8..4c210b8a3cb 100644 --- a/mysql-test/r/fulltext_cache.result +++ b/mysql-test/r/fulltext_cache.result @@ -21,17 +21,17 @@ INSERT INTO t2 VALUES (5,2,'um copo de Vodka'); INSERT INTO t2 VALUES (6,2,'um chocolate Snickers'); INSERT INTO t2 VALUES (7,1,'Bife'); INSERT INTO t2 VALUES (8,1,'Pizza de Salmao'); -SELECT t1.q, t2.item, t2.id, MATCH t2.item AGAINST ('sushi') +SELECT t1.q, t2.item, t2.id, FORMAT(MATCH t2.item AGAINST ('sushi'),6) as x FROM t1, t2 WHERE (t2.id2 = t1.id) ORDER BY x DESC,t2.id; q item id x -aaaaaaaaa dsaass de sushi 1 1.92378664016724 -aaaaaaaaa dsaass de Bolo de Chocolate 2 0 -aaaaaaaaa dsaass de Feijoada 3 0 -aaaaaaaaa dsaass de Mousse de Chocolate 4 0 -ssde df s fsda sad er um copo de Vodka 5 0 -ssde df s fsda sad er um chocolate Snickers 6 0 -aaaaaaaaa dsaass de Bife 7 0 -aaaaaaaaa dsaass de Pizza de Salmao 8 0 +aaaaaaaaa dsaass de sushi 1 1.923787 +aaaaaaaaa dsaass de Bolo de Chocolate 2 0.000000 +aaaaaaaaa dsaass de Feijoada 3 0.000000 +aaaaaaaaa dsaass de Mousse de Chocolate 4 0.000000 +ssde df s fsda sad er um copo de Vodka 5 0.000000 +ssde df s fsda sad er um chocolate Snickers 6 0.000000 +aaaaaaaaa dsaass de Bife 7 0.000000 +aaaaaaaaa dsaass de Pizza de Salmao 8 0.000000 SELECT t1.q, t2.item, t2.id, MATCH t2.item AGAINST ('sushi' IN BOOLEAN MODE) as x FROM t1, t2 WHERE (t2.id2 = t1.id) ORDER BY x DESC,t2.id; q item id x @@ -43,17 +43,17 @@ ssde df s fsda sad er um copo de Vodka 5 0 ssde df s fsda sad er um chocolate Snickers 6 0 aaaaaaaaa dsaass de Bife 7 0 aaaaaaaaa dsaass de Pizza de Salmao 8 0 -SELECT t1.q, t2.item, t2.id, MATCH t2.item AGAINST ('sushi') +SELECT t1.q, t2.item, t2.id, FORMAT(MATCH t2.item AGAINST ('sushi'),6) as x FROM t2, t1 WHERE (t2.id2 = t1.id) ORDER BY x DESC,t2.id; q item id x -aaaaaaaaa dsaass de sushi 1 1.92378664016724 -aaaaaaaaa dsaass de Bolo de Chocolate 2 0 -aaaaaaaaa dsaass de Feijoada 3 0 -aaaaaaaaa dsaass de Mousse de Chocolate 4 0 -ssde df s fsda sad er um copo de Vodka 5 0 -ssde df s fsda sad er um chocolate Snickers 6 0 -aaaaaaaaa dsaass de Bife 7 0 -aaaaaaaaa dsaass de Pizza de Salmao 8 0 +aaaaaaaaa dsaass de sushi 1 1.923787 +aaaaaaaaa dsaass de Bolo de Chocolate 2 0.000000 +aaaaaaaaa dsaass de Feijoada 3 0.000000 +aaaaaaaaa dsaass de Mousse de Chocolate 4 0.000000 +ssde df s fsda sad er um copo de Vodka 5 0.000000 +ssde df s fsda sad er um chocolate Snickers 6 0.000000 +aaaaaaaaa dsaass de Bife 7 0.000000 +aaaaaaaaa dsaass de Pizza de Salmao 8 0.000000 SELECT t1.q, t2.item, t2.id, MATCH t2.item AGAINST ('sushi' IN BOOLEAN MODE) as x FROM t2, t1 WHERE (t2.id2 = t1.id) ORDER BY x DESC,t2.id; q item id x diff --git a/mysql-test/r/fulltext_multi.result b/mysql-test/r/fulltext_multi.result index 968b00020e2..426b104ae89 100644 --- a/mysql-test/r/fulltext_multi.result +++ b/mysql-test/r/fulltext_multi.result @@ -11,19 +11,19 @@ FULLTEXT KEY a(b,c) INSERT INTO t1 VALUES (1,'lala lolo lili','oooo aaaa pppp'); INSERT INTO t1 VALUES (2,'asdf fdsa','lkjh fghj'); INSERT INTO t1 VALUES (3,'qpwoei','zmxnvb'); -SELECT a, MATCH b AGAINST ('lala lkjh') FROM t1; -a MATCH b AGAINST ('lala lkjh') -1 0.67003107070923 -2 0 -3 0 -SELECT a, MATCH c AGAINST ('lala lkjh') FROM t1; -a MATCH c AGAINST ('lala lkjh') -1 0 -2 0.67756325006485 -3 0 -SELECT a, MATCH b,c AGAINST ('lala lkjh') FROM t1; -a MATCH b,c AGAINST ('lala lkjh') -1 0.64840710163116 -2 0.66266459226608 -3 0 +SELECT a, FORMAT(MATCH b AGAINST ('lala lkjh'),6) FROM t1; +a FORMAT(MATCH b AGAINST ('lala lkjh'),6) +1 0.670031 +2 0.000000 +3 0.000000 +SELECT a, FORMAT(MATCH c AGAINST ('lala lkjh'),6) FROM t1; +a FORMAT(MATCH c AGAINST ('lala lkjh'),6) +1 0.000000 +2 0.677563 +3 0.000000 +SELECT a, FORMAT(MATCH b,c AGAINST ('lala lkjh'),6) FROM t1; +a FORMAT(MATCH b,c AGAINST ('lala lkjh'),6) +1 0.648407 +2 0.662665 +3 0.000000 drop table t1; diff --git a/mysql-test/r/fulltext_order_by.result b/mysql-test/r/fulltext_order_by.result index bfee9eba280..c6c42fa2e8b 100644 --- a/mysql-test/r/fulltext_order_by.result +++ b/mysql-test/r/fulltext_order_by.result @@ -6,53 +6,53 @@ FULLTEXT(message) ) comment = 'original testcase by sroussey@network54.com'; INSERT INTO t1 (message) VALUES ("Testing"),("table"),("testbug"), ("steve"),("is"),("cool"),("steve is cool"); -SELECT a, MATCH (message) AGAINST ('steve') FROM t1 WHERE MATCH (message) AGAINST ('steve'); -a MATCH (message) AGAINST ('steve') -4 0.90587323904037 -7 0.89568990468979 +SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) FROM t1 WHERE MATCH (message) AGAINST ('steve'); +a FORMAT(MATCH (message) AGAINST ('steve'),6) +4 0.905873 +7 0.895690 SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE MATCH (message) AGAINST ('steve'); a MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) 4 1 7 1 -SELECT a, MATCH (message) AGAINST ('steve') FROM t1 WHERE MATCH (message) AGAINST ('steve' IN BOOLEAN MODE); -a MATCH (message) AGAINST ('steve') -4 0.90587323904037 -7 0.89568990468979 +SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) FROM t1 WHERE MATCH (message) AGAINST ('steve' IN BOOLEAN MODE); +a FORMAT(MATCH (message) AGAINST ('steve'),6) +4 0.905873 +7 0.895690 SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE MATCH (message) AGAINST ('steve' IN BOOLEAN MODE); a MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) 4 1 7 1 -SELECT a, MATCH (message) AGAINST ('steve') FROM t1 WHERE MATCH (message) AGAINST ('steve') ORDER BY a; -a MATCH (message) AGAINST ('steve') -4 0.90587323904037 -7 0.89568990468979 +SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) FROM t1 WHERE MATCH (message) AGAINST ('steve') ORDER BY a; +a FORMAT(MATCH (message) AGAINST ('steve'),6) +4 0.905873 +7 0.895690 SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) ORDER BY a; a MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) 4 1 7 1 -SELECT a, MATCH (message) AGAINST ('steve') FROM t1 WHERE a in (2,7,4) and MATCH (message) AGAINST ('steve') ORDER BY a DESC; -a MATCH (message) AGAINST ('steve') -7 0.89568990468979 -4 0.90587323904037 +SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) FROM t1 WHERE a in (2,7,4) and MATCH (message) AGAINST ('steve') ORDER BY a DESC; +a FORMAT(MATCH (message) AGAINST ('steve'),6) +7 0.895690 +4 0.905873 SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE a in (2,7,4) and MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) ORDER BY a DESC; a MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) 7 1 4 1 -SELECT a, MATCH (message) AGAINST ('steve') FROM t1 WHERE a=7 and MATCH (message) AGAINST ('steve') ORDER BY 1; -a MATCH (message) AGAINST ('steve') -7 0.89568990468979 +SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) FROM t1 WHERE a=7 and MATCH (message) AGAINST ('steve') ORDER BY 1; +a FORMAT(MATCH (message) AGAINST ('steve'),6) +7 0.895690 SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE a=7 and MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) ORDER BY 1; a MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) 7 1 -SELECT a, MATCH (message) AGAINST ('steve') as rel FROM t1 ORDER BY rel; +SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) as rel FROM t1 ORDER BY rel; a rel -1 0 -2 0 -3 0 -5 0 -6 0 -7 0.89568990468979 -4 0.90587323904037 +1 0.000000 +2 0.000000 +3 0.000000 +5 0.000000 +6 0.000000 +7 0.895690 +4 0.905873 SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) as rel FROM t1 ORDER BY rel; a rel 1 0 diff --git a/mysql-test/r/type_float.result b/mysql-test/r/type_float.result index 30de1e62df7..38845fd08ca 100644 --- a/mysql-test/r/type_float.result +++ b/mysql-test/r/type_float.result @@ -22,14 +22,14 @@ select * from t1; f1 f2 10 10 100000 100000 -1.23457e+09 1234567890 +1.23457e+9 1234567890 1e+10 10000000000 1e+15 1e+15 1e+20 1e+20 3.40282e+38 1e+50 3.40282e+38 1e+150 -10 -10 -1e-05 1e-05 +1e-5 1e-5 1e-10 1e-10 1e-15 1e-15 1e-20 1e-20 diff --git a/mysql-test/t/fulltext.test b/mysql-test/t/fulltext.test index 66df5b1cb92..13722d9732a 100644 --- a/mysql-test/t/fulltext.test +++ b/mysql-test/t/fulltext.test @@ -272,7 +272,7 @@ SELECT t, collation(t) FROM t1 WHERE MATCH t AGAINST ('Osnabr SET NAMES latin1; SELECT t, collation(t) FROM t1 WHERE MATCH t AGAINST ('Osnabrück'); SELECT t, collation(t) FROM t1 WHERE MATCH t AGAINST ('Osnabrueck'); -SELECT t, collation(t),MATCH t AGAINST ('Osnabruck') FROM t1 WHERE MATCH t AGAINST ('Osnabruck'); +SELECT t, collation(t),FORMAT(MATCH t AGAINST ('Osnabruck'),6) FROM t1 WHERE MATCH t AGAINST ('Osnabruck'); #alter table t1 modify t text character set latin1 collate latin1_german2_ci not null; alter table t1 modify t varchar(200) collate latin1_german2_ci not null; SELECT t, collation(t) FROM t1 WHERE MATCH t AGAINST ('Osnabrück'); diff --git a/mysql-test/t/fulltext_cache.test b/mysql-test/t/fulltext_cache.test index 15f32fdb5a0..e8c2b4a7f74 100644 --- a/mysql-test/t/fulltext_cache.test +++ b/mysql-test/t/fulltext_cache.test @@ -29,13 +29,13 @@ INSERT INTO t2 VALUES (6,2,'um chocolate Snickers'); INSERT INTO t2 VALUES (7,1,'Bife'); INSERT INTO t2 VALUES (8,1,'Pizza de Salmao'); -SELECT t1.q, t2.item, t2.id, MATCH t2.item AGAINST ('sushi') +SELECT t1.q, t2.item, t2.id, FORMAT(MATCH t2.item AGAINST ('sushi'),6) as x FROM t1, t2 WHERE (t2.id2 = t1.id) ORDER BY x DESC,t2.id; SELECT t1.q, t2.item, t2.id, MATCH t2.item AGAINST ('sushi' IN BOOLEAN MODE) as x FROM t1, t2 WHERE (t2.id2 = t1.id) ORDER BY x DESC,t2.id; -SELECT t1.q, t2.item, t2.id, MATCH t2.item AGAINST ('sushi') +SELECT t1.q, t2.item, t2.id, FORMAT(MATCH t2.item AGAINST ('sushi'),6) as x FROM t2, t1 WHERE (t2.id2 = t1.id) ORDER BY x DESC,t2.id; SELECT t1.q, t2.item, t2.id, MATCH t2.item AGAINST ('sushi' IN BOOLEAN MODE) diff --git a/mysql-test/t/fulltext_multi.test b/mysql-test/t/fulltext_multi.test index c312a5938b2..437ce96794b 100644 --- a/mysql-test/t/fulltext_multi.test +++ b/mysql-test/t/fulltext_multi.test @@ -17,7 +17,7 @@ INSERT INTO t1 VALUES (1,'lala lolo lili','oooo aaaa pppp'); INSERT INTO t1 VALUES (2,'asdf fdsa','lkjh fghj'); INSERT INTO t1 VALUES (3,'qpwoei','zmxnvb'); -SELECT a, MATCH b AGAINST ('lala lkjh') FROM t1; -SELECT a, MATCH c AGAINST ('lala lkjh') FROM t1; -SELECT a, MATCH b,c AGAINST ('lala lkjh') FROM t1; +SELECT a, FORMAT(MATCH b AGAINST ('lala lkjh'),6) FROM t1; +SELECT a, FORMAT(MATCH c AGAINST ('lala lkjh'),6) FROM t1; +SELECT a, FORMAT(MATCH b,c AGAINST ('lala lkjh'),6) FROM t1; drop table t1; diff --git a/mysql-test/t/fulltext_order_by.test b/mysql-test/t/fulltext_order_by.test index f8afe49d95d..5856f68ec9e 100644 --- a/mysql-test/t/fulltext_order_by.test +++ b/mysql-test/t/fulltext_order_by.test @@ -10,25 +10,25 @@ CREATE TABLE t1 ( INSERT INTO t1 (message) VALUES ("Testing"),("table"),("testbug"), ("steve"),("is"),("cool"),("steve is cool"); # basic MATCH -SELECT a, MATCH (message) AGAINST ('steve') FROM t1 WHERE MATCH (message) AGAINST ('steve'); +SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) FROM t1 WHERE MATCH (message) AGAINST ('steve'); SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE MATCH (message) AGAINST ('steve'); -SELECT a, MATCH (message) AGAINST ('steve') FROM t1 WHERE MATCH (message) AGAINST ('steve' IN BOOLEAN MODE); +SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) FROM t1 WHERE MATCH (message) AGAINST ('steve' IN BOOLEAN MODE); SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE MATCH (message) AGAINST ('steve' IN BOOLEAN MODE); # MATCH + ORDER BY (with ft-ranges) -SELECT a, MATCH (message) AGAINST ('steve') FROM t1 WHERE MATCH (message) AGAINST ('steve') ORDER BY a; +SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) FROM t1 WHERE MATCH (message) AGAINST ('steve') ORDER BY a; SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) ORDER BY a; # MATCH + ORDER BY (with normal ranges) + UNIQUE -SELECT a, MATCH (message) AGAINST ('steve') FROM t1 WHERE a in (2,7,4) and MATCH (message) AGAINST ('steve') ORDER BY a DESC; +SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) FROM t1 WHERE a in (2,7,4) and MATCH (message) AGAINST ('steve') ORDER BY a DESC; SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE a in (2,7,4) and MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) ORDER BY a DESC; # MATCH + ORDER BY + UNIQUE (const_table) -SELECT a, MATCH (message) AGAINST ('steve') FROM t1 WHERE a=7 and MATCH (message) AGAINST ('steve') ORDER BY 1; +SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) FROM t1 WHERE a=7 and MATCH (message) AGAINST ('steve') ORDER BY 1; SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE a=7 and MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) ORDER BY 1; # ORDER BY MATCH -SELECT a, MATCH (message) AGAINST ('steve') as rel FROM t1 ORDER BY rel; +SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) as rel FROM t1 ORDER BY rel; SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) as rel FROM t1 ORDER BY rel; drop table t1; diff --git a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test index e0cc96ccb32..162e44c35ea 100644 --- a/mysql-test/t/innodb.test +++ b/mysql-test/t/innodb.test @@ -1093,6 +1093,7 @@ show create table t2; drop table t2; # Test error handling +--replace_result \\ / --error 1005 create table t2 (id int(11) not null, id2 int(11) not null, constraint t1_id_fk foreign key (id2,id) references t1 (id)) engine = innodb; diff --git a/mysql-test/t/insert.test b/mysql-test/t/insert.test index fd728c453aa..b03b77f0be8 100644 --- a/mysql-test/t/insert.test +++ b/mysql-test/t/insert.test @@ -97,46 +97,57 @@ create table t1(number int auto_increment primary key, original_value varchar(50 set @value= "aa"; insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value); +--replace_result e-0 e- e+0 e+ --query_vertical select * from t1 where number =last_insert_id() set @value= "1aa"; insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value); +--replace_result e-0 e- e+0 e+ --query_vertical select * from t1 where number =last_insert_id() set @value= "aa1"; insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value); +--replace_result e-0 e- e+0 e+ --query_vertical select * from t1 where number =last_insert_id() set @value= "1e+1111111111a"; insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value); +--replace_result e-0 e- e+0 e+ --query_vertical select * from t1 where number =last_insert_id() set @value= "-1e+1111111111a"; insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value); +--replace_result e-0 e- e+0 e+ --query_vertical select * from t1 where number =last_insert_id() set @value= 1e+1111111111; insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value); +--replace_result e-0 e- e+0 e+ --query_vertical select * from t1 where number =last_insert_id() set @value= -1e+1111111111; insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value); +--replace_result e-0 e- e+0 e+ --query_vertical select * from t1 where number =last_insert_id() set @value= 1e+111; insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value); +--replace_result e-0 e- e+0 e+ --query_vertical select * from t1 where number =last_insert_id() set @value= -1e+111; insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value); +--replace_result e-0 e- e+0 e+ --query_vertical select * from t1 where number =last_insert_id() set @value= 1; insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value); +--replace_result e-0 e- e+0 e+ --query_vertical select * from t1 where number =last_insert_id() set @value= -1; insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value); +--replace_result e-0 e- e+0 e+ --query_vertical select * from t1 where number =last_insert_id() drop table t1; diff --git a/mysql-test/t/type_float.test b/mysql-test/t/type_float.test index d3ddecfc314..6497525424e 100644 --- a/mysql-test/t/type_float.test +++ b/mysql-test/t/type_float.test @@ -6,7 +6,9 @@ drop table if exists t1; --enable_warnings +--replace_result e-0 e- e+0 e+ SELECT 10,10.0,10.,.1e+2,100.0e-1; +--replace_result e-00 e-0 SELECT 6e-05, -6e-05, --6e-05, -6e-05+1.000000; SELECT 1e1,1.e1,1.0e1,1e+1,1.e+1,1.0e+1,1e-1,1.e-1,1.0e-1; @@ -14,6 +16,7 @@ create table t1 (f1 float(24),f2 float(52)); show full columns from t1; insert into t1 values(10,10),(1e+5,1e+5),(1234567890,1234567890),(1e+10,1e+10),(1e+15,1e+15),(1e+20,1e+20),(1e+50,1e+50),(1e+150,1e+150); insert into t1 values(-10,-10),(1e-5,1e-5),(1e-10,1e-10),(1e-15,1e-15),(1e-20,1e-20),(1e-50,1e-50),(1e-150,1e-150); +--replace_result e-0 e- e+0 e+ select * from t1; drop table t1; diff --git a/mysql-test/t/variables.test b/mysql-test/t/variables.test index 60ebeb045f5..eec08a7a776 100644 --- a/mysql-test/t/variables.test +++ b/mysql-test/t/variables.test @@ -8,6 +8,7 @@ drop table if exists t1,t2; set @`test`=1,@TEST=3,@select=2,@t5=1.23456; select @test,@`select`,@TEST,@not_used; set @test_int=10,@test_double=1e-10,@test_string="abcdeghi",@test_string2="abcdefghij",@select=NULL; +--replace_result e-0 e- e+0 e+ select @test_int,@test_double,@test_string,@test_string2,@select; set @test_int="hello",@test_double="hello",@test_string="hello",@test_string2="hello"; select @test_int,@test_double,@test_string,@test_string2; From 9caa9f9cd3bd74ecf244dccd3330533563a3360d Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 3 Nov 2004 15:53:26 +0100 Subject: [PATCH 02/28] Fix for bug#6398 update of primary key fails --- mysql-test/r/ndb_basic.result | 5 ++ mysql-test/t/ndb_basic.test | 2 + sql/ha_ndbcluster.cc | 155 ++++++++++++++++++---------------- sql/ha_ndbcluster.h | 23 ++--- 4 files changed, 99 insertions(+), 86 deletions(-) diff --git a/mysql-test/r/ndb_basic.result b/mysql-test/r/ndb_basic.result index 604084a72c2..ba8ee820ad9 100644 --- a/mysql-test/r/ndb_basic.result +++ b/mysql-test/r/ndb_basic.result @@ -40,6 +40,11 @@ SELECT * FROM t1 ORDER BY pk1; pk1 attr1 attr2 attr3 3 1 NULL 9412 9412 9413 17 9413 +UPDATE t1 SET pk1=4 WHERE pk1 = 3; +SELECT * FROM t1 ORDER BY pk1; +pk1 attr1 attr2 attr3 +4 1 NULL 9412 +9412 9413 17 9413 DELETE FROM t1; SELECT * FROM t1; pk1 attr1 attr2 attr3 diff --git a/mysql-test/t/ndb_basic.test b/mysql-test/t/ndb_basic.test index f5bed3dcdff..b62d2a8e0e1 100644 --- a/mysql-test/t/ndb_basic.test +++ b/mysql-test/t/ndb_basic.test @@ -36,6 +36,8 @@ UPDATE t1 SET pk1=2 WHERE attr1=1; SELECT * FROM t1 ORDER BY pk1; UPDATE t1 SET pk1=pk1 + 1; SELECT * FROM t1 ORDER BY pk1; +UPDATE t1 SET pk1=4 WHERE pk1 = 3; +SELECT * FROM t1 ORDER BY pk1; # Delete the record DELETE FROM t1; diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc index 838cf69855a..ec00f09e5c5 100644 --- a/sql/ha_ndbcluster.cc +++ b/sql/ha_ndbcluster.cc @@ -324,7 +324,7 @@ int ha_ndbcluster::ndb_err(NdbConnection *trans) DBUG_PRINT("info", ("transformed ndbcluster error %d to mysql error %d", err.code, res)); if (res == HA_ERR_FOUND_DUPP_KEY) - dupkey= table->primary_key; + m_dupkey= table->primary_key; DBUG_RETURN(res); } @@ -551,7 +551,7 @@ int ha_ndbcluster::get_ndb_blobs_value(NdbBlob *last_ndb_blob) blob_size+= 8 - blob_size % 8; if (loop == 1) { - char *buf= blobs_buffer + offset; + char *buf= m_blobs_buffer + offset; uint32 len= 0xffffffff; // Max uint32 DBUG_PRINT("value", ("read blob ptr=%x len=%u", (uint)buf, (uint)blob_len)); @@ -563,15 +563,15 @@ int ha_ndbcluster::get_ndb_blobs_value(NdbBlob *last_ndb_blob) offset+= blob_size; } } - if (loop == 0 && offset > blobs_buffer_size) + if (loop == 0 && offset > m_blobs_buffer_size) { - my_free(blobs_buffer, MYF(MY_ALLOW_ZERO_PTR)); - blobs_buffer_size= 0; + my_free(m_blobs_buffer, MYF(MY_ALLOW_ZERO_PTR)); + m_blobs_buffer_size= 0; DBUG_PRINT("value", ("allocate blobs buffer size %u", offset)); - blobs_buffer= my_malloc(offset, MYF(MY_WME)); - if (blobs_buffer == NULL) + m_blobs_buffer= my_malloc(offset, MYF(MY_WME)); + if (m_blobs_buffer == NULL) DBUG_RETURN(-1); - blobs_buffer_size= offset; + m_blobs_buffer_size= offset; } } DBUG_RETURN(0); @@ -854,7 +854,7 @@ int ha_ndbcluster::get_ndb_lock_type(enum thr_lock_type type) { if (type >= TL_WRITE_ALLOW_WRITE) return NdbOperation::LM_Exclusive; - else if (uses_blob_value(retrieve_all_fields)) + else if (uses_blob_value(m_retrieve_all_fields)) return NdbOperation::LM_Read; else return NdbOperation::LM_CommittedRead; @@ -1018,7 +1018,7 @@ int ha_ndbcluster::pk_read(const byte *key, uint key_len, byte *buf) { Field *field= table->field[i]; if ((thd->query_id == field->query_id) || - retrieve_all_fields) + m_retrieve_all_fields) { if (get_ndb_value(op, field, i, buf)) ERR_RETURN(trans->getNdbError()); @@ -1055,7 +1055,7 @@ int ha_ndbcluster::complemented_pk_read(const byte *old_data, byte *new_data) THD *thd= current_thd; DBUG_ENTER("complemented_pk_read"); - if (retrieve_all_fields) + if (m_retrieve_all_fields) // We have allready retrieved all fields, nothing to complement DBUG_RETURN(0); @@ -1192,12 +1192,12 @@ inline int ha_ndbcluster::next_result(byte *buf) /* We can only handle one tuple with blobs at a time. */ - if (ops_pending && blobs_pending) + if (m_ops_pending && m_blobs_pending) { if (execute_no_commit(this,trans) != 0) DBUG_RETURN(ndb_err(trans)); - ops_pending= 0; - blobs_pending= FALSE; + m_ops_pending= 0; + m_blobs_pending= FALSE; } check= cursor->nextResult(contact_ndb); if (check == 0) @@ -1219,8 +1219,8 @@ inline int ha_ndbcluster::next_result(byte *buf) all pending update or delete operations should be sent to NDB */ - DBUG_PRINT("info", ("ops_pending: %d", ops_pending)); - if (ops_pending) + DBUG_PRINT("info", ("ops_pending: %d", m_ops_pending)); + if (m_ops_pending) { if (current_thd->transaction.on) { @@ -1234,7 +1234,7 @@ inline int ha_ndbcluster::next_result(byte *buf) int res= trans->restart(); DBUG_ASSERT(res == 0); } - ops_pending= 0; + m_ops_pending= 0; } contact_ndb= (check == 2); @@ -1423,7 +1423,7 @@ int ha_ndbcluster::define_read_attrs(byte* buf, NdbOperation* op) Field *field= table->field[i]; if ((thd->query_id == field->query_id) || (field->flags & PRI_KEY_FLAG) || - retrieve_all_fields) + m_retrieve_all_fields) { if (get_ndb_value(op, field, i, buf)) ERR_RETURN(op->getNdbError()); @@ -1666,9 +1666,9 @@ int ha_ndbcluster::write_row(byte *record) if (has_auto_increment) { - skip_auto_increment= FALSE; + m_skip_auto_increment= FALSE; update_auto_increment(); - skip_auto_increment= !auto_increment_column_changed; + m_skip_auto_increment= !auto_increment_column_changed; } if ((res= set_primary_key(op))) @@ -1683,7 +1683,7 @@ int ha_ndbcluster::write_row(byte *record) if (!(field->flags & PRI_KEY_FLAG) && set_ndb_value(op, field, i, &set_blob_value)) { - skip_auto_increment= TRUE; + m_skip_auto_increment= TRUE; ERR_RETURN(op->getNdbError()); } } @@ -1695,25 +1695,25 @@ int ha_ndbcluster::write_row(byte *record) to NoCommit the transaction between each row. Find out how this is detected! */ - rows_inserted++; + m_rows_inserted++; no_uncommitted_rows_update(1); - bulk_insert_not_flushed= TRUE; - if ((rows_to_insert == 1) || - ((rows_inserted % bulk_insert_rows) == 0) || + m_bulk_insert_not_flushed= TRUE; + if ((m_rows_to_insert == 1) || + ((m_rows_inserted % m_bulk_insert_rows) == 0) || set_blob_value) { THD *thd= current_thd; // Send rows to NDB DBUG_PRINT("info", ("Sending inserts to NDB, "\ "rows_inserted:%d, bulk_insert_rows: %d", - (int)rows_inserted, (int)bulk_insert_rows)); + (int)m_rows_inserted, (int)m_bulk_insert_rows)); - bulk_insert_not_flushed= FALSE; + m_bulk_insert_not_flushed= FALSE; if (thd->transaction.on) { if (execute_no_commit(this,trans) != 0) { - skip_auto_increment= TRUE; + m_skip_auto_increment= TRUE; no_uncommitted_rows_execute_failure(); DBUG_RETURN(ndb_err(trans)); } @@ -1722,7 +1722,7 @@ int ha_ndbcluster::write_row(byte *record) { if (execute_commit(this,trans) != 0) { - skip_auto_increment= TRUE; + m_skip_auto_increment= TRUE; no_uncommitted_rows_execute_failure(); DBUG_RETURN(ndb_err(trans)); } @@ -1730,7 +1730,7 @@ int ha_ndbcluster::write_row(byte *record) DBUG_ASSERT(res == 0); } } - if ((has_auto_increment) && (skip_auto_increment)) + if ((has_auto_increment) && (m_skip_auto_increment)) { Uint64 next_val= (Uint64) table->next_number_field->val_int() + 1; DBUG_PRINT("info", @@ -1740,7 +1740,7 @@ int ha_ndbcluster::write_row(byte *record) DBUG_PRINT("info", ("Setting next auto increment value to %u", next_val)); } - skip_auto_increment= TRUE; + m_skip_auto_increment= TRUE; DBUG_RETURN(0); } @@ -1820,7 +1820,9 @@ int ha_ndbcluster::update_row(const byte *old_data, byte *new_data) } // Delete old row DBUG_PRINT("info", ("insert succeded")); + m_primary_key_update= TRUE; delete_res= delete_row(old_data); + m_primary_key_update= FALSE; if (delete_res) { DBUG_PRINT("info", ("delete failed")); @@ -1843,9 +1845,9 @@ int ha_ndbcluster::update_row(const byte *old_data, byte *new_data) DBUG_PRINT("info", ("Calling updateTuple on cursor")); if (!(op= cursor->updateTuple())) ERR_RETURN(trans->getNdbError()); - ops_pending++; + m_ops_pending++; if (uses_blob_value(FALSE)) - blobs_pending= TRUE; + m_blobs_pending= TRUE; } else { @@ -1921,7 +1923,7 @@ int ha_ndbcluster::delete_row(const byte *record) DBUG_PRINT("info", ("Calling deleteTuple on cursor")); if (cursor->deleteTuple() != 0) ERR_RETURN(trans->getNdbError()); - ops_pending++; + m_ops_pending++; no_uncommitted_rows_update(-1); @@ -1951,8 +1953,10 @@ int ha_ndbcluster::delete_row(const byte *record) else { int res; - if ((res= set_primary_key(op))) - return res; + if ((res= (m_primary_key_update ? + set_primary_key_from_old_data(op, record) + : set_primary_key(op)))) + return res; } } @@ -2411,18 +2415,18 @@ int ha_ndbcluster::close_scan() DBUG_RETURN(1); - if (ops_pending) + if (m_ops_pending) { /* Take over any pending transactions to the deleteing/updating transaction before closing the scan */ - DBUG_PRINT("info", ("ops_pending: %d", ops_pending)); + DBUG_PRINT("info", ("ops_pending: %d", m_ops_pending)); if (execute_no_commit(this,trans) != 0) { no_uncommitted_rows_execute_failure(); DBUG_RETURN(ndb_err(trans)); } - ops_pending= 0; + m_ops_pending= 0; } cursor->close(); @@ -2555,7 +2559,7 @@ void ha_ndbcluster::info(uint flag) if (flag & HA_STATUS_ERRKEY) { DBUG_PRINT("info", ("HA_STATUS_ERRKEY")); - errkey= dupkey; + errkey= m_dupkey; } if (flag & HA_STATUS_AUTO) DBUG_PRINT("info", ("HA_STATUS_AUTO")); @@ -2663,7 +2667,7 @@ int ha_ndbcluster::extra(enum ha_extra_function operation) where field->query_id is the same as the current query id */ DBUG_PRINT("info", ("HA_EXTRA_RETRIEVE_ALL_COLS")); - retrieve_all_fields= TRUE; + m_retrieve_all_fields= TRUE; break; case HA_EXTRA_PREPARE_FOR_DELETE: DBUG_PRINT("info", ("HA_EXTRA_PREPARE_FOR_DELETE")); @@ -2707,8 +2711,8 @@ void ha_ndbcluster::start_bulk_insert(ha_rows rows) DBUG_ENTER("start_bulk_insert"); DBUG_PRINT("enter", ("rows: %d", (int)rows)); - rows_inserted= 0; - rows_to_insert= rows; + m_rows_inserted= 0; + m_rows_to_insert= rows; /* Calculate how many rows that should be inserted @@ -2722,7 +2726,7 @@ void ha_ndbcluster::start_bulk_insert(ha_rows rows) batch= bytesperbatch/bytes; batch= batch == 0 ? 1 : batch; DBUG_PRINT("info", ("batch: %d, bytes: %d", batch, bytes)); - bulk_insert_rows= batch; + m_bulk_insert_rows= batch; DBUG_VOID_RETURN; } @@ -2736,22 +2740,22 @@ int ha_ndbcluster::end_bulk_insert() DBUG_ENTER("end_bulk_insert"); // Check if last inserts need to be flushed - if (bulk_insert_not_flushed) + if (m_bulk_insert_not_flushed) { NdbConnection *trans= m_active_trans; // Send rows to NDB DBUG_PRINT("info", ("Sending inserts to NDB, "\ "rows_inserted:%d, bulk_insert_rows: %d", - rows_inserted, bulk_insert_rows)); - bulk_insert_not_flushed= FALSE; + m_rows_inserted, m_bulk_insert_rows)); + m_bulk_insert_not_flushed= FALSE; if (execute_no_commit(this,trans) != 0) { no_uncommitted_rows_execute_failure(); my_errno= error= ndb_err(trans); } } - rows_inserted= 0; - rows_to_insert= 1; + m_rows_inserted= 0; + m_rows_to_insert= 1; DBUG_RETURN(error); } @@ -2937,8 +2941,8 @@ int ha_ndbcluster::external_lock(THD *thd, int lock_type) (NdbConnection*)thd->transaction.stmt.ndb_tid; DBUG_ASSERT(m_active_trans); // Start of transaction - retrieve_all_fields= FALSE; - ops_pending= 0; + m_retrieve_all_fields= FALSE; + m_ops_pending= 0; { NDBDICT *dict= m_ndb->getDictionary(); const NDBTAB *tab; @@ -2986,13 +2990,13 @@ int ha_ndbcluster::external_lock(THD *thd, int lock_type) DBUG_PRINT("warning", ("m_active_cursor != NULL")); m_active_cursor= NULL; - if (blobs_pending) + if (m_blobs_pending) DBUG_PRINT("warning", ("blobs_pending != 0")); - blobs_pending= 0; + m_blobs_pending= 0; - if (ops_pending) + if (m_ops_pending) DBUG_PRINT("warning", ("ops_pending != 0L")); - ops_pending= 0; + m_ops_pending= 0; } DBUG_RETURN(error); } @@ -3029,8 +3033,8 @@ int ha_ndbcluster::start_stmt(THD *thd) m_active_trans= trans; // Start of statement - retrieve_all_fields= FALSE; - ops_pending= 0; + m_retrieve_all_fields= FALSE; + m_ops_pending= 0; DBUG_RETURN(error); } @@ -3571,13 +3575,13 @@ longlong ha_ndbcluster::get_auto_increment() DBUG_ENTER("get_auto_increment"); DBUG_PRINT("enter", ("m_tabname: %s", m_tabname)); int cache_size= - (rows_to_insert - rows_inserted < autoincrement_prefetch) ? - rows_to_insert - rows_inserted - : (rows_to_insert > autoincrement_prefetch) ? - rows_to_insert + (m_rows_to_insert - m_rows_inserted < autoincrement_prefetch) ? + m_rows_to_insert - m_rows_inserted + : (m_rows_to_insert > autoincrement_prefetch) ? + m_rows_to_insert : autoincrement_prefetch; Uint64 auto_value= - (skip_auto_increment) ? + (m_skip_auto_increment) ? m_ndb->readAutoIncrementValue((const NDBTAB *) m_table) : m_ndb->getAutoIncrementValue((const NDBTAB *) m_table, cache_size); DBUG_RETURN((longlong)auto_value); @@ -3602,17 +3606,18 @@ ha_ndbcluster::ha_ndbcluster(TABLE *table_arg): m_share(0), m_use_write(FALSE), m_ignore_dup_key_not_supported(FALSE), - retrieve_all_fields(FALSE), - rows_to_insert(1), - rows_inserted(0), - bulk_insert_rows(1024), - bulk_insert_not_flushed(FALSE), - ops_pending(0), - skip_auto_increment(TRUE), - blobs_pending(0), - blobs_buffer(0), - blobs_buffer_size(0), - dupkey((uint) -1) + m_primary_key_update(FALSE), + m_retrieve_all_fields(FALSE), + m_rows_to_insert(1), + m_rows_inserted(0), + m_bulk_insert_rows(1024), + m_bulk_insert_not_flushed(FALSE), + m_ops_pending(0), + m_skip_auto_increment(TRUE), + m_blobs_pending(0), + m_blobs_buffer(0), + m_blobs_buffer_size(0), + m_dupkey((uint) -1) { int i; @@ -3646,8 +3651,8 @@ ha_ndbcluster::~ha_ndbcluster() if (m_share) free_share(m_share); release_metadata(); - my_free(blobs_buffer, MYF(MY_ALLOW_ZERO_PTR)); - blobs_buffer= 0; + my_free(m_blobs_buffer, MYF(MY_ALLOW_ZERO_PTR)); + m_blobs_buffer= 0; // Check for open cursor/transaction if (m_active_cursor) { diff --git a/sql/ha_ndbcluster.h b/sql/ha_ndbcluster.h index b33a0657d4f..2121228a869 100644 --- a/sql/ha_ndbcluster.h +++ b/sql/ha_ndbcluster.h @@ -243,18 +243,19 @@ class ha_ndbcluster: public handler NdbValue m_value[NDB_MAX_ATTRIBUTES_IN_TABLE]; bool m_use_write; bool m_ignore_dup_key_not_supported; - bool retrieve_all_fields; - ha_rows rows_to_insert; - ha_rows rows_inserted; - ha_rows bulk_insert_rows; - bool bulk_insert_not_flushed; - ha_rows ops_pending; - bool skip_auto_increment; - bool blobs_pending; + bool m_primary_key_update; + bool m_retrieve_all_fields; + ha_rows m_rows_to_insert; + ha_rows m_rows_inserted; + ha_rows m_bulk_insert_rows; + bool m_bulk_insert_not_flushed; + ha_rows m_ops_pending; + bool m_skip_auto_increment; + bool m_blobs_pending; // memory for blobs in one tuple - char *blobs_buffer; - uint32 blobs_buffer_size; - uint dupkey; + char *m_blobs_buffer; + uint32 m_blobs_buffer_size; + uint m_dupkey; void set_rec_per_key(); void records_update(); From d07f96cf4987ec7b41a5d9ee3f2180e32770342a Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 3 Nov 2004 21:32:48 +0200 Subject: [PATCH 03/28] InnoDB: commit after every 10000 rows in ALTER TABLE innobase/include/lock0lock.h: Added function lock_get_ix_table() innobase/include/row0mysql.h: Added parameter "table" to row_lock_table_for_mysql() innobase/lock/lock0lock.c: Added function lock_get_ix_table() innobase/row/row0mysql.c: Added parameter "table" to row_lock_table_for_mysql() sql/ha_innodb.cc: write_row(): commit every 10000 rows in ALTER TABLE sql/ha_innodb.h: Added member variable num_write_row --- innobase/include/lock0lock.h | 8 ++++++++ innobase/include/row0mysql.h | 6 +++++- innobase/lock/lock0lock.c | 13 +++++++++++++ innobase/row/row0mysql.c | 14 +++++++++++--- sql/ha_innodb.cc | 26 +++++++++++++++++++++++++- sql/ha_innodb.h | 4 +++- 6 files changed, 65 insertions(+), 6 deletions(-) diff --git a/innobase/include/lock0lock.h b/innobase/include/lock0lock.h index 9f525042dcc..f8435e14d97 100644 --- a/innobase/include/lock0lock.h +++ b/innobase/include/lock0lock.h @@ -463,6 +463,14 @@ lock_rec_hash( ulint space, /* in: space */ ulint page_no);/* in: page number */ /************************************************************************* +Gets the table covered by an IX table lock. */ + +dict_table_t* +lock_get_ix_table( +/*==============*/ + /* out: the table covered by the lock */ + lock_t* lock); /* in: table lock */ +/************************************************************************* Checks that a transaction id is sensible, i.e., not in the future. */ ibool diff --git a/innobase/include/row0mysql.h b/innobase/include/row0mysql.h index 9437ed4b6ee..73f41dea0da 100644 --- a/innobase/include/row0mysql.h +++ b/innobase/include/row0mysql.h @@ -175,8 +175,12 @@ int row_lock_table_for_mysql( /*=====================*/ /* out: error code or DB_SUCCESS */ - row_prebuilt_t* prebuilt); /* in: prebuilt struct in the MySQL + row_prebuilt_t* prebuilt, /* in: prebuilt struct in the MySQL table handle */ + dict_table_t* table); /* in: table to LOCK_IX, or NULL + if prebuilt->table should be + locked as LOCK_TABLE_EXP | + prebuilt->select_lock_type */ /************************************************************************* Does an insert for MySQL. */ diff --git a/innobase/lock/lock0lock.c b/innobase/lock/lock0lock.c index 68073647248..6f2d58b72c3 100644 --- a/innobase/lock/lock0lock.c +++ b/innobase/lock/lock0lock.c @@ -395,6 +395,19 @@ lock_rec_get_nth_bit( return(ut_bit_get_nth(b, bit_index)); } +/************************************************************************* +Gets the table covered by an IX table lock. */ + +dict_table_t* +lock_get_ix_table( +/*==============*/ + /* out: the table covered by the lock */ + lock_t* lock) /* in: table lock */ +{ + ut_a(lock->type_mode == (LOCK_TABLE | LOCK_IX)); + return(lock->un_member.tab_lock.table); +} + /*************************************************************************/ #define lock_mutex_enter_kernel() mutex_enter(&kernel_mutex) diff --git a/innobase/row/row0mysql.c b/innobase/row/row0mysql.c index 241ddc310e8..3e780138261 100644 --- a/innobase/row/row0mysql.c +++ b/innobase/row/row0mysql.c @@ -779,8 +779,12 @@ int row_lock_table_for_mysql( /*=====================*/ /* out: error code or DB_SUCCESS */ - row_prebuilt_t* prebuilt) /* in: prebuilt struct in the MySQL + row_prebuilt_t* prebuilt, /* in: prebuilt struct in the MySQL table handle */ + dict_table_t* table) /* in: table to LOCK_IX, or NULL + if prebuilt->table should be + locked as LOCK_TABLE_EXP | + prebuilt->select_lock_type */ { trx_t* trx = prebuilt->trx; que_thr_t* thr; @@ -813,8 +817,12 @@ run_again: trx_start_if_not_started(trx); - err = lock_table(LOCK_TABLE_EXP, prebuilt->table, - prebuilt->select_lock_type, thr); + if (table) { + err = lock_table(0, table, LOCK_IX, thr); + } else { + err = lock_table(LOCK_TABLE_EXP, prebuilt->table, + prebuilt->select_lock_type, thr); + } trx->error_state = err; diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc index 0bcb7062437..25a0f154c25 100644 --- a/sql/ha_innodb.cc +++ b/sql/ha_innodb.cc @@ -2314,7 +2314,31 @@ ha_innobase::write_row( if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_INSERT) table->timestamp_field->set_time(); + num_write_row++; + + if (user_thd->lex->sql_command == SQLCOM_ALTER_TABLE + && num_write_row > 10000) { + /* ALTER TABLE is COMMITted at every 10000 copied rows. + The IX table lock for the original table has to be re-issued. + As this method will be called on a temporary table where the + contents of the original table is being copied to, it is + a bit tricky to determine the source table. The cursor + position in the source table need not be adjusted after the + intermediate COMMIT, since writes by other transactions are + being blocked by a MySQL table lock TL_WRITE_ALLOW_READ. */ + ut_a(prebuilt->trx->mysql_n_tables_locked == 2); + ut_a(UT_LIST_GET_LEN(prebuilt->trx->trx_locks) >= 2); + dict_table_t* table = lock_get_ix_table( + UT_LIST_GET_FIRST(prebuilt->trx->trx_locks)); + num_write_row = 0; + innobase_commit(user_thd, prebuilt->trx); + user_thd->transaction.all.innodb_active_trans = 1; + row_lock_table_for_mysql(prebuilt, table); + goto new_trx; + } + if (last_query_id != user_thd->query_id) { + new_trx: prebuilt->sql_stat_start = TRUE; last_query_id = user_thd->query_id; @@ -4986,7 +5010,7 @@ ha_innobase::external_lock( if (thd->in_lock_tables && thd->variables.innodb_table_locks) { ulint error; - error = row_lock_table_for_mysql(prebuilt); + error = row_lock_table_for_mysql(prebuilt, 0); if (error != DB_SUCCESS) { error = convert_error_code_to_mysql( diff --git a/sql/ha_innodb.h b/sql/ha_innodb.h index c10beacac1b..e76a966c6b9 100644 --- a/sql/ha_innodb.h +++ b/sql/ha_innodb.h @@ -64,6 +64,7 @@ class ha_innobase: public handler uint last_match_mode;/* match mode of the latest search: ROW_SEL_EXACT, ROW_SEL_EXACT_PREFIX, or undefined */ + uint num_write_row; /* number of write_row() calls */ longlong auto_inc_counter_for_this_stat; ulong max_supported_row_length(const byte *buf); @@ -85,7 +86,8 @@ class ha_innobase: public handler HA_PRIMARY_KEY_IN_READ_INDEX | HA_TABLE_SCAN_ON_INDEX), last_dup_key((uint) -1), - start_of_scan(0) + start_of_scan(0), + num_write_row(0) { } ~ha_innobase() {} From 6aeb3468203e8a95804dd7f4826c5af01c83eba9 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 4 Nov 2004 12:14:19 +0100 Subject: [PATCH 04/28] DbaccMain.cpp: ugly fix for 'quadita2' ia64 icc -O1 ndb/src/kernel/blocks/dbacc/DbaccMain.cpp: ugly fix for 'quadita2' ia64 icc -O1 --- ndb/src/kernel/blocks/dbacc/DbaccMain.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/ndb/src/kernel/blocks/dbacc/DbaccMain.cpp b/ndb/src/kernel/blocks/dbacc/DbaccMain.cpp index 9a1bbd86562..c275e5382f7 100644 --- a/ndb/src/kernel/blocks/dbacc/DbaccMain.cpp +++ b/ndb/src/kernel/blocks/dbacc/DbaccMain.cpp @@ -4501,6 +4501,17 @@ void Dbacc::getdirindex(Signal* signal) /* BUCKET, AND SERCH FOR ELEMENT.THE PRIMARY KEYS WHICH IS SAVED */ /* IN THE OPERATION REC ARE THE CHECK ITEMS IN THE SEARCHING. */ /* --------------------------------------------------------------------------------- */ + +#if __ia64 == 1 +#if __INTEL_COMPILER == 810 +int ndb_acc_ia64_icc810_dummy_var = 0; +void ndb_acc_ia64_icc810_dummy_func() +{ + ndb_acc_ia64_icc810_dummy_var++; +} +#endif +#endif + void Dbacc::getElement(Signal* signal) { DirRangePtr geOverflowrangeptr; @@ -4595,6 +4606,12 @@ void Dbacc::getElement(Signal* signal) /* WE HAVE FOUND THE ELEMENT. GET THE LOCK INDICATOR AND RETURN FOUND. */ /* --------------------------------------------------------------------------------- */ jam(); +#if __ia64 == 1 +#if __INTEL_COMPILER == 810 + // prevents SIGSEGV under icc -O1 + ndb_acc_ia64_icc810_dummy_func(); +#endif +#endif tgeLocked = ElementHeader::getLocked(gePageptr.p->word32[tgeElementptr]); tgeResult = ZTRUE; TdataIndex = tgeElementptr + tgeForward; From 9afd24f00090848243d31ae342706e27c8e00f4e Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 4 Nov 2004 14:06:24 +0100 Subject: [PATCH 05/28] NDB bug #6426 fix ndb/src/kernel/blocks/dblqh/DblqhMain.cpp: bug #6426 fix --- ndb/src/kernel/blocks/dblqh/DblqhMain.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp b/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp index cd15ad0c3b2..af1131e5e55 100644 --- a/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp +++ b/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp @@ -8725,7 +8725,7 @@ void Dblqh::sendKeyinfo20(Signal* signal, sendSignal(ref, GSN_KEYINFO20, signal, 25, JBB); src += KeyInfo20::DataLength;; keyLen -= KeyInfo20::DataLength; - } while(keyLen >= KeyInfo20::DataLength); + } MEMCOPY_NO_WORDS(keyInfo->keyData, src, keyLen); sendSignal(ref, GSN_KEYINFO20, signal, From f2be61f5b708a72ea22d773e46d1d42f8b2884a9 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 4 Nov 2004 15:57:54 +0200 Subject: [PATCH 06/28] ha_innodb.cc: write_row(): document the ALTER TABLE tweak better, and commit every n*10000 rows, not n*10000-1 rows. sql/ha_innodb.cc: write_row(): document the ALTER TABLE tweak better, and commit every n*10000 rows, not n*10000-1 rows. --- sql/ha_innodb.cc | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc index 25a0f154c25..6e08fc680b2 100644 --- a/sql/ha_innodb.cc +++ b/sql/ha_innodb.cc @@ -2314,10 +2314,8 @@ ha_innobase::write_row( if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_INSERT) table->timestamp_field->set_time(); - num_write_row++; - if (user_thd->lex->sql_command == SQLCOM_ALTER_TABLE - && num_write_row > 10000) { + && num_write_row >= 10000) { /* ALTER TABLE is COMMITted at every 10000 copied rows. The IX table lock for the original table has to be re-issued. As this method will be called on a temporary table where the @@ -2331,14 +2329,20 @@ ha_innobase::write_row( dict_table_t* table = lock_get_ix_table( UT_LIST_GET_FIRST(prebuilt->trx->trx_locks)); num_write_row = 0; + /* Commit the transaction. This will release the table + locks, so they have to be acquired again. */ innobase_commit(user_thd, prebuilt->trx); + /* Note that this transaction is still active. */ user_thd->transaction.all.innodb_active_trans = 1; + /* Re-acquire the IX table lock on the source table. */ row_lock_table_for_mysql(prebuilt, table); - goto new_trx; + /* We will need an IX lock on the destination table. */ + prebuilt->sql_stat_start = TRUE; } + num_write_row++; + if (last_query_id != user_thd->query_id) { - new_trx: prebuilt->sql_stat_start = TRUE; last_query_id = user_thd->query_id; From 76211d8689c28fbc49625998b237dacbd9f13408 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 4 Nov 2004 15:57:29 +0000 Subject: [PATCH 07/28] updated start script for ndbcluster to make better cleanup changed to use new switch mysql-test/ndb/ndbcluster.sh: updated start script for ndbcluster to make better cleanup ndb/test/run-test/main.cpp: changed to use new switch --- mysql-test/ndb/ndbcluster.sh | 60 +++++++++++++++++++++++++++++++----- ndb/test/run-test/main.cpp | 2 +- 2 files changed, 54 insertions(+), 8 deletions(-) diff --git a/mysql-test/ndb/ndbcluster.sh b/mysql-test/ndb/ndbcluster.sh index d7b115d71b6..9894e70c788 100644 --- a/mysql-test/ndb/ndbcluster.sh +++ b/mysql-test/ndb/ndbcluster.sh @@ -102,12 +102,43 @@ if [ ! -x "$exec_mgmtsrvr" ]; then echo "$exec_mgmtsrvr missing" exit 1 fi +if [ ! -x "$exec_waiter" ]; then + echo "$exec_waiter missing" + exit 1 +fi + +exec_mgmtclient="$exec_mgmtclient --no-defaults" +exec_mgmtsrvr="$exec_mgmtsrvr --no-defaults" +exec_ndb="$exec_ndb --no-defaults" +exec_waiter="$exec_waiter --no-defaults" ndb_host="localhost" ndb_mgmd_port=$port_base NDB_CONNECTSTRING="host=$ndb_host:$ndb_mgmd_port" export NDB_CONNECTSTRING +sleep_until_file_created () { + file=$1 + loop=$2 + org_time=$2 + message=$3 + while (test $loop -gt 0) + do + if [ -r $file ] + then + return 0 + fi + sleep 1 + loop=`expr $loop - 1` + done + if [ $message ] + then + echo $message + fi + echo "ERROR: $file was not created in $org_time seconds; Aborting" + return 1; +} + start_default_ndbcluster() { # do some checks @@ -127,8 +158,8 @@ port_transporter=`expr $ndb_mgmd_port + 2` # Start management server as deamon # Edit file system path and ports in config file - if [ $initial_ndb ] ; then + rm -f $fs_ndb/ndb_* sed \ -e s,"CHOOSE_MaxNoOfOrderedIndexes","$ndb_no_ord",g \ -e s,"CHOOSE_MaxNoOfConcurrentOperations","$ndb_con_op",g \ @@ -150,21 +181,32 @@ if ( cd "$fs_ndb" ; $exec_mgmtsrvr -f config.ini ) ; then :; else echo "Unable to start $exec_mgmtsrvr from `pwd`" exit 1 fi - +if sleep_until_file_created $fs_ndb/ndb_3.pid 30 +then :; else + exit 1 +fi cat `find "$fs_ndb" -name 'ndb_*.pid'` > "$fs_ndb/$pidfile" # Start database node echo "Starting ndbd" ( cd "$fs_ndb" ; $exec_ndb $flags_ndb & ) - +if sleep_until_file_created $fs_ndb/ndb_1.pid 30 +then :; else + stop_default_ndbcluster + exit 1 +fi cat `find "$fs_ndb" -name 'ndb_*.pid'` > "$fs_ndb/$pidfile" # Start database node echo "Starting ndbd" ( cd "$fs_ndb" ; $exec_ndb $flags_ndb & ) - +if sleep_until_file_created $fs_ndb/ndb_2.pid 30 +then :; else + stop_default_ndbcluster + exit 1 +fi cat `find "$fs_ndb" -name 'ndb_*.pid'` > "$fs_ndb/$pidfile" # test if Ndb Cluster starts properly @@ -172,6 +214,7 @@ cat `find "$fs_ndb" -name 'ndb_*.pid'` > "$fs_ndb/$pidfile" echo "Waiting for started..." if ( $exec_waiter ) | grep "NDBT_ProgramExit: 0 - OK"; then :; else echo "Ndbcluster startup failed" + stop_default_ndbcluster exit 1 fi @@ -198,10 +241,12 @@ if [ -f "$fs_ndb/$pidfile" ] ; then attempt=0 while [ $attempt -lt 10 ] ; do new_kill_pid="" + kill_pids2="" for p in $kill_pids ; do kill -0 $p 2> /dev/null if [ $? -eq 0 ] ; then new_kill_pid="$p $new_kill_pid" + kill_pids2="-$p $kill_pids2" fi done kill_pids=$new_kill_pid @@ -211,9 +256,10 @@ if [ -f "$fs_ndb/$pidfile" ] ; then sleep 1 attempt=`expr $attempt + 1` done - if [ "$kill_pids" != "" ] ; then - echo "Failed to shutdown ndbcluster, executing kill "$kill_pids - kill $kill_pids + if [ "$kill_pids2" != "" ] ; then + do_command="kill -9 $kill_pids2" + echo "Failed to shutdown ndbcluster, executing "$do_command + $do_command fi rm "$fs_ndb/$pidfile" fi diff --git a/ndb/test/run-test/main.cpp b/ndb/test/run-test/main.cpp index 22799a9a1b2..e5f73bc6a5c 100644 --- a/ndb/test/run-test/main.cpp +++ b/ndb/test/run-test/main.cpp @@ -459,7 +459,7 @@ setup_config(atrt_config& config){ proc.m_type = atrt_process::NDB_MGM; proc.m_proc.m_name.assfmt("%d-%s", index, "ndb_mgmd"); proc.m_proc.m_path.assign(dir).append("/libexec/ndb_mgmd"); - proc.m_proc.m_args = "--nodaemon -c initconfig.txt"; + proc.m_proc.m_args = "--nodaemon -f config.ini"; proc.m_proc.m_cwd.appfmt("%d.ndb_mgmd", index); connect_string.appfmt("host=%s:%d;", proc.m_hostname.c_str(), proc.m_ndb_mgm_port); From a68b4095ac7267631f866c1382955239d9afa33e Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 4 Nov 2004 16:24:41 +0000 Subject: [PATCH 08/28] to make sure we get the kill right on the different platforms --- mysql-test/ndb/ndbcluster.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/mysql-test/ndb/ndbcluster.sh b/mysql-test/ndb/ndbcluster.sh index 9894e70c788..9c6b6093b93 100644 --- a/mysql-test/ndb/ndbcluster.sh +++ b/mysql-test/ndb/ndbcluster.sh @@ -257,9 +257,13 @@ if [ -f "$fs_ndb/$pidfile" ] ; then attempt=`expr $attempt + 1` done if [ "$kill_pids2" != "" ] ; then - do_command="kill -9 $kill_pids2" - echo "Failed to shutdown ndbcluster, executing "$do_command - $do_command + echo "Failed to shutdown ndbcluster, executing kill "$kill_pids2 + kill -9 -- $kill_pids2 2> /dev/null + /bin/kill -9 -- $kill_pids2 2> /dev/null + /usr/bin/kill -9 -- $kill_pids2 2> /dev/null + kill -9 $kill_pids2 2> /dev/null + /bin/kill -9 $kill_pids2 2> /dev/null + /usr/bin/kill -9 $kill_pids2 2> /dev/null fi rm "$fs_ndb/$pidfile" fi From 1fc515c8cdc570b437a7bf4055511117aa11492a Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 4 Nov 2004 21:25:50 +0500 Subject: [PATCH 09/28] autocommit From 60d8ff97a8784daf443652655c7b1442eae04c17 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 4 Nov 2004 21:25:51 +0500 Subject: [PATCH 10/28] autocommit and changed name mysql_test_run_new client/mysqltest.c: autocommit mysql-test/Makefile.am: changed mysql_test_run to mysql_test_run_new --- client/mysqltest.c | 5 +- mysql-test/Makefile.am | 4 +- mysql-test/init_db.sql | 26 + mysql-test/mysql_test_run_new.c | 1728 +++++++++++++++++++++++++++++++ 4 files changed, 1760 insertions(+), 3 deletions(-) create mode 100644 mysql-test/init_db.sql create mode 100644 mysql-test/mysql_test_run_new.c diff --git a/client/mysqltest.c b/client/mysqltest.c index a635b5bdd11..df80fc7bb66 100644 --- a/client/mysqltest.c +++ b/client/mysqltest.c @@ -949,8 +949,11 @@ static void do_exec(struct st_query* q) while (fgets(buf, sizeof(buf), res_file)) replace_dynstr_append_mem(ds, buf, strlen(buf)); } - +#ifndef __WIN__ error= pclose(res_file); +#else + error= _pclose(res_file); +#endif if (error != 0) die("command \"%s\" failed", cmd); diff --git a/mysql-test/Makefile.am b/mysql-test/Makefile.am index 906ff4b72bf..4e8601f1b88 100644 --- a/mysql-test/Makefile.am +++ b/mysql-test/Makefile.am @@ -37,8 +37,8 @@ test_DATA = std_data/client-key.pem std_data/client-cert.pem std_data/cacert.pem CLEANFILES = $(test_SCRIPTS) $(test_DATA) INCLUDES = -I$(srcdir)/../include -I../include -I.. -bin_PROGRAMS = mysql_test_run -mysql_test_run_SOURCES= mysql_test_run.c my_manage.c +bin_PROGRAMS = mysql_test_run_new +mysql_test_run_new_SOURCES= mysql_test_run_new.c my_manage.c dist-hook: diff --git a/mysql-test/init_db.sql b/mysql-test/init_db.sql new file mode 100644 index 00000000000..4613e5c0274 --- /dev/null +++ b/mysql-test/init_db.sql @@ -0,0 +1,26 @@ +CREATE DATABASE mysql; +CREATE DATABASE test; + +USE mysql; + +CREATE TABLE db (Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Select_priv enum('N','Y') DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL, References_priv enum('N','Y') DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL, PRIMARY KEY Host (Host,Db,User), KEY User (User)) comment='Database privileges'; + +INSERT INTO db VALUES ('%','test','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y'); +INSERT INTO db VALUES ('%','test\_%','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y'); + +CREATE TABLE host (Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, Select_priv enum('N','Y') DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL, References_priv enum('N','Y') DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL, PRIMARY KEY Host (Host,Db)) comment='Host privileges; Merged with database privileges'; + +CREATE TABLE user (Host char(60) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Password char(45) binary DEFAULT '' NOT NULL, Select_priv enum('N','Y') DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL, Reload_priv enum('N','Y') DEFAULT 'N' NOT NULL, Shutdown_priv enum('N','Y') DEFAULT 'N' NOT NULL, Process_priv enum('N','Y') DEFAULT 'N' NOT NULL, File_priv enum('N','Y') DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL, References_priv enum('N','Y') DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL, Show_db_priv enum('N','Y') DEFAULT 'N' NOT NULL, Super_priv enum('N','Y') DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL, Execute_priv enum('N','Y') DEFAULT 'N' NOT NULL, Repl_slave_priv enum('N','Y') DEFAULT 'N' NOT NULL, Repl_client_priv enum('N','Y') DEFAULT 'N' NOT NULL, ssl_type enum('','ANY','X509', 'SPECIFIED') DEFAULT '' NOT NULL, ssl_cipher BLOB NOT NULL, x509_issuer BLOB NOT NULL, x509_subject BLOB NOT NULL, max_questions int(11) unsigned DEFAULT 0 NOT NULL, max_updates int(11) unsigned DEFAULT 0 NOT NULL, max_connections int(11) unsigned DEFAULT 0 NOT NULL, PRIMARY KEY Host (Host,User)) comment='Users and global privileges'; + +INSERT INTO user VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0); +INSERT INTO user VALUES ('','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0); + +INSERT INTO user (host,user) values ('localhost',''); +INSERT INTO user (host,user) values ('',''); + +CREATE TABLE func (name char(64) binary DEFAULT '' NOT NULL, ret tinyint(1) DEFAULT '0' NOT NULL, dl char(128) DEFAULT '' NOT NULL, type enum ('function','aggregate') NOT NULL, PRIMARY KEY (name)) comment='User defined functions'; + +CREATE TABLE tables_priv (Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Table_name char(60) binary DEFAULT '' NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Timestamp timestamp(14), Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter') DEFAULT '' NOT NULL, Column_priv set('Select','Insert','Update','References') DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name), KEY Grantor (Grantor)) comment='Table privileges'; + +CREATE TABLE columns_priv (Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Table_name char(64) binary DEFAULT '' NOT NULL, Column_name char(64) binary DEFAULT '' NOT NULL, Timestamp timestamp(14), Column_priv set('Select','Insert','Update','References') DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name,Column_name)) comment='Column privileges'; + diff --git a/mysql-test/mysql_test_run_new.c b/mysql-test/mysql_test_run_new.c new file mode 100644 index 00000000000..6f388fc4a45 --- /dev/null +++ b/mysql-test/mysql_test_run_new.c @@ -0,0 +1,1728 @@ +/* + Copyright (c) 2002, 2003 Novell, Inc. All Rights Reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#include +#include +#include +#ifndef __WIN__ +#include +#endif +#include +#ifdef __NETWARE__ +#include +#include +#endif +#include +#include +#ifndef __WIN__ +#include +#endif +#include +#ifdef __NETWARE__ +#include +#endif +#ifdef __WIN__ +#include +#include +#endif + +#include "my_manage.h" + +/****************************************************************************** + + macros + +******************************************************************************/ + +#define HEADER "TEST RESULT \n" +#define DASH "-------------------------------------------------------\n" + +#define NW_TEST_SUFFIX ".nw-test" +#define NW_RESULT_SUFFIX ".nw-result" +#define TEST_SUFFIX ".test" +#define RESULT_SUFFIX ".result" +#define REJECT_SUFFIX ".reject" +#define OUT_SUFFIX ".out" +#define ERR_SUFFIX ".err" + +const char *TEST_PASS = "[ pass ]"; +const char *TEST_SKIP = "[ skip ]"; +const char *TEST_FAIL = "[ fail ]"; +const char *TEST_BAD = "[ bad ]"; +const char *TEST_IGNORE = "[ignore]"; + +/****************************************************************************** + + global variables + +******************************************************************************/ +#ifdef __NETWARE__ +static char base_dir[PATH_MAX] = "sys:/mysql"; +#else +static char base_dir[PATH_MAX] = ".."; +#endif +static char db[PATH_MAX] = "test"; +static char user[PATH_MAX] = "root"; +static char password[PATH_MAX] = ""; + +int master_port = 9306; +int slave_port = 9307; + +#if !defined(__NETWARE__) && !defined(__WIN__) +static char master_socket[PATH_MAX] = "./var/tmp/master.sock"; +static char slave_socket[PATH_MAX] = "./var/tmp/slave.sock"; +#endif + +// comma delimited list of tests to skip or empty string +#ifndef __WIN__ +static char skip_test[PATH_MAX] = " lowercase_table3 , system_mysql_db_fix "; +#else +/* + The most ignore testes contain the calls of system command +*/ +#define MAX_COUNT_TESTES 1024 +/* + lowercase_table3 is disabled by Gerg + system_mysql_db_fix is disabled by Gerg + sp contains a command system + rpl_EE_error contains a command system + rpl_loaddatalocal contains a command system + ndb_autodiscover contains a command system + rpl_rotate_logs contains a command system + repair contains a command system + rpl_trunc_binlog contains a command system + mysqldump contains a command system + rpl000001 makes non-exit loop...temporary skiped +*/ +static char skip_test[PATH_MAX] = " lowercase_table3 , system_mysql_db_fix , sp , rpl_EE_error , rpl_loaddatalocal , ndb_autodiscover , rpl_rotate_logs , repair , rpl_trunc_binlog , mysqldump , rpl000001 "; +#endif +static char ignore_test[PATH_MAX] = ""; + +static char bin_dir[PATH_MAX]; +static char mysql_test_dir[PATH_MAX]; +static char test_dir[PATH_MAX]; +static char mysql_tmp_dir[PATH_MAX]; +static char result_dir[PATH_MAX]; +static char master_dir[PATH_MAX]; +static char slave_dir[PATH_MAX]; +static char lang_dir[PATH_MAX]; +static char char_dir[PATH_MAX]; + +static char mysqladmin_file[PATH_MAX]; +static char mysqld_file[PATH_MAX]; +static char mysqltest_file[PATH_MAX]; +#ifndef __WIN__ +static char master_pid[PATH_MAX]; +static char slave_pid[PATH_MAX]; +static char sh_file[PATH_MAX] = "/bin/sh"; +#else +static HANDLE master_pid; +static HANDLE slave_pid; +#endif + +static char master_opt[PATH_MAX] = ""; +static char slave_opt[PATH_MAX] = ""; + +static char slave_master_info[PATH_MAX] = ""; + +static char master_init_script[PATH_MAX] = ""; +static char slave_init_script[PATH_MAX] = ""; + +// OpenSSL +static char ca_cert[PATH_MAX]; +static char server_cert[PATH_MAX]; +static char server_key[PATH_MAX]; +static char client_cert[PATH_MAX]; +static char client_key[PATH_MAX]; + +int total_skip = 0; +int total_pass = 0; +int total_fail = 0; +int total_test = 0; + +int total_ignore = 0; + +int use_openssl = FALSE; +int master_running = FALSE; +int slave_running = FALSE; +int skip_slave = TRUE; +int single_test = TRUE; + +int restarts = 0; + +FILE *log_fd = NULL; + +/****************************************************************************** + + functions + +******************************************************************************/ + +/****************************************************************************** + + prototypes + +******************************************************************************/ + +void report_stats(); +void install_db(char *); +void mysql_install_db(); +void start_master(); +void start_slave(); +void mysql_start(); +void stop_slave(); +void stop_master(); +void mysql_stop(); +void mysql_restart(); +int read_option(char *, char *); +void run_test(char *); +void setup(char *); +void vlog(const char *, va_list); +void mlog(const char *, ...); +void log_info(const char *, ...); +void log_error(const char *, ...); +void log_errno(const char *, ...); +void die(const char *); +char *str_tok(char *string, const char *delim); +#ifndef __WIN__ +void run_init_script(const char *script_name); +#endif +/****************************************************************************** + + report_stats() + + Report the gathered statistics. + +******************************************************************************/ +void report_stats() +{ + if (total_fail == 0) + { + mlog("\nAll %d test(s) were successful.\n", total_test); + } + else + { + double percent = ((double)total_pass / total_test) * 100; + + mlog("\nFailed %u/%u test(s), %.02f%% successful.\n", + total_fail, total_test, percent); + mlog("\nThe .out and .err files in %s may give you some\n", result_dir); + mlog("hint of what when wrong.\n"); + mlog("\nIf you want to report this error, please first read the documentation\n"); + mlog("at: http://www.mysql.com/doc/M/y/MySQL_test_suite.html\n"); + } +} + +/****************************************************************************** + + install_db() + + Install the a database. + +******************************************************************************/ +void install_db(char *datadir) +{ + arg_list_t al; + int err; + char input[PATH_MAX]; + char output[PATH_MAX]; + char error[PATH_MAX]; + + // input file +#ifdef __NETWARE__ + snprintf(input, PATH_MAX, "%s/bin/init_db.sql", base_dir); +#else + snprintf(input, PATH_MAX, "%s/mysql-test/init_db.sql", base_dir); +#endif + snprintf(output, PATH_MAX, "%s/install.out", datadir); + snprintf(error, PATH_MAX, "%s/install.err", datadir); + + // args + init_args(&al); + add_arg(&al, mysqld_file); + add_arg(&al, "--no-defaults"); + add_arg(&al, "--bootstrap"); + add_arg(&al, "--skip-grant-tables"); + add_arg(&al, "--basedir=%s", base_dir); + add_arg(&al, "--datadir=%s", datadir); + add_arg(&al, "--skip-innodb"); + add_arg(&al, "--skip-bdb"); +#ifndef __NETWARE__ + add_arg(&al, "--character-sets-dir=%s", char_dir); + add_arg(&al, "--language=%s", lang_dir); +#endif + + // spawn + if ((err = spawn(mysqld_file, &al, TRUE, input, output, error, NULL)) != 0) + { + die("Unable to create database."); + } + + // free args + free_args(&al); +} + +/****************************************************************************** + + mysql_install_db() + + Install the test databases. + +******************************************************************************/ +void mysql_install_db() +{ + char temp[PATH_MAX]; + + // var directory + snprintf(temp, PATH_MAX, "%s/var", mysql_test_dir); + + // clean up old direcotry + del_tree(temp); + + // create var directory +#ifndef __WIN__ + mkdir(temp, S_IRWXU); + // create subdirectories + mlog("Creating test-suite folders...\n"); + snprintf(temp, PATH_MAX, "%s/var/run", mysql_test_dir); + mkdir(temp, S_IRWXU); + snprintf(temp, PATH_MAX, "%s/var/tmp", mysql_test_dir); + mkdir(temp, S_IRWXU); + snprintf(temp, PATH_MAX, "%s/var/master-data", mysql_test_dir); + mkdir(temp, S_IRWXU); + snprintf(temp, PATH_MAX, "%s/var/master-data/mysql", mysql_test_dir); + mkdir(temp, S_IRWXU); + snprintf(temp, PATH_MAX, "%s/var/master-data/test", mysql_test_dir); + mkdir(temp, S_IRWXU); + snprintf(temp, PATH_MAX, "%s/var/slave-data", mysql_test_dir); + mkdir(temp, S_IRWXU); + snprintf(temp, PATH_MAX, "%s/var/slave-data/mysql", mysql_test_dir); + mkdir(temp, S_IRWXU); + snprintf(temp, PATH_MAX, "%s/var/slave-data/test", mysql_test_dir); + mkdir(temp, S_IRWXU); +#else + mkdir(temp); + // create subdirectories + mlog("Creating test-suite folders...\n"); + snprintf(temp, PATH_MAX, "%s/var/run", mysql_test_dir); + mkdir(temp); + snprintf(temp, PATH_MAX, "%s/var/tmp", mysql_test_dir); + mkdir(temp); + snprintf(temp, PATH_MAX, "%s/var/master-data", mysql_test_dir); + mkdir(temp); + snprintf(temp, PATH_MAX, "%s/var/master-data/mysql", mysql_test_dir); + mkdir(temp); + snprintf(temp, PATH_MAX, "%s/var/master-data/test", mysql_test_dir); + mkdir(temp); + snprintf(temp, PATH_MAX, "%s/var/slave-data", mysql_test_dir); + mkdir(temp); + snprintf(temp, PATH_MAX, "%s/var/slave-data/mysql", mysql_test_dir); + mkdir(temp); + snprintf(temp, PATH_MAX, "%s/var/slave-data/test", mysql_test_dir); + mkdir(temp); +#endif + + // install databases + mlog("Creating test databases for master... \n"); + install_db(master_dir); + mlog("Creating test databases for slave... \n"); + install_db(slave_dir); +} + +/****************************************************************************** + + start_master() + + Start the master server. + +******************************************************************************/ +void start_master() +{ + arg_list_t al; + int err; + char master_out[PATH_MAX]; + char master_err[PATH_MAX]; +// char temp[PATH_MAX]; + char temp2[PATH_MAX]; + + // remove old berkeley db log files that can confuse the server + removef("%s/log.*", master_dir); + + // remove stale binary logs + removef("%s/var/log/*-bin.*", mysql_test_dir); + + // remove stale binary logs + removef("%s/var/log/*.index", mysql_test_dir); + + // remove master.info file + removef("%s/master.info", master_dir); + + // remove relay files + removef("%s/var/log/*relay*", mysql_test_dir); + + // remove relay-log.info file + removef("%s/relay-log.info", master_dir); + + // init script + if (master_init_script[0] != 0) + { +#ifdef __NETWARE__ + // TODO: use the scripts + if (strinstr(master_init_script, "repair_part2-master.sh") != 0) + { + FILE *fp; + + // create an empty index file + snprintf(temp, PATH_MAX, "%s/test/t1.MYI", master_dir); + fp = fopen(temp, "wb+"); + + fputs("1", fp); + + fclose(fp); + } +#elif !defined(__WIN__) + run_init_script(master_init_script); +#endif + } + + // redirection files + snprintf(master_out, PATH_MAX, "%s/var/run/master%u.out", + mysql_test_dir, restarts); + snprintf(master_err, PATH_MAX, "%s/var/run/master%u.err", + mysql_test_dir, restarts); +#ifndef __WIN__ + snprintf(temp2,PATH_MAX,"%s/var",mysql_test_dir); + mkdir(temp2,S_IRWXU); + snprintf(temp2,PATH_MAX,"%s/var/log",mysql_test_dir); + mkdir(temp2,S_IRWXU); +#else + snprintf(temp2,PATH_MAX,"%s/var",mysql_test_dir); + mkdir(temp2); + snprintf(temp2,PATH_MAX,"%s/var/log",mysql_test_dir); + mkdir(temp2); +#endif + // args + init_args(&al); + add_arg(&al, "%s", mysqld_file); + add_arg(&al, "--no-defaults"); + add_arg(&al, "--log-bin=%s/var/log/master-bin",mysql_test_dir); + add_arg(&al, "--server-id=1"); + add_arg(&al, "--basedir=%s", base_dir); + add_arg(&al, "--port=%u", master_port); +#if !defined(__NETWARE__) && !defined(__WIN__) + add_arg(&al, "--socket=%s",master_socket); +#endif + add_arg(&al, "--local-infile"); + add_arg(&al, "--core"); + add_arg(&al, "--datadir=%s", master_dir); +#ifndef __WIN__ + add_arg(&al, "--pid-file=%s", master_pid); +#endif + add_arg(&al, "--character-sets-dir=%s", char_dir); + add_arg(&al, "--tmpdir=%s", mysql_tmp_dir); + add_arg(&al, "--language=%s", lang_dir); +#ifdef DEBUG //only for debug builds + add_arg(&al, "--debug"); +#endif + + if (use_openssl) + { + add_arg(&al, "--ssl-ca=%s", ca_cert); + add_arg(&al, "--ssl-cert=%s", server_cert); + add_arg(&al, "--ssl-key=%s", server_key); + } + + // $MASTER_40_ARGS + add_arg(&al, "--rpl-recovery-rank=1"); + add_arg(&al, "--init-rpl-role=master"); + + // $SMALL_SERVER + add_arg(&al, "-O"); + add_arg(&al, "key_buffer_size=1M"); + add_arg(&al, "-O"); + add_arg(&al, "sort_buffer=256K"); + add_arg(&al, "-O"); + add_arg(&al, "max_heap_table_size=1M"); + + // $EXTRA_MASTER_OPT + if (master_opt[0] != 0) + { + char *p; + + p = (char *)str_tok(master_opt, " \t"); + if (!strstr(master_opt, "timezone")) + { + while (p) + { + add_arg(&al, "%s", p); + p = (char *)str_tok(NULL, " \t"); + } + } + } + + // remove the pid file if it exists +#ifndef __WIN__ + remove(master_pid); +#endif + + // spawn +#ifdef __WIN__ + if ((err= spawn(mysqld_file, &al, FALSE, NULL, master_out, master_err, &master_pid)) == 0) +#else + if ((err= spawn(mysqld_file, &al, FALSE, NULL, master_out, master_err, master_pid)) == 0) +#endif + { + sleep_until_file_exists(master_pid); + + if ((err = wait_for_server_start(bin_dir, mysqladmin_file, user, password, master_port, + mysql_tmp_dir)) == 0) + { + master_running = TRUE; + } + else + { + log_error("The master server went down early."); + } + } + else + { + log_error("Unable to start master server."); + } + + // free_args + free_args(&al); +} + +/****************************************************************************** + + start_slave() + + Start the slave server. + +******************************************************************************/ +void start_slave() +{ + arg_list_t al; + int err; + char slave_out[PATH_MAX]; + char slave_err[PATH_MAX]; + + // skip? + if (skip_slave) return; + + // remove stale binary logs + removef("%s/*-bin.*", slave_dir); + + // remove stale binary logs + removef("%s/*.index", slave_dir); + + // remove master.info file + removef("%s/master.info", slave_dir); + + // remove relay files + removef("%s/var/log/*relay*", mysql_test_dir); + + // remove relay-log.info file + removef("%s/relay-log.info", slave_dir); + + // init script + if (slave_init_script[0] != 0) + { +#ifdef __NETWARE__ + // TODO: use the scripts + if (strinstr(slave_init_script, "rpl000016-slave.sh") != 0) + { + // create empty master.info file + snprintf(temp, PATH_MAX, "%s/master.info", slave_dir); + close(open(temp, O_WRONLY | O_CREAT,S_IRWXU|S_IRWXG|S_IRWXO)); + } + else if (strinstr(slave_init_script, "rpl000017-slave.sh") != 0) + { + FILE *fp; + + // create a master.info file + snprintf(temp, PATH_MAX, "%s/master.info", slave_dir); + fp = fopen(temp, "wb+"); + + fputs("master-bin.000001\n", fp); + fputs("4\n", fp); + fputs("127.0.0.1\n", fp); + fputs("replicate\n", fp); + fputs("aaaaaaaaaaaaaaab\n", fp); + fputs("9306\n", fp); + fputs("1\n", fp); + fputs("0\n", fp); + + fclose(fp); + } + else if (strinstr(slave_init_script, "rpl_rotate_logs-slave.sh") != 0) + { + // create empty master.info file + snprintf(temp, PATH_MAX, "%s/master.info", slave_dir); + close(open(temp, O_WRONLY | O_CREAT,S_IRWXU|S_IRWXG|S_IRWXO)); + } +#elif !defined(__WIN__) + run_init_script(slave_init_script); +#endif + } + + // redirection files + snprintf(slave_out, PATH_MAX, "%s/var/run/slave%u.out", + mysql_test_dir, restarts); + snprintf(slave_err, PATH_MAX, "%s/var/run/slave%u.err", + mysql_test_dir, restarts); + + // args + init_args(&al); + add_arg(&al, "%s", mysqld_file); + add_arg(&al, "--no-defaults"); + add_arg(&al, "--log-bin=slave-bin"); + add_arg(&al, "--relay_log=slave-relay-bin"); + add_arg(&al, "--basedir=%s", base_dir); + add_arg(&al, "--port=%u", slave_port); +#if !defined(__NETWARE__) && !defined(__WIN__) + add_arg(&al, "--socket=%s",slave_socket); +#endif + add_arg(&al, "--datadir=%s", slave_dir); +#ifndef __WIN__ + add_arg(&al, "--pid-file=%s", slave_pid); +#endif + add_arg(&al, "--character-sets-dir=%s", char_dir); + add_arg(&al, "--core"); + add_arg(&al, "--tmpdir=%s", mysql_tmp_dir); + add_arg(&al, "--language=%s", lang_dir); + + add_arg(&al, "--exit-info=256"); + add_arg(&al, "--log-slave-updates"); + add_arg(&al, "--init-rpl-role=slave"); + add_arg(&al, "--skip-innodb"); + add_arg(&al, "--skip-slave-start"); + add_arg(&al, "--slave-load-tmpdir=../../var/tmp"); + + add_arg(&al, "--report-user=%s", user); + add_arg(&al, "--report-host=127.0.0.1"); + add_arg(&al, "--report-port=%u", slave_port); + + add_arg(&al, "--master-retry-count=10"); + add_arg(&al, "-O"); + add_arg(&al, "slave_net_timeout=10"); +#ifdef DEBUG //only for debug builds + add_arg(&al, "--debug"); +#endif + + if (use_openssl) + { + add_arg(&al, "--ssl-ca=%s", ca_cert); + add_arg(&al, "--ssl-cert=%s", server_cert); + add_arg(&al, "--ssl-key=%s", server_key); + } + + // slave master info + if (slave_master_info[0] != 0) + { + char *p; + + p = (char *)str_tok(slave_master_info, " \t"); + + while(p) + { + add_arg(&al, "%s", p); + + p = (char *)str_tok(NULL, " \t"); + } + } + else + { + add_arg(&al, "--master-user=%s", user); + add_arg(&al, "--master-password=%s", password); + add_arg(&al, "--master-host=127.0.0.1"); + add_arg(&al, "--master-port=%u", master_port); + add_arg(&al, "--master-connect-retry=1"); + add_arg(&al, "--server-id=2"); + add_arg(&al, "--rpl-recovery-rank=2"); + } + + // small server + add_arg(&al, "-O"); + add_arg(&al, "key_buffer_size=1M"); + add_arg(&al, "-O"); + add_arg(&al, "sort_buffer=256K"); + add_arg(&al, "-O"); + add_arg(&al, "max_heap_table_size=1M"); + + + // opt args + if (slave_opt[0] != 0) + { + char *p; + + p = (char *)str_tok(slave_opt, " \t"); + + while(p) + { + add_arg(&al, "%s", p); + + p = (char *)str_tok(NULL, " \t"); + } + } + + // remove the pid file if it exists +#ifndef __WIN__ + remove(slave_pid); +#endif + // spawn +#ifdef __WIN__ + if ((err = spawn(mysqld_file, &al, FALSE, NULL, slave_out, slave_err, &slave_pid)) == 0) +#else + if ((err = spawn(mysqld_file, &al, FALSE, NULL, slave_out, slave_err, slave_pid)) == 0) +#endif + { + sleep_until_file_exists(slave_pid); + + if ((err = wait_for_server_start(bin_dir, mysqladmin_file, user, password, slave_port, + mysql_tmp_dir)) == 0) + { + slave_running = TRUE; + } + else + { + log_error("The slave server went down early."); + } + } + else + { + log_error("Unable to start slave server."); + } + + // free args + free_args(&al); +} + +/****************************************************************************** + + mysql_start() + + Start the mysql servers. + +******************************************************************************/ +void mysql_start() +{ +// log_info("Starting the MySQL server(s): %u", ++restarts); + start_master(); + + start_slave(); + + // activate the test screen +#ifdef __NETWARE__ + ActivateScreen(getscreenhandle()); +#endif +} + +/****************************************************************************** + + stop_slave() + + Stop the slave server. + +******************************************************************************/ +void stop_slave() +{ + int err; + + // running? + if (!slave_running) return; + + // stop + if ((err = stop_server(bin_dir, mysqladmin_file, user, password, slave_port, slave_pid, + mysql_tmp_dir)) == 0) + { + slave_running = FALSE; + } + else + { + log_error("Unable to stop slave server."); + } +} + +/****************************************************************************** + + stop_master() + + Stop the master server. + +******************************************************************************/ +void stop_master() +{ + int err; + + // running? + if (!master_running) return; + + if ((err = stop_server(bin_dir, mysqladmin_file, user, password, master_port, master_pid, + mysql_tmp_dir)) == 0) + { + master_running = FALSE; + } + else + { + log_error("Unable to stop master server."); + } +} + +/****************************************************************************** + + mysql_stop() + + Stop the mysql servers. + +******************************************************************************/ +void mysql_stop() +{ + + stop_master(); + + stop_slave(); + + // activate the test screen +#ifdef __NETWARE__ + ActivateScreen(getscreenhandle()); +#endif +} + +/****************************************************************************** + + mysql_restart() + + Restart the mysql servers. + +******************************************************************************/ +void mysql_restart() +{ +// log_info("Restarting the MySQL server(s): %u", ++restarts); + + mysql_stop(); + + mlog(DASH); + + mysql_start(); +} + +/****************************************************************************** + + read_option() + + Read the option file. + +******************************************************************************/ +int read_option(char *opt_file, char *opt) +{ + int fd, err; + char *p; + char buf[PATH_MAX]; + + // copy current option + strncpy(buf, opt, PATH_MAX); + + // open options file + fd = open(opt_file, O_RDONLY); + + err = read(fd, opt, PATH_MAX); + + close(fd); + + if (err > 0) + { + // terminate string + if ((p = strchr(opt, '\n')) != NULL) + { + *p = 0; + + // check for a '\r' + if ((p = strchr(opt, '\r')) != NULL) + { + *p = 0; + } + } + else + { + opt[err] = 0; + } + + // check for $MYSQL_TEST_DIR + if ((p = strstr(opt, "$MYSQL_TEST_DIR")) != NULL) + { + char temp[PATH_MAX]; + + *p = 0; + + strcpy(temp, p + strlen("$MYSQL_TEST_DIR")); + + strcat(opt, mysql_test_dir); + + strcat(opt, temp); + } + // Check for double backslash and replace it with single bakslash + if ((p = strstr(opt, "\\\\")) != NULL) + { + /* bmove is guranteed to work byte by byte */ + bmove(p, p+1, strlen(p+1)); + } + } + else + { + // clear option + *opt = 0; + } + + // compare current option with previous + return strcmp(opt, buf); +} + +/****************************************************************************** + + run_test() + + Run the given test case. + +******************************************************************************/ +void run_test(char *test) +{ + char temp[PATH_MAX]; + const char *rstr; + int skip = FALSE, ignore=FALSE; + int restart = FALSE; + int flag = FALSE; + struct stat info; + + // skip tests in the skip list + snprintf(temp, PATH_MAX, " %s ", test); + skip = (strinstr(skip_test, temp) != 0); + if (skip == FALSE) + ignore = (strinstr(ignore_test, temp) != 0); + + snprintf(master_init_script, PATH_MAX, "%s/%s-master.sh", test_dir, test); + snprintf(slave_init_script, PATH_MAX, "%s/%s-slave.sh", test_dir, test); +#ifdef __WIN__ + if (! stat(master_init_script, &info)) + skip = TRUE; + if (!stat(slave_init_script, &info)) + skip = TRUE; +#endif + if (ignore) + { + // show test + mlog("%-46s ", test); + + // ignore + rstr = TEST_IGNORE; + ++total_ignore; + } + else if (!skip) // skip test? + { + char test_file[PATH_MAX]; + char master_opt_file[PATH_MAX]; + char slave_opt_file[PATH_MAX]; + char slave_master_info_file[PATH_MAX]; + char result_file[PATH_MAX]; + char reject_file[PATH_MAX]; + char out_file[PATH_MAX]; + char err_file[PATH_MAX]; + int err; + arg_list_t al; +#ifdef __WIN__ + /* + Clean test database + */ + removef("%s/test/*.*", master_dir); + removef("%s/test/*.*", slave_dir); + removef("%s/mysqltest/*.*", master_dir); + removef("%s/mysqltest/*.*", slave_dir); + +#endif + // skip slave? + flag = skip_slave; + skip_slave = (strncmp(test, "rpl", 3) != 0); + if (flag != skip_slave) restart = TRUE; + + // create files + snprintf(master_opt_file, PATH_MAX, "%s/%s-master.opt", test_dir, test); + snprintf(slave_opt_file, PATH_MAX, "%s/%s-slave.opt", test_dir, test); + snprintf(slave_master_info_file, PATH_MAX, "%s/%s.slave-mi", test_dir, test); + snprintf(reject_file, PATH_MAX, "%s/%s%s", result_dir, test, REJECT_SUFFIX); + snprintf(out_file, PATH_MAX, "%s/%s%s", result_dir, test, OUT_SUFFIX); + snprintf(err_file, PATH_MAX, "%s/%s%s", result_dir, test, ERR_SUFFIX); + + // netware specific files + snprintf(test_file, PATH_MAX, "%s/%s%s", test_dir, test, NW_TEST_SUFFIX); + if (stat(test_file, &info)) + { + snprintf(test_file, PATH_MAX, "%s/%s%s", test_dir, test, TEST_SUFFIX); + if (access(test_file,0)) + { + printf("Invalid test name %s, %s file not found\n",test,test_file); + return; + } + } + + snprintf(result_file, PATH_MAX, "%s/%s%s", result_dir, test, NW_RESULT_SUFFIX); + if (stat(result_file, &info)) + { + snprintf(result_file, PATH_MAX, "%s/%s%s", result_dir, test, RESULT_SUFFIX); + } + + // init scripts + if (stat(master_init_script, &info)) + master_init_script[0] = 0; + else + restart = TRUE; + + if (stat(slave_init_script, &info)) + slave_init_script[0] = 0; + else + restart = TRUE; + + // read options + if (read_option(master_opt_file, master_opt)) restart = TRUE; + if (read_option(slave_opt_file, slave_opt)) restart = TRUE; + if (read_option(slave_master_info_file, slave_master_info)) restart = TRUE; + + // cleanup previous run + remove(reject_file); + remove(out_file); + remove(err_file); + + // start or restart? + if (!master_running) mysql_start(); + else if (restart) mysql_restart(); + + // let the system stabalize + sleep(1); + + // show test + mlog("%-46s ", test); + + + // args + init_args(&al); + add_arg(&al, "%s", mysqltest_file); + add_arg(&al, "--no-defaults"); + add_arg(&al, "--port=%u", master_port); +#if !defined(__NETWARE__) && !defined(__WIN__) + add_arg(&al, "--socket=%s", master_socket); + add_arg(&al, "--tmpdir=%s", mysql_tmp_dir); +#endif + add_arg(&al, "--database=%s", db); + add_arg(&al, "--user=%s", user); + add_arg(&al, "--password=%s", password); + add_arg(&al, "--silent"); + add_arg(&al, "--basedir=%s/", mysql_test_dir); + add_arg(&al, "--host=127.0.0.1"); + add_arg(&al, "-v"); + add_arg(&al, "-R"); + add_arg(&al, "%s", result_file); + + if (use_openssl) + { + add_arg(&al, "--ssl-ca=%s", ca_cert); + add_arg(&al, "--ssl-cert=%s", client_cert); + add_arg(&al, "--ssl-key=%s", client_key); + } + + // spawn + err = spawn(mysqltest_file, &al, TRUE, test_file, out_file, err_file, NULL); + + // free args + free_args(&al); + + remove_empty_file(out_file); + remove_empty_file(err_file); + + if (err == 0) + { + // pass + rstr = TEST_PASS; + ++total_pass; + + // increment total + ++total_test; + } + else if (err == 2) + { + // skip + rstr = TEST_SKIP; + ++total_skip; + } + else if (err == 1) + { + // fail + rstr = TEST_FAIL; + ++total_fail; + + // increment total + ++total_test; + } + else + { + rstr = TEST_BAD; + } + } + else // early skips + { + // show test + mlog("%-46s ", test); + + // skip + rstr = TEST_SKIP; + ++total_skip; + } + + // result + mlog("%-14s\n", rstr); +} + +/****************************************************************************** + + vlog() + + Log the message. + +******************************************************************************/ +void vlog(const char *format, va_list ap) +{ + vfprintf(stdout, format, ap); + fflush(stdout); + + if (log_fd) + { + vfprintf(log_fd, format, ap); + fflush(log_fd); + } +} + +/****************************************************************************** + + log() + + Log the message. + +******************************************************************************/ +void mlog(const char *format, ...) +{ + va_list ap; + + va_start(ap, format); + + vlog(format, ap); + + va_end(ap); +} + +/****************************************************************************** + + log_info() + + Log the given information. + +******************************************************************************/ +void log_info(const char *format, ...) +{ + va_list ap; + + va_start(ap, format); + + mlog("-- INFO : "); + vlog(format, ap); + mlog("\n"); + + va_end(ap); +} + +/****************************************************************************** + + log_error() + + Log the given error. + +******************************************************************************/ +void log_error(const char *format, ...) +{ + va_list ap; + + va_start(ap, format); + + mlog("-- ERROR: "); + vlog(format, ap); + mlog("\n"); + + va_end(ap); +} + +/****************************************************************************** + + log_errno() + + Log the given error and errno. + +******************************************************************************/ +void log_errno(const char *format, ...) +{ + va_list ap; + + va_start(ap, format); + + mlog("-- ERROR: (%003u) ", errno); + vlog(format, ap); + mlog("\n"); + + va_end(ap); +} + +/****************************************************************************** + + die() + + Exit the application. + +******************************************************************************/ +void die(const char *msg) +{ + log_error(msg); +#ifdef __NETWARE__ + pressanykey(); +#endif + exit(-1); +} + +/****************************************************************************** + + setup() + + Setup the mysql test enviornment. + +******************************************************************************/ +void setup(char *file) +{ + char temp[PATH_MAX]; + char file_path[PATH_MAX*2]; + char *p; + int position; + + // set the timezone for the timestamp test +#ifdef __WIN__ + _putenv( "TZ=GMT-3" ); +#else + setenv("TZ", "GMT-3", TRUE); +#endif + // find base dir +#ifdef __NETWARE__ + strcpy(temp, strlwr(file)); + while((p = strchr(temp, '\\')) != NULL) *p = '/'; +#else + getcwd(temp, PATH_MAX); + position = strlen(temp); + temp[position] = '/'; + temp[position+1] = 0; +#ifdef __WIN__ + while((p = strchr(temp, '\\')) != NULL) *p = '/'; +#endif +#endif + + if ((position = strinstr(temp, "/mysql-test/")) != 0) + { + p = temp + position - 1; + *p = 0; + strcpy(base_dir, temp); + } + + log_info("Currect directory: %s",base_dir); + +#ifdef __NETWARE__ + // setup paths + snprintf(bin_dir, PATH_MAX, "%s/bin", base_dir); + snprintf(mysql_test_dir, PATH_MAX, "%s/mysql-test", base_dir); + snprintf(test_dir, PATH_MAX, "%s/t", mysql_test_dir); + snprintf(mysql_tmp_dir, PATH_MAX, "%s/var/tmp", mysql_test_dir); + snprintf(result_dir, PATH_MAX, "%s/r", mysql_test_dir); + snprintf(master_dir, PATH_MAX, "%s/var/master-data", mysql_test_dir); + snprintf(slave_dir, PATH_MAX, "%s/var/slave-data", mysql_test_dir); + snprintf(lang_dir, PATH_MAX, "%s/share/english", base_dir); + snprintf(char_dir, PATH_MAX, "%s/share/charsets", base_dir); + +#ifdef HAVE_OPENSSL + use_openssl = TRUE; +#endif // HAVE_OPENSSL + + // OpenSSL paths + snprintf(ca_cert, PATH_MAX, "%s/SSL/cacert.pem", base_dir); + snprintf(server_cert, PATH_MAX, "%s/SSL/server-cert.pem", base_dir); + snprintf(server_key, PATH_MAX, "%s/SSL/server-key.pem", base_dir); + snprintf(client_cert, PATH_MAX, "%s/SSL/client-cert.pem", base_dir); + snprintf(client_key, PATH_MAX, "%s/SSL/client-key.pem", base_dir); + + // setup files + snprintf(mysqld_file, PATH_MAX, "%s/mysqld", bin_dir); + snprintf(mysqltest_file, PATH_MAX, "%s/mysqltest", bin_dir); + snprintf(mysqladmin_file, PATH_MAX, "%s/mysqladmin", bin_dir); + snprintf(master_pid, PATH_MAX, "%s/var/run/master.pid", mysql_test_dir); + snprintf(slave_pid, PATH_MAX, "%s/var/run/slave.pid", mysql_test_dir); +#elif __WIN__ + // setup paths +#ifdef _DEBUG + snprintf(bin_dir, PATH_MAX, "%s/client_debug", base_dir); +#else + snprintf(bin_dir, PATH_MAX, "%s/client_release", base_dir); +#endif + snprintf(mysql_test_dir, PATH_MAX, "%s/mysql-test", base_dir); + snprintf(test_dir, PATH_MAX, "%s/t", mysql_test_dir); + snprintf(mysql_tmp_dir, PATH_MAX, "%s/var/tmp", mysql_test_dir); + snprintf(result_dir, PATH_MAX, "%s/r", mysql_test_dir); + snprintf(master_dir, PATH_MAX, "%s/var/master-data", mysql_test_dir); + snprintf(slave_dir, PATH_MAX, "%s/var/slave-data", mysql_test_dir); + snprintf(lang_dir, PATH_MAX, "%s/share/english", base_dir); + snprintf(char_dir, PATH_MAX, "%s/share/charsets", base_dir); + +#ifdef HAVE_OPENSSL + use_openssl = TRUE; +#endif // HAVE_OPENSSL + + // OpenSSL paths + snprintf(ca_cert, PATH_MAX, "%s/SSL/cacert.pem", base_dir); + snprintf(server_cert, PATH_MAX, "%s/SSL/server-cert.pem", base_dir); + snprintf(server_key, PATH_MAX, "%s/SSL/server-key.pem", base_dir); + snprintf(client_cert, PATH_MAX, "%s/SSL/client-cert.pem", base_dir); + snprintf(client_key, PATH_MAX, "%s/SSL/client-key.pem", base_dir); + + // setup files + snprintf(mysqld_file, PATH_MAX, "%s/mysqld.exe", bin_dir); + snprintf(mysqltest_file, PATH_MAX, "%s/mysqltest.exe", bin_dir); + snprintf(mysqladmin_file, PATH_MAX, "%s/mysqladmin.exe", bin_dir); +#else + // setup paths + snprintf(bin_dir, PATH_MAX, "%s/client", base_dir); + snprintf(mysql_test_dir, PATH_MAX, "%s/mysql-test", base_dir); + snprintf(test_dir, PATH_MAX, "%s/t", mysql_test_dir); + snprintf(mysql_tmp_dir, PATH_MAX, "%s/var/tmp", mysql_test_dir); + snprintf(result_dir, PATH_MAX, "%s/r", mysql_test_dir); + snprintf(master_dir, PATH_MAX, "%s/var/master-data", mysql_test_dir); + snprintf(slave_dir, PATH_MAX, "%s/var/slave-data", mysql_test_dir); + snprintf(lang_dir, PATH_MAX, "%s/sql/share/english", base_dir); + snprintf(char_dir, PATH_MAX, "%s/sql/share/charsets", base_dir); + +#ifdef HAVE_OPENSSL + use_openssl = TRUE; +#endif // HAVE_OPENSSL + + // OpenSSL paths + snprintf(ca_cert, PATH_MAX, "%s/SSL/cacert.pem", base_dir); + snprintf(server_cert, PATH_MAX, "%s/SSL/server-cert.pem", base_dir); + snprintf(server_key, PATH_MAX, "%s/SSL/server-key.pem", base_dir); + snprintf(client_cert, PATH_MAX, "%s/SSL/client-cert.pem", base_dir); + snprintf(client_key, PATH_MAX, "%s/SSL/client-key.pem", base_dir); + + // setup files + snprintf(mysqld_file, PATH_MAX, "%s/sql/mysqld", base_dir); + snprintf(mysqltest_file, PATH_MAX, "%s/mysqltest", bin_dir); + snprintf(mysqladmin_file, PATH_MAX, "%s/mysqladmin", bin_dir); + snprintf(master_pid, PATH_MAX, "%s/var/run/master.pid", mysql_test_dir); + snprintf(slave_pid, PATH_MAX, "%s/var/run/slave.pid", mysql_test_dir); + + snprintf(master_socket,PATH_MAX, "%s/var/tmp/master.sock", mysql_test_dir); + snprintf(slave_socket,PATH_MAX, "%s/var/tmp/slave.sock", mysql_test_dir); + +#endif + // create log file + snprintf(temp, PATH_MAX, "%s/mysql-test-run.log", mysql_test_dir); + if ((log_fd = fopen(temp, "w+")) == NULL) + { + log_errno("Unable to create log file."); + } + + // prepare skip test list + while((p = strchr(skip_test, ',')) != NULL) *p = ' '; + strcpy(temp, strlwr(skip_test)); + snprintf(skip_test, PATH_MAX, " %s ", temp); + + // environment +#ifdef __NETWARE__ + setenv("MYSQL_TEST_DIR", mysql_test_dir, 1); + snprintf(file_path, PATH_MAX*2, "%s/client/mysqldump --no-defaults -u root --port=%u", bin_dir, master_port); + setenv("MYSQL_DUMP", file_path, 1); + snprintf(file_path, PATH_MAX*2, "%s/client/mysqlbinlog --no-defaults --local-load=%s", bin_dir, mysql_tmp_dir); + setenv("MYSQL_BINLOG", file_path, 1); +#elif __WIN__ + snprintf(file_path,MAX_PATH,"MYSQL_TEST_DIR=%s",mysql_test_dir); + _putenv(file_path); + snprintf(file_path, PATH_MAX*2, "MYSQL_DUMP=%s/mysqldump.exe --no-defaults -u root --port=%u", bin_dir, master_port); + _putenv(file_path); + snprintf(file_path, PATH_MAX*2, "MYSQL_BINLOG=%s/mysqlbinlog.exe --no-defaults --local-load=%s", bin_dir, mysql_tmp_dir); + _putenv(file_path); +#else + setenv("MYSQL_TEST_DIR", mysql_test_dir, 1); + snprintf(file_path, PATH_MAX*2, "%s/mysqldump --no-defaults -u root --port=%u --socket=%s", bin_dir, master_port, master_socket); + setenv("MYSQL_DUMP", file_path, 1); + snprintf(file_path, PATH_MAX*2, "%s/mysqlbinlog --no-defaults --local-load=%s", bin_dir, mysql_tmp_dir); + setenv("MYSQL_BINLOG", file_path, 1); +#endif + +#ifndef __WIN__ + setenv("MASTER_MYPORT", "9306", 1); + setenv("SLAVE_MYPORT", "9307", 1); + setenv("MYSQL_TCP_PORT", "3306", 1); +#else + _putenv("MASTER_MYPORT=9306"); + _putenv("SLAVE_MYPORT=9307"); + _putenv("MYSQL_TCP_PORT=3306"); +#endif + +} + +/****************************************************************************** + + main() + +******************************************************************************/ +int main(int argc, char **argv) +{ + int is_ignore_list = 0; + // setup + setup(argv[0]); + + /* The --ignore option is comma saperated list of test cases to skip and + should be very first command line option to the test suite. + + The usage is now: + mysql_test_run --ignore=test1,test2 test3 test4 + where test1 and test2 are test cases to ignore + and test3 and test4 are test cases to run. + */ + if (argc >= 2 && !strnicmp(argv[1], "--ignore=", sizeof("--ignore=")-1)) + { + char *temp, *token; + temp= strdup(strchr(argv[1],'=') + 1); + for (token=str_tok(temp, ","); token != NULL; token=str_tok(NULL, ",")) + { + if (strlen(ignore_test) + strlen(token) + 2 <= PATH_MAX-1) + sprintf(ignore_test+strlen(ignore_test), " %s ", token); + else + { + free(temp); + die("ignore list too long."); + } + } + free(temp); + is_ignore_list = 1; + } + // header +#ifndef __WIN__ + mlog("MySQL Server %s, for %s (%s)\n\n", VERSION, SYSTEM_TYPE, MACHINE_TYPE); +#else + mlog("MySQL Server ---, for %s (%s)\n\n", SYSTEM_TYPE, MACHINE_TYPE); +#endif + + mlog("Initializing Tests...\n"); + + // install test databases + mysql_install_db(); + + mlog("Starting Tests...\n"); + + mlog("\n"); + mlog(HEADER); + mlog(DASH); + + if ( argc > 1 + is_ignore_list ) + { + int i; + + // single test + single_test = TRUE; + + for (i = 1 + is_ignore_list; i < argc; i++) + { + // run given test + run_test(argv[i]); + } + } + else + { + // run all tests +#ifndef __WIN__ + struct dirent **namelist; + int i,n; + char test[NAME_MAX]; + char *p; + int position; + + n = scandir(test_dir, &namelist, 0, alphasort); + if (n < 0) + die("Unable to open tests directory."); + else + { + for (i = 0; i < n; i++) + { + strcpy(test, strlwr(namelist[i]->d_name)); + // find the test suffix + if ((position = strinstr(test, TEST_SUFFIX)) != 0) + { + p = test + position - 1; + // null terminate at the suffix + *p = 0; + // run test + run_test(test); + } + free(namelist[n]); + } + free(namelist); + } +#else + struct _finddata_t dir; + intptr_t handle; + char test[NAME_MAX]; + char mask[PATH_MAX]; + char *p; + int position; + char **names = 0; + char **testes = 0; + int name_index; + int index; + + // single test + single_test = FALSE; + + snprintf(mask,MAX_PATH,"%s/*.test",test_dir); + + if ((handle=_findfirst(mask,&dir)) == -1L) + { + die("Unable to open tests directory."); + } + + names = malloc(MAX_COUNT_TESTES*4); + testes = names; + name_index = 0; + + do + { + if (!(dir.attrib & _A_SUBDIR)) + { + strcpy(test, strlwr(dir.name)); + + // find the test suffix + if ((position = strinstr(test, TEST_SUFFIX)) != 0) + { + p = test + position - 1; + // null terminate at the suffix + *p = 0; + + // insert test + *names = malloc(PATH_MAX); + strcpy(*names,test); + names++; + name_index++; + } + } + }while (_findnext(handle,&dir) == 0); + + _findclose(handle); + + qsort( (void *)testes, name_index, sizeof( char * ), compare ); + + for (index = 0; index <= name_index; index++) + { + run_test(testes[index]); + free(testes[index]); + } + + free(testes); +#endif + } + + // stop server + mysql_stop(); + + mlog(DASH); + mlog("\n"); + + mlog("Ending Tests...\n"); + + // report stats + report_stats(); + + // close log + if (log_fd) fclose(log_fd); + + // keep results up +#ifdef __NETWARE__ + pressanykey(); +#endif + return 0; +} + + +/* + Synopsis: + This function breaks the string into a sequence of tokens. The difference + between this function and strtok is that it respects the quoted string i.e. + it skips any delimiter character within the quoted part of the string. + It return tokens by eliminating quote character. It modifies the input string + passed. It will work with whitespace delimeter but may not work properly with + other delimeter. If the delimeter will contain any quote character, then + function will not tokenize and will return null string. + e.g. if input string is + --init-slave="set global max_connections=500" --skip-external-locking + then the output will two string i.e. + --init-slave=set global max_connections=500 + --skip-external-locking + +Arguments: + string: input string + delim: set of delimiter character +Output: + return the null terminated token of NULL. +*/ + + +char *str_tok(char *string, const char *delim) +{ + char *token; /* current token received from strtok */ + char *qt_token; /* token delimeted by the matching pair of quote */ + /* + if there are any quote chars found in the token then this variable + will hold the concatenated string to return to the caller + */ + char *ptr_token=NULL; + /* pointer to the quote character in the token from strtok */ + char *ptr_quote=NULL; + + /* See if the delimeter contains any quote character */ + if (strchr(delim,'\'') || strchr(delim,'\"')) + return NULL; + + /* repeate till we are getting some token from strtok */ + while ((token = (char*)strtok(string, delim) ) != NULL) + { + /* + make the input string NULL so that next time onward strtok can + be called with NULL input string. + */ + string = NULL; + /* + We don't need to remove any quote character for Windows version + */ +#ifndef __WIN__ + /* check if the current token contain double quote character*/ + if ((ptr_quote = (char*)strchr(token,'\"')) != NULL) + { + /* + get the matching the matching double quote in the remaining + input string + */ + qt_token = (char*)strtok(NULL,"\""); + } + /* check if the current token contain single quote character*/ + else if ((ptr_quote = (char*)strchr(token,'\'')) != NULL) + { + /* + get the matching the matching single quote in the remaining + input string + */ + qt_token = (char*)strtok(NULL,"\'"); + } +#endif + /* + if the current token does not contains any quote character then + return to the caller. + */ + if (ptr_quote == NULL) + { + /* + if there is any earlier token i.e. ptr_token then append the + current token in it and return it else return the current + token directly + */ + return ptr_token ? strcat(ptr_token,token) : token; + } + + /* + remove the quote character i.e. make NULL so that the token will + be devided in two part and later both part can be concatenated + and hence quote will be removed + */ + *ptr_quote= 0; + + /* check if ptr_token has been initialized or not */ + if (ptr_token == NULL) + { + /* initialize the ptr_token with current token */ + ptr_token= token; + /* copy entire string between matching pair of quote*/ + sprintf(ptr_token+strlen(ptr_token),"%s %s", ptr_quote+1, qt_token); + } + else + { + /* + copy the current token and entire string between matching pair + of quote + */ + if (qt_token == NULL) + { + sprintf(ptr_token+strlen(ptr_token),"%s%s", token, ptr_quote+1); + } + else + { + sprintf(ptr_token+strlen(ptr_token),"%s%s %s", token, ptr_quote+1, + qt_token ); + } + } + } + + /* return the concatenated token */ + return ptr_token; +} + +#ifndef __WIN__ + +/* + Synopsis: + This function run scripts files on Linux and Netware + +Arguments: + script_name: name of script file + +Output: + nothing +*/ +void run_init_script(const char *script_name) +{ + arg_list_t al; + int err; + + // args + init_args(&al); + add_arg(&al, sh_file); + add_arg(&al, script_name); + + // spawn + if ((err = spawn(sh_file, &al, TRUE, NULL, NULL, NULL, NULL)) != 0) + { + die("Unable to run script."); + } + + // free args + free_args(&al); +} +#endif From 7f3749c82ff55deb4f25626084b242ce6c2306e1 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 4 Nov 2004 21:26:36 +0300 Subject: [PATCH 11/28] Fix for Bug#6408 "configure checking for custom zlib fails because code check is wrong". acinclude.m4: Fix for Bug#6408 "configure checking for custom zlib fails because code check is wrong". AC_TRY_LINK needs something it can put into main() as its second argument. Apparently everything worked before because gcc supports nested functions. --- acinclude.m4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/acinclude.m4 b/acinclude.m4 index 7f25b447f10..671e279a9f3 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -208,7 +208,7 @@ INCLUDES="$INCLUDES $ZLIB_INCLUDES" LIBS="$LIBS $ZLIB_LIBS" AC_CACHE_VAL([mysql_cv_compress], [AC_TRY_LINK([#include ], - [int link_test() { return compress(0, (unsigned long*) 0, "", 0); }], + [return compress(0, (unsigned long*) 0, "", 0);], [mysql_cv_compress="yes" AC_MSG_RESULT([ok])], [mysql_cv_compress="no"]) From c7b5a8d7b14832b6257d6c410f7c6e8d37536617 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 5 Nov 2004 00:45:41 +0300 Subject: [PATCH 12/28] A test case for Bug#4172 "Floating point conversion looses precision (prepared staements)": adding the test case to close the bug (the bug was fixed along with other conversion incompatibilities in 4.1.7) tests/client_test.c: A test case for Bug#4172: "Floating point conversion loses precision (prepared staements)" Fix memleak. --- tests/client_test.c | 67 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) diff --git a/tests/client_test.c b/tests/client_test.c index 227f7e29ef2..004f076c6df 100644 --- a/tests/client_test.c +++ b/tests/client_test.c @@ -11082,12 +11082,77 @@ static void test_bug6096() free(bind[i].buffer); mysql_stmt_close(stmt); mysql_free_result(query_result); + mysql_free_result(stmt_metadata); stmt_text= "drop table t1"; rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text)); myquery(rc); } +static void test_bug4172() +{ + MYSQL_STMT *stmt; + MYSQL_BIND bind[3]; + const char *stmt_text; + MYSQL_RES *res; + MYSQL_ROW row; + int rc; + char f[100], d[100], e[100]; + long f_len, d_len, e_len; + + myheader("test_bug4172"); + + mysql_query(mysql, "DROP TABLE IF EXISTS t1"); + mysql_query(mysql, "CREATE TABLE t1 (f float, d double, e decimal(10,4))"); + mysql_query(mysql, "INSERT INTO t1 VALUES (12345.1234, 123456.123456, " + "123456.1234)"); + + stmt= mysql_stmt_init(mysql); + stmt_text= "SELECT f, d, e FROM t1"; + + rc= mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text)); + check_execute(stmt, rc); + rc= mysql_stmt_execute(stmt); + check_execute(stmt, rc); + + bzero(bind, sizeof(bind)); + bind[0].buffer_type= MYSQL_TYPE_STRING; + bind[0].buffer= f; + bind[0].buffer_length= sizeof(f); + bind[0].length= &f_len; + bind[1].buffer_type= MYSQL_TYPE_STRING; + bind[1].buffer= d; + bind[1].buffer_length= sizeof(d); + bind[1].length= &d_len; + bind[2].buffer_type= MYSQL_TYPE_STRING; + bind[2].buffer= e; + bind[2].buffer_length= sizeof(e); + bind[2].length= &e_len; + + mysql_stmt_bind_result(stmt, bind); + + mysql_stmt_store_result(stmt); + rc= mysql_stmt_fetch(stmt); + check_execute(stmt, rc); + + rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text)); + myquery(rc); + res= mysql_store_result(mysql); + row= mysql_fetch_row(res); + + printf("Binary protocol: float=%s, double=%s, decimal(10,4)=%s\n", + f, d, e); + printf("Text protocol: float=%s, double=%s, decimal(10,4)=%s\n", + row[0], row[1], row[2]); + + DIE_UNLESS(!strcmp(f, row[0]) && !strcmp(d, row[1]) && !strcmp(e, row[2])); + + mysql_free_result(res); + mysql_stmt_close(stmt); +} + + + /* Read and parse arguments and MySQL options from my.cnf */ @@ -11404,6 +11469,8 @@ int main(int argc, char **argv) test_bug6046(); /* NATURAL JOIN transformation works in PS */ test_bug6081(); /* test of mysql_create_db()/mysql_rm_db() */ test_bug6096(); /* max_length for numeric columns */ + test_bug4172(); /* floating point conversions in libmysql */ + /* XXX: PLEASE RUN THIS PROGRAM UNDER VALGRIND AND VERIFY THAT YOUR TEST DOESN'T CONTAIN WARNINGS/ERRORS BEFORE YOU PUSH. From c52f3942a8ec10761594788c2c906706aa74b536 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 5 Nov 2004 08:08:38 +0400 Subject: [PATCH 13/28] mysqladmin.c: Missing initialized for "lengths" element. , client/mysqladmin.c: Missing initialized for "lengths" element. , --- client/mysqladmin.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/mysqladmin.c b/client/mysqladmin.c index bccbf29ef83..6258b9685a5 100644 --- a/client/mysqladmin.c +++ b/client/mysqladmin.c @@ -108,7 +108,7 @@ static const char *command_names[]= { }; static TYPELIB command_typelib= -{ array_elements(command_names)-1,"commands", command_names}; +{ array_elements(command_names)-1,"commands", command_names, NULL}; static struct my_option my_long_options[] = { From 62ded37e365041e315f0f6317bdeda99f7a55ad0 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 4 Nov 2004 20:39:52 -0800 Subject: [PATCH 14/28] func_in.result, func_in.test: Added a case for bug #6365. item_cmpfunc.cc: Fixed bug #6365 : Server crashed when list of values in IN predicate contains NULL while the tested field is of the character type and not of the default set; e.g. when f in 'f IN (NULL,'aa') belongs to binary character set, while the default character set is latin1. sql/item_cmpfunc.cc: Fixed bug #6365 : Server crash when list of values in IN predicate contains NULL while the tested field is of the character type of not of the default set e.g. when f in 'f IN (NULL,'aa') belongs to binary character set, while the default character set is latin1. mysql-test/t/func_in.test: Added a case for bug #6365. mysql-test/r/func_in.result: Added a case for bug #6365. --- mysql-test/r/func_in.result | 6 ++++++ mysql-test/t/func_in.test | 7 +++++++ sql/item_cmpfunc.cc | 3 ++- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/func_in.result b/mysql-test/r/func_in.result index 374affce8c5..daeda51a12a 100644 --- a/mysql-test/r/func_in.result +++ b/mysql-test/r/func_in.result @@ -179,3 +179,9 @@ select 1 in ('1.1',2); select 1 in ('1.1',2.0); 1 in ('1.1',2.0) 0 +create table t1 (a char(20) character set binary); +insert into t1 values ('aa'), ('bb'); +select * from t1 where a in (NULL, 'aa'); +a +aa +drop table t1; diff --git a/mysql-test/t/func_in.test b/mysql-test/t/func_in.test index 22079377ad2..3cd8c064817 100644 --- a/mysql-test/t/func_in.test +++ b/mysql-test/t/func_in.test @@ -89,3 +89,10 @@ select 1 in ('1.0',2.0); select 1 in (1.0,'2.0'); select 1 in ('1.1',2); select 1 in ('1.1',2.0); + +# Test case for bug #6365 + +create table t1 (a char(20) character set binary); +insert into t1 values ('aa'), ('bb'); +select * from t1 where a in (NULL, 'aa'); +drop table t1; diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 701894cacb5..a28f0f5d4a9 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -1749,7 +1749,8 @@ void Item_func_in::fix_length_and_dec() thd->set_n_backup_item_arena(arena, &backup); for (arg= args+1, arg_end= args+arg_count; arg < arg_end; arg++) { - if (!my_charset_same(cmp_collation.collation, + if (!arg[0]->null_value && + !my_charset_same(cmp_collation.collation, arg[0]->collation.collation)) { Item_string *conv; From 0a4984a4305c8088761e57d9cb8fb728f1913313 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 5 Nov 2004 08:44:40 +0400 Subject: [PATCH 15/28] libmysql.def, libmysql.c: Minor clean-ups libmysql/libmysql.c: Minor clean-ups libmysql/libmysql.def: bk commit --- libmysql/libmysql.c | 3 ++- libmysql/libmysql.def | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index 88f46ce19e7..a57c82e6424 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -1563,7 +1563,8 @@ void my_net_local_init(NET *net) trailing '. The caller must supply whichever of those is desired. */ -ulong mysql_hex_string(char *to, const char *from, ulong length) +ulong STDCALL +mysql_hex_string(char *to, const char *from, ulong length) { char *to0= to; const char *end; diff --git a/libmysql/libmysql.def b/libmysql/libmysql.def index bc91e90a41c..c9ff70f208d 100644 --- a/libmysql/libmysql.def +++ b/libmysql/libmysql.def @@ -47,6 +47,7 @@ EXPORTS mysql_errno mysql_error mysql_escape_string + mysql_hex_string mysql_stmt_execute mysql_stmt_fetch mysql_stmt_fetch_column From 85941cf54304e6b10ff56eb93766536682792312 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 5 Nov 2004 08:54:52 +0400 Subject: [PATCH 16/28] mysqldump.c: - 'mysqldump --help' comment that --xeh-blob doesn't work with --extended-inserts was removed. It does work now. Thanks to Lachlan who noticed this wrong help message. - Switched to use the recently introduced mysql_hex_string() instead of slow sprintf(). Thanks to Sinisa for the idea. - 'mysqldump --hex-blob' dumps in HEX not only BLOBs but also BINARY(x) columns. Thanks to Paul. client/mysqldump.c: - comment that --xeh-blob doesn't work with --extended-inserts was removed. It does work now. - Switched to use recently introduced mysql_hex_string() instead of sprintf() - BINARY(x) are dumped in HEX too --- client/mysqldump.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/client/mysqldump.c b/client/mysqldump.c index 1686278096b..a8db8ab440b 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -124,7 +124,7 @@ const char *compatible_mode_names[]= (1<<10) /* ANSI */\ ) TYPELIB compatible_mode_typelib= {array_elements(compatible_mode_names) - 1, - "", compatible_mode_names}; + "", compatible_mode_names, NULL}; static struct my_option my_long_options[] = @@ -317,7 +317,7 @@ static struct my_option my_long_options[] = {"comments", 'i', "Write additional information.", (gptr*) &opt_comments, (gptr*) &opt_comments, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, - {"hex-blob", OPT_HEXBLOB, "Dump BLOBs in HEX. this mode does not work with extended-insert", + {"hex-blob", OPT_HEXBLOB, "Dump BLOBs in HEX.", (gptr*) &opt_hex_blob, (gptr*) &opt_hex_blob, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; @@ -1523,10 +1523,11 @@ static void dumpTable(uint numFields, char *table) /* 63 is my_charset_bin. If charsetnr is not 63, we have not a BLOB but a TEXT column. - we'll dump it in hex only BLOB columns. + we'll dump in hex only BLOB columns. */ is_blob= (opt_hex_blob && field->charsetnr == 63 && - (field->type == FIELD_TYPE_BLOB || + (field->type == FIELD_TYPE_STRING || + field->type == FIELD_TYPE_BLOB || field->type == FIELD_TYPE_LONG_BLOB || field->type == FIELD_TYPE_MEDIUM_BLOB || field->type == FIELD_TYPE_TINY_BLOB)) ? 1 : 0; @@ -1544,6 +1545,13 @@ static void dumpTable(uint numFields, char *table) { if (!IS_NUM_FIELD(field)) { + /* + "length * 2 + 2" is OK for both HEX and non-HEX modes: + - In HEX mode we need exactly 2 bytes per character + plus 2 bytes for '0x' prefix. + - In non-HEX mode we need up to 2 bytes per character, + plus 2 bytes for leading and trailing '\'' characters. + */ if (dynstr_realloc(&extended_row,length * 2+2)) { fputs("Aborting dump (out of memory)",stderr); @@ -1552,15 +1560,11 @@ static void dumpTable(uint numFields, char *table) } if (opt_hex_blob && is_blob) { - ulong counter; - unsigned char *ptr= row[i]; dynstr_append(&extended_row, "0x"); - for (counter = 0; counter < lengths[i]; counter++) - { - char xx[3]; - sprintf(xx, "%02X", ptr[counter]); - dynstr_append(&extended_row, xx); - } + extended_row.length+= mysql_hex_string(extended_row.str + + extended_row.length, + row[i], length); + extended_row.str[extended_row.length]= '\0'; } else { From 8264d83dfae9616c0382b5bbc2c773ad3d129b92 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 5 Nov 2004 10:12:33 +0400 Subject: [PATCH 17/28] ps.result, ctype_ucs.result, ctype_ucs.test, ps.test: Bug #6351 make test failure "Unknown character set" UCS2 related tests were moved into ctype_ucs. mysql-test/t/ps.test: Bug #6351 make test failure "Unknown character set" UCS2 related tests were moved into ctype_ucs. Bug #6351 make test failure "Unknown character set" UCS2 related tests were moved into ctype_ucs. mysql-test/t/ctype_ucs.test: Bug #6351 make test failure "Unknown character set" UCS2 related tests were moved into ctype_ucs. mysql-test/r/ctype_ucs.result: Bug #6351 make test failure "Unknown character set" UCS2 related tests were moved into ctype_ucs. mysql-test/r/ps.result: Bug #6351 make test failure "Unknown character set" UCS2 related tests were moved into ctype_ucs. --- mysql-test/r/ctype_ucs.result | 7 +++++++ mysql-test/r/ps.result | 6 ------ mysql-test/t/ctype_ucs.test | 8 ++++++++ mysql-test/t/ps.test | 4 ---- 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/mysql-test/r/ctype_ucs.result b/mysql-test/r/ctype_ucs.result index 1d3deb0b09a..0e36b00a670 100644 --- a/mysql-test/r/ctype_ucs.result +++ b/mysql-test/r/ctype_ucs.result @@ -480,3 +480,10 @@ a 0061 b 0062 c 0063 drop table t1; +set @ivar= 1234; +set @str1 = 'select ?'; +set @str2 = convert(@str1 using ucs2); +prepare stmt1 from @str2; +execute stmt1 using @ivar; +? +1234 diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result index 6cad58282a2..6d9cfabb5a7 100644 --- a/mysql-test/r/ps.result +++ b/mysql-test/r/ps.result @@ -106,12 +106,6 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp set @fvar= 123.4567; prepare stmt1 from @fvar; ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '123.4567' at line 1 -set @str1 = 'select ?'; -set @str2 = convert(@str1 using ucs2); -prepare stmt1 from @str2; -execute stmt1 using @ivar; -? -1234 drop table t1,t2; PREPARE stmt1 FROM "select _utf8 'A' collate utf8_bin = ?"; set @var='A'; diff --git a/mysql-test/t/ctype_ucs.test b/mysql-test/t/ctype_ucs.test index d9ef91496e9..4c6d1bbebef 100644 --- a/mysql-test/t/ctype_ucs.test +++ b/mysql-test/t/ctype_ucs.test @@ -315,3 +315,11 @@ alter table t1 modify a char(5); select a, hex(a) from t1; drop table t1; +# +# Check prepare statement from an UCS2 string +# +set @ivar= 1234; +set @str1 = 'select ?'; +set @str2 = convert(@str1 using ucs2); +prepare stmt1 from @str2; +execute stmt1 using @ivar; diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test index 978ce2bc2c3..2b3e961fc28 100644 --- a/mysql-test/t/ps.test +++ b/mysql-test/t/ps.test @@ -110,10 +110,6 @@ set @fvar= 123.4567; --error 1064 prepare stmt1 from @fvar; -set @str1 = 'select ?'; -set @str2 = convert(@str1 using ucs2); -prepare stmt1 from @str2; -execute stmt1 using @ivar; drop table t1,t2; # From aee1e78aa1e0be37acd9640dfb48f63200a7d0ef Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 5 Nov 2004 13:37:36 +0400 Subject: [PATCH 18/28] As it is wrong and confusing to associate any character set with NULL, @a should be latin2 after this query sequence: SET @a=_latin2'string'; SET @a=NULL; I.e. the second query should not change the charset to the current default value, but should keep the original value assigned during the first query. In order to do it, we don't copy charset from the argument if the argument is NULL and the variable has previously been initialized. mysql-test/r/ps_6bdb.result: t mysql-test/r/ps_5merge.result: t mysql-test/r/ps_3innodb.result: t mysql-test/r/ps_7ndb.result: t mysql-test/r/ps_4heap.result: t mysql-test/r/ps_2myisam.result: t sql/item_func.cc: t --- mysql-test/r/ps_2myisam.result | 76 ++++++++--------- mysql-test/r/ps_3innodb.result | 76 ++++++++--------- mysql-test/r/ps_4heap.result | 108 +++++++++++------------ mysql-test/r/ps_5merge.result | 152 ++++++++++++++++----------------- mysql-test/r/ps_6bdb.result | 76 ++++++++--------- mysql-test/r/ps_7ndb.result | 108 +++++++++++------------ sql/item_func.cc | 21 ++++- 7 files changed, 317 insertions(+), 300 deletions(-) diff --git a/mysql-test/r/ps_2myisam.result b/mysql-test/r/ps_2myisam.result index efb12561950..345929d8104 100644 --- a/mysql-test/r/ps_2myisam.result +++ b/mysql-test/r/ps_2myisam.result @@ -1793,7 +1793,7 @@ t5 CREATE TABLE `t5` ( `const12` char(0) default NULL, `param12` bigint(20) default NULL, `param13` double default NULL, - `param14` longblob, + `param14` longtext, `param15` longblob ) ENGINE=MyISAM DEFAULT CHARSET=latin1 select * from t5 ; @@ -1823,7 +1823,7 @@ def test t5 t5 param11 param11 8 20 4 Y 32768 0 63 def test t5 t5 const12 const12 254 0 0 Y 0 0 8 def test t5 t5 param12 param12 8 20 0 Y 32768 0 63 def test t5 t5 param13 param13 5 20 0 Y 32768 31 63 -def test t5 t5 param14 param14 252 16777215 0 Y 144 0 63 +def test t5 t5 param14 param14 252 16777215 0 Y 16 0 8 def test t5 t5 param15 param15 252 16777215 0 Y 144 0 63 const01 8 param01 8 @@ -1976,19 +1976,19 @@ def @arg16 254 8192 0 Y 128 31 63 def @arg17 254 20 0 Y 128 31 63 def @arg18 254 20 0 Y 128 31 63 def @arg19 254 20 0 Y 128 31 63 -def @arg20 254 8192 0 Y 128 31 63 -def @arg21 254 8192 0 Y 128 31 63 -def @arg22 254 8192 0 Y 128 31 63 +def @arg20 254 8192 0 Y 0 31 8 +def @arg21 254 8192 0 Y 0 31 8 +def @arg22 254 8192 0 Y 0 31 8 def @arg23 254 8192 0 Y 128 31 63 -def @arg24 254 8192 0 Y 128 31 63 +def @arg24 254 8192 0 Y 0 31 8 def @arg25 254 8192 0 Y 128 31 63 -def @arg26 254 8192 0 Y 128 31 63 +def @arg26 254 8192 0 Y 0 31 8 def @arg27 254 8192 0 Y 128 31 63 -def @arg28 254 8192 0 Y 128 31 63 +def @arg28 254 8192 0 Y 0 31 8 def @arg29 254 8192 0 Y 128 31 63 -def @arg30 254 8192 0 Y 128 31 63 -def @arg31 254 8192 0 Y 128 31 63 -def @arg32 254 8192 0 Y 128 31 63 +def @arg30 254 8192 0 Y 0 31 8 +def @arg31 254 8192 0 Y 0 31 8 +def @arg32 254 8192 0 Y 0 31 8 @arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL prepare stmt1 from "select @@ -2066,19 +2066,19 @@ def @arg16 254 8192 0 Y 128 31 63 def @arg17 254 20 0 Y 128 31 63 def @arg18 254 20 0 Y 128 31 63 def @arg19 254 20 0 Y 128 31 63 -def @arg20 254 8192 0 Y 128 31 63 -def @arg21 254 8192 0 Y 128 31 63 -def @arg22 254 8192 0 Y 128 31 63 +def @arg20 254 8192 0 Y 0 31 8 +def @arg21 254 8192 0 Y 0 31 8 +def @arg22 254 8192 0 Y 0 31 8 def @arg23 254 8192 0 Y 128 31 63 -def @arg24 254 8192 0 Y 128 31 63 +def @arg24 254 8192 0 Y 0 31 8 def @arg25 254 8192 0 Y 128 31 63 -def @arg26 254 8192 0 Y 128 31 63 +def @arg26 254 8192 0 Y 0 31 8 def @arg27 254 8192 0 Y 128 31 63 -def @arg28 254 8192 0 Y 128 31 63 +def @arg28 254 8192 0 Y 0 31 8 def @arg29 254 8192 0 Y 128 31 63 -def @arg30 254 8192 0 Y 128 31 63 -def @arg31 254 8192 0 Y 128 31 63 -def @arg32 254 8192 0 Y 128 31 63 +def @arg30 254 8192 0 Y 0 31 8 +def @arg31 254 8192 0 Y 0 31 8 +def @arg32 254 8192 0 Y 0 31 8 @arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL prepare stmt1 from "select ? := c1 from t9 where c1= 1" ; @@ -2158,19 +2158,19 @@ def @arg16 254 8192 0 Y 128 31 63 def @arg17 254 20 0 Y 128 31 63 def @arg18 254 20 0 Y 128 31 63 def @arg19 254 20 0 Y 128 31 63 -def @arg20 254 8192 0 Y 128 31 63 -def @arg21 254 8192 0 Y 128 31 63 -def @arg22 254 8192 0 Y 128 31 63 +def @arg20 254 8192 0 Y 0 31 8 +def @arg21 254 8192 0 Y 0 31 8 +def @arg22 254 8192 0 Y 0 31 8 def @arg23 254 8192 0 Y 128 31 63 -def @arg24 254 8192 0 Y 128 31 63 +def @arg24 254 8192 0 Y 0 31 8 def @arg25 254 8192 0 Y 128 31 63 -def @arg26 254 8192 0 Y 128 31 63 +def @arg26 254 8192 0 Y 0 31 8 def @arg27 254 8192 0 Y 128 31 63 -def @arg28 254 8192 0 Y 128 31 63 +def @arg28 254 8192 0 Y 0 31 8 def @arg29 254 8192 0 Y 128 31 63 -def @arg30 254 8192 0 Y 128 31 63 -def @arg31 254 8192 0 Y 128 31 63 -def @arg32 254 8192 0 Y 128 31 63 +def @arg30 254 8192 0 Y 0 31 8 +def @arg31 254 8192 0 Y 0 31 8 +def @arg32 254 8192 0 Y 0 31 8 @arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL prepare stmt1 from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, @@ -2242,19 +2242,19 @@ def @arg16 254 8192 0 Y 128 31 63 def @arg17 254 20 0 Y 128 31 63 def @arg18 254 20 0 Y 128 31 63 def @arg19 254 20 0 Y 128 31 63 -def @arg20 254 8192 0 Y 128 31 63 -def @arg21 254 8192 0 Y 128 31 63 -def @arg22 254 8192 0 Y 128 31 63 +def @arg20 254 8192 0 Y 0 31 8 +def @arg21 254 8192 0 Y 0 31 8 +def @arg22 254 8192 0 Y 0 31 8 def @arg23 254 8192 0 Y 128 31 63 -def @arg24 254 8192 0 Y 128 31 63 +def @arg24 254 8192 0 Y 0 31 8 def @arg25 254 8192 0 Y 128 31 63 -def @arg26 254 8192 0 Y 128 31 63 +def @arg26 254 8192 0 Y 0 31 8 def @arg27 254 8192 0 Y 128 31 63 -def @arg28 254 8192 0 Y 128 31 63 +def @arg28 254 8192 0 Y 0 31 8 def @arg29 254 8192 0 Y 128 31 63 -def @arg30 254 8192 0 Y 128 31 63 -def @arg31 254 8192 0 Y 128 31 63 -def @arg32 254 8192 0 Y 128 31 63 +def @arg30 254 8192 0 Y 0 31 8 +def @arg31 254 8192 0 Y 0 31 8 +def @arg32 254 8192 0 Y 0 31 8 @arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL prepare stmt1 from "select c1 into ? from t9 where c1= 1" ; diff --git a/mysql-test/r/ps_3innodb.result b/mysql-test/r/ps_3innodb.result index cb096882d13..45a3af8e6fa 100644 --- a/mysql-test/r/ps_3innodb.result +++ b/mysql-test/r/ps_3innodb.result @@ -1776,7 +1776,7 @@ t5 CREATE TABLE `t5` ( `const12` char(0) default NULL, `param12` bigint(20) default NULL, `param13` double default NULL, - `param14` longblob, + `param14` longtext, `param15` longblob ) ENGINE=MyISAM DEFAULT CHARSET=latin1 select * from t5 ; @@ -1806,7 +1806,7 @@ def test t5 t5 param11 param11 8 20 4 Y 32768 0 63 def test t5 t5 const12 const12 254 0 0 Y 0 0 8 def test t5 t5 param12 param12 8 20 0 Y 32768 0 63 def test t5 t5 param13 param13 5 20 0 Y 32768 31 63 -def test t5 t5 param14 param14 252 16777215 0 Y 144 0 63 +def test t5 t5 param14 param14 252 16777215 0 Y 16 0 8 def test t5 t5 param15 param15 252 16777215 0 Y 144 0 63 const01 8 param01 8 @@ -1959,19 +1959,19 @@ def @arg16 254 8192 0 Y 128 31 63 def @arg17 254 20 0 Y 128 31 63 def @arg18 254 20 0 Y 128 31 63 def @arg19 254 20 0 Y 128 31 63 -def @arg20 254 8192 0 Y 128 31 63 -def @arg21 254 8192 0 Y 128 31 63 -def @arg22 254 8192 0 Y 128 31 63 +def @arg20 254 8192 0 Y 0 31 8 +def @arg21 254 8192 0 Y 0 31 8 +def @arg22 254 8192 0 Y 0 31 8 def @arg23 254 8192 0 Y 128 31 63 -def @arg24 254 8192 0 Y 128 31 63 +def @arg24 254 8192 0 Y 0 31 8 def @arg25 254 8192 0 Y 128 31 63 -def @arg26 254 8192 0 Y 128 31 63 +def @arg26 254 8192 0 Y 0 31 8 def @arg27 254 8192 0 Y 128 31 63 -def @arg28 254 8192 0 Y 128 31 63 +def @arg28 254 8192 0 Y 0 31 8 def @arg29 254 8192 0 Y 128 31 63 -def @arg30 254 8192 0 Y 128 31 63 -def @arg31 254 8192 0 Y 128 31 63 -def @arg32 254 8192 0 Y 128 31 63 +def @arg30 254 8192 0 Y 0 31 8 +def @arg31 254 8192 0 Y 0 31 8 +def @arg32 254 8192 0 Y 0 31 8 @arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL prepare stmt1 from "select @@ -2049,19 +2049,19 @@ def @arg16 254 8192 0 Y 128 31 63 def @arg17 254 20 0 Y 128 31 63 def @arg18 254 20 0 Y 128 31 63 def @arg19 254 20 0 Y 128 31 63 -def @arg20 254 8192 0 Y 128 31 63 -def @arg21 254 8192 0 Y 128 31 63 -def @arg22 254 8192 0 Y 128 31 63 +def @arg20 254 8192 0 Y 0 31 8 +def @arg21 254 8192 0 Y 0 31 8 +def @arg22 254 8192 0 Y 0 31 8 def @arg23 254 8192 0 Y 128 31 63 -def @arg24 254 8192 0 Y 128 31 63 +def @arg24 254 8192 0 Y 0 31 8 def @arg25 254 8192 0 Y 128 31 63 -def @arg26 254 8192 0 Y 128 31 63 +def @arg26 254 8192 0 Y 0 31 8 def @arg27 254 8192 0 Y 128 31 63 -def @arg28 254 8192 0 Y 128 31 63 +def @arg28 254 8192 0 Y 0 31 8 def @arg29 254 8192 0 Y 128 31 63 -def @arg30 254 8192 0 Y 128 31 63 -def @arg31 254 8192 0 Y 128 31 63 -def @arg32 254 8192 0 Y 128 31 63 +def @arg30 254 8192 0 Y 0 31 8 +def @arg31 254 8192 0 Y 0 31 8 +def @arg32 254 8192 0 Y 0 31 8 @arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL prepare stmt1 from "select ? := c1 from t9 where c1= 1" ; @@ -2141,19 +2141,19 @@ def @arg16 254 8192 0 Y 128 31 63 def @arg17 254 20 0 Y 128 31 63 def @arg18 254 20 0 Y 128 31 63 def @arg19 254 20 0 Y 128 31 63 -def @arg20 254 8192 0 Y 128 31 63 -def @arg21 254 8192 0 Y 128 31 63 -def @arg22 254 8192 0 Y 128 31 63 +def @arg20 254 8192 0 Y 0 31 8 +def @arg21 254 8192 0 Y 0 31 8 +def @arg22 254 8192 0 Y 0 31 8 def @arg23 254 8192 0 Y 128 31 63 -def @arg24 254 8192 0 Y 128 31 63 +def @arg24 254 8192 0 Y 0 31 8 def @arg25 254 8192 0 Y 128 31 63 -def @arg26 254 8192 0 Y 128 31 63 +def @arg26 254 8192 0 Y 0 31 8 def @arg27 254 8192 0 Y 128 31 63 -def @arg28 254 8192 0 Y 128 31 63 +def @arg28 254 8192 0 Y 0 31 8 def @arg29 254 8192 0 Y 128 31 63 -def @arg30 254 8192 0 Y 128 31 63 -def @arg31 254 8192 0 Y 128 31 63 -def @arg32 254 8192 0 Y 128 31 63 +def @arg30 254 8192 0 Y 0 31 8 +def @arg31 254 8192 0 Y 0 31 8 +def @arg32 254 8192 0 Y 0 31 8 @arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL prepare stmt1 from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, @@ -2225,19 +2225,19 @@ def @arg16 254 8192 0 Y 128 31 63 def @arg17 254 20 0 Y 128 31 63 def @arg18 254 20 0 Y 128 31 63 def @arg19 254 20 0 Y 128 31 63 -def @arg20 254 8192 0 Y 128 31 63 -def @arg21 254 8192 0 Y 128 31 63 -def @arg22 254 8192 0 Y 128 31 63 +def @arg20 254 8192 0 Y 0 31 8 +def @arg21 254 8192 0 Y 0 31 8 +def @arg22 254 8192 0 Y 0 31 8 def @arg23 254 8192 0 Y 128 31 63 -def @arg24 254 8192 0 Y 128 31 63 +def @arg24 254 8192 0 Y 0 31 8 def @arg25 254 8192 0 Y 128 31 63 -def @arg26 254 8192 0 Y 128 31 63 +def @arg26 254 8192 0 Y 0 31 8 def @arg27 254 8192 0 Y 128 31 63 -def @arg28 254 8192 0 Y 128 31 63 +def @arg28 254 8192 0 Y 0 31 8 def @arg29 254 8192 0 Y 128 31 63 -def @arg30 254 8192 0 Y 128 31 63 -def @arg31 254 8192 0 Y 128 31 63 -def @arg32 254 8192 0 Y 128 31 63 +def @arg30 254 8192 0 Y 0 31 8 +def @arg31 254 8192 0 Y 0 31 8 +def @arg32 254 8192 0 Y 0 31 8 @arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL prepare stmt1 from "select c1 into ? from t9 where c1= 1" ; diff --git a/mysql-test/r/ps_4heap.result b/mysql-test/r/ps_4heap.result index ac9946ef070..995224fcd21 100644 --- a/mysql-test/r/ps_4heap.result +++ b/mysql-test/r/ps_4heap.result @@ -1777,7 +1777,7 @@ t5 CREATE TABLE `t5` ( `const12` char(0) default NULL, `param12` bigint(20) default NULL, `param13` double default NULL, - `param14` longblob, + `param14` longtext, `param15` longblob ) ENGINE=MyISAM DEFAULT CHARSET=latin1 select * from t5 ; @@ -1807,7 +1807,7 @@ def test t5 t5 param11 param11 8 20 4 Y 32768 0 63 def test t5 t5 const12 const12 254 0 0 Y 0 0 8 def test t5 t5 param12 param12 8 20 0 Y 32768 0 63 def test t5 t5 param13 param13 5 20 0 Y 32768 31 63 -def test t5 t5 param14 param14 252 16777215 0 Y 144 0 63 +def test t5 t5 param14 param14 252 16777215 0 Y 16 0 8 def test t5 t5 param15 param15 252 16777215 0 Y 144 0 63 const01 8 param01 8 @@ -1960,19 +1960,19 @@ def @arg16 254 8192 0 Y 128 31 63 def @arg17 254 20 0 Y 128 31 63 def @arg18 254 20 0 Y 128 31 63 def @arg19 254 20 0 Y 128 31 63 -def @arg20 254 8192 0 Y 128 31 63 -def @arg21 254 8192 0 Y 128 31 63 -def @arg22 254 8192 0 Y 128 31 63 -def @arg23 254 8192 0 Y 128 31 63 -def @arg24 254 8192 0 Y 128 31 63 -def @arg25 254 8192 0 Y 128 31 63 -def @arg26 254 8192 0 Y 128 31 63 -def @arg27 254 8192 0 Y 128 31 63 -def @arg28 254 8192 0 Y 128 31 63 -def @arg29 254 8192 0 Y 128 31 63 -def @arg30 254 8192 0 Y 128 31 63 -def @arg31 254 8192 0 Y 128 31 63 -def @arg32 254 8192 0 Y 128 31 63 +def @arg20 254 8192 0 Y 0 31 8 +def @arg21 254 8192 0 Y 0 31 8 +def @arg22 254 8192 0 Y 0 31 8 +def @arg23 254 8192 0 Y 0 31 8 +def @arg24 254 8192 0 Y 0 31 8 +def @arg25 254 8192 0 Y 0 31 8 +def @arg26 254 8192 0 Y 0 31 8 +def @arg27 254 8192 0 Y 0 31 8 +def @arg28 254 8192 0 Y 0 31 8 +def @arg29 254 8192 0 Y 0 31 8 +def @arg30 254 8192 0 Y 0 31 8 +def @arg31 254 8192 0 Y 0 31 8 +def @arg32 254 8192 0 Y 0 31 8 @arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL prepare stmt1 from "select @@ -2050,19 +2050,19 @@ def @arg16 254 8192 0 Y 128 31 63 def @arg17 254 20 0 Y 128 31 63 def @arg18 254 20 0 Y 128 31 63 def @arg19 254 20 0 Y 128 31 63 -def @arg20 254 8192 0 Y 128 31 63 -def @arg21 254 8192 0 Y 128 31 63 -def @arg22 254 8192 0 Y 128 31 63 -def @arg23 254 8192 0 Y 128 31 63 -def @arg24 254 8192 0 Y 128 31 63 -def @arg25 254 8192 0 Y 128 31 63 -def @arg26 254 8192 0 Y 128 31 63 -def @arg27 254 8192 0 Y 128 31 63 -def @arg28 254 8192 0 Y 128 31 63 -def @arg29 254 8192 0 Y 128 31 63 -def @arg30 254 8192 0 Y 128 31 63 -def @arg31 254 8192 0 Y 128 31 63 -def @arg32 254 8192 0 Y 128 31 63 +def @arg20 254 8192 0 Y 0 31 8 +def @arg21 254 8192 0 Y 0 31 8 +def @arg22 254 8192 0 Y 0 31 8 +def @arg23 254 8192 0 Y 0 31 8 +def @arg24 254 8192 0 Y 0 31 8 +def @arg25 254 8192 0 Y 0 31 8 +def @arg26 254 8192 0 Y 0 31 8 +def @arg27 254 8192 0 Y 0 31 8 +def @arg28 254 8192 0 Y 0 31 8 +def @arg29 254 8192 0 Y 0 31 8 +def @arg30 254 8192 0 Y 0 31 8 +def @arg31 254 8192 0 Y 0 31 8 +def @arg32 254 8192 0 Y 0 31 8 @arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL prepare stmt1 from "select ? := c1 from t9 where c1= 1" ; @@ -2142,19 +2142,19 @@ def @arg16 254 8192 0 Y 128 31 63 def @arg17 254 20 0 Y 128 31 63 def @arg18 254 20 0 Y 128 31 63 def @arg19 254 20 0 Y 128 31 63 -def @arg20 254 8192 0 Y 128 31 63 -def @arg21 254 8192 0 Y 128 31 63 -def @arg22 254 8192 0 Y 128 31 63 -def @arg23 254 8192 0 Y 128 31 63 -def @arg24 254 8192 0 Y 128 31 63 -def @arg25 254 8192 0 Y 128 31 63 -def @arg26 254 8192 0 Y 128 31 63 -def @arg27 254 8192 0 Y 128 31 63 -def @arg28 254 8192 0 Y 128 31 63 -def @arg29 254 8192 0 Y 128 31 63 -def @arg30 254 8192 0 Y 128 31 63 -def @arg31 254 8192 0 Y 128 31 63 -def @arg32 254 8192 0 Y 128 31 63 +def @arg20 254 8192 0 Y 0 31 8 +def @arg21 254 8192 0 Y 0 31 8 +def @arg22 254 8192 0 Y 0 31 8 +def @arg23 254 8192 0 Y 0 31 8 +def @arg24 254 8192 0 Y 0 31 8 +def @arg25 254 8192 0 Y 0 31 8 +def @arg26 254 8192 0 Y 0 31 8 +def @arg27 254 8192 0 Y 0 31 8 +def @arg28 254 8192 0 Y 0 31 8 +def @arg29 254 8192 0 Y 0 31 8 +def @arg30 254 8192 0 Y 0 31 8 +def @arg31 254 8192 0 Y 0 31 8 +def @arg32 254 8192 0 Y 0 31 8 @arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL prepare stmt1 from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, @@ -2226,19 +2226,19 @@ def @arg16 254 8192 0 Y 128 31 63 def @arg17 254 20 0 Y 128 31 63 def @arg18 254 20 0 Y 128 31 63 def @arg19 254 20 0 Y 128 31 63 -def @arg20 254 8192 0 Y 128 31 63 -def @arg21 254 8192 0 Y 128 31 63 -def @arg22 254 8192 0 Y 128 31 63 -def @arg23 254 8192 0 Y 128 31 63 -def @arg24 254 8192 0 Y 128 31 63 -def @arg25 254 8192 0 Y 128 31 63 -def @arg26 254 8192 0 Y 128 31 63 -def @arg27 254 8192 0 Y 128 31 63 -def @arg28 254 8192 0 Y 128 31 63 -def @arg29 254 8192 0 Y 128 31 63 -def @arg30 254 8192 0 Y 128 31 63 -def @arg31 254 8192 0 Y 128 31 63 -def @arg32 254 8192 0 Y 128 31 63 +def @arg20 254 8192 0 Y 0 31 8 +def @arg21 254 8192 0 Y 0 31 8 +def @arg22 254 8192 0 Y 0 31 8 +def @arg23 254 8192 0 Y 0 31 8 +def @arg24 254 8192 0 Y 0 31 8 +def @arg25 254 8192 0 Y 0 31 8 +def @arg26 254 8192 0 Y 0 31 8 +def @arg27 254 8192 0 Y 0 31 8 +def @arg28 254 8192 0 Y 0 31 8 +def @arg29 254 8192 0 Y 0 31 8 +def @arg30 254 8192 0 Y 0 31 8 +def @arg31 254 8192 0 Y 0 31 8 +def @arg32 254 8192 0 Y 0 31 8 @arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL prepare stmt1 from "select c1 into ? from t9 where c1= 1" ; diff --git a/mysql-test/r/ps_5merge.result b/mysql-test/r/ps_5merge.result index 15e707959ca..7a0191b186a 100644 --- a/mysql-test/r/ps_5merge.result +++ b/mysql-test/r/ps_5merge.result @@ -1716,7 +1716,7 @@ t5 CREATE TABLE `t5` ( `const12` char(0) default NULL, `param12` bigint(20) default NULL, `param13` double default NULL, - `param14` longblob, + `param14` longtext, `param15` longblob ) ENGINE=MyISAM DEFAULT CHARSET=latin1 select * from t5 ; @@ -1746,7 +1746,7 @@ def test t5 t5 param11 param11 8 20 4 Y 32768 0 63 def test t5 t5 const12 const12 254 0 0 Y 0 0 8 def test t5 t5 param12 param12 8 20 0 Y 32768 0 63 def test t5 t5 param13 param13 5 20 0 Y 32768 31 63 -def test t5 t5 param14 param14 252 16777215 0 Y 144 0 63 +def test t5 t5 param14 param14 252 16777215 0 Y 16 0 8 def test t5 t5 param15 param15 252 16777215 0 Y 144 0 63 const01 8 param01 8 @@ -1899,19 +1899,19 @@ def @arg16 254 8192 0 Y 128 31 63 def @arg17 254 20 0 Y 128 31 63 def @arg18 254 20 0 Y 128 31 63 def @arg19 254 20 0 Y 128 31 63 -def @arg20 254 8192 0 Y 128 31 63 -def @arg21 254 8192 0 Y 128 31 63 -def @arg22 254 8192 0 Y 128 31 63 +def @arg20 254 8192 0 Y 0 31 8 +def @arg21 254 8192 0 Y 0 31 8 +def @arg22 254 8192 0 Y 0 31 8 def @arg23 254 8192 0 Y 128 31 63 -def @arg24 254 8192 0 Y 128 31 63 +def @arg24 254 8192 0 Y 0 31 8 def @arg25 254 8192 0 Y 128 31 63 -def @arg26 254 8192 0 Y 128 31 63 +def @arg26 254 8192 0 Y 0 31 8 def @arg27 254 8192 0 Y 128 31 63 -def @arg28 254 8192 0 Y 128 31 63 +def @arg28 254 8192 0 Y 0 31 8 def @arg29 254 8192 0 Y 128 31 63 -def @arg30 254 8192 0 Y 128 31 63 -def @arg31 254 8192 0 Y 128 31 63 -def @arg32 254 8192 0 Y 128 31 63 +def @arg30 254 8192 0 Y 0 31 8 +def @arg31 254 8192 0 Y 0 31 8 +def @arg32 254 8192 0 Y 0 31 8 @arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL prepare stmt1 from "select @@ -1989,19 +1989,19 @@ def @arg16 254 8192 0 Y 128 31 63 def @arg17 254 20 0 Y 128 31 63 def @arg18 254 20 0 Y 128 31 63 def @arg19 254 20 0 Y 128 31 63 -def @arg20 254 8192 0 Y 128 31 63 -def @arg21 254 8192 0 Y 128 31 63 -def @arg22 254 8192 0 Y 128 31 63 +def @arg20 254 8192 0 Y 0 31 8 +def @arg21 254 8192 0 Y 0 31 8 +def @arg22 254 8192 0 Y 0 31 8 def @arg23 254 8192 0 Y 128 31 63 -def @arg24 254 8192 0 Y 128 31 63 +def @arg24 254 8192 0 Y 0 31 8 def @arg25 254 8192 0 Y 128 31 63 -def @arg26 254 8192 0 Y 128 31 63 +def @arg26 254 8192 0 Y 0 31 8 def @arg27 254 8192 0 Y 128 31 63 -def @arg28 254 8192 0 Y 128 31 63 +def @arg28 254 8192 0 Y 0 31 8 def @arg29 254 8192 0 Y 128 31 63 -def @arg30 254 8192 0 Y 128 31 63 -def @arg31 254 8192 0 Y 128 31 63 -def @arg32 254 8192 0 Y 128 31 63 +def @arg30 254 8192 0 Y 0 31 8 +def @arg31 254 8192 0 Y 0 31 8 +def @arg32 254 8192 0 Y 0 31 8 @arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL prepare stmt1 from "select ? := c1 from t9 where c1= 1" ; @@ -2081,19 +2081,19 @@ def @arg16 254 8192 0 Y 128 31 63 def @arg17 254 20 0 Y 128 31 63 def @arg18 254 20 0 Y 128 31 63 def @arg19 254 20 0 Y 128 31 63 -def @arg20 254 8192 0 Y 128 31 63 -def @arg21 254 8192 0 Y 128 31 63 -def @arg22 254 8192 0 Y 128 31 63 +def @arg20 254 8192 0 Y 0 31 8 +def @arg21 254 8192 0 Y 0 31 8 +def @arg22 254 8192 0 Y 0 31 8 def @arg23 254 8192 0 Y 128 31 63 -def @arg24 254 8192 0 Y 128 31 63 +def @arg24 254 8192 0 Y 0 31 8 def @arg25 254 8192 0 Y 128 31 63 -def @arg26 254 8192 0 Y 128 31 63 +def @arg26 254 8192 0 Y 0 31 8 def @arg27 254 8192 0 Y 128 31 63 -def @arg28 254 8192 0 Y 128 31 63 +def @arg28 254 8192 0 Y 0 31 8 def @arg29 254 8192 0 Y 128 31 63 -def @arg30 254 8192 0 Y 128 31 63 -def @arg31 254 8192 0 Y 128 31 63 -def @arg32 254 8192 0 Y 128 31 63 +def @arg30 254 8192 0 Y 0 31 8 +def @arg31 254 8192 0 Y 0 31 8 +def @arg32 254 8192 0 Y 0 31 8 @arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL prepare stmt1 from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, @@ -2165,19 +2165,19 @@ def @arg16 254 8192 0 Y 128 31 63 def @arg17 254 20 0 Y 128 31 63 def @arg18 254 20 0 Y 128 31 63 def @arg19 254 20 0 Y 128 31 63 -def @arg20 254 8192 0 Y 128 31 63 -def @arg21 254 8192 0 Y 128 31 63 -def @arg22 254 8192 0 Y 128 31 63 +def @arg20 254 8192 0 Y 0 31 8 +def @arg21 254 8192 0 Y 0 31 8 +def @arg22 254 8192 0 Y 0 31 8 def @arg23 254 8192 0 Y 128 31 63 -def @arg24 254 8192 0 Y 128 31 63 +def @arg24 254 8192 0 Y 0 31 8 def @arg25 254 8192 0 Y 128 31 63 -def @arg26 254 8192 0 Y 128 31 63 +def @arg26 254 8192 0 Y 0 31 8 def @arg27 254 8192 0 Y 128 31 63 -def @arg28 254 8192 0 Y 128 31 63 +def @arg28 254 8192 0 Y 0 31 8 def @arg29 254 8192 0 Y 128 31 63 -def @arg30 254 8192 0 Y 128 31 63 -def @arg31 254 8192 0 Y 128 31 63 -def @arg32 254 8192 0 Y 128 31 63 +def @arg30 254 8192 0 Y 0 31 8 +def @arg31 254 8192 0 Y 0 31 8 +def @arg32 254 8192 0 Y 0 31 8 @arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL prepare stmt1 from "select c1 into ? from t9 where c1= 1" ; @@ -4726,7 +4726,7 @@ t5 CREATE TABLE `t5` ( `const12` char(0) default NULL, `param12` bigint(20) default NULL, `param13` double default NULL, - `param14` longblob, + `param14` longtext, `param15` longblob ) ENGINE=MyISAM DEFAULT CHARSET=latin1 select * from t5 ; @@ -4756,7 +4756,7 @@ def test t5 t5 param11 param11 8 20 4 Y 32768 0 63 def test t5 t5 const12 const12 254 0 0 Y 0 0 8 def test t5 t5 param12 param12 8 20 0 Y 32768 0 63 def test t5 t5 param13 param13 5 20 0 Y 32768 31 63 -def test t5 t5 param14 param14 252 16777215 0 Y 144 0 63 +def test t5 t5 param14 param14 252 16777215 0 Y 16 0 8 def test t5 t5 param15 param15 252 16777215 0 Y 144 0 63 const01 8 param01 8 @@ -4909,19 +4909,19 @@ def @arg16 254 8192 0 Y 128 31 63 def @arg17 254 20 0 Y 128 31 63 def @arg18 254 20 0 Y 128 31 63 def @arg19 254 20 0 Y 128 31 63 -def @arg20 254 8192 0 Y 128 31 63 -def @arg21 254 8192 0 Y 128 31 63 -def @arg22 254 8192 0 Y 128 31 63 +def @arg20 254 8192 0 Y 0 31 8 +def @arg21 254 8192 0 Y 0 31 8 +def @arg22 254 8192 0 Y 0 31 8 def @arg23 254 8192 0 Y 128 31 63 -def @arg24 254 8192 0 Y 128 31 63 +def @arg24 254 8192 0 Y 0 31 8 def @arg25 254 8192 0 Y 128 31 63 -def @arg26 254 8192 0 Y 128 31 63 +def @arg26 254 8192 0 Y 0 31 8 def @arg27 254 8192 0 Y 128 31 63 -def @arg28 254 8192 0 Y 128 31 63 +def @arg28 254 8192 0 Y 0 31 8 def @arg29 254 8192 0 Y 128 31 63 -def @arg30 254 8192 0 Y 128 31 63 -def @arg31 254 8192 0 Y 128 31 63 -def @arg32 254 8192 0 Y 128 31 63 +def @arg30 254 8192 0 Y 0 31 8 +def @arg31 254 8192 0 Y 0 31 8 +def @arg32 254 8192 0 Y 0 31 8 @arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL prepare stmt1 from "select @@ -4999,19 +4999,19 @@ def @arg16 254 8192 0 Y 128 31 63 def @arg17 254 20 0 Y 128 31 63 def @arg18 254 20 0 Y 128 31 63 def @arg19 254 20 0 Y 128 31 63 -def @arg20 254 8192 0 Y 128 31 63 -def @arg21 254 8192 0 Y 128 31 63 -def @arg22 254 8192 0 Y 128 31 63 +def @arg20 254 8192 0 Y 0 31 8 +def @arg21 254 8192 0 Y 0 31 8 +def @arg22 254 8192 0 Y 0 31 8 def @arg23 254 8192 0 Y 128 31 63 -def @arg24 254 8192 0 Y 128 31 63 +def @arg24 254 8192 0 Y 0 31 8 def @arg25 254 8192 0 Y 128 31 63 -def @arg26 254 8192 0 Y 128 31 63 +def @arg26 254 8192 0 Y 0 31 8 def @arg27 254 8192 0 Y 128 31 63 -def @arg28 254 8192 0 Y 128 31 63 +def @arg28 254 8192 0 Y 0 31 8 def @arg29 254 8192 0 Y 128 31 63 -def @arg30 254 8192 0 Y 128 31 63 -def @arg31 254 8192 0 Y 128 31 63 -def @arg32 254 8192 0 Y 128 31 63 +def @arg30 254 8192 0 Y 0 31 8 +def @arg31 254 8192 0 Y 0 31 8 +def @arg32 254 8192 0 Y 0 31 8 @arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL prepare stmt1 from "select ? := c1 from t9 where c1= 1" ; @@ -5091,19 +5091,19 @@ def @arg16 254 8192 0 Y 128 31 63 def @arg17 254 20 0 Y 128 31 63 def @arg18 254 20 0 Y 128 31 63 def @arg19 254 20 0 Y 128 31 63 -def @arg20 254 8192 0 Y 128 31 63 -def @arg21 254 8192 0 Y 128 31 63 -def @arg22 254 8192 0 Y 128 31 63 +def @arg20 254 8192 0 Y 0 31 8 +def @arg21 254 8192 0 Y 0 31 8 +def @arg22 254 8192 0 Y 0 31 8 def @arg23 254 8192 0 Y 128 31 63 -def @arg24 254 8192 0 Y 128 31 63 +def @arg24 254 8192 0 Y 0 31 8 def @arg25 254 8192 0 Y 128 31 63 -def @arg26 254 8192 0 Y 128 31 63 +def @arg26 254 8192 0 Y 0 31 8 def @arg27 254 8192 0 Y 128 31 63 -def @arg28 254 8192 0 Y 128 31 63 +def @arg28 254 8192 0 Y 0 31 8 def @arg29 254 8192 0 Y 128 31 63 -def @arg30 254 8192 0 Y 128 31 63 -def @arg31 254 8192 0 Y 128 31 63 -def @arg32 254 8192 0 Y 128 31 63 +def @arg30 254 8192 0 Y 0 31 8 +def @arg31 254 8192 0 Y 0 31 8 +def @arg32 254 8192 0 Y 0 31 8 @arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL prepare stmt1 from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, @@ -5175,19 +5175,19 @@ def @arg16 254 8192 0 Y 128 31 63 def @arg17 254 20 0 Y 128 31 63 def @arg18 254 20 0 Y 128 31 63 def @arg19 254 20 0 Y 128 31 63 -def @arg20 254 8192 0 Y 128 31 63 -def @arg21 254 8192 0 Y 128 31 63 -def @arg22 254 8192 0 Y 128 31 63 +def @arg20 254 8192 0 Y 0 31 8 +def @arg21 254 8192 0 Y 0 31 8 +def @arg22 254 8192 0 Y 0 31 8 def @arg23 254 8192 0 Y 128 31 63 -def @arg24 254 8192 0 Y 128 31 63 +def @arg24 254 8192 0 Y 0 31 8 def @arg25 254 8192 0 Y 128 31 63 -def @arg26 254 8192 0 Y 128 31 63 +def @arg26 254 8192 0 Y 0 31 8 def @arg27 254 8192 0 Y 128 31 63 -def @arg28 254 8192 0 Y 128 31 63 +def @arg28 254 8192 0 Y 0 31 8 def @arg29 254 8192 0 Y 128 31 63 -def @arg30 254 8192 0 Y 128 31 63 -def @arg31 254 8192 0 Y 128 31 63 -def @arg32 254 8192 0 Y 128 31 63 +def @arg30 254 8192 0 Y 0 31 8 +def @arg31 254 8192 0 Y 0 31 8 +def @arg32 254 8192 0 Y 0 31 8 @arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL prepare stmt1 from "select c1 into ? from t9 where c1= 1" ; diff --git a/mysql-test/r/ps_6bdb.result b/mysql-test/r/ps_6bdb.result index 3dd9c200510..d0549503bfe 100644 --- a/mysql-test/r/ps_6bdb.result +++ b/mysql-test/r/ps_6bdb.result @@ -1776,7 +1776,7 @@ t5 CREATE TABLE `t5` ( `const12` char(0) default NULL, `param12` bigint(20) default NULL, `param13` double default NULL, - `param14` longblob, + `param14` longtext, `param15` longblob ) ENGINE=MyISAM DEFAULT CHARSET=latin1 select * from t5 ; @@ -1806,7 +1806,7 @@ def test t5 t5 param11 param11 8 20 4 Y 32768 0 63 def test t5 t5 const12 const12 254 0 0 Y 0 0 8 def test t5 t5 param12 param12 8 20 0 Y 32768 0 63 def test t5 t5 param13 param13 5 20 0 Y 32768 31 63 -def test t5 t5 param14 param14 252 16777215 0 Y 144 0 63 +def test t5 t5 param14 param14 252 16777215 0 Y 16 0 8 def test t5 t5 param15 param15 252 16777215 0 Y 144 0 63 const01 8 param01 8 @@ -1959,19 +1959,19 @@ def @arg16 254 8192 0 Y 128 31 63 def @arg17 254 20 0 Y 128 31 63 def @arg18 254 20 0 Y 128 31 63 def @arg19 254 20 0 Y 128 31 63 -def @arg20 254 8192 0 Y 128 31 63 -def @arg21 254 8192 0 Y 128 31 63 -def @arg22 254 8192 0 Y 128 31 63 +def @arg20 254 8192 0 Y 0 31 8 +def @arg21 254 8192 0 Y 0 31 8 +def @arg22 254 8192 0 Y 0 31 8 def @arg23 254 8192 0 Y 128 31 63 -def @arg24 254 8192 0 Y 128 31 63 +def @arg24 254 8192 0 Y 0 31 8 def @arg25 254 8192 0 Y 128 31 63 -def @arg26 254 8192 0 Y 128 31 63 +def @arg26 254 8192 0 Y 0 31 8 def @arg27 254 8192 0 Y 128 31 63 -def @arg28 254 8192 0 Y 128 31 63 +def @arg28 254 8192 0 Y 0 31 8 def @arg29 254 8192 0 Y 128 31 63 -def @arg30 254 8192 0 Y 128 31 63 -def @arg31 254 8192 0 Y 128 31 63 -def @arg32 254 8192 0 Y 128 31 63 +def @arg30 254 8192 0 Y 0 31 8 +def @arg31 254 8192 0 Y 0 31 8 +def @arg32 254 8192 0 Y 0 31 8 @arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL prepare stmt1 from "select @@ -2049,19 +2049,19 @@ def @arg16 254 8192 0 Y 128 31 63 def @arg17 254 20 0 Y 128 31 63 def @arg18 254 20 0 Y 128 31 63 def @arg19 254 20 0 Y 128 31 63 -def @arg20 254 8192 0 Y 128 31 63 -def @arg21 254 8192 0 Y 128 31 63 -def @arg22 254 8192 0 Y 128 31 63 +def @arg20 254 8192 0 Y 0 31 8 +def @arg21 254 8192 0 Y 0 31 8 +def @arg22 254 8192 0 Y 0 31 8 def @arg23 254 8192 0 Y 128 31 63 -def @arg24 254 8192 0 Y 128 31 63 +def @arg24 254 8192 0 Y 0 31 8 def @arg25 254 8192 0 Y 128 31 63 -def @arg26 254 8192 0 Y 128 31 63 +def @arg26 254 8192 0 Y 0 31 8 def @arg27 254 8192 0 Y 128 31 63 -def @arg28 254 8192 0 Y 128 31 63 +def @arg28 254 8192 0 Y 0 31 8 def @arg29 254 8192 0 Y 128 31 63 -def @arg30 254 8192 0 Y 128 31 63 -def @arg31 254 8192 0 Y 128 31 63 -def @arg32 254 8192 0 Y 128 31 63 +def @arg30 254 8192 0 Y 0 31 8 +def @arg31 254 8192 0 Y 0 31 8 +def @arg32 254 8192 0 Y 0 31 8 @arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL prepare stmt1 from "select ? := c1 from t9 where c1= 1" ; @@ -2141,19 +2141,19 @@ def @arg16 254 8192 0 Y 128 31 63 def @arg17 254 20 0 Y 128 31 63 def @arg18 254 20 0 Y 128 31 63 def @arg19 254 20 0 Y 128 31 63 -def @arg20 254 8192 0 Y 128 31 63 -def @arg21 254 8192 0 Y 128 31 63 -def @arg22 254 8192 0 Y 128 31 63 +def @arg20 254 8192 0 Y 0 31 8 +def @arg21 254 8192 0 Y 0 31 8 +def @arg22 254 8192 0 Y 0 31 8 def @arg23 254 8192 0 Y 128 31 63 -def @arg24 254 8192 0 Y 128 31 63 +def @arg24 254 8192 0 Y 0 31 8 def @arg25 254 8192 0 Y 128 31 63 -def @arg26 254 8192 0 Y 128 31 63 +def @arg26 254 8192 0 Y 0 31 8 def @arg27 254 8192 0 Y 128 31 63 -def @arg28 254 8192 0 Y 128 31 63 +def @arg28 254 8192 0 Y 0 31 8 def @arg29 254 8192 0 Y 128 31 63 -def @arg30 254 8192 0 Y 128 31 63 -def @arg31 254 8192 0 Y 128 31 63 -def @arg32 254 8192 0 Y 128 31 63 +def @arg30 254 8192 0 Y 0 31 8 +def @arg31 254 8192 0 Y 0 31 8 +def @arg32 254 8192 0 Y 0 31 8 @arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL prepare stmt1 from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, @@ -2225,19 +2225,19 @@ def @arg16 254 8192 0 Y 128 31 63 def @arg17 254 20 0 Y 128 31 63 def @arg18 254 20 0 Y 128 31 63 def @arg19 254 20 0 Y 128 31 63 -def @arg20 254 8192 0 Y 128 31 63 -def @arg21 254 8192 0 Y 128 31 63 -def @arg22 254 8192 0 Y 128 31 63 +def @arg20 254 8192 0 Y 0 31 8 +def @arg21 254 8192 0 Y 0 31 8 +def @arg22 254 8192 0 Y 0 31 8 def @arg23 254 8192 0 Y 128 31 63 -def @arg24 254 8192 0 Y 128 31 63 +def @arg24 254 8192 0 Y 0 31 8 def @arg25 254 8192 0 Y 128 31 63 -def @arg26 254 8192 0 Y 128 31 63 +def @arg26 254 8192 0 Y 0 31 8 def @arg27 254 8192 0 Y 128 31 63 -def @arg28 254 8192 0 Y 128 31 63 +def @arg28 254 8192 0 Y 0 31 8 def @arg29 254 8192 0 Y 128 31 63 -def @arg30 254 8192 0 Y 128 31 63 -def @arg31 254 8192 0 Y 128 31 63 -def @arg32 254 8192 0 Y 128 31 63 +def @arg30 254 8192 0 Y 0 31 8 +def @arg31 254 8192 0 Y 0 31 8 +def @arg32 254 8192 0 Y 0 31 8 @arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL prepare stmt1 from "select c1 into ? from t9 where c1= 1" ; diff --git a/mysql-test/r/ps_7ndb.result b/mysql-test/r/ps_7ndb.result index 85e51df776f..e90eff5d1cd 100644 --- a/mysql-test/r/ps_7ndb.result +++ b/mysql-test/r/ps_7ndb.result @@ -1752,7 +1752,7 @@ t5 CREATE TABLE `t5` ( `const12` char(0) default NULL, `param12` bigint(20) default NULL, `param13` double default NULL, - `param14` longblob, + `param14` longtext, `param15` longblob ) ENGINE=MyISAM DEFAULT CHARSET=latin1 select * from t5 ; @@ -1782,7 +1782,7 @@ def test t5 t5 param11 param11 8 20 4 Y 32768 0 63 def test t5 t5 const12 const12 254 0 0 Y 0 0 8 def test t5 t5 param12 param12 8 20 0 Y 32768 0 63 def test t5 t5 param13 param13 5 20 0 Y 32768 31 63 -def test t5 t5 param14 param14 252 16777215 0 Y 144 0 63 +def test t5 t5 param14 param14 252 16777215 0 Y 16 0 8 def test t5 t5 param15 param15 252 16777215 0 Y 144 0 63 const01 8 param01 8 @@ -1935,19 +1935,19 @@ def @arg16 254 8192 0 Y 128 31 63 def @arg17 254 20 0 Y 128 31 63 def @arg18 254 20 0 Y 128 31 63 def @arg19 254 20 0 Y 128 31 63 -def @arg20 254 8192 0 Y 128 31 63 -def @arg21 254 8192 0 Y 128 31 63 -def @arg22 254 8192 0 Y 128 31 63 -def @arg23 254 8192 0 Y 128 31 63 -def @arg24 254 8192 0 Y 128 31 63 -def @arg25 254 8192 0 Y 128 31 63 -def @arg26 254 8192 0 Y 128 31 63 -def @arg27 254 8192 0 Y 128 31 63 -def @arg28 254 8192 0 Y 128 31 63 -def @arg29 254 8192 0 Y 128 31 63 -def @arg30 254 8192 0 Y 128 31 63 -def @arg31 254 8192 0 Y 128 31 63 -def @arg32 254 8192 0 Y 128 31 63 +def @arg20 254 8192 0 Y 0 31 8 +def @arg21 254 8192 0 Y 0 31 8 +def @arg22 254 8192 0 Y 0 31 8 +def @arg23 254 8192 0 Y 0 31 8 +def @arg24 254 8192 0 Y 0 31 8 +def @arg25 254 8192 0 Y 0 31 8 +def @arg26 254 8192 0 Y 0 31 8 +def @arg27 254 8192 0 Y 0 31 8 +def @arg28 254 8192 0 Y 0 31 8 +def @arg29 254 8192 0 Y 0 31 8 +def @arg30 254 8192 0 Y 0 31 8 +def @arg31 254 8192 0 Y 0 31 8 +def @arg32 254 8192 0 Y 0 31 8 @arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL prepare stmt1 from "select @@ -2025,19 +2025,19 @@ def @arg16 254 8192 0 Y 128 31 63 def @arg17 254 20 0 Y 128 31 63 def @arg18 254 20 0 Y 128 31 63 def @arg19 254 20 0 Y 128 31 63 -def @arg20 254 8192 0 Y 128 31 63 -def @arg21 254 8192 0 Y 128 31 63 -def @arg22 254 8192 0 Y 128 31 63 -def @arg23 254 8192 0 Y 128 31 63 -def @arg24 254 8192 0 Y 128 31 63 -def @arg25 254 8192 0 Y 128 31 63 -def @arg26 254 8192 0 Y 128 31 63 -def @arg27 254 8192 0 Y 128 31 63 -def @arg28 254 8192 0 Y 128 31 63 -def @arg29 254 8192 0 Y 128 31 63 -def @arg30 254 8192 0 Y 128 31 63 -def @arg31 254 8192 0 Y 128 31 63 -def @arg32 254 8192 0 Y 128 31 63 +def @arg20 254 8192 0 Y 0 31 8 +def @arg21 254 8192 0 Y 0 31 8 +def @arg22 254 8192 0 Y 0 31 8 +def @arg23 254 8192 0 Y 0 31 8 +def @arg24 254 8192 0 Y 0 31 8 +def @arg25 254 8192 0 Y 0 31 8 +def @arg26 254 8192 0 Y 0 31 8 +def @arg27 254 8192 0 Y 0 31 8 +def @arg28 254 8192 0 Y 0 31 8 +def @arg29 254 8192 0 Y 0 31 8 +def @arg30 254 8192 0 Y 0 31 8 +def @arg31 254 8192 0 Y 0 31 8 +def @arg32 254 8192 0 Y 0 31 8 @arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL prepare stmt1 from "select ? := c1 from t9 where c1= 1" ; @@ -2117,19 +2117,19 @@ def @arg16 254 8192 0 Y 128 31 63 def @arg17 254 20 0 Y 128 31 63 def @arg18 254 20 0 Y 128 31 63 def @arg19 254 20 0 Y 128 31 63 -def @arg20 254 8192 0 Y 128 31 63 -def @arg21 254 8192 0 Y 128 31 63 -def @arg22 254 8192 0 Y 128 31 63 -def @arg23 254 8192 0 Y 128 31 63 -def @arg24 254 8192 0 Y 128 31 63 -def @arg25 254 8192 0 Y 128 31 63 -def @arg26 254 8192 0 Y 128 31 63 -def @arg27 254 8192 0 Y 128 31 63 -def @arg28 254 8192 0 Y 128 31 63 -def @arg29 254 8192 0 Y 128 31 63 -def @arg30 254 8192 0 Y 128 31 63 -def @arg31 254 8192 0 Y 128 31 63 -def @arg32 254 8192 0 Y 128 31 63 +def @arg20 254 8192 0 Y 0 31 8 +def @arg21 254 8192 0 Y 0 31 8 +def @arg22 254 8192 0 Y 0 31 8 +def @arg23 254 8192 0 Y 0 31 8 +def @arg24 254 8192 0 Y 0 31 8 +def @arg25 254 8192 0 Y 0 31 8 +def @arg26 254 8192 0 Y 0 31 8 +def @arg27 254 8192 0 Y 0 31 8 +def @arg28 254 8192 0 Y 0 31 8 +def @arg29 254 8192 0 Y 0 31 8 +def @arg30 254 8192 0 Y 0 31 8 +def @arg31 254 8192 0 Y 0 31 8 +def @arg32 254 8192 0 Y 0 31 8 @arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL prepare stmt1 from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, @@ -2201,19 +2201,19 @@ def @arg16 254 8192 0 Y 128 31 63 def @arg17 254 20 0 Y 128 31 63 def @arg18 254 20 0 Y 128 31 63 def @arg19 254 20 0 Y 128 31 63 -def @arg20 254 8192 0 Y 128 31 63 -def @arg21 254 8192 0 Y 128 31 63 -def @arg22 254 8192 0 Y 128 31 63 -def @arg23 254 8192 0 Y 128 31 63 -def @arg24 254 8192 0 Y 128 31 63 -def @arg25 254 8192 0 Y 128 31 63 -def @arg26 254 8192 0 Y 128 31 63 -def @arg27 254 8192 0 Y 128 31 63 -def @arg28 254 8192 0 Y 128 31 63 -def @arg29 254 8192 0 Y 128 31 63 -def @arg30 254 8192 0 Y 128 31 63 -def @arg31 254 8192 0 Y 128 31 63 -def @arg32 254 8192 0 Y 128 31 63 +def @arg20 254 8192 0 Y 0 31 8 +def @arg21 254 8192 0 Y 0 31 8 +def @arg22 254 8192 0 Y 0 31 8 +def @arg23 254 8192 0 Y 0 31 8 +def @arg24 254 8192 0 Y 0 31 8 +def @arg25 254 8192 0 Y 0 31 8 +def @arg26 254 8192 0 Y 0 31 8 +def @arg27 254 8192 0 Y 0 31 8 +def @arg28 254 8192 0 Y 0 31 8 +def @arg29 254 8192 0 Y 0 31 8 +def @arg30 254 8192 0 Y 0 31 8 +def @arg31 254 8192 0 Y 0 31 8 +def @arg32 254 8192 0 Y 0 31 8 @arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL prepare stmt1 from "select c1 into ? from t9 where c1= 1" ; diff --git a/sql/item_func.cc b/sql/item_func.cc index 09d7e50eaa3..b382dbf7bf9 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -2340,6 +2340,7 @@ static user_var_entry *get_variable(HASH *hash, LEX_STRING &name, entry->value=0; entry->length=0; entry->update_query_id=0; + entry->collation.set(NULL, DERIVATION_NONE); /* If we are here, we were called from a SET or a query which sets a variable. Imagine it is this: @@ -2381,7 +2382,24 @@ bool Item_func_set_user_var::fix_fields(THD *thd, TABLE_LIST *tables, is different from query_id). */ entry->update_query_id= thd->query_id; - entry->collation.set(args[0]->collation); + /* + As it is wrong and confusing to associate any + character set with NULL, @a should be latin2 + after this query sequence: + + SET @a=_latin2'string'; + SET @a=NULL; + + I.e. the second query should not change the charset + to the current default value, but should keep the + original value assigned during the first query. + In order to do it, we don't copy charset + from the argument if the argument is NULL + and the variable has previously been initialized. + */ + if (!entry->collation.collation || !args[0]->null_value) + entry->collation.set(args[0]->collation); + collation.set(entry->collation); cached_result_type= args[0]->result_type(); return 0; } @@ -2409,7 +2427,6 @@ bool Item_func_set_user_var::update_hash(void *ptr, uint length, my_free(entry->value,MYF(0)); entry->value=0; entry->length=0; - entry->collation.set(cs, dv); } else { From ac391280932251ed953c2a5feaf5ae57ac8b9402 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 5 Nov 2004 10:42:37 +0100 Subject: [PATCH 19/28] The new "Bootstrap" pushed in 4.0 with changeset "joerg:1.2057" is used for building _all_ versions. It tries to remove "Docs/Images/Makefile*" as part of the actions to correct bug number 6350. If the source tree does not contain a dummy file matching that pattern, this "rm" will fail, and so "Bootstrap" will fail. The "Makefile.am" introduced with this changeset is identical to the one that will arrive here when "joerg:1.2057" is propagated from 4.0, so this separate introduction here is just to allow "Bootstraps" in the meantime. --- Docs/Images/Makefile.am | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 Docs/Images/Makefile.am diff --git a/Docs/Images/Makefile.am b/Docs/Images/Makefile.am new file mode 100644 index 00000000000..b57d701d8a0 --- /dev/null +++ b/Docs/Images/Makefile.am @@ -0,0 +1,35 @@ +# Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Library General Public +# License as published by the Free Software Foundation; either +# version 2 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public +# License along with this library; if not, write to the Free +# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, +# MA 02111-1307, USA + +## Process this file with automake to create Makefile.in + +# This is a dummy file to satisfy the hierarchy of Makefiles. +# When a release is built, the true Makefile will be copied +# together with the "real" files in this directory. + +EXTRA_DIST = + +# Nothing to create in this dummy directory. +all: + : + +# Nothing to cleanup in this dummy directory. +clean: + : + +# Don't update the files from bitkeeper +%::SCCS/s.% From 6608e22d9ceb67fe39879f7cf08cfbd9c05591f5 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 5 Nov 2004 14:07:12 +0400 Subject: [PATCH 20/28] user_var.result, user_var.test: My previous change that "set @a=NULL" doesn't change charset fixed 'Bug #6321' as well. Prove with a new test that FIELD(, ...) now works fine too. mysql-test/t/user_var.test: My previous change that "set @a=NULL" doesn't change charset fixed 'Bug #6321' as well. Prove with a new test that FIELD(, ...) now works fine too. mysql-test/r/user_var.result: My previous change that "set @a=NULL" doesn't change charset fixed 'Bug #6321' as well. Prove with a new test that FIELD(, ...) now works fine too. --- mysql-test/r/user_var.result | 4 ++++ mysql-test/t/user_var.test | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/mysql-test/r/user_var.result b/mysql-test/r/user_var.result index 2750478c1c5..659c392e153 100644 --- a/mysql-test/r/user_var.result +++ b/mysql-test/r/user_var.result @@ -195,3 +195,7 @@ SET @`v`:=_ucs2 0x006100620063 COLLATE ucs2_general_ci; SET TIMESTAMP=10000; insert into t2 values (@v); drop table t1, t2; +set @var= NULL ; +select FIELD( @var,'1it','Hit') as my_column; +my_column +0 diff --git a/mysql-test/t/user_var.test b/mysql-test/t/user_var.test index 601724e68c8..3816af42c55 100644 --- a/mysql-test/t/user_var.test +++ b/mysql-test/t/user_var.test @@ -120,3 +120,9 @@ show binlog events from 79; drop table t1, t2; +# +# Bug #6321 strange error: +# string function FIELD(, ...) +# +set @var= NULL ; +select FIELD( @var,'1it','Hit') as my_column; From 00d05c1e6dce8528e51bf46badee1bcf73452055 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 5 Nov 2004 15:50:53 +0100 Subject: [PATCH 21/28] Ensure that even the (relatively new) "mysql-test/Makefile.am" gets into the source tar-ball. BitKeeper/etc/ignore: Added mysql-test/mysql_test_run_new to the ignore list mysql-test/Makefile.am: All source files must be contained in their respective macros in order to be contained in the DISTFILES macro so that they get included in the source file tar-ball. "my_manage.h" was missing. --- .bzrignore | 1 + mysql-test/Makefile.am | 1 + 2 files changed, 2 insertions(+) diff --git a/.bzrignore b/.bzrignore index 27fb593c662..1e89b903ac7 100644 --- a/.bzrignore +++ b/.bzrignore @@ -922,3 +922,4 @@ Docs/Images/mydsn-test-success.txt Docs/Images/mydsn-trace.txt Docs/Images/mydsn.txt Docs/Images/myflowchart.txt +mysql-test/mysql_test_run_new diff --git a/mysql-test/Makefile.am b/mysql-test/Makefile.am index 4e8601f1b88..ad02d304d1b 100644 --- a/mysql-test/Makefile.am +++ b/mysql-test/Makefile.am @@ -38,6 +38,7 @@ CLEANFILES = $(test_SCRIPTS) $(test_DATA) INCLUDES = -I$(srcdir)/../include -I../include -I.. bin_PROGRAMS = mysql_test_run_new +noinst_HEADERS = my_manage.h mysql_test_run_new_SOURCES= mysql_test_run_new.c my_manage.c From 7bcd40bd32df675d9c2f84191015915aafa20ee2 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 5 Nov 2004 20:35:56 +0400 Subject: [PATCH 22/28] mysqldump.c: in 4.1: Dump only VARBINARY() in hex, while VARCHAR() COLLATE xxx_bin as a string. client/mysqldump.c: in 4.1: Dump only VARBINARY() in hex, while VARCHAR() COLLATE xxx_bin as a string. --- client/mysqldump.c | 1 + 1 file changed, 1 insertion(+) diff --git a/client/mysqldump.c b/client/mysqldump.c index a8db8ab440b..e1388aa0f85 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -1527,6 +1527,7 @@ static void dumpTable(uint numFields, char *table) */ is_blob= (opt_hex_blob && field->charsetnr == 63 && (field->type == FIELD_TYPE_STRING || + field->type == FIELD_TYPE_VAR_STRING || field->type == FIELD_TYPE_BLOB || field->type == FIELD_TYPE_LONG_BLOB || field->type == FIELD_TYPE_MEDIUM_BLOB || From b3d84df165fbc3d2ec0b1aab27f3e2e20ac49f2e Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 5 Nov 2004 21:02:12 +0300 Subject: [PATCH 23/28] A fix and test case for the bug reported by Reggie: if character set of client equals to character set of connection, possibly required conversion to character set of column is not performed (prepared statements, data is supplied using placeholders). sql/item.cc: Fix for the bug reported by Reggie: if character_set_connection is equal to character_set_client, placeholder's value is not converted furhter to character set of column when it's different. This is because the original implementation left placeholder's character set intact (binary) if there were no need for client->connection conversion. tests/client_test.c: A test case for the conversion bug. --- sql/item.cc | 4 +++ tests/client_test.c | 71 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+) diff --git a/sql/item.cc b/sql/item.cc index 7dc7e9e542c..b4e7322b7cc 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -1218,6 +1218,10 @@ bool Item_param::convert_str_value(THD *thd) value.cs_info.character_set_client, value.cs_info.final_character_set_of_str_value); } + else + str_value.set_charset(value.cs_info.final_character_set_of_str_value); + /* Here str_value is guaranteed to be in final_character_set_of_str_value */ + max_length= str_value.length(); decimals= 0; /* diff --git a/tests/client_test.c b/tests/client_test.c index 004f076c6df..d373f57c1de 100644 --- a/tests/client_test.c +++ b/tests/client_test.c @@ -11152,6 +11152,73 @@ static void test_bug4172() } +static void test_conversion() +{ + MYSQL_STMT *stmt; + const char *stmt_text; + int rc; + MYSQL_BIND bind[1]; + char buff[4]; + ulong length; + + myheader("test_conversion"); + + stmt_text= "DROP TABLE IF EXISTS t1"; + rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text)); + myquery(rc); + stmt_text= "CREATE TABLE t1 (a TEXT) DEFAULT CHARSET latin1"; + rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text)); + myquery(rc); + stmt_text= "SET character_set_connection=utf8, character_set_client=utf8, " + " character_set_results=latin1"; + rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text)); + myquery(rc); + + stmt= mysql_stmt_init(mysql); + + stmt_text= "INSERT INTO t1 (a) VALUES (?)"; + rc= mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text)); + check_execute(stmt, rc); + + bzero(bind, sizeof(bind)); + bind[0].buffer= buff; + bind[0].length= &length; + bind[0].buffer_type= MYSQL_TYPE_STRING; + + mysql_stmt_bind_param(stmt, bind); + + buff[0]= 0xC3; + buff[1]= 0xA0; + length= 2; + + rc= mysql_stmt_execute(stmt); + check_execute(stmt, rc); + + stmt_text= "SELECT a FROM t1"; + rc= mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text)); + check_execute(stmt, rc); + rc= mysql_stmt_execute(stmt); + check_execute(stmt, rc); + + bind[0].buffer_length= sizeof(buff); + mysql_stmt_bind_result(stmt, bind); + + rc= mysql_stmt_fetch(stmt); + DIE_UNLESS(rc == 0); + DIE_UNLESS(length == 1); + DIE_UNLESS((uchar) buff[0] == 0xE0); + rc= mysql_stmt_fetch(stmt); + DIE_UNLESS(rc == MYSQL_NO_DATA); + + mysql_stmt_close(stmt); + stmt_text= "DROP TABLE t1"; + rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text)); + myquery(rc); + stmt_text= "SET NAMES DEFAULT"; + rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text)); + myquery(rc); +} + /* Read and parse arguments and MySQL options from my.cnf @@ -11471,6 +11538,10 @@ int main(int argc, char **argv) test_bug6096(); /* max_length for numeric columns */ test_bug4172(); /* floating point conversions in libmysql */ + test_conversion(); /* placeholder value is not converted to + character set of column if character set + of connection equals to character set of + client */ /* XXX: PLEASE RUN THIS PROGRAM UNDER VALGRIND AND VERIFY THAT YOUR TEST DOESN'T CONTAIN WARNINGS/ERRORS BEFORE YOU PUSH. From e5b02acd1070868f331974d026f82646f6b956cc Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 5 Nov 2004 23:59:06 +0000 Subject: [PATCH 24/28] removed a bunch of "dead" files from the ndb src tree BitKeeper/deleted/.del-Makefile_mysql~13fd89716a05b953: Delete: ndb/test/odbc/tpcb/Makefile_mysql BitKeeper/deleted/.del-Makefile_ndb~6c74a0c6f8a79774: Delete: ndb/test/odbc/tpcb/Makefile_ndb BitKeeper/deleted/.del-Makefile~c02da49a787c2f6e: Delete: ndb/test/odbc/tpcb/Makefile BitKeeper/deleted/.del-readme.txt~3549c08b7818c64: Delete: ndb/test/odbc/tpcb/readme.txt BitKeeper/deleted/.del-timesten.h~24e85d9b33938c67: Delete: ndb/test/odbc/tpcb/timesten.h BitKeeper/deleted/.del-tpcb.cpp~7b670d738e1890ae: Delete: ndb/test/odbc/tpcb/tpcb.cpp BitKeeper/deleted/.del-ttTime.c~94f84fefd7be03f3: Delete: ndb/test/odbc/tpcb/ttTime.c BitKeeper/deleted/.del-ttTime.h~52ca967b5dfc48bc: Delete: ndb/test/odbc/tpcb/ttTime.h BitKeeper/deleted/.del-list.h~1329477d9fb820be: Delete: ndb/src/external/LINUX.x86/sci/include/list.h BitKeeper/deleted/.del-rmlib.h~1889009d4b47c498: Delete: ndb/src/external/LINUX.x86/sci/include/rmlib.h BitKeeper/deleted/.del-sci_errno.h~a1da22da939f627: Delete: ndb/src/external/LINUX.x86/sci/include/sci_errno.h BitKeeper/deleted/.del-sci_types.h~64136c0e5ac2ac5f: Delete: ndb/src/external/LINUX.x86/sci/include/sci_types.h BitKeeper/deleted/.del-sisci_api.h~67839b64a1235d51: Delete: ndb/src/external/LINUX.x86/sci/include/sisci_api.h BitKeeper/deleted/.del-sisci_demolib.h~ea5d3afd60121d20: Delete: ndb/src/external/LINUX.x86/sci/include/sisci_demolib.h BitKeeper/deleted/.del-sisci_error.h~c6771e123aa79c71: Delete: ndb/src/external/LINUX.x86/sci/include/sisci_error.h BitKeeper/deleted/.del-sisci_types.h~67a1a116970eb17f: Delete: ndb/src/external/LINUX.x86/sci/include/sisci_types.h BitKeeper/deleted/.del-sisci_version.h~d542bfa4c7633fc: Delete: ndb/src/external/LINUX.x86/sci/include/sisci_version.h BitKeeper/deleted/.del-version.h~b022e3a29d6d96ad: Delete: ndb/src/external/LINUX.x86/sci/include/version.h BitKeeper/deleted/.del-inttypes.h~c9dfa7f6273df1b1: Delete: ndb/src/external/LINUX.x86/sci/include/os/inttypes.h BitKeeper/deleted/.del-rmlib.h~61359201e51879bc: Delete: ndb/src/external/WIN32.x86/sci/include/rmlib.h BitKeeper/deleted/.del-sisci_api.h~3b78e2453819b68d: Delete: ndb/src/external/SOLARIS.SPARC/sci/include/sisci_api.h BitKeeper/deleted/.del-sisci_error.h~f48df70a324479a2: Delete: ndb/src/external/SOLARIS.SPARC/sci/include/sisci_error.h BitKeeper/deleted/.del-sisci_types.h~f97cdce73b27052d: Delete: ndb/src/external/SOLARIS.SPARC/sci/include/sisci_types.h BitKeeper/deleted/.del-sisci_version.h~fa5e2e6069bad028: Delete: ndb/src/external/SOLARIS.SPARC/sci/include/sisci_version.h BitKeeper/deleted/.del-scilib.h~144397858368aafd: Delete: ndb/src/external/WIN32.x86/sci/include/scilib.h BitKeeper/deleted/.del-sisci_api.h~23d9bf22685196be: Delete: ndb/src/external/WIN32.x86/sci/include/sisci_api.h BitKeeper/deleted/.del-sisci_demolib.h~c149b88ed12e698e: Delete: ndb/src/external/WIN32.x86/sci/include/sisci_demolib.h BitKeeper/deleted/.del-sisci_error.h~3118f4dbedb2eee0: Delete: ndb/src/external/WIN32.x86/sci/include/sisci_error.h BitKeeper/deleted/.del-sisci_types.h~3cf6f68a4de25d19: Delete: ndb/src/external/WIN32.x86/sci/include/sisci_types.h BitKeeper/deleted/.del-md5-rfc1321.txt~61f874f9cd434768: Delete: ndb/src/common/util/md5-rfc1321.txt BitKeeper/deleted/.del-getarg.3~3d3256e9714fadf1: Delete: ndb/src/common/util/getarg.3 BitKeeper/deleted/.del-getarg.3.ps~bfb45b011e1164ae: Delete: ndb/src/common/util/getarg.3.ps BitKeeper/deleted/.del-cvschk~c63d92daa21ed311: Delete: ndb/home/bin/cvschk BitKeeper/deleted/.del-AssemblyInfo.cs~7632ee81b277625: Delete: ndb/src/cw/cpcc-win32/csharp/AssemblyInfo.cs BitKeeper/deleted/.del-frmSplash.frm~40b5877abca91856: Delete: ndb/src/cw/cpcc-win32/vb6/frmSplash.frm --- ndb/home/bin/cvschk | 569 ----- ndb/src/common/util/getarg.3 | 315 --- ndb/src/common/util/getarg.3.ps | 458 ---- ndb/src/common/util/md5-rfc1321.txt | 1179 --------- ndb/src/cw/cpcc-win32/csharp/AssemblyInfo.cs | 58 - ndb/src/cw/cpcc-win32/vb6/frmSplash.frm | 159 -- ndb/src/external/LINUX.x86/sci/include/list.h | 56 - .../LINUX.x86/sci/include/os/inttypes.h | 53 - .../external/LINUX.x86/sci/include/rmlib.h | 212 -- .../LINUX.x86/sci/include/sci_errno.h | 216 -- .../LINUX.x86/sci/include/sci_types.h | 300 --- .../LINUX.x86/sci/include/sisci_api.h | 2170 ---------------- .../LINUX.x86/sci/include/sisci_demolib.h | 226 -- .../LINUX.x86/sci/include/sisci_error.h | 89 - .../LINUX.x86/sci/include/sisci_types.h | 133 - .../LINUX.x86/sci/include/sisci_version.h | 91 - .../external/LINUX.x86/sci/include/version.h | 25 - .../SOLARIS.SPARC/sci/include/sisci_api.h | 2148 ---------------- .../SOLARIS.SPARC/sci/include/sisci_error.h | 89 - .../SOLARIS.SPARC/sci/include/sisci_types.h | 133 - .../SOLARIS.SPARC/sci/include/sisci_version.h | 91 - .../external/WIN32.x86/sci/include/rmlib.h | 212 -- .../external/WIN32.x86/sci/include/scilib.h | 330 --- .../WIN32.x86/sci/include/sisci_api.h | 2217 ----------------- .../WIN32.x86/sci/include/sisci_demolib.h | 226 -- .../WIN32.x86/sci/include/sisci_error.h | 94 - .../WIN32.x86/sci/include/sisci_types.h | 133 - ndb/test/odbc/tpcb/Makefile | 30 - ndb/test/odbc/tpcb/Makefile_mysql | 33 - ndb/test/odbc/tpcb/Makefile_ndb | 30 - ndb/test/odbc/tpcb/readme.txt | 15 - ndb/test/odbc/tpcb/timesten.h | 188 -- ndb/test/odbc/tpcb/tpcb.cpp | 1415 ----------- ndb/test/odbc/tpcb/ttTime.c | 366 --- ndb/test/odbc/tpcb/ttTime.h | 125 - 35 files changed, 14184 deletions(-) delete mode 100755 ndb/home/bin/cvschk delete mode 100644 ndb/src/common/util/getarg.3 delete mode 100644 ndb/src/common/util/getarg.3.ps delete mode 100644 ndb/src/common/util/md5-rfc1321.txt delete mode 100644 ndb/src/cw/cpcc-win32/csharp/AssemblyInfo.cs delete mode 100644 ndb/src/cw/cpcc-win32/vb6/frmSplash.frm delete mode 100644 ndb/src/external/LINUX.x86/sci/include/list.h delete mode 100644 ndb/src/external/LINUX.x86/sci/include/os/inttypes.h delete mode 100644 ndb/src/external/LINUX.x86/sci/include/rmlib.h delete mode 100644 ndb/src/external/LINUX.x86/sci/include/sci_errno.h delete mode 100644 ndb/src/external/LINUX.x86/sci/include/sci_types.h delete mode 100644 ndb/src/external/LINUX.x86/sci/include/sisci_api.h delete mode 100644 ndb/src/external/LINUX.x86/sci/include/sisci_demolib.h delete mode 100644 ndb/src/external/LINUX.x86/sci/include/sisci_error.h delete mode 100644 ndb/src/external/LINUX.x86/sci/include/sisci_types.h delete mode 100644 ndb/src/external/LINUX.x86/sci/include/sisci_version.h delete mode 100644 ndb/src/external/LINUX.x86/sci/include/version.h delete mode 100644 ndb/src/external/SOLARIS.SPARC/sci/include/sisci_api.h delete mode 100644 ndb/src/external/SOLARIS.SPARC/sci/include/sisci_error.h delete mode 100644 ndb/src/external/SOLARIS.SPARC/sci/include/sisci_types.h delete mode 100644 ndb/src/external/SOLARIS.SPARC/sci/include/sisci_version.h delete mode 100644 ndb/src/external/WIN32.x86/sci/include/rmlib.h delete mode 100644 ndb/src/external/WIN32.x86/sci/include/scilib.h delete mode 100644 ndb/src/external/WIN32.x86/sci/include/sisci_api.h delete mode 100644 ndb/src/external/WIN32.x86/sci/include/sisci_demolib.h delete mode 100644 ndb/src/external/WIN32.x86/sci/include/sisci_error.h delete mode 100644 ndb/src/external/WIN32.x86/sci/include/sisci_types.h delete mode 100644 ndb/test/odbc/tpcb/Makefile delete mode 100644 ndb/test/odbc/tpcb/Makefile_mysql delete mode 100644 ndb/test/odbc/tpcb/Makefile_ndb delete mode 100644 ndb/test/odbc/tpcb/readme.txt delete mode 100644 ndb/test/odbc/tpcb/timesten.h delete mode 100644 ndb/test/odbc/tpcb/tpcb.cpp delete mode 100644 ndb/test/odbc/tpcb/ttTime.c delete mode 100644 ndb/test/odbc/tpcb/ttTime.h diff --git a/ndb/home/bin/cvschk b/ndb/home/bin/cvschk deleted file mode 100755 index 4510cc30888..00000000000 --- a/ndb/home/bin/cvschk +++ /dev/null @@ -1,569 +0,0 @@ -#!/usr/bin/perl -w -# -# cvschk -- fast offline check for new files and modifications of files - -# cvschk : A perl program which checks the status of the CVS controlled -# files and gives an ASCII table sorted after the status of files. -# -# If you have used CVS, then you know that it is hard to -# get a good overview the CVS-status of the files in you -# directories. Any new files? Any files changes? -# cvschk will help the programmer get the overview in the -# situation, where we do not have access to the CVS repository. -# -# Note that the program does only local checks of the files -# If you have fast access to the CVS repositiory, then consider -# the cvsstat-program - which additionally can tell if other -# people have made newer versions of the files. -# -# The program requires Perl 5.004 (maybe previous versions also work). -# -# It is tuned to parse the output of cvs(1) version 1.9. -# Earlier and later versions may require modifications to the script. -# -# ** Note that the first line might be wrong depending ** -# ** on the location of your perl program. ** -# -# Sample output: -# The directory ./mytempdir is not under CVS control -# -# Changed files -# --------------- -# ./cvs2html -# ./cvschk -# ./cvsstat -# -# New files -# --------------- -# ./.#cvschk -# ./XX -# ./cvs2html.ok -# -# Deleted files -# --------------- -# (none) - -# Changelog: -# -# Ver Date Author Changelog -# --- ---------- -------------------- ------------------------------------- -# 1.12 2002-01-04 Michael Kohne Fixed a $foo=<> warning for -# 5.004_01 with defined($foo=<>) -# Added a --tabular|-t switch -# -# 1.11 2001-12-27 Michael Kohne Added cvsignore functionality -# Handling of 'dummy timestamp' -# Handling of 'Result of Merge' -# -# 1.10 2001-11-06 Michael Kohne Added -r and -l options -# -# 1.9 2001-08-03 Lars G. T. Jørgensen Hack to allow special entry-line -# -# 1.8 2001-06-07 Peter Toft Back to the same as 1.6 -# CVS is my friend -# -# 1.7 2001-06-04 Peter Toft Peter was very tired and -# applied a wrong patch - -# version 1.7 is crap -# -# 1.6 2000-12-17 Peter Toft Better description added -# -# 1.5 2000-11-04 Peter Toft URL of cvsstat changed -# -# 1.4 2000-09-20 Peter Toft Must show deleted files also -# as the default -# -# 1.3 2000-08-08 Ole Tange and Initial version -# Peter Toft -# ---- ---------- -------------------- ------------------------------------- -# -# ----------------------------------------------------------------------------- -# -# This program is protected by the GPL, and all modifications of -# general interest should be emailed to the maintainer (pto@sslug.dk). -# -# This program also uses code parts from cvsstat -# (same homepage as cvschk) -# -# Copyright 2000,2001 by Peter Toft and Ole Tange -# as well as -# Lars G. T. Jørgensen -# -# The URL of the home page of cvschk is shown below. - - -use Time::Local; -use strict; -use Getopt::Long; - -my $startdir = "."; - -my $debug = 0; -my (%files,%filesok,%seen,%skip); - - -# Michael Kohne 12/16/01 -# -# Simulation of .cvsignore as CVS does it... -# -# using .cvsignore handling makes cvschk take from 2 to 3 times -# longer to run over the same set of files. -# in my tests, disabling cvsignore altogether, cvschk takes .2 -# seconds on my working directory. Adding cvsignore,takes -# .4 seconds. -# Note that I do not use individual .cvsignore files - if there -# are a lot of them in your directory tree, it will add run time -# -# variables used for .cvsignore handling -my $initcvsignoreregex;# regex holding all startup cvsignore pattersn (no ()) -my $cvsignoreregex;# one regex holding all current cvsignore patterns -my $disable_cvsignore=0;# set to 1 to disable cvsignore emulation - # (available in case it's REALLY screwed up) -my $disable_ind_cvsignore=0;# set to 1 to disable finding .cvsignore files - # in each directory. -my $debug_cvsignore = 0; # For debugging .cvsignore problems - -my %mon; -@mon{qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec)}= - 0..11; # Perl months are 0 .. 11 - -my ($version) = ('$Revision: 1.12 $ ' =~ /^\$\w+: (.*) \$ $/); -my $URL = "http://cvs.sslug.dk/cvs2html"; -my $version_line = "cvschk version $version (see $URL)\n"; - -my $opt_all; -my $restrict; -my $local; -my $tabular; - -my $opt_restrict; - -sub show_version {print $version_line} - -sub die_version {die $version_line} - -sub die_usage { - my $bundled = ($] > 5.00399 - ? "can be bundled" - : "can't be bundled, because your Perl is too old"); - die < 5.00399) { # This requires 5.004, so silently skip it for older Perls. - eval {Getopt::Long::config("bundling")}; # avoid 5.003 compilation error - warn $@ if $@; # For Perl 5.004+ we do want to see any compilation error -} - - -GetOptions( "all|a" => \$opt_all, - "tabular|t" => \$tabular, - "restrict|r" => \$restrict, - "local|l" => \$local, - "help|h" => \&die_help, - "debug|d" => \$debug, - "version|V" => \&die_version, - ) or die_usage; - -sub cvs_changed_in_dir($); #define prototype (for recursion) - -# functions for .cvsignore handling - -# converts a given filename pattern -# (of the sort that sh(1) takes) to -# a perl regex of similar meaning. -# -# It works by doing the following: -# -# change: -# . to \. -# $ to \$ -# * to .* -# ? to . -# -sub fpat_to_regex($) -{ - my $fexp; - $fexp = shift; - $fexp =~ s/\./\\\./g;#change . to \. - $fexp =~ s/\$/\\\$/g;#change dollar sign to \dollar sign - $fexp =~ s/\*/.*/g;# change * to .* - $fexp =~ s/\?/./g; # change ? to . - return $fexp; -} - -# copy the input list to one single regex, -# items seperated by | symbols. -# return the regex string -sub do_regex_convert -{ - my $rx = ""; - my $first = 1;#true for first element only - - - # convert each element of cvsignore into a regex - # this makes the patterns usable in perl - my $cp; - foreach $cp (@_) { - if (not $first) { $rx = $rx . "|"; } - if ($first) { $first = 0; } - $rx = $rx . fpat_to_regex($cp); - } - - return $rx; -} - -# first parameter is a reference to the array -# to be loaded -# the rest of the parameters are just items -# that need to be loaded into the array. -# Note that if a ! is found, the list is -# emptied, then further items are added. -# returns true if a ! was found -sub load_list_from_list -{ - my $arref = shift;# get reference to array from front - my $item; - my $ret=0;#false means no ! found - - chomp @_;#kill newlines - foreach $item (@_) { - $item =~ s/^\s*(.*?)\s*$/$1/;#kill leading/trailing whitespace - if ($item) { # empty string is false - push @$arref,$item; - } - if ($item eq "!") { - @$arref = ();# '!' causes list to clear - $ret = 1;# ! found - } - } - - return $ret; -} - -# loads the given list with lines from the -# specified file. Note that if a '!' is found -# all prior patterns are removed from the list -# before the following patterns are loaded -# first param is the filename, -# second param is a reference to an array -# that the data is to go into -# returns true if a ! was found -sub load_list_from_file -{ - my @inlist; - my $fname = shift;#filename to read from - #if (not -e $fname) { return; } - my $arref = shift;#array to store into - open CVSIGNORE,"$fname" or return;#file might not exist, that's OK - @inlist = ; - close CVSIGNORE; - return load_list_from_list($arref,@inlist); -} - -# loads $cvsignoreregex from -# $initcvsignoreregex and the .cvsignore file -# in the local directory -sub load_cvsignore -{ - if ($disable_ind_cvsignore) {return;}#don't look for local .cvsignore files - if ($disable_cvsignore) {return;}#don't do anything - - my $dir = shift; - my @cvsignore; - - # bang will be true if a ! was found. In such cases, I need - # to not use the pre-exisitng regex list. - my $bang = load_list_from_file("$dir/.cvsignore",\@cvsignore); - - # if we get a local cvsignore list, then... - my $rx = do_regex_convert(@cvsignore); - if ($rx) { - $cvsignoreregex = "("; - if (not $bang) {$cvsignoreregex = $cvsignoreregex . $initcvsignoreregex . "|";} - $cvsignoreregex = $cvsignoreregex . $rx . ")"; - } else { - if ($bang) {$cvsignoreregex = "";} - else {$cvsignoreregex = "(" . $initcvsignoreregex . ")";} - } - - if ($debug_cvsignore) {print $dir,":",$cvsignoreregex, "\n";} -} - - -# loads all of the cvsignore patterns that -# can be loaded at script startup -sub load_initial_cvsignore() -{ - #load the default patterns - # (taken from http://www.gnu.org/manual/cvs-1.9/html_node/cvs_141.html#IDX399) - # - # this gives you the patterns that cvs normally starts with - my @initcvsignore; - push @initcvsignore,("RCS"); - push @initcvsignore,("SCCS"); - push @initcvsignore,("CVS"); - push @initcvsignore,("CVS.adm"); - push @initcvsignore,("RCSLOG"); - push @initcvsignore,("cvslog.*"); - push @initcvsignore,("tags"); - push @initcvsignore,("TAGS"); - push @initcvsignore,(".make.state"); - push @initcvsignore,(".nse_depinfo"); - push @initcvsignore,("*~"); - push @initcvsignore,("\#*"); - push @initcvsignore,(".\#*"); - push @initcvsignore,("\,*"); - push @initcvsignore,("_\$\*"); - push @initcvsignore,("*\$"); - push @initcvsignore,("*.old"); - push @initcvsignore,("*.bak"); - push @initcvsignore,("*.BAK"); - push @initcvsignore,("*.orig"); - push @initcvsignore,("*.rej"); - push @initcvsignore,(".del-*"); - push @initcvsignore,("*.a"); - push @initcvsignore,("*.olb"); - push @initcvsignore,("*.o"); - push @initcvsignore,("*.obj"); - push @initcvsignore,("*.so"); - push @initcvsignore,("*.exe"); - push @initcvsignore,("*.Z"); - push @initcvsignore,("*.elc"); - push @initcvsignore,("*.ln"); - push @initcvsignore,("core"); - - - # now, load (in proper order!) - # each of the possible cvsignore files - - # there are 4 possible .cvsignore files: - - # $CVSROOT/CVSROOT/cvsignore - # ~/.cvsignore - # $CVSIGNORE environment variable - # .cvsignore in current directory - - # The first (CVSROOT/cvsignore) would require calling cvs, so - # we won't do that one. - # The last (.cvsignore in current directory) is done - # for each directory. It's handled in the load_cvsignore routine. - - # ~/.cvsignore - my @inlist; - my $item; - my $HOME=$ENV{"HOME"}; - if (not $HOME) {$HOME = ".";} - load_list_from_file("$HOME/.cvsignore",\@initcvsignore); - - # $CVSIGNORE environment variable - my $igstr = $ENV{"CVSIGNORE"}; # get env var - if ($igstr) { - my @iglist = split(/\s+/, $igstr); #if it exists, convert to list - load_list_from_list(\@initcvsignore,@iglist); - } - - # now that @initcvsignore is setup, - # turn it into a regex string - $initcvsignoreregex = do_regex_convert(@initcvsignore); - - # now preset the cvsignore regex string to match - # @initcvsignore. That way, if we aren't using local - # cvsignore files, we do nothing. - $cvsignoreregex = "(" . $initcvsignoreregex . ")"; -} -# routine to see if the given name is in the cvsignore regex -# returns true if it is, false if it's not -sub ignore_file($) -{ - #allow user to disable the cvsignore stuff - if ($disable_cvsignore) {return 0;} - if (not $cvsignoreregex) {return 0;}# if regex is empty, nothing matches the regex - my $filename = shift; - - if ($debug_cvsignore) {print "ignore_file:",$filename,"\n";} - - if ($filename =~ $cvsignoreregex) { - if ($debug_cvsignore) {print $filename," matches\n";} - return 1; - } - - if ($debug_cvsignore) {print $filename," doesn't match\n";} - return 0; -} - -sub cvs_changed_in_dir($) { - my $dir = shift; - - my ($line,$filename,$version,$mtime,$date, - $dir_filename,$cvstime,@subdirs, - @new_in_dir,$i); - - # Examine status of files in CVS/Entries - if(not open(ENTRIES,"$dir/CVS/Entries")) { - if ($tabular) { - push @{$files{Unknown}}, $dir; - } - else { - warn "The directory $dir is not under CVS control\n"; - } - } else { - load_cvsignore($dir);#load up proper cvsignore for given directory - - while(defined ($line=)) { - # Parse CVS/Entries-line - $line=~m!^/(.*)/(.*)/(.*)/.*/! or do { - $debug and warn("Skipping entry-line $line"); - next; - }; - ($filename,$version,$date) = ($1,$2,$3); - $dir_filename=$dir."/".$filename; - - # Mark this file as seen - $seen{$dir_filename}=1; - - # if not exists: Deleted - if(not -e $dir_filename) { - push @{$files{Deleted}}, $dir_filename; next; - } - # if dir: save name for recursion - -d $dir_filename and do { - push @subdirs, $dir_filename; next; - }; - - # modification time of $dir_filename - $mtime= (stat $dir_filename)[9]; - - - if($date eq "dummy timestamp") { - # dummy timestamp means it's new to the repository. - push @{$files{Changed}}, $dir_filename; - if ($debug) { - print "$dir_filename is changed\n"; - } - } - elsif($date eq "Result of merge") { - # result of merge means it's changed, then updated. - push @{$files{Changed}}, $dir_filename; - if ($debug) { - print "$dir_filename is changed\n"; - } - } - elsif(not - $date=~/... (...)\s+(\d+)\s+(\d+):(\d+):(\d+) (\d{4})/) - { - #bogus entry in Entires - warn "Warning: $dir_filename -> '$date' ". - "not in ctime(3) format\n"; - } else { - $cvstime=timegm($5,$4,$3,$2,$mon{$1},$6); - if($cvstime != $mtime) { - push @{$files{Changed}}, $dir_filename; - if ($debug) { - print "$dir_filename is changed\n"; - } - } else { - push @{$files{Unchanged}}, $dir_filename; - if ($debug) { - print "$dir_filename is Unchanged\n"; - } - } - } - } - close ENTRIES; - - # Locate any new files/dirs - if(not opendir(D,$dir)) { - warn("Cannot open $dir"); - @new_in_dir= (); - } else { - @skip{qw(. .. CVS)}=1..3; # Filenames that that we want to ignore - #(note: these are exact filenames) - @new_in_dir= - (grep { not $seen{$_} } # files we have not already processed - map { $dir."/".$_ } # map from file to dir/file - grep { not ignore_file($_) } # ignore files in the cvsignore list - grep { not $skip{$_} } # skip files to be ignored - readdir(D)); - closedir(D); - } - - # Remember new files (actually non-directories) - push @{$files{New}}, grep { not -d $_ } @new_in_dir; - if ($debug) { print "@{$files{New}} are new in $dir\n"; } - - # Remember new subdirs - push @subdirs, grep { -d $_ } @new_in_dir; - - # Recurse all subdirs - if (not $local) { - for $i (@subdirs) { cvs_changed_in_dir($i); } - } - } -} - -sub print_status() -{ - my $k; - my %show_these_states = ("Changed" => 1); - if(not $restrict) { - $show_these_states{"New"} = 1; - $show_these_states{"Deleted"} = 1; - } - - if($opt_all) { $show_these_states{"Unchanged"} = 1; } - - if ($tabular) { - my %allfiles; # key: filesname, value: state - my ($file, $state, $statefiles); - - $show_these_states{"Unknown"} = 1; - while (($state, $statefiles) = each %files) { - for my $f (@{$statefiles}) { - $allfiles{$f} = $state; - } - } - for $file (sort keys %allfiles) { - $state = $allfiles{$file}; - printf("%-10s %s\n", $state, $file) if $show_these_states{$state}; - } - } - else { - print "\n"; - for $k (keys %show_these_states) { - if(not $files{$k} or not @{$files{$k}}) { - # no files - $files{$k}=["(none)"]; - } - print("$k files\n", - "---------------\n", - map { "$_\n" } sort @{$files{$k}}); - print "\n"; - } - } -} - -load_initial_cvsignore(); -if ($debug_cvsignore) {print "initial regex:",$cvsignoreregex,"\n";} -cvs_changed_in_dir($startdir); -print_status(); - diff --git a/ndb/src/common/util/getarg.3 b/ndb/src/common/util/getarg.3 deleted file mode 100644 index 43aae5d7b31..00000000000 --- a/ndb/src/common/util/getarg.3 +++ /dev/null @@ -1,315 +0,0 @@ -.\" Copyright (c) 1999 Kungliga Tekniska Högskolan -.\" $KTH: getarg.3,v 1.1.4.1 2001/07/26 19:54:45 lha Exp $ -.Dd September 24, 1999 -.Dt GETARG 3 -.Os ROKEN -.Sh NAME -.Nm getarg , -.Nm arg_printusage -.Nd collect command line options -.Sh SYNOPSIS -.Fd #include - -.Ft int -.Fn getarg "struct getargs *args" "size_t num_args" "int argc" "char **argv" "int *optind" - -.Ft void -.Fn arg_printusage "struct getargs *args" "size_t num_args" "const char *progname" "const char *extra_string" - -.Sh DESCRIPTION -.Fn getarg -collects any command line options given to a program in an easily used way. -.Fn arg_printusage -pretty-prints the available options, with a short help text. -.Pp -.Fa args -is the option specification to use, and it's an array of -.Fa struct getargs -elements. -.Fa num_args -is the size of -.Fa args -(in elements). -.Fa argc -and -.Fa argv -are the argument count and argument vector to extract option from. -.Fa optind -is a pointer to an integer where the index to the last processed -argument is stored, it must be initialised to the first index (minus -one) to process (normally 0) before the first call. -.Pp -.Fa arg_printusage -take the same -.Fa args -and -.Fa num_args -as getarg; -.Fa progname is the name of the program (to be used in the help text), and -.Fa extra_string -is a string to print after the actual options to indicate more -arguments. The usefulness of this function is realised only be people -who has used programs that has help strings that doesn't match what -the code does. -.Pp -The -.Fa getargs -struct has the following elements. - -.Bd -literal -struct getargs{ - const char *long_name; - char short_name; - enum { arg_integer, - arg_string, - arg_flag, - arg_negative_flag, - arg_strings, - arg_double, - arg_collect - } type; - void *value; - const char *help; - const char *arg_help; -}; -.Ed -.Pp -.Fa long_name -is the long name of the option, it can be -.Dv NULL , -if you don't want a long name. -.Fa short_name -is the characted to use as short option, it can be zero. If the option -has a value the -.Fa value -field gets filled in with that value interpreted as specified by the -.Fa type -field. -.Fa help -is a longer help string for the option as a whole, if it's -.Dv NULL -the help text for the option is omitted (but it's still displayed in -the synopsis). -.Fa arg_help -is a description of the argument, if -.Dv NULL -a default value will be used, depending on the type of the option: -.Pp -.Bl -hang -width arg_negative_flag -.It arg_integer -the argument is a signed integer, and -.Fa value -should point to an -.Fa int . -.It Fa arg_string -the argument is a string, and -.Fa value -should point to a -.Fa char* . -.It Fa arg_flag -the argument is a flag, and -.Fa value -should point to a -.Fa int . -It gets filled in with either zero or one, depending on how the option -is given, the normal case beeing one. Note that if the option isn't -given, the value isn't altered, so it should be initialised to some -useful default. -.It Fa arg_negative_flag -this is the same as -.Fa arg_flag -but it reverses the meaning of the flag (a given short option clears -the flag), and the synopsis of a long option is negated. -.It Fa arg_strings -the argument can be given multiple times, and the values are collected -in an array; -.Fa value -should be a pointer to a -.Fa struct getarg_strings -structure, which holds a length and a string pointer. -.It Fa arg_double -argument is a double precision floating point value, and -.Fa value -should point to a -.Fa double . -.It Fa arg_collect -allows more fine-grained control of the option parsing process. -.Fa value -should be a pointer to a -.Fa getarg_collect_info -structure: -.Bd -literal -typedef int (*getarg_collect_func)(int short_opt, - int argc, - char **argv, - int *optind, - int *optarg, - void *data); - -typedef struct getarg_collect_info { - getarg_collect_func func; - void *data; -} getarg_collect_info; -.Ed -.Pp -With the -.Fa func -member set to a function to call, and -.Fa data -to some application specific data. The parameters to the collect function are: -.Bl -inset -.It Fa short_flag -non-zero if this call is via a short option flag, zero otherwise -.It Fa argc , argv -the whole argument list -.It Fa optind -pointer to the index in argv where the flag is -.It Fa optarg -pointer to the index in argv[*optind] where the flag name starts -.It Fa data -application specific data -.El -.Pp -You can modify -.Fa *optind , -and -.Fa *optarg , -but to do this correct you (more or less) have to know about the inner -workings of getarg. - -You can skip parts of arguments by increasing -.Fa *optarg -(you could -implement the -.Fl z Ns Ar 3 -set of flags from -.Nm gzip -with this), or whole argument strings by increasing -.Fa *optind -(let's say you want a flag -.Fl c Ar x y z -to specify a coordinate); if you also have to set -.Fa *optarg -to a sane value. -.Pp -The collect function should return one of -.Dv ARG_ERR_NO_MATCH , ARG_ERR_BAD_ARG , ARG_ERR_NO_ARG -on error, zero otherwise. -.Pp -For your convenience there is a function, -.Fn getarg_optarg , -that returns the traditional argument string, and you pass it all -arguments, sans data, that where given to the collection function. -.Pp -Don't use this more this unless you absolutely have to. -.El -.Pp -Option parsing is similar to what -.Xr getopt -uses. Short options without arguments can be compressed -.Pf ( Fl xyz -is the same as -.Fl x y z ) , -and short -options with arguments take these as either the rest of the -argv-string or as the next option -.Pf ( Fl o Ns Ar foo , -or -.Fl o Ar foo ) . -.Pp -Long option names are prefixed with -- (double dash), and the value -with a = (equal), -.Fl -foo= Ns Ar bar . -Long option flags can either be specified as they are -.Pf ( Fl -help ) , -or with an (boolean parsable) option -.Pf ( Fl -help= Ns Ar yes , -.Fl -help= Ns Ar true , -or similar), or they can also be negated -.Pf ( Fl -no-help -is the same as -.Fl -help= Ns no ) , -and if you're really confused you can do it multiple times -.Pf ( Fl -no-no-help= Ns Ar false , -or even -.Fl -no-no-help= Ns Ar maybe ) . -.Sh EXAMPLE -.Bd -literal -#include -#include -#include - -char *source = "Ouagadougou"; -char *destination; -int weight; -int include_catalog = 1; -int help_flag; - -struct getargs args[] = { - { "source", 's', arg_string, &source, - "source of shippment", "city" }, - { "destination", 'd', arg_string, &destination, - "destination of shippment", "city" }, - { "weight", 'w', arg_integer, &weight, - "weight of shippment", "tons" }, - { "catalog", 'c', arg_negative_flag, &include_catalog, - "include product catalog" }, - { "help", 'h', arg_flag, &help_flag } -}; - -int num_args = sizeof(args) / sizeof(args[0]); /* number of elements in args */ - -const char *progname = "ship++"; - -int -main(int argc, char **argv) -{ - int optind = 0; - if (getarg(args, num_args, argc, argv, &optind)) { - arg_printusage(args, num_args, progname, "stuff..."); - exit (1); - } - if (help_flag) { - arg_printusage(args, num_args, progname, "stuff..."); - exit (0); - } - if (destination == NULL) { - fprintf(stderr, "%s: must specify destination\n", progname); - exit(1); - } - if (strcmp(source, destination) == 0) { - fprintf(stderr, "%s: destination must be different from source\n"); - exit(1); - } - /* include more stuff here ... */ - exit(2); -} -.Ed -.Pp -The output help output from this program looks like this: -.Bd -literal -$ ship++ --help -Usage: ship++ [--source=city] [-s city] [--destination=city] [-d city] - [--weight=tons] [-w tons] [--no-catalog] [-c] [--help] [-h] stuff... --s city, --source=city source of shippment --d city, --destination=city destination of shippment --w tons, --weight=tons weight of shippment --c, --no-catalog include product catalog -.Ed - -.Sh BUGS -It should be more flexible, so it would be possible to use other more -complicated option syntaxes, such as what -.Xr ps 1 , -and -.Xr tar 1 , -uses, or the AFS model where you can skip the flag names as long as -the options come in the correct order. -.Pp -Options with multiple arguments should be handled better. -.Pp -Should be integreated with SL. -.Pp -It's very confusing that the struct you pass in is called getargS. -.Sh SEE ALSO -.Xr getopt 3 diff --git a/ndb/src/common/util/getarg.3.ps b/ndb/src/common/util/getarg.3.ps deleted file mode 100644 index 146fb8e4961..00000000000 --- a/ndb/src/common/util/getarg.3.ps +++ /dev/null @@ -1,458 +0,0 @@ -%!PS-Adobe-3.0 -%%Creator: groff version 1.15 -%%CreationDate: Thu Nov 7 12:53:13 2002 -%%DocumentNeededResources: font Times-Roman -%%+ font Times-Bold -%%+ font Courier-Bold -%%+ font Courier-Oblique -%%+ font Symbol -%%+ font Courier -%%DocumentSuppliedResources: procset grops 1.15 0 -%%Pages: 4 -%%PageOrder: Ascend -%%Orientation: Portrait -%%EndComments -%%BeginProlog -%%BeginResource: procset grops 1.15 0 -/setpacking where{ -pop -currentpacking -true setpacking -}if -/grops 120 dict dup begin -/SC 32 def -/A/show load def -/B{0 SC 3 -1 roll widthshow}bind def -/C{0 exch ashow}bind def -/D{0 exch 0 SC 5 2 roll awidthshow}bind def -/E{0 rmoveto show}bind def -/F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def -/G{0 rmoveto 0 exch ashow}bind def -/H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def -/I{0 exch rmoveto show}bind def -/J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def -/K{0 exch rmoveto 0 exch ashow}bind def -/L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def -/M{rmoveto show}bind def -/N{rmoveto 0 SC 3 -1 roll widthshow}bind def -/O{rmoveto 0 exch ashow}bind def -/P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def -/Q{moveto show}bind def -/R{moveto 0 SC 3 -1 roll widthshow}bind def -/S{moveto 0 exch ashow}bind def -/T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def -/SF{ -findfont exch -[exch dup 0 exch 0 exch neg 0 0]makefont -dup setfont -[exch/setfont cvx]cvx bind def -}bind def -/MF{ -findfont -[5 2 roll -0 3 1 roll -neg 0 0]makefont -dup setfont -[exch/setfont cvx]cvx bind def -}bind def -/level0 0 def -/RES 0 def -/PL 0 def -/LS 0 def -/MANUAL{ -statusdict begin/manualfeed true store end -}bind def -/PLG{ -gsave newpath clippath pathbbox grestore -exch pop add exch pop -}bind def -/BP{ -/level0 save def -1 setlinecap -1 setlinejoin -72 RES div dup scale -LS{ -90 rotate -}{ -0 PL translate -}ifelse -1 -1 scale -}bind def -/EP{ -level0 restore -showpage -}bind def -/DA{ -newpath arcn stroke -}bind def -/SN{ -transform -.25 sub exch .25 sub exch -round .25 add exch round .25 add exch -itransform -}bind def -/DL{ -SN -moveto -SN -lineto stroke -}bind def -/DC{ -newpath 0 360 arc closepath -}bind def -/TM matrix def -/DE{ -TM currentmatrix pop -translate scale newpath 0 0 .5 0 360 arc closepath -TM setmatrix -}bind def -/RC/rcurveto load def -/RL/rlineto load def -/ST/stroke load def -/MT/moveto load def -/CL/closepath load def -/FL{ -currentgray exch setgray fill setgray -}bind def -/BL/fill load def -/LW/setlinewidth load def -/RE{ -findfont -dup maxlength 1 index/FontName known not{1 add}if dict begin -{ -1 index/FID ne{def}{pop pop}ifelse -}forall -/Encoding exch def -dup/FontName exch def -currentdict end definefont pop -}bind def -/DEFS 0 def -/EBEGIN{ -moveto -DEFS begin -}bind def -/EEND/end load def -/CNT 0 def -/level1 0 def -/PBEGIN{ -/level1 save def -translate -div 3 1 roll div exch scale -neg exch neg exch translate -0 setgray -0 setlinecap -1 setlinewidth -0 setlinejoin -10 setmiterlimit -[]0 setdash -/setstrokeadjust where{ -pop -false setstrokeadjust -}if -/setoverprint where{ -pop -false setoverprint -}if -newpath -/CNT countdictstack def -userdict begin -/showpage{}def -}bind def -/PEND{ -clear -countdictstack CNT sub{end}repeat -level1 restore -}bind def -end def -/setpacking where{ -pop -setpacking -}if -%%EndResource -%%IncludeResource: font Times-Roman -%%IncludeResource: font Times-Bold -%%IncludeResource: font Courier-Bold -%%IncludeResource: font Courier-Oblique -%%IncludeResource: font Symbol -%%IncludeResource: font Courier -grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72 -def/PL 792 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron/Zcaron -/scaron/zcaron/Ydieresis/trademark/quotesingle/.notdef/.notdef/.notdef -/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef -/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef -/.notdef/.notdef/space/exclam/quotedbl/numbersign/dollar/percent -/ampersand/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen -/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon -/semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O -/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/circumflex -/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y -/z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase/guillemotleft -/guillemotright/bullet/florin/fraction/perthousand/dagger/daggerdbl -/endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut -/dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash -/quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen -/brokenbar/section/dieresis/copyright/ordfeminine/guilsinglleft -/logicalnot/minus/registered/macron/degree/plusminus/twosuperior -/threesuperior/acute/mu/paragraph/periodcentered/cedilla/onesuperior -/ordmasculine/guilsinglright/onequarter/onehalf/threequarters -/questiondown/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE -/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex -/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis -/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn -/germandbls/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla -/egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis -/eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide/oslash -/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis]def -/Courier@0 ENC0/Courier RE/Courier-Oblique@0 ENC0/Courier-Oblique RE -/Courier-Bold@0 ENC0/Courier-Bold RE/Times-Bold@0 ENC0/Times-Bold RE -/Times-Roman@0 ENC0/Times-Roman RE -%%EndProlog -%%Page: 1 1 -%%BeginPageSetup -BP -%%EndPageSetup -/F0 10/Times-Roman@0 SF(GET)72 48 Q -.834(ARG \( 3 \))-.93 F -(OpenBSD Programmer')111.062 E 2.5(sM)-.55 G 108.562(anual GET)-2.5 F --.834(ARG \( 3 \))-.93 F/F1 10/Times-Bold@0 SF -.2(NA)72 108 S(ME).2 E -/F2 10/Courier-Bold@0 SF(getarg)102 120 Q F0(,)A F2(arg_printusage)2.5 E -F0 2.52.5 G(ollect command line options)-2.5 E F1(SYNOPSIS)72 144 -Q F2(#include )102 156 Q/F3 10/Courier-Oblique@0 SF(int)102 -186 Q F2(getarg)102 198 Q F0(\()A F3(struct getargs)A/F4 10/Symbol SF(*) -6 E F3(args)A F0(,)1.666 E F3(size_t num_args)4.166 E F0(,)1.666 E F3 -(int argc)4.166 E F0(,)1.666 E F3(char)4.166 E F4(**)6 E F3(argv)A F0(,) -1.666 E F3(int)151.666 210 Q F4(*)6 E F3(optind)A F0(\);)A F3(void)102 -240 Q F2(arg_printusage)102 252 Q F0(\()A F3(struct getargs)A F4(*)6 E -F3(args)A F0(,)1.666 E F3(size_t num_args)4.166 E F0(,)1.666 E F3 -(const char)4.166 E F4(*)6 E F3(progname)A F0(,)1.666 E F3(const char) -151.666 264 Q F4(*)6 E F3(extra_string)A F0(\);)A F1(DESCRIPTION)72 300 -Q F2(getarg)102 312 Q F0 2.721 1.666(\(\) c)D 6.053(ollects an)-1.666 F -8.553(yc)-.15 G 6.053(ommand line options gi)-8.553 F -.15(ve)-.25 G -8.552(nt).15 G 8.552(oap)-8.552 G 6.052(rogram in an easily used w) --8.552 F(ay)-.1 E(.)-.65 E F2(arg_printusage)102 324 Q F0 -3.332 1.666 -(\(\) p)D(retty-prints the a)-1.666 E -.25(va)-.2 G -(ilable options, with a short help te).25 E(xt.)-.15 E F3(args)102 342 Q -F0 .855(is the option speci\214cation to use, and it')3.355 F 3.356(sa) --.55 G 3.356(na)-3.356 G .856(rray of)-3.356 F F3 .856(struct getargs) -3.356 F F0(elements.)3.356 E F3(num_args)5.856 E F0(is)3.356 E .344 -(the size of)102 354 R F3(args)2.844 E F0 .344(\(in elements\).)2.844 F -F3(argc)5.344 E F0(and)2.844 E F3(argv)2.844 E F0 .344(are the ar)2.844 -F .344(gument count and ar)-.18 F .344(gument v)-.18 F .344(ector to e) --.15 F .343(xtract op-)-.15 F 1.127(tion from.)102 366 R F3(optind)6.127 -E F0 1.127(is a pointer to an inte)3.627 F 1.127(ger where the inde)-.15 -F 3.627(xt)-.15 G 3.628(ot)-3.627 G 1.128(he last processed ar)-3.628 F -1.128(gument is stored, it)-.18 F -(must be initialised to the \214rst inde)102 378 Q 2.5(x\()-.15 G -(minus one\) to process \(normally 0\) before the \214rst call.)-2.5 E -F3(arg_printusage)102 396 Q F0(tak)4.178 E 4.178(et)-.1 G 1.678(he same) --4.178 F F3(args)4.178 E F0(and)4.178 E F3(num_args)4.178 E F0 1.678 -(as getar)4.178 F(g;)-.18 E F3 1.677(progname is the name of)4.178 F -6.381(the program \(to be)102 408 R F0(progname0)12.381 E F3(0)12.381 E -F0(progname1)A F3(1)12.381 E F0(progname2)A F3(2)12.382 E F0(progname3)A -F3(3)12.382 E F0(progname4)A F3(4)102 420 Q F0(progname5)A F3 -(extra_string)3.404 E F0 .904 -(is a string to print after the actual options to indicate more ar)3.404 -F .904(guments. The)-.18 F .025(usefulness of this function is realised\ - only be people who has used programs that has help strings that doesn') -102 432 R(t)-.18 E(match what the code does.)102 444 Q(The)102 462 Q F3 -(getargs)2.5 E F0(struct has the follo)2.5 E(wing elements.)-.25 E/F5 10 -/Courier@0 SF(struct getargs{)102 504 Q(const char)126 516 Q F4(*)6 E F5 -(long_name;)A(char short_name;)126 528 Q(enum { arg_integer,)126 540 Q -(arg_string,)165 552 Q(arg_flag,)165 564 Q(arg_negative_flag,)165 576 Q -(arg_strings,)165 588 Q(arg_double,)165 600 Q(arg_collect)168 612 Q 6 -(}t)126 624 S(ype;)-6 E(void)126 636 Q F4(*)6 E F5(value;)A(const char) -126 648 Q F4(*)6 E F5(help;)A(const char)126 660 Q F4(*)6 E F5 -(arg_help;)A(};)102 672 Q F3(long_name)102 690 Q F0 .207 -(is the long name of the option, it can be)2.707 F F5(NULL)2.706 E F0 -2.706(,i)C 2.706(fy)-2.706 G .206(ou don')-2.706 F 2.706(tw)-.18 G .206 -(ant a long name.)-2.806 F F3(short_name)5.206 E F0 .397(is the charact\ -ed to use as short option, it can be zero. If the option has a v)102 702 -R .398(alue the)-.25 F F3(value)2.898 E F0 .398 -(\214eld gets \214lled in)2.898 F -.4(RO)77 750 S 152.325(KEN September) -.4 F(24, 1999)2.5 E(1)188.865 E EP -%%Page: 2 2 -%%BeginPageSetup -BP -%%EndPageSetup -/F0 10/Times-Roman@0 SF(GET)72 48 Q -.834(ARG \( 3 \))-.93 F -(OpenBSD Programmer')111.062 E 2.5(sM)-.55 G 108.562(anual GET)-2.5 F --.834(ARG \( 3 \))-.93 F .737(with that v)102 96 R .737 -(alue interpreted as speci\214ed by the)-.25 F/F1 10/Courier-Oblique@0 -SF(type)3.237 E F0(\214eld.)3.237 E F1(help)5.737 E F0 .737 -(is a longer help string for the option as a)3.237 F 2.833 -(whole, if it')102 108 R(s)-.55 E/F2 10/Courier@0 SF(NULL)5.333 E F0 -2.833(the help te)5.333 F 2.833(xt for the option is omitted \(b)-.15 F -2.834(ut it')-.2 F 5.334(ss)-.55 G 2.834 -(till displayed in the synopsis\).)-5.334 F F1(arg_help)102 120 Q F0 -.391(is a description of the ar)2.891 F .391(gument, if)-.18 F F2(NULL) -2.891 E F0 2.891(ad)2.891 G(ef)-2.891 E .39(ault v)-.1 F .39 -(alue will be used, depending on the type of)-.25 F(the option:)102 132 -Q(ar)102 150 Q(g_inte)-.18 E 59.29(ger the)-.15 F(ar)2.5 E -(gument is a signed inte)-.18 E(ger)-.15 E 2.5(,a)-.4 G(nd)-2.5 E F1 -(value)2.5 E F0(should point to an)2.5 E F1(int)2.5 E F0(.)A F1 -(arg_string)102 168 Q F0(the ar)47 E(gument is a string, and)-.18 E F1 -(value)2.5 E F0(should point to a)2.5 E F1(char)2.5 E/F3 10/Symbol SF(*) -A F0(.)A F1(arg_flag)102 186 Q F0 .4(the ar)59 F .4 -(gument is a \215ag, and)-.18 F F1(value)2.9 E F0 .4(should point to a) -2.9 F F1(int)2.9 E F0 2.9(.I)C 2.9(tg)-2.9 G .4 -(ets \214lled in with ei-)-2.9 F 1.154 -(ther zero or one, depending on ho)209 198 R 3.654(wt)-.25 G 1.153 -(he option is gi)-3.654 F -.15(ve)-.25 G 1.153 -(n, the normal case beeing).15 F .526(one. Note that if the option isn') -209 210 R 3.026(tg)-.18 G -2.15 -.25(iv e)-3.026 H .526(n, the v).25 F -.526(alue isn')-.25 F 3.026(ta)-.18 G .527(ltered, so it should be ini-) --3.026 F(tialised to some useful def)209 222 Q(ault.)-.1 E F1 -(arg_negative_flag)102 240 Q F0 .058(this is the same as)2.558 F F1 -(arg_flag)2.558 E F0 -.2(bu)2.558 G 2.558(ti).2 G 2.558(tr)-2.558 G --2.15 -.25(ev e)-2.558 H .057(rses the meaning of the \215ag \(a gi).25 -F -.15(ve)-.25 G 2.557(ns).15 G(hort)-2.557 E -(option clears the \215ag\), and the synopsis of a long option is ne)209 -252 Q -.05(ga)-.15 G(ted.).05 E F1(arg_strings)102 270 Q F0 .195(the ar) -41 F .195(gument can be gi)-.18 F -.15(ve)-.25 G 2.695(nm).15 G .195 -(ultiple times, and the v)-2.695 F .195 -(alues are collected in an array;)-.25 F F1(value)209 282 Q F0 .947 -(should be a pointer to a)3.447 F F1 .947(struct getarg_strings)3.447 F -F0 .947(structure, which)3.447 F(holds a length and a string pointer)209 -294 Q(.)-.55 E F1(arg_double)102 312 Q F0(ar)47 E .538 -(gument is a double precision \215oating point v)-.18 F .539(alue, and) --.25 F F1(value)3.039 E F0 .539(should point to a)3.039 F F1(double)209 -324 Q F0(.)A F1(arg_collect)102 342 Q F0(allo)41 E .345 -(ws more \214ne-grained control of the option parsing process.)-.25 F F1 -(value)5.344 E F0 .344(should be)2.844 F 2.5(ap)209 354 S(ointer to a) --2.5 E F1(getarg_collect_info)2.5 E F0(structure:)2.5 E F2 -(typedef int \()209 372 Q F3(*)A F2 -(getarg_collect_func\)\(int short_opt,)A(int argc,)407 384 Q(char)407 -396 Q F3(**)6 E F2(argv,)A(int)407 408 Q F3(*)6 E F2(optind,)A(int)407 -420 Q F3(*)6 E F2(optarg,)A(void)407 432 Q F3(*)6 E F2(data\);)A -(typedef struct getarg_collect_info {)209 456 Q -(getarg_collect_func func;)233 468 Q(void)233 480 Q F3(*)6 E F2(data;)A -6(}g)209 492 S(etarg_collect_info;)-6 E F0 -.4(Wi)209 510 S 1.018 -(th the).4 F F1(func)3.518 E F0 1.019 -(member set to a function to call, and)3.518 F F1(data)3.519 E F0 1.019 -(to some application)3.519 F -(speci\214c data. The parameters to the collect function are:)209 522 Q -F1(short_flag)209 540 Q F0 -(non-zero if this call is via a short option \215ag, zero otherwise)2.5 -E F1(argc)209 558 Q F0(,)A F1(argv)6 E F0(the whole ar)2.5 E -(gument list)-.18 E F1(optind)209 576 Q F0(pointer to the inde)2.5 E 2.5 -(xi)-.15 G 2.5(na)-2.5 G -.18(rg)-2.5 G 2.5(vw).18 G(here the \215ag is) --2.5 E F1(optarg)209 594 Q F0(pointer to the inde)2.5 E 2.5(xi)-.15 G -2.5(na)-2.5 G -.18(rg)-2.5 G(v[).18 E F3(*)A F0 -(optind] where the \215ag name starts)A F1(data)209 612 Q F0 -(application speci\214c data)2.5 E -1.1(Yo)209 630 S 3.915(uc)1.1 G -1.415(an modify)-3.915 F F3(*)3.915 E F1(optind)A F0 3.915(,a)C(nd) --3.915 E F3(*)3.915 E F1(optarg)A F0 3.915(,b)C 1.414 -(ut to do this correct you \(more or)-4.115 F(less\) ha)209 642 Q .3 --.15(ve t)-.2 H 2.5(ok).15 G(no)-2.5 E 2.5(wa)-.25 G(bout the inner w) --2.5 E(orkings of getar)-.1 E(g.)-.18 E -1.1(Yo)209 666 S 3.604(uc)1.1 G -1.104(an skip parts of ar)-3.604 F 1.105(guments by increasing)-.18 F F3 -(*)3.605 E F1(optarg)A F0 1.105(\(you could implement)3.605 F(the)209 -678 Q/F4 10/Courier-Bold@0 SF4.567 E F1(3)A F0 .401 -(set of \215ags from)2.901 F F4(gzip)2.9 E F0 .4 -(with this\), or whole ar)2.9 F .4(gument strings by increas-)-.18 F -(ing)209 690 Q F3(*)3.275 E F1(optind)A F0(\(let')3.275 E 3.276(ss)-.55 -G .776(ay you w)-3.276 F .776(ant a \215ag)-.1 F F44.942 E F1 -6.776(xyz)6.776 G F0 .776(to specify a coordinate\); if)-3.5 F -(you also ha)209 702 Q .3 -.15(ve t)-.2 H 2.5(os).15 G(et)-2.5 E F3(*) -2.5 E F1(optarg)A F0(to a sane v)2.5 E(alue.)-.25 E -.4(RO)77 750 S -152.325(KEN September).4 F(24, 1999)2.5 E(2)188.865 E EP -%%Page: 3 3 -%%BeginPageSetup -BP -%%EndPageSetup -/F0 10/Times-Roman@0 SF(GET)72 48 Q -.834(ARG \( 3 \))-.93 F -(OpenBSD Programmer')111.062 E 2.5(sM)-.55 G 108.562(anual GET)-2.5 F --.834(ARG \( 3 \))-.93 F 9.449 -(The collect function should return one of)209 96 R/F1 10/Courier@0 SF -(ARG_ERR_NO_MATCH)11.948 E F0(,)A F1(ARG_ERR_BAD_ARG)209 108 Q F0(,)A F1 -(ARG_ERR_NO_ARG)6 E F0(on error)2.5 E 2.5(,z)-.4 G(ero otherwise.)-2.5 E --.15(Fo)209 126 S 4.042(ry).15 G 1.542(our con)-4.042 F -.15(ve)-.4 G -1.542(nience there is a function,).15 F/F2 10/Courier-Bold@0 SF -(getarg_optarg)4.042 E F0 1.542(\(\), that returns the)B 1.251 -(traditional ar)209 138 R 1.251(gument string, and you pass it all ar) --.18 F 1.251(guments, sans data, that where)-.18 F(gi)209 150 Q -.15(ve) --.25 G 2.5(nt).15 G 2.5(ot)-2.5 G(he collection function.)-2.5 E(Don') -209 168 Q 2.5(tu)-.18 G(se this more this unless you absolutely ha)-2.5 -E .3 -.15(ve t)-.2 H(o.).15 E .213(Option parsing is similar to what)102 -186 R F1(getopt)2.713 E F0 .214(uses. Short options without ar)2.714 F -.214(guments can be compressed \()-.18 F F2(\255xyz)1.666 E F0 .207 -(is the same as)102 198 R F2 1.8734.373 F F0 .207 -(\), and short options with ar)B .207(guments tak)-.18 F 2.706(et)-.1 G -.206(hese as either the rest of the ar)-2.706 F(gv-string)-.18 E -(or as the ne)102 210 Q(xt option \()-.15 E F21.666 E/F3 10 -/Courier-Oblique@0 SF(foo)A F0 2.5(,o)C(r)-2.5 E F24.166 E F3(foo) -6 E F0(\).)A .78(Long option names are pre\214x)102 228 R .781 -(ed with -- \(double dash\), and the v)-.15 F .781 -(alue with a = \(equal\),)-.25 F F2(\255-foo=)4.947 E F3(bar)A F0 3.281 -(.L)C(ong)-3.281 E 3.815 -(option \215ags can either be speci\214ed as the)102 240 R 6.315(ya)-.15 -G 3.815(re \()-6.315 F F2(\255-help)1.666 E F0 3.815 -(\), or with an \(boolean parsable\) option)B(\()102 252 Q F2 -(\255-help=)1.666 E F3(yes)A F0(,)A F2(\255-help=)5.659 E F3(true)A F0 -3.993(,o)C 3.993(rs)-3.993 G 1.493(imilar\), or the)-3.993 F 3.993(yc) --.15 G 1.493(an also be ne)-3.993 F -.05(ga)-.15 G 1.493(ted \().05 F F2 -(\255-no-help)1.666 E F0 1.493(is the same as)3.993 F F2(\255-help=) -103.666 264 Q F0 1.363(no\), and if you')B 1.362 -(re really confused you can do it multiple times \()-.5 F F2 -(\255-no-no-help=)1.666 E F3(false)A F0 3.862(,o)C(r)-3.862 E -2.15 -.25 -(ev e)102 276 T(n).25 E F2(\255-no-no-help=)4.166 E F3(maybe)A F0(\).)A -/F4 10/Times-Bold@0 SF(EXAMPLE)72 300 Q F1(#include )102 330 Q -(#include )102 342 Q(#include )102 354 Q(char)102 -378 Q/F5 10/Symbol SF(*)6 E F1(source = "Ouagadougou";)A(char)102 390 Q -F5(*)6 E F1(destination;)A(int weight;)102 402 Q -(int include_catalog = 1;)102 414 Q(int help_flag;)102 426 Q -(struct getargs args[] = {)102 450 Q 6({")126 462 S 30(source", 's',)-6 -F 6(arg_string, &source,)6 F("source of shippment", "city" },)138 474 Q -6({")126 486 S(destination", 'd', arg_string,)-6 E(&destination,)12 E -("destination of shippment", "city" },)138 498 Q 6({")126 510 S 30 -(weight", 'w',)-6 F(arg_integer, &weight,)6 E -("weight of shippment", "tons" },)138 522 Q 6({")126 534 S 24 -(catalog", 'c',)-6 F(arg_negative_flag, &include_catalog,)6 E -("include product catalog" },)138 546 Q 6({")126 558 S 42(help", 'h',)-6 -F(arg_flag, &help_flag })6 E(};)102 570 Q -(int num_args = sizeof\(args\) / sizeof\(args[0]\); /)102 594 Q F5(*)A -F1(number of elements in args)6 E F5(*)6 E F1(/)A(const char)102 618 Q -F5(*)6 E F1(progname = "ship++";)A(int)102 642 Q(main\(int argc, char) -102 654 Q F5(**)6 E F1(argv\))A({)102 666 Q(int optind = 0;)126 678 Q -(if \(getarg\(args, num_args, argc, argv, &optind\)\) {)126 690 Q -(arg_printusage\(args, num_args, progname, "stuff..."\);)147 702 Q F0 --.4(RO)77 750 S 152.325(KEN September).4 F(24, 1999)2.5 E(3)188.865 E EP -%%Page: 4 4 -%%BeginPageSetup -BP -%%EndPageSetup -/F0 10/Times-Roman@0 SF(GET)72 48 Q -.834(ARG \( 3 \))-.93 F -(OpenBSD Programmer')111.062 E 2.5(sM)-.55 G 108.562(anual GET)-2.5 F --.834(ARG \( 3 \))-.93 F/F1 10/Courier@0 SF(exit \(1\);)147 96 Q(})126 -108 Q(if \(help_flag\) {)126 120 Q -(arg_printusage\(args, num_args, progname, "stuff..."\);)147 132 Q -(exit \(0\);)147 144 Q(})126 156 Q(if \(destination == NULL\) {)126 168 -Q(fprintf\(stderr, "%s: must specify destination0, progname\);)147 180 Q -(exit\(1\);)147 192 Q(})126 204 Q -(if \(strcmp\(source, destination\) == 0\) {)126 216 Q -(fprintf\(stderr, "%s: destination must be different from source0\);)147 -228 Q(exit\(1\);)147 240 Q(})126 252 Q(/)126 264 Q/F2 10/Symbol SF(*)A -F1(include more stuff here ...)6 E F2(*)6 E F1(/)A(exit\(2\);)126 276 Q -(})102 288 Q F0(The output help output from this program looks lik)102 -306 Q 2.5(et)-.1 G(his:)-2.5 E F1 6($s)102 324 S(hip++ --help)-6 E -(Usage: ship++ [--source=city] [-s city] [--destination=city] [-d city]) -102 336 Q -([--weight=tons] [-w tons] [--no-catalog] [-c] [--help] [-h] stuff...) -120 348 Q(-s city, --source=city)102 360 Q(source of shippment)36 E -(-d city, --destination=city destination of shippment)102 372 Q -(-w tons, --weight=tons)102 384 Q(weight of shippment)36 E -(-c, --no-catalog)102 396 Q(include product catalog)72 E/F3 10 -/Times-Bold@0 SF -.1(BU)72 432 S(GS).1 E F0 .9(It should be more \215e) -102 444 R .9(xible, so it w)-.15 F .901 -(ould be possible to use other more complicated option syntax)-.1 F .901 -(es, such as)-.15 F(what)102 456 Q F1(ps)3.167 E F0 .667(\(1\), and)B F1 -(tar)3.167 E F0 .666(\(1\), uses, or the AFS model where you can skip t\ -he \215ag names as long as the options)B(come in the correct order)102 -468 Q(.)-.55 E(Options with multiple ar)102 486 Q -(guments should be handled better)-.18 E(.)-.55 E(Should be inte)102 504 -Q(greated with SL.)-.15 E(It')102 522 Q 2.5(sv)-.55 G -(ery confusing that the struct you pass in is called getar)-2.65 E(gS.) --.18 E F3 1.666(SEE ALSO)72 546 R F1(getopt)102 558 Q F0(\(3\))A -.4(RO) -77 750 S 152.325(KEN September).4 F(24, 1999)2.5 E(4)188.865 E EP -%%Trailer -end -%%EOF diff --git a/ndb/src/common/util/md5-rfc1321.txt b/ndb/src/common/util/md5-rfc1321.txt deleted file mode 100644 index c9e09e00cce..00000000000 --- a/ndb/src/common/util/md5-rfc1321.txt +++ /dev/null @@ -1,1179 +0,0 @@ - - - - - - -Network Working Group R. Rivest -Request for Comments: 1321 MIT Laboratory for Computer Science - and RSA Data Security, Inc. - April 1992 - - - The MD5 Message-Digest Algorithm - -Status of this Memo - - This memo provides information for the Internet community. It does - not specify an Internet standard. Distribution of this memo is - unlimited. - -Acknowlegements - - We would like to thank Don Coppersmith, Burt Kaliski, Ralph Merkle, - David Chaum, and Noam Nisan for numerous helpful comments and - suggestions. - -Table of Contents - - 1. Executive Summary 1 - 2. Terminology and Notation 2 - 3. MD5 Algorithm Description 3 - 4. Summary 6 - 5. Differences Between MD4 and MD5 6 - References 7 - APPENDIX A - Reference Implementation 7 - Security Considerations 21 - Author's Address 21 - -1. Executive Summary - - This document describes the MD5 message-digest algorithm. The - algorithm takes as input a message of arbitrary length and produces - as output a 128-bit "fingerprint" or "message digest" of the input. - It is conjectured that it is computationally infeasible to produce - two messages having the same message digest, or to produce any - message having a given prespecified target message digest. The MD5 - algorithm is intended for digital signature applications, where a - large file must be "compressed" in a secure manner before being - encrypted with a private (secret) key under a public-key cryptosystem - such as RSA. - - - - - - - -Rivest [Page 1] - -RFC 1321 MD5 Message-Digest Algorithm April 1992 - - - The MD5 algorithm is designed to be quite fast on 32-bit machines. In - addition, the MD5 algorithm does not require any large substitution - tables; the algorithm can be coded quite compactly. - - The MD5 algorithm is an extension of the MD4 message-digest algorithm - 1,2]. MD5 is slightly slower than MD4, but is more "conservative" in - design. MD5 was designed because it was felt that MD4 was perhaps - being adopted for use more quickly than justified by the existing - critical review; because MD4 was designed to be exceptionally fast, - it is "at the edge" in terms of risking successful cryptanalytic - attack. MD5 backs off a bit, giving up a little in speed for a much - greater likelihood of ultimate security. It incorporates some - suggestions made by various reviewers, and contains additional - optimizations. The MD5 algorithm is being placed in the public domain - for review and possible adoption as a standard. - - For OSI-based applications, MD5's object identifier is - - md5 OBJECT IDENTIFIER ::= - iso(1) member-body(2) US(840) rsadsi(113549) digestAlgorithm(2) 5} - - In the X.509 type AlgorithmIdentifier [3], the parameters for MD5 - should have type NULL. - -2. Terminology and Notation - - In this document a "word" is a 32-bit quantity and a "byte" is an - eight-bit quantity. A sequence of bits can be interpreted in a - natural manner as a sequence of bytes, where each consecutive group - of eight bits is interpreted as a byte with the high-order (most - significant) bit of each byte listed first. Similarly, a sequence of - bytes can be interpreted as a sequence of 32-bit words, where each - consecutive group of four bytes is interpreted as a word with the - low-order (least significant) byte given first. - - Let x_i denote "x sub i". If the subscript is an expression, we - surround it in braces, as in x_{i+1}. Similarly, we use ^ for - superscripts (exponentiation), so that x^i denotes x to the i-th - power. - - Let the symbol "+" denote addition of words (i.e., modulo-2^32 - addition). Let X <<< s denote the 32-bit value obtained by circularly - shifting (rotating) X left by s bit positions. Let not(X) denote the - bit-wise complement of X, and let X v Y denote the bit-wise OR of X - and Y. Let X xor Y denote the bit-wise XOR of X and Y, and let XY - denote the bit-wise AND of X and Y. - - - - - -Rivest [Page 2] - -RFC 1321 MD5 Message-Digest Algorithm April 1992 - - -3. MD5 Algorithm Description - - We begin by supposing that we have a b-bit message as input, and that - we wish to find its message digest. Here b is an arbitrary - nonnegative integer; b may be zero, it need not be a multiple of - eight, and it may be arbitrarily large. We imagine the bits of the - message written down as follows: - - m_0 m_1 ... m_{b-1} - - The following five steps are performed to compute the message digest - of the message. - -3.1 Step 1. Append Padding Bits - - The message is "padded" (extended) so that its length (in bits) is - congruent to 448, modulo 512. That is, the message is extended so - that it is just 64 bits shy of being a multiple of 512 bits long. - Padding is always performed, even if the length of the message is - already congruent to 448, modulo 512. - - Padding is performed as follows: a single "1" bit is appended to the - message, and then "0" bits are appended so that the length in bits of - the padded message becomes congruent to 448, modulo 512. In all, at - least one bit and at most 512 bits are appended. - -3.2 Step 2. Append Length - - A 64-bit representation of b (the length of the message before the - padding bits were added) is appended to the result of the previous - step. In the unlikely event that b is greater than 2^64, then only - the low-order 64 bits of b are used. (These bits are appended as two - 32-bit words and appended low-order word first in accordance with the - previous conventions.) - - At this point the resulting message (after padding with bits and with - b) has a length that is an exact multiple of 512 bits. Equivalently, - this message has a length that is an exact multiple of 16 (32-bit) - words. Let M[0 ... N-1] denote the words of the resulting message, - where N is a multiple of 16. - -3.3 Step 3. Initialize MD Buffer - - A four-word buffer (A,B,C,D) is used to compute the message digest. - Here each of A, B, C, D is a 32-bit register. These registers are - initialized to the following values in hexadecimal, low-order bytes - first): - - - - -Rivest [Page 3] - -RFC 1321 MD5 Message-Digest Algorithm April 1992 - - - word A: 01 23 45 67 - word B: 89 ab cd ef - word C: fe dc ba 98 - word D: 76 54 32 10 - -3.4 Step 4. Process Message in 16-Word Blocks - - We first define four auxiliary functions that each take as input - three 32-bit words and produce as output one 32-bit word. - - F(X,Y,Z) = XY v not(X) Z - G(X,Y,Z) = XZ v Y not(Z) - H(X,Y,Z) = X xor Y xor Z - I(X,Y,Z) = Y xor (X v not(Z)) - - In each bit position F acts as a conditional: if X then Y else Z. - The function F could have been defined using + instead of v since XY - and not(X)Z will never have 1's in the same bit position.) It is - interesting to note that if the bits of X, Y, and Z are independent - and unbiased, the each bit of F(X,Y,Z) will be independent and - unbiased. - - The functions G, H, and I are similar to the function F, in that they - act in "bitwise parallel" to produce their output from the bits of X, - Y, and Z, in such a manner that if the corresponding bits of X, Y, - and Z are independent and unbiased, then each bit of G(X,Y,Z), - H(X,Y,Z), and I(X,Y,Z) will be independent and unbiased. Note that - the function H is the bit-wise "xor" or "parity" function of its - inputs. - - This step uses a 64-element table T[1 ... 64] constructed from the - sine function. Let T[i] denote the i-th element of the table, which - is equal to the integer part of 4294967296 times abs(sin(i)), where i - is in radians. The elements of the table are given in the appendix. - - Do the following: - - /* Process each 16-word block. */ - For i = 0 to N/16-1 do - - /* Copy block i into X. */ - For j = 0 to 15 do - Set X[j] to M[i*16+j]. - end /* of loop on j */ - - /* Save A as AA, B as BB, C as CC, and D as DD. */ - AA = A - BB = B - - - -Rivest [Page 4] - -RFC 1321 MD5 Message-Digest Algorithm April 1992 - - - CC = C - DD = D - - /* Round 1. */ - /* Let [abcd k s i] denote the operation - a = b + ((a + F(b,c,d) + X[k] + T[i]) <<< s). */ - /* Do the following 16 operations. */ - [ABCD 0 7 1] [DABC 1 12 2] [CDAB 2 17 3] [BCDA 3 22 4] - [ABCD 4 7 5] [DABC 5 12 6] [CDAB 6 17 7] [BCDA 7 22 8] - [ABCD 8 7 9] [DABC 9 12 10] [CDAB 10 17 11] [BCDA 11 22 12] - [ABCD 12 7 13] [DABC 13 12 14] [CDAB 14 17 15] [BCDA 15 22 16] - - /* Round 2. */ - /* Let [abcd k s i] denote the operation - a = b + ((a + G(b,c,d) + X[k] + T[i]) <<< s). */ - /* Do the following 16 operations. */ - [ABCD 1 5 17] [DABC 6 9 18] [CDAB 11 14 19] [BCDA 0 20 20] - [ABCD 5 5 21] [DABC 10 9 22] [CDAB 15 14 23] [BCDA 4 20 24] - [ABCD 9 5 25] [DABC 14 9 26] [CDAB 3 14 27] [BCDA 8 20 28] - [ABCD 13 5 29] [DABC 2 9 30] [CDAB 7 14 31] [BCDA 12 20 32] - - /* Round 3. */ - /* Let [abcd k s t] denote the operation - a = b + ((a + H(b,c,d) + X[k] + T[i]) <<< s). */ - /* Do the following 16 operations. */ - [ABCD 5 4 33] [DABC 8 11 34] [CDAB 11 16 35] [BCDA 14 23 36] - [ABCD 1 4 37] [DABC 4 11 38] [CDAB 7 16 39] [BCDA 10 23 40] - [ABCD 13 4 41] [DABC 0 11 42] [CDAB 3 16 43] [BCDA 6 23 44] - [ABCD 9 4 45] [DABC 12 11 46] [CDAB 15 16 47] [BCDA 2 23 48] - - /* Round 4. */ - /* Let [abcd k s t] denote the operation - a = b + ((a + I(b,c,d) + X[k] + T[i]) <<< s). */ - /* Do the following 16 operations. */ - [ABCD 0 6 49] [DABC 7 10 50] [CDAB 14 15 51] [BCDA 5 21 52] - [ABCD 12 6 53] [DABC 3 10 54] [CDAB 10 15 55] [BCDA 1 21 56] - [ABCD 8 6 57] [DABC 15 10 58] [CDAB 6 15 59] [BCDA 13 21 60] - [ABCD 4 6 61] [DABC 11 10 62] [CDAB 2 15 63] [BCDA 9 21 64] - - /* Then perform the following additions. (That is increment each - of the four registers by the value it had before this block - was started.) */ - A = A + AA - B = B + BB - C = C + CC - D = D + DD - - end /* of loop on i */ - - - -Rivest [Page 5] - -RFC 1321 MD5 Message-Digest Algorithm April 1992 - - -3.5 Step 5. Output - - The message digest produced as output is A, B, C, D. That is, we - begin with the low-order byte of A, and end with the high-order byte - of D. - - This completes the description of MD5. A reference implementation in - C is given in the appendix. - -4. Summary - - The MD5 message-digest algorithm is simple to implement, and provides - a "fingerprint" or message digest of a message of arbitrary length. - It is conjectured that the difficulty of coming up with two messages - having the same message digest is on the order of 2^64 operations, - and that the difficulty of coming up with any message having a given - message digest is on the order of 2^128 operations. The MD5 algorithm - has been carefully scrutinized for weaknesses. It is, however, a - relatively new algorithm and further security analysis is of course - justified, as is the case with any new proposal of this sort. - -5. Differences Between MD4 and MD5 - - The following are the differences between MD4 and MD5: - - 1. A fourth round has been added. - - 2. Each step now has a unique additive constant. - - 3. The function g in round 2 was changed from (XY v XZ v YZ) to - (XZ v Y not(Z)) to make g less symmetric. - - 4. Each step now adds in the result of the previous step. This - promotes a faster "avalanche effect". - - 5. The order in which input words are accessed in rounds 2 and - 3 is changed, to make these patterns less like each other. - - 6. The shift amounts in each round have been approximately - optimized, to yield a faster "avalanche effect." The shifts in - different rounds are distinct. - - - - - - - - - - -Rivest [Page 6] - -RFC 1321 MD5 Message-Digest Algorithm April 1992 - - -References - - [1] Rivest, R., "The MD4 Message Digest Algorithm", RFC 1320, MIT and - RSA Data Security, Inc., April 1992. - - [2] Rivest, R., "The MD4 message digest algorithm", in A.J. Menezes - and S.A. Vanstone, editors, Advances in Cryptology - CRYPTO '90 - Proceedings, pages 303-311, Springer-Verlag, 1991. - - [3] CCITT Recommendation X.509 (1988), "The Directory - - Authentication Framework." - -APPENDIX A - Reference Implementation - - This appendix contains the following files taken from RSAREF: A - Cryptographic Toolkit for Privacy-Enhanced Mail: - - global.h -- global header file - - md5.h -- header file for MD5 - - md5c.c -- source code for MD5 - - For more information on RSAREF, send email to . - - The appendix also includes the following file: - - mddriver.c -- test driver for MD2, MD4 and MD5 - - The driver compiles for MD5 by default but can compile for MD2 or MD4 - if the symbol MD is defined on the C compiler command line as 2 or 4. - - The implementation is portable and should work on many different - plaforms. However, it is not difficult to optimize the implementation - on particular platforms, an exercise left to the reader. For example, - on "little-endian" platforms where the lowest-addressed byte in a 32- - bit word is the least significant and there are no alignment - restrictions, the call to Decode in MD5Transform can be replaced with - a typecast. - -A.1 global.h - -/* GLOBAL.H - RSAREF types and constants - */ - -/* PROTOTYPES should be set to one if and only if the compiler supports - function argument prototyping. -The following makes PROTOTYPES default to 0 if it has not already - - - -Rivest [Page 7] - -RFC 1321 MD5 Message-Digest Algorithm April 1992 - - - been defined with C compiler flags. - */ -#ifndef PROTOTYPES -#define PROTOTYPES 0 -#endif - -/* POINTER defines a generic pointer type */ -typedef unsigned char *POINTER; - -/* UINT2 defines a two byte word */ -typedef unsigned short int UINT2; - -/* UINT4 defines a four byte word */ -typedef unsigned long int UINT4; - -/* PROTO_LIST is defined depending on how PROTOTYPES is defined above. -If using PROTOTYPES, then PROTO_LIST returns the list, otherwise it - returns an empty list. - */ -#if PROTOTYPES -#define PROTO_LIST(list) list -#else -#define PROTO_LIST(list) () -#endif - -A.2 md5.h - -/* MD5.H - header file for MD5C.C - */ - -/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All -rights reserved. - -License to copy and use this software is granted provided that it -is identified as the "RSA Data Security, Inc. MD5 Message-Digest -Algorithm" in all material mentioning or referencing this software -or this function. - -License is also granted to make and use derivative works provided -that such works are identified as "derived from the RSA Data -Security, Inc. MD5 Message-Digest Algorithm" in all material -mentioning or referencing the derived work. - -RSA Data Security, Inc. makes no representations concerning either -the merchantability of this software or the suitability of this -software for any particular purpose. It is provided "as is" -without express or implied warranty of any kind. - - - - -Rivest [Page 8] - -RFC 1321 MD5 Message-Digest Algorithm April 1992 - - -These notices must be retained in any copies of any part of this -documentation and/or software. - */ - -/* MD5 context. */ -typedef struct { - UINT4 state[4]; /* state (ABCD) */ - UINT4 count[2]; /* number of bits, modulo 2^64 (lsb first) */ - unsigned char buffer[64]; /* input buffer */ -} MD5_CTX; - -void MD5Init PROTO_LIST ((MD5_CTX *)); -void MD5Update PROTO_LIST - ((MD5_CTX *, unsigned char *, unsigned int)); -void MD5Final PROTO_LIST ((unsigned char [16], MD5_CTX *)); - -A.3 md5c.c - -/* MD5C.C - RSA Data Security, Inc., MD5 message-digest algorithm - */ - -/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All -rights reserved. - -License to copy and use this software is granted provided that it -is identified as the "RSA Data Security, Inc. MD5 Message-Digest -Algorithm" in all material mentioning or referencing this software -or this function. - -License is also granted to make and use derivative works provided -that such works are identified as "derived from the RSA Data -Security, Inc. MD5 Message-Digest Algorithm" in all material -mentioning or referencing the derived work. - -RSA Data Security, Inc. makes no representations concerning either -the merchantability of this software or the suitability of this -software for any particular purpose. It is provided "as is" -without express or implied warranty of any kind. - -These notices must be retained in any copies of any part of this -documentation and/or software. - */ - -#include "global.h" -#include "md5.h" - -/* Constants for MD5Transform routine. - */ - - - -Rivest [Page 9] - -RFC 1321 MD5 Message-Digest Algorithm April 1992 - - -#define S11 7 -#define S12 12 -#define S13 17 -#define S14 22 -#define S21 5 -#define S22 9 -#define S23 14 -#define S24 20 -#define S31 4 -#define S32 11 -#define S33 16 -#define S34 23 -#define S41 6 -#define S42 10 -#define S43 15 -#define S44 21 - -static void MD5Transform PROTO_LIST ((UINT4 [4], unsigned char [64])); -static void Encode PROTO_LIST - ((unsigned char *, UINT4 *, unsigned int)); -static void Decode PROTO_LIST - ((UINT4 *, unsigned char *, unsigned int)); -static void MD5_memcpy PROTO_LIST ((POINTER, POINTER, unsigned int)); -static void MD5_memset PROTO_LIST ((POINTER, int, unsigned int)); - -static unsigned char PADDING[64] = { - 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -}; - -/* F, G, H and I are basic MD5 functions. - */ -#define F(x, y, z) (((x) & (y)) | ((~x) & (z))) -#define G(x, y, z) (((x) & (z)) | ((y) & (~z))) -#define H(x, y, z) ((x) ^ (y) ^ (z)) -#define I(x, y, z) ((y) ^ ((x) | (~z))) - -/* ROTATE_LEFT rotates x left n bits. - */ -#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n)))) - -/* FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4. -Rotation is separate from addition to prevent recomputation. - */ -#define FF(a, b, c, d, x, s, ac) { \ - (a) += F ((b), (c), (d)) + (x) + (UINT4)(ac); \ - (a) = ROTATE_LEFT ((a), (s)); \ - - - -Rivest [Page 10] - -RFC 1321 MD5 Message-Digest Algorithm April 1992 - - - (a) += (b); \ - } -#define GG(a, b, c, d, x, s, ac) { \ - (a) += G ((b), (c), (d)) + (x) + (UINT4)(ac); \ - (a) = ROTATE_LEFT ((a), (s)); \ - (a) += (b); \ - } -#define HH(a, b, c, d, x, s, ac) { \ - (a) += H ((b), (c), (d)) + (x) + (UINT4)(ac); \ - (a) = ROTATE_LEFT ((a), (s)); \ - (a) += (b); \ - } -#define II(a, b, c, d, x, s, ac) { \ - (a) += I ((b), (c), (d)) + (x) + (UINT4)(ac); \ - (a) = ROTATE_LEFT ((a), (s)); \ - (a) += (b); \ - } - -/* MD5 initialization. Begins an MD5 operation, writing a new context. - */ -void MD5Init (context) -MD5_CTX *context; /* context */ -{ - context->count[0] = context->count[1] = 0; - /* Load magic initialization constants. -*/ - context->state[0] = 0x67452301; - context->state[1] = 0xefcdab89; - context->state[2] = 0x98badcfe; - context->state[3] = 0x10325476; -} - -/* MD5 block update operation. Continues an MD5 message-digest - operation, processing another message block, and updating the - context. - */ -void MD5Update (context, input, inputLen) -MD5_CTX *context; /* context */ -unsigned char *input; /* input block */ -unsigned int inputLen; /* length of input block */ -{ - unsigned int i, index, partLen; - - /* Compute number of bytes mod 64 */ - index = (unsigned int)((context->count[0] >> 3) & 0x3F); - - /* Update number of bits */ - if ((context->count[0] += ((UINT4)inputLen << 3)) - - - -Rivest [Page 11] - -RFC 1321 MD5 Message-Digest Algorithm April 1992 - - - < ((UINT4)inputLen << 3)) - context->count[1]++; - context->count[1] += ((UINT4)inputLen >> 29); - - partLen = 64 - index; - - /* Transform as many times as possible. -*/ - if (inputLen >= partLen) { - MD5_memcpy - ((POINTER)&context->buffer[index], (POINTER)input, partLen); - MD5Transform (context->state, context->buffer); - - for (i = partLen; i + 63 < inputLen; i += 64) - MD5Transform (context->state, &input[i]); - - index = 0; - } - else - i = 0; - - /* Buffer remaining input */ - MD5_memcpy - ((POINTER)&context->buffer[index], (POINTER)&input[i], - inputLen-i); -} - -/* MD5 finalization. Ends an MD5 message-digest operation, writing the - the message digest and zeroizing the context. - */ -void MD5Final (digest, context) -unsigned char digest[16]; /* message digest */ -MD5_CTX *context; /* context */ -{ - unsigned char bits[8]; - unsigned int index, padLen; - - /* Save number of bits */ - Encode (bits, context->count, 8); - - /* Pad out to 56 mod 64. -*/ - index = (unsigned int)((context->count[0] >> 3) & 0x3f); - padLen = (index < 56) ? (56 - index) : (120 - index); - MD5Update (context, PADDING, padLen); - - /* Append length (before padding) */ - MD5Update (context, bits, 8); - - - -Rivest [Page 12] - -RFC 1321 MD5 Message-Digest Algorithm April 1992 - - - /* Store state in digest */ - Encode (digest, context->state, 16); - - /* Zeroize sensitive information. -*/ - MD5_memset ((POINTER)context, 0, sizeof (*context)); -} - -/* MD5 basic transformation. Transforms state based on block. - */ -static void MD5Transform (state, block) -UINT4 state[4]; -unsigned char block[64]; -{ - UINT4 a = state[0], b = state[1], c = state[2], d = state[3], x[16]; - - Decode (x, block, 64); - - /* Round 1 */ - FF (a, b, c, d, x[ 0], S11, 0xd76aa478); /* 1 */ - FF (d, a, b, c, x[ 1], S12, 0xe8c7b756); /* 2 */ - FF (c, d, a, b, x[ 2], S13, 0x242070db); /* 3 */ - FF (b, c, d, a, x[ 3], S14, 0xc1bdceee); /* 4 */ - FF (a, b, c, d, x[ 4], S11, 0xf57c0faf); /* 5 */ - FF (d, a, b, c, x[ 5], S12, 0x4787c62a); /* 6 */ - FF (c, d, a, b, x[ 6], S13, 0xa8304613); /* 7 */ - FF (b, c, d, a, x[ 7], S14, 0xfd469501); /* 8 */ - FF (a, b, c, d, x[ 8], S11, 0x698098d8); /* 9 */ - FF (d, a, b, c, x[ 9], S12, 0x8b44f7af); /* 10 */ - FF (c, d, a, b, x[10], S13, 0xffff5bb1); /* 11 */ - FF (b, c, d, a, x[11], S14, 0x895cd7be); /* 12 */ - FF (a, b, c, d, x[12], S11, 0x6b901122); /* 13 */ - FF (d, a, b, c, x[13], S12, 0xfd987193); /* 14 */ - FF (c, d, a, b, x[14], S13, 0xa679438e); /* 15 */ - FF (b, c, d, a, x[15], S14, 0x49b40821); /* 16 */ - - /* Round 2 */ - GG (a, b, c, d, x[ 1], S21, 0xf61e2562); /* 17 */ - GG (d, a, b, c, x[ 6], S22, 0xc040b340); /* 18 */ - GG (c, d, a, b, x[11], S23, 0x265e5a51); /* 19 */ - GG (b, c, d, a, x[ 0], S24, 0xe9b6c7aa); /* 20 */ - GG (a, b, c, d, x[ 5], S21, 0xd62f105d); /* 21 */ - GG (d, a, b, c, x[10], S22, 0x2441453); /* 22 */ - GG (c, d, a, b, x[15], S23, 0xd8a1e681); /* 23 */ - GG (b, c, d, a, x[ 4], S24, 0xe7d3fbc8); /* 24 */ - GG (a, b, c, d, x[ 9], S21, 0x21e1cde6); /* 25 */ - GG (d, a, b, c, x[14], S22, 0xc33707d6); /* 26 */ - GG (c, d, a, b, x[ 3], S23, 0xf4d50d87); /* 27 */ - - - -Rivest [Page 13] - -RFC 1321 MD5 Message-Digest Algorithm April 1992 - - - GG (b, c, d, a, x[ 8], S24, 0x455a14ed); /* 28 */ - GG (a, b, c, d, x[13], S21, 0xa9e3e905); /* 29 */ - GG (d, a, b, c, x[ 2], S22, 0xfcefa3f8); /* 30 */ - GG (c, d, a, b, x[ 7], S23, 0x676f02d9); /* 31 */ - GG (b, c, d, a, x[12], S24, 0x8d2a4c8a); /* 32 */ - - /* Round 3 */ - HH (a, b, c, d, x[ 5], S31, 0xfffa3942); /* 33 */ - HH (d, a, b, c, x[ 8], S32, 0x8771f681); /* 34 */ - HH (c, d, a, b, x[11], S33, 0x6d9d6122); /* 35 */ - HH (b, c, d, a, x[14], S34, 0xfde5380c); /* 36 */ - HH (a, b, c, d, x[ 1], S31, 0xa4beea44); /* 37 */ - HH (d, a, b, c, x[ 4], S32, 0x4bdecfa9); /* 38 */ - HH (c, d, a, b, x[ 7], S33, 0xf6bb4b60); /* 39 */ - HH (b, c, d, a, x[10], S34, 0xbebfbc70); /* 40 */ - HH (a, b, c, d, x[13], S31, 0x289b7ec6); /* 41 */ - HH (d, a, b, c, x[ 0], S32, 0xeaa127fa); /* 42 */ - HH (c, d, a, b, x[ 3], S33, 0xd4ef3085); /* 43 */ - HH (b, c, d, a, x[ 6], S34, 0x4881d05); /* 44 */ - HH (a, b, c, d, x[ 9], S31, 0xd9d4d039); /* 45 */ - HH (d, a, b, c, x[12], S32, 0xe6db99e5); /* 46 */ - HH (c, d, a, b, x[15], S33, 0x1fa27cf8); /* 47 */ - HH (b, c, d, a, x[ 2], S34, 0xc4ac5665); /* 48 */ - - /* Round 4 */ - II (a, b, c, d, x[ 0], S41, 0xf4292244); /* 49 */ - II (d, a, b, c, x[ 7], S42, 0x432aff97); /* 50 */ - II (c, d, a, b, x[14], S43, 0xab9423a7); /* 51 */ - II (b, c, d, a, x[ 5], S44, 0xfc93a039); /* 52 */ - II (a, b, c, d, x[12], S41, 0x655b59c3); /* 53 */ - II (d, a, b, c, x[ 3], S42, 0x8f0ccc92); /* 54 */ - II (c, d, a, b, x[10], S43, 0xffeff47d); /* 55 */ - II (b, c, d, a, x[ 1], S44, 0x85845dd1); /* 56 */ - II (a, b, c, d, x[ 8], S41, 0x6fa87e4f); /* 57 */ - II (d, a, b, c, x[15], S42, 0xfe2ce6e0); /* 58 */ - II (c, d, a, b, x[ 6], S43, 0xa3014314); /* 59 */ - II (b, c, d, a, x[13], S44, 0x4e0811a1); /* 60 */ - II (a, b, c, d, x[ 4], S41, 0xf7537e82); /* 61 */ - II (d, a, b, c, x[11], S42, 0xbd3af235); /* 62 */ - II (c, d, a, b, x[ 2], S43, 0x2ad7d2bb); /* 63 */ - II (b, c, d, a, x[ 9], S44, 0xeb86d391); /* 64 */ - - state[0] += a; - state[1] += b; - state[2] += c; - state[3] += d; - - /* Zeroize sensitive information. - - - -Rivest [Page 14] - -RFC 1321 MD5 Message-Digest Algorithm April 1992 - - -*/ - MD5_memset ((POINTER)x, 0, sizeof (x)); -} - -/* Encodes input (UINT4) into output (unsigned char). Assumes len is - a multiple of 4. - */ -static void Encode (output, input, len) -unsigned char *output; -UINT4 *input; -unsigned int len; -{ - unsigned int i, j; - - for (i = 0, j = 0; j < len; i++, j += 4) { - output[j] = (unsigned char)(input[i] & 0xff); - output[j+1] = (unsigned char)((input[i] >> 8) & 0xff); - output[j+2] = (unsigned char)((input[i] >> 16) & 0xff); - output[j+3] = (unsigned char)((input[i] >> 24) & 0xff); - } -} - -/* Decodes input (unsigned char) into output (UINT4). Assumes len is - a multiple of 4. - */ -static void Decode (output, input, len) -UINT4 *output; -unsigned char *input; -unsigned int len; -{ - unsigned int i, j; - - for (i = 0, j = 0; j < len; i++, j += 4) - output[i] = ((UINT4)input[j]) | (((UINT4)input[j+1]) << 8) | - (((UINT4)input[j+2]) << 16) | (((UINT4)input[j+3]) << 24); -} - -/* Note: Replace "for loop" with standard memcpy if possible. - */ - -static void MD5_memcpy (output, input, len) -POINTER output; -POINTER input; -unsigned int len; -{ - unsigned int i; - - for (i = 0; i < len; i++) - - - -Rivest [Page 15] - -RFC 1321 MD5 Message-Digest Algorithm April 1992 - - - output[i] = input[i]; -} - -/* Note: Replace "for loop" with standard memset if possible. - */ -static void MD5_memset (output, value, len) -POINTER output; -int value; -unsigned int len; -{ - unsigned int i; - - for (i = 0; i < len; i++) - ((char *)output)[i] = (char)value; -} - -A.4 mddriver.c - -/* MDDRIVER.C - test driver for MD2, MD4 and MD5 - */ - -/* Copyright (C) 1990-2, RSA Data Security, Inc. Created 1990. All -rights reserved. - -RSA Data Security, Inc. makes no representations concerning either -the merchantability of this software or the suitability of this -software for any particular purpose. It is provided "as is" -without express or implied warranty of any kind. - -These notices must be retained in any copies of any part of this -documentation and/or software. - */ - -/* The following makes MD default to MD5 if it has not already been - defined with C compiler flags. - */ -#ifndef MD -#define MD MD5 -#endif - -#include -#include -#include -#include "global.h" -#if MD == 2 -#include "md2.h" -#endif -#if MD == 4 - - - -Rivest [Page 16] - -RFC 1321 MD5 Message-Digest Algorithm April 1992 - - -#include "md4.h" -#endif -#if MD == 5 -#include "md5.h" -#endif - -/* Length of test block, number of test blocks. - */ -#define TEST_BLOCK_LEN 1000 -#define TEST_BLOCK_COUNT 1000 - -static void MDString PROTO_LIST ((char *)); -static void MDTimeTrial PROTO_LIST ((void)); -static void MDTestSuite PROTO_LIST ((void)); -static void MDFile PROTO_LIST ((char *)); -static void MDFilter PROTO_LIST ((void)); -static void MDPrint PROTO_LIST ((unsigned char [16])); - -#if MD == 2 -#define MD_CTX MD2_CTX -#define MDInit MD2Init -#define MDUpdate MD2Update -#define MDFinal MD2Final -#endif -#if MD == 4 -#define MD_CTX MD4_CTX -#define MDInit MD4Init -#define MDUpdate MD4Update -#define MDFinal MD4Final -#endif -#if MD == 5 -#define MD_CTX MD5_CTX -#define MDInit MD5Init -#define MDUpdate MD5Update -#define MDFinal MD5Final -#endif - -/* Main driver. - -Arguments (may be any combination): - -sstring - digests string - -t - runs time trial - -x - runs test script - filename - digests file - (none) - digests standard input - */ -int main (argc, argv) -int argc; - - - -Rivest [Page 17] - -RFC 1321 MD5 Message-Digest Algorithm April 1992 - - -char *argv[]; -{ - int i; - - if (argc > 1) - for (i = 1; i < argc; i++) - if (argv[i][0] == '-' && argv[i][1] == 's') - MDString (argv[i] + 2); - else if (strcmp (argv[i], "-t") == 0) - MDTimeTrial (); - else if (strcmp (argv[i], "-x") == 0) - MDTestSuite (); - else - MDFile (argv[i]); - else - MDFilter (); - - return (0); -} - -/* Digests a string and prints the result. - */ -static void MDString (string) -char *string; -{ - MD_CTX context; - unsigned char digest[16]; - unsigned int len = strlen (string); - - MDInit (&context); - MDUpdate (&context, string, len); - MDFinal (digest, &context); - - printf ("MD%d (\"%s\") = ", MD, string); - MDPrint (digest); - printf ("\n"); -} - -/* Measures the time to digest TEST_BLOCK_COUNT TEST_BLOCK_LEN-byte - blocks. - */ -static void MDTimeTrial () -{ - MD_CTX context; - time_t endTime, startTime; - unsigned char block[TEST_BLOCK_LEN], digest[16]; - unsigned int i; - - - - -Rivest [Page 18] - -RFC 1321 MD5 Message-Digest Algorithm April 1992 - - - printf - ("MD%d time trial. Digesting %d %d-byte blocks ...", MD, - TEST_BLOCK_LEN, TEST_BLOCK_COUNT); - - /* Initialize block */ - for (i = 0; i < TEST_BLOCK_LEN; i++) - block[i] = (unsigned char)(i & 0xff); - - /* Start timer */ - time (&startTime); - - /* Digest blocks */ - MDInit (&context); - for (i = 0; i < TEST_BLOCK_COUNT; i++) - MDUpdate (&context, block, TEST_BLOCK_LEN); - MDFinal (digest, &context); - - /* Stop timer */ - time (&endTime); - - printf (" done\n"); - printf ("Digest = "); - MDPrint (digest); - printf ("\nTime = %ld seconds\n", (long)(endTime-startTime)); - printf - ("Speed = %ld bytes/second\n", - (long)TEST_BLOCK_LEN * (long)TEST_BLOCK_COUNT/(endTime-startTime)); -} - -/* Digests a reference suite of strings and prints the results. - */ -static void MDTestSuite () -{ - printf ("MD%d test suite:\n", MD); - - MDString (""); - MDString ("a"); - MDString ("abc"); - MDString ("message digest"); - MDString ("abcdefghijklmnopqrstuvwxyz"); - MDString - ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"); - MDString - ("1234567890123456789012345678901234567890\ -1234567890123456789012345678901234567890"); -} - -/* Digests a file and prints the result. - - - -Rivest [Page 19] - -RFC 1321 MD5 Message-Digest Algorithm April 1992 - - - */ -static void MDFile (filename) -char *filename; -{ - FILE *file; - MD_CTX context; - int len; - unsigned char buffer[1024], digest[16]; - - if ((file = fopen (filename, "rb")) == NULL) - printf ("%s can't be opened\n", filename); - - else { - MDInit (&context); - while (len = fread (buffer, 1, 1024, file)) - MDUpdate (&context, buffer, len); - MDFinal (digest, &context); - - fclose (file); - - printf ("MD%d (%s) = ", MD, filename); - MDPrint (digest); - printf ("\n"); - } -} - -/* Digests the standard input and prints the result. - */ -static void MDFilter () -{ - MD_CTX context; - int len; - unsigned char buffer[16], digest[16]; - - MDInit (&context); - while (len = fread (buffer, 1, 16, stdin)) - MDUpdate (&context, buffer, len); - MDFinal (digest, &context); - - MDPrint (digest); - printf ("\n"); -} - -/* Prints a message digest in hexadecimal. - */ -static void MDPrint (digest) -unsigned char digest[16]; -{ - - - -Rivest [Page 20] - -RFC 1321 MD5 Message-Digest Algorithm April 1992 - - - unsigned int i; - - for (i = 0; i < 16; i++) - printf ("%02x", digest[i]); -} - -A.5 Test suite - - The MD5 test suite (driver option "-x") should print the following - results: - -MD5 test suite: -MD5 ("") = d41d8cd98f00b204e9800998ecf8427e -MD5 ("a") = 0cc175b9c0f1b6a831c399e269772661 -MD5 ("abc") = 900150983cd24fb0d6963f7d28e17f72 -MD5 ("message digest") = f96b697d7cb7938d525a2f31aaf161d0 -MD5 ("abcdefghijklmnopqrstuvwxyz") = c3fcd3d76192e4007dfb496cca67e13b -MD5 ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") = -d174ab98d277d9f5a5611c2c9f419d9f -MD5 ("123456789012345678901234567890123456789012345678901234567890123456 -78901234567890") = 57edf4a22be3c955ac49da2e2107b67a - -Security Considerations - - The level of security discussed in this memo is considered to be - sufficient for implementing very high security hybrid digital- - signature schemes based on MD5 and a public-key cryptosystem. - -Author's Address - - Ronald L. Rivest - Massachusetts Institute of Technology - Laboratory for Computer Science - NE43-324 - 545 Technology Square - Cambridge, MA 02139-1986 - - Phone: (617) 253-5880 - EMail: rivest@theory.lcs.mit.edu - - - - - - - - - - - - -Rivest [Page 21] - diff --git a/ndb/src/cw/cpcc-win32/csharp/AssemblyInfo.cs b/ndb/src/cw/cpcc-win32/csharp/AssemblyInfo.cs deleted file mode 100644 index 9f89a3282c5..00000000000 --- a/ndb/src/cw/cpcc-win32/csharp/AssemblyInfo.cs +++ /dev/null @@ -1,58 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; - -// -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -// -[assembly: AssemblyTitle("")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("")] -[assembly: AssemblyCopyright("")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Revision and Build Numbers -// by using the '*' as shown below: - -[assembly: AssemblyVersion("1.0.*")] - -// -// In order to sign your assembly you must specify a key to use. Refer to the -// Microsoft .NET Framework documentation for more information on assembly signing. -// -// Use the attributes below to control which key is used for signing. -// -// Notes: -// (*) If no key is specified, the assembly is not signed. -// (*) KeyName refers to a key that has been installed in the Crypto Service -// Provider (CSP) on your machine. KeyFile refers to a file which contains -// a key. -// (*) If the KeyFile and the KeyName values are both specified, the -// following processing occurs: -// (1) If the KeyName can be found in the CSP, that key is used. -// (2) If the KeyName does not exist and the KeyFile does exist, the key -// in the KeyFile is installed into the CSP and used. -// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility. -// When specifying the KeyFile, the location of the KeyFile should be -// relative to the project output directory which is -// %Project Directory%\obj\. For example, if your KeyFile is -// located in the project directory, you would specify the AssemblyKeyFile -// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")] -// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework -// documentation for more information on this. -// -[assembly: AssemblyDelaySign(false)] -[assembly: AssemblyKeyFile("")] -[assembly: AssemblyKeyName("")] diff --git a/ndb/src/cw/cpcc-win32/vb6/frmSplash.frm b/ndb/src/cw/cpcc-win32/vb6/frmSplash.frm deleted file mode 100644 index 56ccbd79876..00000000000 --- a/ndb/src/cw/cpcc-win32/vb6/frmSplash.frm +++ /dev/null @@ -1,159 +0,0 @@ -VERSION 5.00 -Begin VB.Form frmSplash - BorderStyle = 3 'Fixed Dialog - ClientHeight = 4710 - ClientLeft = 45 - ClientTop = 45 - ClientWidth = 7455 - ControlBox = 0 'False - LinkTopic = "Form1" - MaxButton = 0 'False - MinButton = 0 'False - ScaleHeight = 4710 - ScaleWidth = 7455 - ShowInTaskbar = 0 'False - StartUpPosition = 2 'CenterScreen - Visible = 0 'False - Begin VB.Frame fraMainFrame - Height = 4590 - Left = 45 - TabIndex = 0 - Top = -15 - Width = 7380 - Begin VB.PictureBox picLogo - Height = 2385 - Left = 510 - Picture = "frmSplash.frx":0000 - ScaleHeight = 2325 - ScaleWidth = 1755 - TabIndex = 2 - Top = 855 - Width = 1815 - End - Begin VB.Label lblLicenseTo - Alignment = 1 'Right Justify - Caption = "LicenseTo" - Height = 255 - Left = 270 - TabIndex = 1 - Tag = "LicenseTo" - Top = 300 - Width = 6855 - End - Begin VB.Label lblProductName - AutoSize = -1 'True - Caption = "Product" - BeginProperty Font - Name = "MS Sans Serif" - Size = 29.25 - Charset = 0 - Weight = 700 - Underline = 0 'False - Italic = 0 'False - Strikethrough = 0 'False - EndProperty - Height = 720 - Left = 2670 - TabIndex = 9 - Tag = "Product" - Top = 1200 - Width = 2190 - End - Begin VB.Label lblCompanyProduct - AutoSize = -1 'True - Caption = "CompanyProduct" - BeginProperty Font - Name = "MS Sans Serif" - Size = 18 - Charset = 0 - Weight = 700 - Underline = 0 'False - Italic = 0 'False - Strikethrough = 0 'False - EndProperty - Height = 435 - Left = 2505 - TabIndex = 8 - Tag = "CompanyProduct" - Top = 765 - Width = 3000 - End - Begin VB.Label lblPlatform - Alignment = 1 'Right Justify - AutoSize = -1 'True - Caption = "Platform" - BeginProperty Font - Name = "MS Sans Serif" - Size = 13.5 - Charset = 0 - Weight = 700 - Underline = 0 'False - Italic = 0 'False - Strikethrough = 0 'False - EndProperty - Height = 360 - Left = 5865 - TabIndex = 7 - Tag = "Platform" - Top = 2400 - Width = 1140 - End - Begin VB.Label lblVersion - Alignment = 1 'Right Justify - AutoSize = -1 'True - Caption = "Version" - BeginProperty Font - Name = "MS Sans Serif" - Size = 12 - Charset = 0 - Weight = 700 - Underline = 0 'False - Italic = 0 'False - Strikethrough = 0 'False - EndProperty - Height = 300 - Left = 6075 - TabIndex = 6 - Tag = "Version" - Top = 2760 - Width = 930 - End - Begin VB.Label lblWarning - Caption = "Warning" - Height = 195 - Left = 300 - TabIndex = 3 - Tag = "Warning" - Top = 3720 - Width = 6855 - End - Begin VB.Label lblCompany - Caption = "Company" - Height = 255 - Left = 4710 - TabIndex = 5 - Tag = "Company" - Top = 3330 - Width = 2415 - End - Begin VB.Label lblCopyright - Caption = "Copyright" - Height = 255 - Left = 4710 - TabIndex = 4 - Tag = "Copyright" - Top = 3120 - Width = 2415 - End - End -End -Attribute VB_Name = "frmSplash" -Attribute VB_GlobalNameSpace = False -Attribute VB_Creatable = False -Attribute VB_PredeclaredId = True -Attribute VB_Exposed = False -Private Sub Form_Load() - lblVersion.Caption = "Version " & App.Major & "." & App.Minor & "." & App.Revision - lblProductName.Caption = App.Title -End Sub - diff --git a/ndb/src/external/LINUX.x86/sci/include/list.h b/ndb/src/external/LINUX.x86/sci/include/list.h deleted file mode 100644 index 81c467a461b..00000000000 --- a/ndb/src/external/LINUX.x86/sci/include/list.h +++ /dev/null @@ -1,56 +0,0 @@ -/* $Id: list.h,v 1.1 2002/12/13 12:17:20 hin Exp $ */ - -/******************************************************************************* - * * - * Copyright (C) 1993 - 2000 * - * Dolphin Interconnect Solutions AS * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, * - * or (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the Free Software * - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - * * - *******************************************************************************/ - - - -#ifndef _LIST_H -#define _LIST_H -#include "sci_types.h" - - -typedef struct ListElement *ListElement_t; -typedef struct List *List_t; - -struct ListElement { - void *element; - u_vkaddr_t key; - ListElement_t prev,next; -}; - -void *Get_Element(ListElement_t el); -void Set_Element(ListElement_t el,void *elptr,u_vkaddr_t key); -void Create_Element(ListElement_t *el); -void Destroy_Element(ListElement_t *el); -void Create_List(List_t *list); -void Destroy_List(List_t *list); -void Add_Element(List_t list,ListElement_t el); -void Remove_Element(List_t list,ListElement_t el); -ListElement_t Find_Element(List_t list,u_vkaddr_t key); -scibool List_Empty(List_t); -scibool List_Elements(List_t); -ListElement_t First_Element(List_t list); -ListElement_t Last_Element(List_t list); -ListElement_t Next_Element(ListElement_t el); - -#endif /* _LIST_H */ diff --git a/ndb/src/external/LINUX.x86/sci/include/os/inttypes.h b/ndb/src/external/LINUX.x86/sci/include/os/inttypes.h deleted file mode 100644 index b9e5a6cb19f..00000000000 --- a/ndb/src/external/LINUX.x86/sci/include/os/inttypes.h +++ /dev/null @@ -1,53 +0,0 @@ -/* $Id: inttypes.h,v 1.1 2002/12/13 12:17:21 hin Exp $ */ - -/******************************************************************************* - * * - * Copyright (C) 1993 - 2000 * - * Dolphin Interconnect Solutions AS * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, * - * or (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the Free Software * - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - * * - *******************************************************************************/ - - -#ifndef _SCI_OS_INTTYPES_H_ -#define _SCI_OS_INTTYPES_H_ - -/* - * -------------------------------------------------------------------------------------- - * Basic types of various sizes. - * -------------------------------------------------------------------------------------- - */ -typedef unsigned char unsigned8; -typedef unsigned short unsigned16; -typedef unsigned int unsigned32; -typedef unsigned long long unsigned64; - -typedef signed char signed8; -typedef signed short signed16; -typedef signed int signed32; -typedef signed long long signed64; - - -#ifdef CPU_WORD_IS_64_BIT -typedef unsigned64 uptr_t; -typedef signed64 iptr_t; -#else -typedef unsigned32 uptr_t; -typedef signed32 iptr_t; -#endif - -#endif /* _SCI_OS_INTTYPES_H_ */ diff --git a/ndb/src/external/LINUX.x86/sci/include/rmlib.h b/ndb/src/external/LINUX.x86/sci/include/rmlib.h deleted file mode 100644 index 9d2722e9798..00000000000 --- a/ndb/src/external/LINUX.x86/sci/include/rmlib.h +++ /dev/null @@ -1,212 +0,0 @@ -/* $Id: rmlib.h,v 1.1 2002/12/13 12:17:20 hin Exp $ */ - -/********************************************************************************* - * * - * Copyright (C) 1993 - 2000 * - * Dolphin Interconnect Solutions AS * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU Lesser General Public License as published by * - * the Free Software Foundation; either version 2.1 of the License, * - * or (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU Lesser General Public License * - * along with this program; if not, write to the Free Software * - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - * * - *********************************************************************************/ - -/********************************************************************************/ -/* This header file contains the declarations of the SCI Reflective Memory */ -/* library rmlib. The implementation of the library functions is in rmlib.c. */ -/* The library contains all the functions that operate on the reflective */ -/* memory. */ -/* */ -/* NB! */ -/* */ -/* DOLPHIN'S SCI REFLECTIVE MEMORY FILES ARE UNDER DEVELOPMENT AND MAY CHANGE. */ -/* PLEASE CONTACT DOLPHIN FOR FURTHER INFORMATION. */ -/* */ -/* */ -/********************************************************************************/ - -#include "sisci_error.h" -#include "sisci_api.h" -#include "sisci_demolib.h" -#include "sisci_types.h" - -unsigned int seqerr, syncseqerr; - -#ifndef _RMLIB_H -#define _RMLIB_H - - -#if defined(_REENTRANT) - -#define _RMLIB_EXPAND_NAME(name) _RMLIB_MT_ ## name - -#else - -#define _RMLIB_EXPAND_NAME(name) _RMLIB_ST_ ## name - -#endif - -#ifdef __sparc -#define CACHE_SIZE 2097152 -#else -#define CACHE_SIZE 8192 -#endif - -/*********************************************************************************/ -/* FLAG VALUES */ -/*********************************************************************************/ - -#define REFLECT_ERRCHECK 0x2 - -struct ReflectiveMemorySpace { - unsigned int localAdapterNo; - unsigned int localNodeId; - unsigned int remoteNodeId; - sci_desc_t sd; - sci_desc_t syncsd; - sci_map_t localMap; - sci_map_t remoteMap; - unsigned int localSegmentId; - unsigned int remoteSegmentId; - unsigned int syncSegmentId; - unsigned int sync_rSegmentId; - unsigned int segmentSize; - unsigned int *localMapAddr; - volatile unsigned int *remoteMapAddr; - sci_local_segment_t localSegment; - sci_remote_segment_t remoteSegment; - sci_local_segment_t syncSegment; - sci_remote_segment_t sync_rSegment; - sci_map_t syncMap; - sci_map_t sync_rMap; - sci_sequence_t syncsequence; - sci_sequence_t sequence; - unsigned int protection; - unsigned int retry_value; - sci_sequence_status_t sequenceStatus, syncsequenceStatus; - volatile unsigned int *syncMapAddr; - volatile unsigned int *sync_rMapAddr; -}; - -/*********************************************************************************/ -/* P R I N T R E F L E C T I V E M E M O R Y S P A C E */ -/* */ -/*********************************************************************************/ -#define ReflectPrintParameters _RMLIB_EXPAND_NAME(ReflectPrintParameters) -void ReflectPrintParameters(FILE *stream, struct ReflectiveMemorySpace RM_space); - -/*********************************************************************************/ -/* R E F L E C T D M A S E T U P */ -/* */ -/*********************************************************************************/ -#define ReflectDmaSetup _RMLIB_EXPAND_NAME(ReflectDmaSetup) -sci_error_t ReflectDmaSetup(struct ReflectiveMemorySpace RM_space, sci_dma_queue_t *dmaQueue); - -/*********************************************************************************/ -/* R E F L E C T D M A R E M O V E */ -/* */ -/*********************************************************************************/ -#define ReflectDmaRemove _RMLIB_EXPAND_NAME(ReflectDmaRemove) -sci_error_t ReflectDmaRemove(sci_dma_queue_t dmaQueue); - -/*********************************************************************************/ -/* R E F L E C T D M A R U N */ -/* */ -/*********************************************************************************/ -#define ReflectDmaRun _RMLIB_EXPAND_NAME(ReflectDmaRun) -sci_error_t ReflectDmaRun(struct ReflectiveMemorySpace RM_space, - unsigned int* privateSrc, - unsigned int size, - unsigned int offset, - sci_dma_queue_t dmaQueue); -/*********************************************************************************/ -/* C L O S E R E F L E C T I V E M E M O R Y S P A C E */ -/* */ -/*********************************************************************************/ -#define ReflectClose _RMLIB_EXPAND_NAME(ReflectClose) -sci_error_t ReflectClose(struct ReflectiveMemorySpace RM_space, unsigned int segment_no); - -/*********************************************************************************/ -/* O P E N R E F L E C T I V E M E M O R Y S P A C E */ -/* */ -/*********************************************************************************/ -#define ReflectOpen _RMLIB_EXPAND_NAME(ReflectOpen) -sci_error_t ReflectOpen(struct ReflectiveMemorySpace *RM_space, - unsigned int size, - unsigned int segment_no, - unsigned int localAdapterNo, - unsigned int remoteNodeId, - unsigned int protection, - unsigned int retry_value); - -/*********************************************************************************/ -/* R E F L E C T G E T A C C E S S */ -/* */ -/*********************************************************************************/ -#define ReflectGetAccess _RMLIB_EXPAND_NAME(ReflectGetAccess) -sci_error_t ReflectGetAccess(struct ReflectiveMemorySpace *RM_space); - -/*********************************************************************************/ -/* R E F L E C T R E L E A S E A C C E S S */ -/* */ -/*********************************************************************************/ -#define ReflectReleaseAccess _RMLIB_EXPAND_NAME(ReflectReleaseAccess) -sci_error_t ReflectReleaseAccess(struct ReflectiveMemorySpace *RM_space); - -/*********************************************************************************/ -/* R E F L E C T D M A */ -/* */ -/*********************************************************************************/ -#define ReflectDma _RMLIB_EXPAND_NAME(ReflectDma) -sci_error_t ReflectDma(struct ReflectiveMemorySpace RM_space, - unsigned int* privateSrc, - unsigned int size, - unsigned int offset); - -/*********************************************************************************/ -/* R E F L E C T M E M C O P Y */ -/* */ -/*********************************************************************************/ -#define ReflectMemCopy _RMLIB_EXPAND_NAME(ReflectMemCopy) -sci_error_t ReflectMemCopy(struct ReflectiveMemorySpace RM_space, - unsigned int* privateSrc, - unsigned int size, - unsigned int offset, - unsigned int flags); - -/*********************************************************************************/ -/* R E F L E C T S E T */ -/* */ -/*********************************************************************************/ -#define ReflectSet _RMLIB_EXPAND_NAME(ReflectSet) -sci_error_t ReflectSet(struct ReflectiveMemorySpace RM_space, - unsigned int value, - unsigned int size, - unsigned int offset, - unsigned int flags - ); - -/*********************************************************************************/ -/* R E F L E C T P R I N T */ -/* */ -/*********************************************************************************/ -#define ReflectPrint _RMLIB_EXPAND_NAME(ReflectPrint) -sci_error_t ReflectPrint(FILE *stream, - struct ReflectiveMemorySpace RM_space, - unsigned int size, - unsigned int offset - ); - - -#endif diff --git a/ndb/src/external/LINUX.x86/sci/include/sci_errno.h b/ndb/src/external/LINUX.x86/sci/include/sci_errno.h deleted file mode 100644 index 03f3256a86f..00000000000 --- a/ndb/src/external/LINUX.x86/sci/include/sci_errno.h +++ /dev/null @@ -1,216 +0,0 @@ -/* $Id: sci_errno.h,v 1.1 2002/12/13 12:17:20 hin Exp $ */ - -/******************************************************************************* - * * - * Copyright (C) 1993 - 2000 * - * Dolphin Interconnect Solutions AS * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, * - * or (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the Free Software * - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - * * - *******************************************************************************/ - - - -#ifndef _SCI_ERRNO_H_ -#define _SCI_ERRNO_H_ - - -/* - * SCI Error return values always have 30 bit set - * Remote errors should have bit 0 set - */ -#define SCI_ERR_MASK 0x40000000 -#define ESCI_REMOTE_MASK 0x01000000 - -#define SCI_ERR(u) ((unsigned32)(u)&0x7FFFFFFF ) -#define _SCI_ERROR(x) ((x) | SCI_ERR_MASK) -#define _SCI_REMOTE_ERROR(x) ( _SCI_ERROR(x) | ESCI_REMOTE_MASK ) - -/* - * Error codes - */ -typedef enum { - ESCI_OK = 0x000, - ESCI_STILL_EXPORTED = _SCI_ERROR(0x800), - - ESCI_BUS_ERR = _SCI_ERROR(0x900), - ESCI_PEND_SCIERR = _SCI_ERROR(0x901), - ESCI_SCI_ERR = _SCI_ERROR(0x902), - - /* - * Specific SCI error responses: - */ - ESCI_SCI_ERR_DATA = _SCI_ERROR(0x9021), - ESCI_SCI_ERR_TYPE = _SCI_ERROR(0x9022), - ESCI_SCI_ERR_ADDR = _SCI_ERROR(0x9023), - - ESCI_LINK_TIMEOUT = _SCI_ERROR(0x903), - ESCI_EXDEV_TIMEOUT = _SCI_ERROR(0x904), - ESCI_REMOTE_ERR = _SCI_ERROR(0x905), - ESCI_MBX_BUSY = _SCI_ERROR(0x906), - ESCI_DMAERR = _SCI_ERROR(0x907), - ESCI_DMA_DISABLED = _SCI_ERROR(0x908), - ESCI_SW_MBX_SEND_FAILED = _SCI_ERROR(0x909), - ESCI_HW_MBX_SEND_FAILED = _SCI_ERROR(0x90A), - ESCI_HAS_NO_SESSION = _SCI_ERROR(0xA00), - ESCI_CONNREFUSED_SESSION = _SCI_ERROR(0xA01), - ESCI_SESSION_NOT_ESTABLISHED = _SCI_ERROR(0xA11), - ESCI_REMOTE_NO_VALID_SESSION = _SCI_ERROR(0xA02), - ESCI_SESSION_DISABLED = _SCI_ERROR(0xA03), - ESCI_NODE_CLOSED = _SCI_ERROR(0xA04), - ESCI_NODE_DISABLED = _SCI_ERROR(0xA05), - - ESCI_LOCAL_MASTER_ERR = _SCI_ERROR(0xA06), - ESCI_REMOTE_MASTER_ERR = _SCI_REMOTE_ERROR(0xA06), - - ESCI_ILLEGAL_CMD_RECEIVED = _SCI_ERROR(0xA08), - ESCI_ILLEGAL_CMD_SENT = _SCI_ERROR(0xA09), - - /* used above: ESCI_SESSION_NOT_ESTABLISHED = _SCI_ERROR(0xA11), */ - - /* - * Remote error codes - */ - ESCI_CONNREFUSED = _SCI_ERROR(0xB00), - ESCI_NODE_NOT_RESPONDING = _SCI_ERROR(0xB01), - ESCI_ISCONN = _SCI_ERROR(0xB02), - ESCI_HOSTUNREACH = _SCI_ERROR(0xB03), - ESCI_NO_SUCH_USER_ID = _SCI_ERROR(0xB04), - ESCI_REMOTE_NO_SUCH_USER_ID = _SCI_REMOTE_ERROR(0xB04), /* ESCI_NO_SUCH_USER_ID */ - ESCI_NO_SUCH_KEY = _SCI_ERROR(0xB04), /* ESCI_NO_SUCH_USER_ID */ - ESCI_REMOTE_NO_SUCH_KEY = _SCI_REMOTE_ERROR(0xB04), /* ESCI_REMOTE_NO_SUCH_USER_ID */ - ESCI_NODE_ERR = _SCI_ERROR(0xB06), - ESCI_REMOTE_NODE_ERR = _SCI_REMOTE_ERROR(0xB06), /* ESCI_NODE_ERR */ - ESCI_NOSPC = _SCI_ERROR(0xB08), - ESCI_REMOTE_NOSPC = _SCI_REMOTE_ERROR(0xB08), /* ESCI_NOSPC */ - ESCI_NODMASPC = _SCI_ERROR(0xB0A), - ESCI_REMOTE_NODMASPC = _SCI_REMOTE_ERROR(0xB0A), /* ESCI_NODMASPC */ - ESCI_NOTMAP = _SCI_ERROR(0xC00), - ESCI_ISMAP = _SCI_ERROR(0xC01), - ESCI_NOT_INITIALIZED = _SCI_ERROR(0xD00), - ESCI_REMOTE_NOT_INITIALIZED = _SCI_REMOTE_ERROR(ESCI_NOT_INITIALIZED), - /* - * ??? - */ - ESCI_PARAM_ERR = _SCI_ERROR(0xD01), - ESCI_NO_FREE_VC = _SCI_ERROR(0xD02), - ESCI_REMOTE_NO_FREE_VC = _SCI_REMOTE_ERROR(0xD02), /* ESCI_NO_FREE_VC */ - - /* - * Adapter state related error codes: - */ - ESCI_SUSPENDED = _SCI_ERROR(0xD03), - ESCI_NOT_SUSPENDED = _SCI_ERROR(0xD04), - ESCI_NOT_READY = _SCI_ERROR(0xD05), - ESCI_NOT_CONFIGURED = _SCI_ERROR(0xD06), - ESCI_INVALID_ADAPTERID = _SCI_ERROR(0xD07), /* if an adapter-id is out of range */ - ESCI_NONEXIST_ADAPTERID = _SCI_ERROR(0xD08), /* if adapter-id is valid but no adapter matches */ - ESCI_ADAPTERID_INUSE = _SCI_ERROR(0xD09), - - ESCI_INVALID_INSTANCE = _SCI_ERROR(0xD0A), - ESCI_NONEXIST_INSTANCE = _SCI_ERROR(0xD0B), - - ESCI_ADAPTER_INIT_FAILURE = _SCI_ERROR(0xD0C), - - ESCI_PAUSED = _SCI_ERROR(0xD0D), - ESCI_NOT_PAUSED = _SCI_ERROR(0xD0E), - ESCI_ADAPTER_NEED_RESET = _SCI_ERROR(0xD0F), - - ESCI_NONEXIST_SERIAL_NUMBER = _SCI_ERROR(0xD10), - ESCI_NOT_AVAILABLE = _SCI_ERROR(0xD11), - - ESCI_EACCESS = _SCI_ERROR(0xD12), - - /* - * Local error codes - */ - ESCI_NO_LOCAL_ACCESS = _SCI_ERROR(0xE00), - ESCI_LRESOURCE_BUSY = _SCI_ERROR(0xE01), - ESCI_LRESOURCE_EXIST = _SCI_ERROR(0xE02), - ESCI_NO_LRESOURCE = _SCI_ERROR(0xE03), - ESCI_NOTCONN = _SCI_ERROR(0xE04), - ESCI_LOCAL_ERR = _SCI_ERROR(0xE05), - ESCI_NOVAL_NODEID = _SCI_ERROR(0xE06), - ESCI_NOT_SUPPORTED = _SCI_ERROR(0xE07), - ESCI_TIMEOUT = _SCI_ERROR(0xE08), - ESCI_NO_LOCAL_LC_ACCESS = _SCI_ERROR(0xE0A), - ESCI_INVALID_ATT = _SCI_ERROR(0xE0B), - ESCI_BAD_CHECKSUM = _SCI_ERROR(0xE0C), - ESCI_INTERRUPT_FLAG_DISABLED = _SCI_ERROR(0xE0D), - ESCI_COND_INT_RACE_PROBLEM = _SCI_ERROR(0xE0E), - ESCI_OVERFLOW = _SCI_ERROR(0xE0F), - ESCI_BLINK_PARITY_ERROR = _SCI_ERROR(0xE10), - ESCI_FIRMWARE_VERSION_MISMATCH = _SCI_ERROR(0xE11), - - /* - * Link error codes - */ - ESCI_NO_LINK_ACCESS = _SCI_ERROR(0xF00), - ESCI_NO_REMOTE_LINK_ACCESS = _SCI_REMOTE_ERROR(0xF00), /* ESCI_NO_LINK_ACCESS */ - - ESCI_NO_SUCH_NODE = _SCI_ERROR(0xF02), - ESCI_USR_ACCESS_DISABLED = _SCI_ERROR(0xF03), - ESCI_HW_AVOID_DEADLOCK = _SCI_ERROR(0xF04), - ESCI_POTENTIAL_ERROR = _SCI_ERROR(0xF05), - - ESCI_FENCED = _SCI_ERROR(0xF06), - ESCI_SWITCH_HW_FAILURE = _SCI_ERROR(0xF07), - ESCI_SWITCH_WRONG_BLINK_ID = _SCI_ERROR(0xF08), - ESCI_SWITCH_WRONG_PORT_NUMB = _SCI_ERROR(0xF09), - ESCI_SWITCH_WRONG_INIT_TYPE = _SCI_ERROR(0xF0A), /* It is determined that the swith initialization - * do not match the local adapter initialization - */ - ESCI_SWITCH_WRONG_SWITCH_NUMB = _SCI_ERROR(0xF0B), /* It is determined that we are operationg on the - * wrong switch port - */ - ESCI_SWITCH_NOT_CONNECTED = _SCI_ERROR(0xF0C), - ESCI_SWITCH_NOT_RECOGNIZED = _SCI_ERROR(0xF0D), - ESCI_SWITCH_INIT_IN_PROGRESS = _SCI_ERROR(0xF0E), /* Switch TINI initialization in progress */ - - - ESCI_NO_BACKBONE_LINK_ACCESS = _SCI_ERROR(0xF20), - ESCI_BACKBONE_FENCED = _SCI_ERROR(0xF21), - ESCI_NO_BACKBONE_ACCESS = _SCI_ERROR(0xF22), - ESCI_BACKBONE_CABLE_PROBLEM = _SCI_ERROR(0xF23), - ESCI_BACKBONE_BLINK_PROBLEM = _SCI_ERROR(0xF24), - ESCI_BACKBONE_HWINIT_PROBLEM = _SCI_ERROR(0xF25), - ESCI_BACKBONE_ID_PROBLEM = _SCI_ERROR(0xF26), - ESCI_BACKBONE_STATE_PROBLEM = _SCI_ERROR(0xF27), - ESCI_BACKBONE_REQ_LINK_PROBLEM = _SCI_ERROR(0xF28), - ESCI_BACKBONE_UNFENCING = _SCI_ERROR(0xF29), /* Unfencing in progress */ - - /* - * added for pci port - */ - ESCI_AGAIN = _SCI_ERROR(0xF15), - ESCI_ORANGE = _SCI_ERROR(0xF16), /* Out of range */ - ESCI_NOSYS = _SCI_ERROR(0xF17), /* Used instead of ENOSYS. Means function not implemented */ - ESCI_REMOTE_NOSYS = _SCI_REMOTE_ERROR(ESCI_NOSYS), - ESCI_INTR = _SCI_ERROR(0xF18), /* Used instead of EINTR from sys/errno.h */ - ESCI_IO = _SCI_ERROR(0xF19), /* Used instead of EIO from sys/errno.h */ - ESCI_FAULT = _SCI_ERROR(0xF1A), /* Used instead of EFAULT from sys/errno.h */ - ESCI_BUSY = _SCI_ERROR(0xF1B), /* Used instead of EBUST from sys/errno.h */ - ESCI_INVAL = _SCI_ERROR(0xF1C), /* Used instead of EINVAL from sys/errno.h */ - ESCI_NXIO = _SCI_ERROR(0xF1D), /* Used instead of ENXIO from sys/errno.h */ - ESCI_EXIST = _SCI_ERROR(0xF1E) /* Used instead of EEXIST from sys/errno.h */ - -} scierror_t; - -#endif /* _SCI_ERRNO_H_ */ - - - - diff --git a/ndb/src/external/LINUX.x86/sci/include/sci_types.h b/ndb/src/external/LINUX.x86/sci/include/sci_types.h deleted file mode 100644 index 740b3a45cfd..00000000000 --- a/ndb/src/external/LINUX.x86/sci/include/sci_types.h +++ /dev/null @@ -1,300 +0,0 @@ -/* $Id: sci_types.h,v 1.1 2002/12/13 12:17:21 hin Exp $ */ - -/******************************************************************************* - * * - * Copyright (C) 1993 - 2000 * - * Dolphin Interconnect Solutions AS * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, * - * or (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the Free Software * - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - * * - *******************************************************************************/ - - -#ifndef _SCI_TYPES_H_ -#define _SCI_TYPES_H_ - -/* - * Remains for the time being for backward compatibility .... - */ - -/* #define UNIQUE(type) struct { type x; } * */ -#ifndef UNIQUE -#define UNIQUE(type) type -#endif -#include "os/inttypes.h" - -#if defined(WIN32) -#if defined(_KERNEL) -#include -#else -#include -#endif /* _KERNEL */ -#else -#if defined(Linux) -#if defined(__KERNEL__) -#include -#else -#include -#endif -#else -#include -#endif -#ifdef SUNOS5 -#include -#include -#endif -#ifdef OS_IS_TRU64 -#include -#endif -#ifdef OS_IS_HP_UX11 -#if defined(_KERNEL) -#include <../wsio/wsio.h> -#else -#include -#endif -#endif -#endif - -/* See comments about "UNCONFIGURED_ADAPTERS" in config.h */ -#define UNCONFIGURED_ADAPTERS 100 - -#ifndef FALSE -#define FALSE 0 -#endif - -#ifndef TRUE -#define TRUE 1 -#endif - -#ifndef NULL -#define NULL 0 -#endif - -#ifndef IN -#define IN -#endif - -#ifndef NOT -#define NOT ! -#endif - -/* - * -------------------------------------------------------------------------------------- - * Basic types of various sizes. - * -------------------------------------------------------------------------------------- - */ - -typedef signed32 scibool; -#ifndef OS_IS_VXWORKS -typedef signed32 BOOL; -#else -/* VXWORKS has already defined BOOL */ -#endif -typedef unsigned32 node_t; /* This is the logical nodeid */ -typedef unsigned32 sciNodeId_t; /* This is the physical 16 bit SCI nodeid */ - -/* - * -------------------------------------------------------------------------------------- - * Various register types. - * -------------------------------------------------------------------------------------- - */ -typedef volatile unsigned32 register32; - - -/* -Temporary for Windows NT, until we use only the above types. -*/ - -#ifdef WIN32 - -typedef unsigned char u_char; -typedef unsigned short u_short; -typedef unsigned long u_long; -typedef unsigned int u_int; -typedef char * caddr_t; - -typedef long off_t; -typedef unsigned int size_t; - -#endif -#ifdef OS_IS_VXWORKS -#include -#endif - -/* - * -------------------------------------------------------------------------------------- - * Various address types. - * - * We are using a struct * instead of unsigned long (int) inorder to enforce strong - * type checking - * - * -------------------------------------------------------------------------------------- - */ -typedef UNIQUE(void *) vkaddr_t; /* Virtual kernel address */ -typedef UNIQUE(uptr_t) vuaddr_t; /* Virtual user address */ - -typedef UNIQUE(unsigned32) remaddr_t; /* Remote IO address (physical address on PCs) */ -typedef UNIQUE(unsigned32) sciofs_lo_t; /* Lower 32 bits of an SCI offset. */ -typedef UNIQUE(unsigned32) sciofs_hi_t; /* The upper 16 bits of an SCI offset. */ - -typedef UNIQUE(unsigned32) ioaddr_t; /* Local IO address (physical address on PCs) */ -typedef unsigned32 u_ioaddr_t; -typedef unsigned32 iooffset_t; -typedef unsigned32 iosize_t; - -typedef uptr_t vkoffset_t; -typedef uptr_t u_vkaddr_t; -typedef uptr_t u_vuaddr_t; -typedef unsigned32 u_sciofs_lo_t; -typedef unsigned32 u_sciofs_hi_t; -typedef unsigned32 u_remaddr_t; -typedef unsigned32 attOffset_t; /* Address displacement from start of ATT entry */ - -typedef unsigned32 adapterNo_t; - -typedef enum { - NO_NODE = 0, - AD_MEM_NODE = 1, - AD_ALT_NODE = 2, - AD_MBX_NODE = 3, - AD_LC_NODE = 4, - AD_LC_PORT_0 = 5, - AD_LC_PORT_1 = 6, - AD_LC_PORT_2 = 7, - PHYS_NODE = 8 -} node_type_t; - - -/* - * Currently we don't support more than 32 bit sizes. - */ -#define SIZEOF(x) ((unsigned32)sizeof(x)) - -#if defined(_KERNEL) - -/* - * -------------------------------------------------------------------------------------- - * Some small macros intended to ease the transition to more strongly typed address - * types. The intention is that they in the long run shall be removed ... - * -------------------------------------------------------------------------------------- - */ -#define P2SIZE_T(x) ((size_t)((uptr_t)(x))) /* Pointer to size_t */ -#define P2U32(x) ((unsigned32)((uptr_t)(x))) /* Pointer to Unsigned 32-bit int */ -#ifdef WIN32 -#define PHADDR(x) ((ioaddr_t)(x)) -#define HASV(x) (x) -#endif -#if 0 -static vkaddr_t VKPTR (void * ptr) { return (vkaddr_t)ptr; } -static vkaddr_t VKADDR(volatile void * ptr) { return (vkaddr_t)ptr; } -#else -#define VKPTR(ptr) (vkaddr_t)ptr -#define VKADDR(ptr) (vkaddr_t)ptr -#endif - -#ifdef KLOG -#define KLOG_LOG(n,m,v) ts_log((n),(m),(v)) -#else -#define KLOG_LOG(n,m,v) -#endif /* KLOG */ - - -/* - * -------------------------------------------------------------------------------------- - * - * M E M A R E A T - * - * Memory area descriptor. - * - * paddr -- Physical address (aligned) of memory area - * ual_vaddr -- (Kernel )Virtual address of the unaligned memory area - * vaddr -- (Kernel) Virtual address of memory area - * rsize -- Real (Physical) Size of memory area - * msize -- Mapped (Virtual) Size of memory area (Size of area mapped - * into virtual) memory - * - * -------------------------------------- - * | | <----- msize ----->| | - * |<------|------- rsize ------|------>| - * -------------------------------------- - * /|\ /|\ - * | | - * ual_vaddr vaddr/paddr - * - * -------------------------------------------------------------------------------------- - */ -struct _memarea_ { - ioaddr_t ioaddr; - vkaddr_t vaddr; - vkaddr_t ual_vaddr; - size_t rsize; - size_t msize; - char *id; - unsigned32 cookie; - - -#ifdef SUNOS5 -#ifdef _USE_NEW_SOLARIS_DDI_INTERFACE - ddi_acc_handle_t mem_handle; - ddi_dma_handle_t dma_handle; -#else - ddi_dma_handle_t handle; -#endif -#endif -#ifdef OS_IS_TRU64 - dma_handle_t dma_handle; -#endif - -#if OS_IS_LINUX - unsigned long ph_base_addr; -#endif - -#ifdef OS_IS_HP_UX11 - struct isc_table_type * isc; - wsio_shmem_attr_t type; -#endif -}; - -typedef struct _memarea_ memarea_t; - -#ifdef SCI_MALLOC_DEBUG -struct _maddr_ { - char *id; - size_t size; - struct _maddr_ *next; - struct _maddr_ **prev; - unsigned32 cookie; -}; - -typedef struct _maddr_ maddr_t; - -#define MALLOC_COOKIE 0xc3c3c3c3 - -#else - -typedef struct { void *p; } *maddr_t; - -#endif /* SCI_MALLOC_DEBUG */ - - -typedef struct { - scibool disabled; - unsigned32 disable_cnt; -} disable_info_t; - -#endif /* _KERNEL */ - -#endif /* _SCI_TYPES_H_ */ diff --git a/ndb/src/external/LINUX.x86/sci/include/sisci_api.h b/ndb/src/external/LINUX.x86/sci/include/sisci_api.h deleted file mode 100644 index 38fdf54125f..00000000000 --- a/ndb/src/external/LINUX.x86/sci/include/sisci_api.h +++ /dev/null @@ -1,2170 +0,0 @@ -/* $Id: sisci_api.h,v 1.1 2002/12/13 12:17:21 hin Exp $ */ -/******************************************************************************* - * * - * Copyright (C) 1993 - 2001 * - * Dolphin Interconnect Solutions AS * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU Lesser General Public License as published by * - * the Free Software Foundation; either version 2.1 of the License, * - * or (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU Lesser General Public License * - * along with this program; if not, write to the Free Software * - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - * * - *******************************************************************************/ - -#ifndef _SISCI_API_H -#define _SISCI_API_H - -#include "sisci_types.h" -#include "sisci_error.h" - - -#ifdef WIN32 -#ifdef API_DLL -#define DLL __declspec(dllexport) -#elif CLIENT_DLL -#define DLL __declspec(dllimport) -#endif -#endif /* WIN32 */ - - -#ifndef DLL -#define DLL -#endif - -#if defined(_REENTRANT) -#define _SISCI_EXPANDE_FUNCTION_NAME(name) _SISCI_PUBLIC_FUNC_MT_ ## name -#define _SISCI_EXPANDE_VARIABLE_NAME(name) _SISCI_PUBLIC_VAR_MT_ ## name -#else -#define _SISCI_EXPANDE_FUNCTION_NAME(name) _SISCI_PUBLIC_FUNC_ST_ ## name -#define _SISCI_EXPANDE_VARIABLE_NAME(name) _SISCI_PUBLIC_VAR_ST_ ## name -#endif -#define _SISCI_EXPANDE_CONSTANT_NAME(name) _SISCI_PUBLIC_CONST_ ## name - -#if defined(CPLUSPLUS) || defined(__cplusplus) -extern "C" { -#endif - - -/*********************************************************************************/ -/* FLAG VALUES */ -/*********************************************************************************/ - -#define SCI_FLAG_FIXED_INTNO _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_FIXED_INTNO) -extern const unsigned int SCI_FLAG_FIXED_INTNO; - -#define SCI_FLAG_SHARED_INT _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_SHARED_INT) -extern const unsigned int SCI_FLAG_SHARED_INT; - -#define SCI_FLAG_FIXED_MAP_ADDR _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_FIXED_MAP_ADDR) -extern const unsigned int SCI_FLAG_FIXED_MAP_ADDR; - -#define SCI_FLAG_READONLY_MAP _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_READONLY_MAP) -extern const unsigned int SCI_FLAG_READONLY_MAP; - -#define SCI_FLAG_USE_CALLBACK _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_USE_CALLBACK) -extern const unsigned int SCI_FLAG_USE_CALLBACK; - -#define SCI_FLAG_BLOCK_READ _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_BLOCK_READ) -extern const unsigned int SCI_FLAG_BLOCK_READ; - -#define SCI_FLAG_THREAD_SAFE _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_THREAD_SAFE) -extern const unsigned int SCI_FLAG_THREAD_SAFE; - -#define SCI_FLAG_ASYNCHRONOUS_CONNECT _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_ASYNCHRONOUS_CONNECT) -extern const unsigned int SCI_FLAG_ASYNCHRONOUS_CONNECT; - -#define SCI_FLAG_EMPTY _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_EMPTY) -extern const unsigned int SCI_FLAG_EMPTY; - -#define SCI_FLAG_PRIVATE _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_PRIVATE) -extern const unsigned int SCI_FLAG_PRIVATE; - -#define SCI_FLAG_FORCE_DISCONNECT _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_FORCE_DISCONNECT) -extern const unsigned int SCI_FLAG_FORCE_DISCONNECT; - -#define SCI_FLAG_NOTIFY _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_NOTIFY) -extern const unsigned int SCI_FLAG_NOTIFY; - -#define SCI_FLAG_DMA_READ _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_DMA_READ) -extern const unsigned int SCI_FLAG_DMA_READ; - -#define SCI_FLAG_DMA_POST _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_DMA_POST) -extern const unsigned int SCI_FLAG_DMA_POST; - -#define SCI_FLAG_DMA_WAIT _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_DMA_WAIT) -extern const unsigned int SCI_FLAG_DMA_WAIT; - -#define SCI_FLAG_DMA_RESET _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_DMA_RESET) -extern const unsigned int SCI_FLAG_DMA_RESET; - -#define SCI_FLAG_NO_FLUSH _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_NO_FLUSH) -extern const unsigned int SCI_FLAG_NO_FLUSH; - -#define SCI_FLAG_NO_STORE_BARRIER _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_NO_STORE_BARRIER) -extern const unsigned int SCI_FLAG_NO_STORE_BARRIER; - -#define SCI_FLAG_FAST_BARRIER _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_FAST_BARRIER) -extern const unsigned int SCI_FLAG_FAST_BARRIER; - -#define SCI_FLAG_ERROR_CHECK _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_ERROR_CHECK) -extern const unsigned int SCI_FLAG_ERROR_CHECK; - -#define SCI_FLAG_FLUSH_CPU_BUFFERS_ONLY _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_FLUSH_CPU_BUFFERS_ONLY) -extern const unsigned int SCI_FLAG_FLUSH_CPU_BUFFERS_ONLY; - -/* the FLUSH_CPU_BUFFERS_ONLY flag is for backwards compabillity only and should never be used */ -#define FLUSH_CPU_BUFFERS_ONLY _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_FLUSH_CPU_BUFFERS_ONLY) - -#define SCI_FLAG_LOCK_OPERATION _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_LOCK_OPERATION) -extern const unsigned int SCI_FLAG_LOCK_OPERATION; - -#define SCI_FLAG_READ_PREFETCH_AGGR_HOLD_MAP _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_READ_PREFETCH_AGGR_HOLD_MAP) -extern const unsigned int SCI_FLAG_READ_PREFETCH_AGGR_HOLD_MAP; - -#define SCI_FLAG_READ_PREFETCH_NO_HOLD_MAP _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_READ_PREFETCH_NO_HOLD_MAP) -extern const unsigned int SCI_FLAG_READ_PREFETCH_NO_HOLD_MAP; - -#define SCI_FLAG_IO_MAP_IOSPACE _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_IO_MAP_IOSPACE) -extern const unsigned int SCI_FLAG_IO_MAP_IOSPACE; - -#define SCI_FLAG_DMOVE_MAP _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_DMOVE_MAP) -extern const unsigned int SCI_FLAG_DMOVE_MAP; - -#define SCI_FLAG_WRITES_DISABLE_GATHER_MAP _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_WRITES_DISABLE_GATHER_MAP) -extern const unsigned int SCI_FLAG_WRITES_DISABLE_GATHER_MAP; - -#define SCI_FLAG_DISABLE_128_BYTES_PACKETS _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_DISABLE_128_BYTES_PACKETS) -extern const unsigned int SCI_FLAG_DISABLE_128_BYTES_PACKETS; - -#define SCI_FLAG_SHARED_MAP _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_SHARED_MAP) -extern const unsigned int SCI_FLAG_SHARED_MAP; - -#define SCI_FLAG_DMA_SOURCE_ONLY _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_DMA_SOURCE_ONLY) -extern const unsigned int SCI_FLAG_DMA_SOURCE_ONLY; - -#define SCI_FLAG_CONDITIONAL_INTERRUPT _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_CONDITIONAL_INTERRUPT) -extern const unsigned int SCI_FLAG_CONDITIONAL_INTERRUPT; - -#define SCI_FLAG_CONDITIONAL_INTERRUPT_MAP _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_CONDITIONAL_INTERRUPT_MAP) -extern const unsigned int SCI_FLAG_CONDITIONAL_INTERRUPT_MAP; - -#define SCI_FLAG_UNCONDITIONAL_DATA_INTERRUPT_MAP _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_UNCONDITIONAL_DATA_INTERRUPT_MAP) -extern const unsigned int SCI_FLAG_UNCONDITIONAL_DATA_INTERRUPT_MAP; - -#define SCI_FLAG_NO_MEMORY_LOOPBACK_MAP _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_NO_MEMORY_LOOPBACK_MAP) -extern const unsigned int SCI_FLAG_NO_MEMORY_LOOPBACK_MAP; - -#if defined(OS_IS_LYNXOS) || defined(OS_IS_VXWORKS) -#define SCI_FLAG_WRITE_BACK_CACHE_MAP _SISCI_EXPANDE_CONSTANT_NAME(WRITE_BACK_CACHE_MAP) -extern const unsigned int SCI_FLAG_WRITE_BACK_CACHE_MAP; -#endif - -#define SCI_FLAG_DMA_PHDMA _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_DMA_PHDMA) -extern const unsigned int SCI_FLAG_DMA_PHDMA; - -/*********************************************************************************/ -/* GENERAL VALUES */ -/*********************************************************************************/ -#define SCI_LOCAL_HOST _SISCI_EXPANDE_CONSTANT_NAME(SCI_LOCAL_HOST) -extern const unsigned int SCI_LOCAL_HOST; - -#define SCI_INFINITE_TIMEOUT _SISCI_EXPANDE_CONSTANT_NAME(SCI_INFINITE_TIMEOUT) -extern const unsigned int SCI_INFINITE_TIMEOUT; - -/*********************************************************************************/ -/* GENERAL ERROR CODES */ -/* */ -/* SCI_ERR_ILLEGAL_FLAG - Illegal flag value. */ -/* SCI_ERR_FLAG_NOT_IMPLEMENTED - Flag legal but flag feature not implemented. */ -/* SCI_ERR_NOT_IMPLEMENTED - Function not implemented. */ -/* SCI_ERR_SYSTEM - A system error. Check errno. */ -/* SCI_ERR_NOSPC - Unable to allocate OS resources. */ -/* SCI_ERR_API_NOSPC - Unable to allocate API resources. */ -/* SCI_ERR_HW_NOSPC - Unable to allocate HW resources (Hardware) */ -/* */ -/*********************************************************************************/ - - -/*********************************************************************************/ -/* GENERAL "ADAPTER" ERROR CODES */ -/* */ -/* SCI_ERR_NO_SUCH_ADAPTERNO - Adapter number is legal but does not exist. */ -/* SCI_ERR_ILLEGAL_ADAPTERNO - Illegal local adapter number (i.e. outside */ -/* legal range). */ -/* */ -/*********************************************************************************/ - - -/*********************************************************************************/ -/* GENERAL "NODEID" ERROR CODES */ -/* */ -/* SCI_ERR_NO_SUCH_NODEID - The remote adapter identified by nodeId does */ -/* not respond, but the intermediate link(s) */ -/* seem(s) to be operational. */ -/* SCI_ERR_ILLEGAL_NODEID - Illegal NodeId. */ -/* */ -/*********************************************************************************/ - - - -/********************************************************************************* - * * - * S C I I N I T I A L I Z E * - * * - * This function initializes the SISCI library. * - * The function must be called before SCIOpen(). * - * * - * Flags: * - * None * - * * - * Specific error codes for this function: * - * * - * None * - * * - *********************************************************************************/ -#define SCIInitialize _SISCI_EXPANDE_FUNCTION_NAME(SCIInitialize) -DLL void SCIInitialize(unsigned int flags, - sci_error_t *error); -#if 0 -unsigned int __Internal_SISCI_version_var; -#endif - -/********************************************************************************* - * * - * S C I T E R M I N A T E * - * * - * This function terminates the SISCI library. * - * The function must be called after SCIClose(). * - * * - * * - *********************************************************************************/ -#define SCITerminate _SISCI_EXPANDE_FUNCTION_NAME(SCITerminate) -DLL void SCITerminate(void); - -/********************************************************************************* - * * - * S C I O P E N * - * * - * * - * Opens a SCI virtual device. * - * Caller must supply a pointer to a variable of type sci_desc_t to be * - * initialized. * - * * - * Flags * - * SCI_FLAG_THREAD_SAFE - Operations on resources associated with this * - * descriptor will be performed in a multithread-safe * - * manner. * - * * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_INCONSISTENT_VERSIONS - Inconsistency between the SISCI library * - * and the SISCI driver versions. * - * * - * * - *********************************************************************************/ -#define SCIOpen _SISCI_EXPANDE_FUNCTION_NAME(SCIOpen) -DLL void SCIOpen(sci_desc_t *sd, - unsigned int flags, - sci_error_t *error); - - - - -/********************************************************************************* - * * - * S C I C L O S E * - * * - * This function closes an open SCI virtual device. * - * * - * Flags: * - * None * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_BUSY - All resources are not deallocated. * - * * - *********************************************************************************/ -#define SCIClose _SISCI_EXPANDE_FUNCTION_NAME(SCIClose) -DLL void SCIClose(sci_desc_t sd, - unsigned int flags, - sci_error_t *error); - - - - -/********************************************************************************* - * * - * S C I C O N N E C T S E G M E N T * - * * - * Connects to a remote shared memory segment located at with the * - * identifier . * - * The user may then call SCIMapRemoteSegment() to map shared memory * - * into user space. * - * * - * Flags * - * SCI_FLAG_USE_CALLBACK * - * SCI_FLAG_ASYNCHRONOUS_CONNECT * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_NO_SUCH_SEGMENT - Could not find the remote segment with the * - * given segmentId. * - * SCI_ERR_CONNECTION_REFUSED - Connection attempt refused by remote node. * - * SCI_ERR_TIMEOUT - The function timed out after specified * - * timeout value. * - * SCI_ERR_NO_LINK_ACCESS - It was not possible to communicate via the * - * local adapter. * - * SCI_ERR_NO_REMOTE_LINK_ACCESS - It was not possible to communicate via a * - * remote switch port. * - * * - *********************************************************************************/ -#define SCIConnectSegment _SISCI_EXPANDE_FUNCTION_NAME(SCIConnectSegment) -DLL void SCIConnectSegment(sci_desc_t sd, - sci_remote_segment_t *segment, - unsigned int nodeId, - unsigned int segmentId, - unsigned int localAdapterNo, - sci_cb_remote_segment_t callback, - void *callbackArg, - unsigned int timeout, - unsigned int flags, - sci_error_t *error); - - -/********************************************************************************* - * * - * S C I D I S C O N N E C T S E G M E N T * - * * - * Disconnects from the give mapped shared memory segment * - * * - * Flags * - * None. * - * * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_BUSY - The segment is currently mapped or in use. * - * * - *********************************************************************************/ -#define SCIDisconnectSegment _SISCI_EXPANDE_FUNCTION_NAME(SCIDisconnectSegment) -DLL void SCIDisconnectSegment(sci_remote_segment_t segment, - unsigned int flags, - sci_error_t *error); - - - -/********************************************************************************* - * * - * S C I G E T R E M O T E S E G M E N T S I Z E * - * * - *********************************************************************************/ -#define SCIGetRemoteSegmentSize _SISCI_EXPANDE_FUNCTION_NAME(SCIGetRemoteSegmentSize) -DLL unsigned int SCIGetRemoteSegmentSize(sci_remote_segment_t segment); - - - -/********************************************************************************* - * * - * S C I W A I T F O R R E M O T E S E G M E N T E V E N T * - * * - * Flags * - * None. * - * * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_TIMEOUT - The function timed out after specified * - * timeout value. * - * SCI_ERR_ILLEGAL_OPERATION - Illegal operation. * - * SCI_ERR_CANCELLED - The wait operation has been cancelled du * - * to a SCIDisconnectSegment() on the same * - * handle. The handle is invalid when this * - * error is returned. * - * * - *********************************************************************************/ -#define SCIWaitForRemoteSegmentEvent _SISCI_EXPANDE_FUNCTION_NAME(SCIWaitForRemoteSegmentEvent) -DLL sci_segment_cb_reason_t SCIWaitForRemoteSegmentEvent( - sci_remote_segment_t segment, - sci_error_t *status, - unsigned int timeout, - unsigned int flags, - sci_error_t *error); - - - - -/********************************************************************************* - * * - * S C I M A P R E M O T E S E G M E N T * - * * - * This function is used to include a shared memory segment in the virtual * - * address space of the application. * - * * - * Flags: * - * * - * SCI_FLAG_SHARED_MAP - The low level physical map may be shared by * - * other applications. * - * * - * SCI_FLAG_FIXED_MAP_ADDR - Map at the suggested virtual address * - * SCI_FLAG_READONLY_MAP - The segment is mapped in read-only mode * - * SCI_FLAG_LOCK_OPERATION - Enable Lock operations (fetch and add) * - * SCI_FLAG_READ_PREFETCH_AGGR_HOLD_MAP * - * - Enable aggressive prefetch with speculative * - * hold. * - * * - * SCI_FLAG_READ_PREFETCH_NO_HOLD_MAP * - * - The PSB66 will prefetch 64 bytes. As soon * - * as the PCI read retry has been accepted, * - * the stream will change state to FREE, even * - * if less than 64 bytes were actually read. * - * * - * SCI_FLAG_IO_MAP_IOSPACE - Enable No Prefetch, no speculative hold. * - * * - * SCI_FLAG_DMOVE_MAP - Enable DMOVE packet type. The stream will be * - * set into FREE state immediately. * - * * - * SCI_FLAG_WRITES_DISABLE_GATHER_MAP * - * - Disable use of gather. * - * * - * SCI_FLAG_DISABLE_128_BYTES_PACKETS * - * - Disable use of 128-Byte packets * - * * - * SCI_FLAG_CONDITIONAL_INTERRUPT_MAP * - * - Write operations through this map will cause * - * an atomic "fetch-and-add-one" operation on * - * remote memory, but in addition an interrupt * - * will be generated if the target memory * - * location contained a "null value" before the * - * add operation was carried out. * - * The conditional interrupt flag must also be * - * specified in the SCIRegisterInterruptFlag() * - * function. * - * * - * SCI_FLAG_UNCONDITIONAL_INTERRUPT_MAP * - * - Write operations through this map will cause * - * an interrupt for the remote adapter * - * "in addition to" updating the corresponding * - * remote memory location with the data being * - * written. * - * The unconditional interrupt flag must also * - * be specified in the * - * SCIRegisterInterruptFlag() function. * - * * - * SCI_FLAG_WRITE_BACK_CACHE_MAP * - * - Enable cacheing of the mapped region. * - * Writes through this map will be written to a * - * write back cache, hence no remote SCI updates* - * until the cache line is flushed. The * - * application is responsible for the cache * - * flush operation. * - * The SCImemCopy() function will handle this * - * correctly by doing cache flushes internally. * - * This feature is architechture dependent and * - * not be available on all plattforms. * - * * - * SCI_FLAG_NO_MEMORY_LOOPBACK_MAP * - * - Forces a map to a remote segment located * - * in the local machine to be mapped using * - * SCI loopback. This is useful i.e. if you * - * want to use a regular map access to be * - * serialized with lock operations. * - * The default behaviour is to access a remte * - * segment located in the local machine as a * - * local MMU operation. * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_OUT_OF_RANGE - The sum of the offset and size is * - * larger than the segment size. * - * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as * - * required by the implementation. * - * SCI_ERR_OFFSET_ALIGNMENT - Offset is not correctly aligned as * - * required by the implementation. * - * * - *********************************************************************************/ -#define SCIMapRemoteSegment _SISCI_EXPANDE_FUNCTION_NAME(SCIMapRemoteSegment) -DLL volatile void *SCIMapRemoteSegment( - sci_remote_segment_t segment, - sci_map_t *map, - unsigned int offset, - unsigned int size, - void *addr, - unsigned int flags, - sci_error_t *error); - - - - -/********************************************************************************* - * * - * S C I M A P L O C A L S E G M E N T * - * * - * Flags * - * * - * SCI_FLAG_FIXED_MAP_ADDR * - * SCI_FLAG_READONLY_MAP * - * * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_OUT_OF_RANGE - The sum of the offset and size is * - * larger than the segment size. * - * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as * - * required by the implementation. * - * SCI_ERR_OFFSET_ALIGNMENT - Offset is not correctly aligned as * - * required by the implementation. * - * * - *********************************************************************************/ -#define SCIMapLocalSegment _SISCI_EXPANDE_FUNCTION_NAME(SCIMapLocalSegment) -DLL void *SCIMapLocalSegment(sci_local_segment_t segment, - sci_map_t *map, - unsigned int offset, - unsigned int size, - void *addr, - unsigned int flags, - sci_error_t *error); - - - -/********************************************************************************* - * * - * S C I U N M A P S E G M E N T * - * * - * This function unmaps pages of shared memory from the callers virtual * - * address space. * - * * - * Flags * - * None. * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_BUSY - The map is currently in use. * - * * - *********************************************************************************/ -#define SCIUnmapSegment _SISCI_EXPANDE_FUNCTION_NAME(SCIUnmapSegment) -DLL void SCIUnmapSegment(sci_map_t map, - unsigned int flags, - sci_error_t *error); - - - - -/********************************************************************************* - * * - * S C I C R E A T E S E G M E N T * - * * - * Make the specified segment available for connections via the specified * - * adapter. If successful, the segment can be accessed from remote nodes * - * via the specified adapter. * - * * - * Flags: * - * * - * SCI_FLAG_USE_CALLBACK - The callback function will be invoked for events * - * on this segment. * - * SCI_FLAG_EMPTY - No memory will be allocated for the segment. * - * SCI_FLAG_PRIVATE - The segment will be private meaning it will never * - * be any connections to it. * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_SEGMENTID_USED - The segment with this segmentId is already used * - * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as required * - * by the implementation. * - * * - *********************************************************************************/ -#define SCICreateSegment _SISCI_EXPANDE_FUNCTION_NAME(SCICreateSegment) -DLL void SCICreateSegment(sci_desc_t sd, - sci_local_segment_t *segment, - unsigned int segmentId, - unsigned int size, - sci_cb_local_segment_t callback, - void *callbackArg, - unsigned int flags, - sci_error_t *error); - - - -/********************************************************************************* - * * - * S C I W A I T F O R L O C A L S E G M E N T E V E N T * - * * - * Flags * - * None. * - * * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_TIMEOUT - The function timed out after specified timeout value. * - * SCI_ERR_CANCELLED - The wait operation has been cancelled du to a * - * SCIRemoveSegment() on the same handle. * - * The handle is invalid when this error is returned. * - * * - *********************************************************************************/ -#define SCIWaitForLocalSegmentEvent _SISCI_EXPANDE_FUNCTION_NAME(SCIWaitForLocalSegmentEvent) -DLL sci_segment_cb_reason_t SCIWaitForLocalSegmentEvent( - sci_local_segment_t segment, - unsigned int *sourcenodeId, - unsigned int *localAdapterNo, - unsigned int timeout, - unsigned int flags, - sci_error_t *error); - - - -/********************************************************************************* - * * - * S C I P R E P A R E S E G M E N T * - * * - * Flags * - * * - * SCI_FLAG_DMA_SOURCE_ONLY - The segment will be used as a source segment * - * for DMA operations. On some system types this * - * will enable the SISCI driver to use performance * - * improving features. * - * * - * Specific error codes for this function: * - * * - * * - *********************************************************************************/ -#define SCIPrepareSegment _SISCI_EXPANDE_FUNCTION_NAME(SCIPrepareSegment) -DLL void SCIPrepareSegment(sci_local_segment_t segment, - unsigned int localAdapterNo, - unsigned int flags, - sci_error_t *error); - - - -/********************************************************************************* - * * - * S C I R E M O V E S E G M E N T * - * * - * Flags * - * None. * - * * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_BUSY - Unable to remove the segment. The segment is currently * - * in use. * - * * - *********************************************************************************/ -#define SCIRemoveSegment _SISCI_EXPANDE_FUNCTION_NAME(SCIRemoveSegment) -DLL void SCIRemoveSegment(sci_local_segment_t segment, - unsigned int flags, - sci_error_t *error); - - - - -/********************************************************************************* - * * - * S C I S E T S E G M E N T A V A I L A B L E * - * * - * Flags * - * None. * - * * - * * - * SCI_ERR_SEGMENT_NOT_PREPARED - The segment has not been prepared for access * - * from this adapter. * - * SCI_ERR_ILLEGAL_OPERATION - The segment is created with the * - * SCI_FLAG_PRIVATE flag specified and * - * therefore has no segmentId. * - * * - *********************************************************************************/ -#define SCISetSegmentAvailable _SISCI_EXPANDE_FUNCTION_NAME(SCISetSegmentAvailable) -DLL void SCISetSegmentAvailable(sci_local_segment_t segment, - unsigned int localAdapterNo, - unsigned int flags, - sci_error_t *error); - - - -/********************************************************************************* - * * - * S C I S E T S E G M E N T U N A V A I L A B L E * - * * - * Flags * - * * - * SCI_FLAG_FORCE_DISCONNECT * - * SCI_FLAG_NOTIFY * - * * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_ILLEGAL_OPERATION - Illegal operation. * - * * - *********************************************************************************/ -#define SCISetSegmentUnavailable _SISCI_EXPANDE_FUNCTION_NAME(SCISetSegmentUnavailable) -DLL void SCISetSegmentUnavailable(sci_local_segment_t segment, - unsigned int localAdapterNo, - unsigned int flags, - sci_error_t *error); - - - - -/********************************************************************************* - * * - * S C I C R E A T E M A P S E Q U E N C E * - * * - * Flags: * - * * - * SCI_FLAG_FAST_BARRIER * - * * - * * - * Specific error codes for this function: * - * * - *********************************************************************************/ -#define SCICreateMapSequence _SISCI_EXPANDE_FUNCTION_NAME(SCICreateMapSequence) -DLL void SCICreateMapSequence(sci_map_t map, - sci_sequence_t *sequence, - unsigned int flags, - sci_error_t *error); - - - -/********************************************************************************* - * * - * S C I R E M O V E S E Q U E N C E * - * * - * Flags: * - * None * - * * - * Specific error codes for this function: * - * * - *********************************************************************************/ -#define SCIRemoveSequence _SISCI_EXPANDE_FUNCTION_NAME(SCIRemoveSequence) -DLL void SCIRemoveSequence(sci_sequence_t sequence, - unsigned int flags, - sci_error_t *error); - - - -/********************************************************************************* - * * - * S C I S T A R T S E Q U E N C E * - * * - * Flags * - * None. * - * * - * * - * Specific error codes for this function: * - * * - * * - *********************************************************************************/ -#define SCIStartSequence _SISCI_EXPANDE_FUNCTION_NAME(SCIStartSequence) -DLL sci_sequence_status_t SCIStartSequence(sci_sequence_t sequence, - unsigned int flags, - sci_error_t *error); - - - -/********************************************************************************* - * * - * S C I C H E C K S E Q U E N CE * - * * - * Flags * - * * - * SCI_FLAG_NO_FLUSH * - * SCI_FLAG_NO_STORE_BARRIER * - * * - * * - * Specific error codes for this function: * - * * - *********************************************************************************/ -#define SCICheckSequence _SISCI_EXPANDE_FUNCTION_NAME(SCICheckSequence) -DLL sci_sequence_status_t SCICheckSequence(sci_sequence_t sequence, - unsigned int flags, - sci_error_t *error); - - - -/********************************************************************************* - * * - * S C I S T O R E B A R R I E R * - * * - * Flags * - * None. * - * * - * * - * * - *********************************************************************************/ -#define SCIStoreBarrier _SISCI_EXPANDE_FUNCTION_NAME(SCIStoreBarrier) -DLL void SCIStoreBarrier(sci_sequence_t sequence, - unsigned int flags); - - - - -/********************************************************************************* - * * - * S C I F L U S H R E A D B U F F E R S * - * * - *********************************************************************************/ -#define SCIFlushReadBuffers _SISCI_EXPANDE_FUNCTION_NAME(SCIFlushReadBuffers) -DLL void SCIFlushReadBuffers(sci_sequence_t sequence); - - - - -/********************************************************************************* - * * - * S C I P R O B E N O D E * - * * - * Flags * - * None. * - * * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_NO_LINK_ACCESS - It was not possible to communicate via the * - * local adapter. * - * SCI_ERR_NO_REMOTE_LINK_ACCESS - It was not possible to communicate via a * - * remote switch port. * - * * - *********************************************************************************/ -#define SCIProbeNode _SISCI_EXPANDE_FUNCTION_NAME(SCIProbeNode) -DLL int SCIProbeNode(sci_desc_t sd, - unsigned int localAdapterNo, - unsigned int nodeId, - unsigned int flags, - sci_error_t *error); - - - -/********************************************************************************* - * * - * S C I G E T C S R R E G I S T E R * - * * - * SISCI Priveleged function * - * * - * * - * Flags * - * None. * - * * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_NO_LINK_ACCESS - It was not possible to communicate via the * - * local adapter. * - * SCI_ERR_NO_REMOTE_LINK_ACCESS - It was not possible to communicate via a * - * remote switch port. * - * * - *********************************************************************************/ -#define SCIGetCSRRegister _SISCI_EXPANDE_FUNCTION_NAME(SCIGetCSRRegister) -DLL unsigned int SCIGetCSRRegister(sci_desc_t sd, - unsigned int localAdapterNo, - unsigned int SCINodeId, - unsigned int CSROffset, - unsigned int flags, - sci_error_t *error); - - - -/********************************************************************************* - * * - * S C I S E T C S R R E G I S T E R * - * * - * SISCI Priveleged function * - * * - * * - * Flags * - * None. * - * * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_NO_LINK_ACCESS - It was not possible to communicate via the * - * local adapter. * - * SCI_ERR_NO_REMOTE_LINK_ACCESS - It was not possible to communicate via a * - * remote switch port. * - * * - *********************************************************************************/ -#define SCISetCSRRegister _SISCI_EXPANDE_FUNCTION_NAME(SCISetCSRRegister) -DLL void SCISetCSRRegister(sci_desc_t sd, - unsigned int localAdapterNo, - unsigned int SCINodeId, - unsigned int CSROffset, - unsigned int CSRValue, - unsigned int flags, - sci_error_t *error); - - -/********************************************************************************* - * * - * S C I G E T L O C A L C S R * - * * - * SISCI Priveleged function * - * * - * Flags * - * None. * - * * - * * - * Specific error codes for this function: * - * * - * * - *********************************************************************************/ -#define SCIGetLocalCSR _SISCI_EXPANDE_FUNCTION_NAME(SCIGetLocalCSR) -DLL unsigned int SCIGetLocalCSR(sci_desc_t sd, - unsigned int localAdapterNo, - unsigned int CSROffset, - unsigned int flags, - sci_error_t *error); - - - -/********************************************************************************* - * * - * S C I S E T L O C A L C S R * - * * - * SISCI Priveleged function - * - * Flags * - * None. * - * * - * * - * Specific error codes for this function: * - * * - * * - *********************************************************************************/ -#define SCISetLocalCSR _SISCI_EXPANDE_FUNCTION_NAME(SCISetLocalCSR) -DLL void SCISetLocalCSR(sci_desc_t sd, - unsigned int localAdapterNo, - unsigned int CSROffset, - unsigned int CSRValue, - unsigned int flags, - sci_error_t *error); - - - -/********************************************************************************* - * * - * S C I A T T A C H P H Y S I C A L M E M O R Y * - * * - * SISCI Priveleged function * - * * - * Description: * - * * - * This function enables usage of physical devices and memory regions where the * - * Physical PCI bus address ( and mapped CPU address ) are already known. * - * The function will register the physical memory as a SISCI segment which can * - * be connected and mapped as a regular SISCI segment. * - * * - * Requirements: * - * * - * SCICreateSegment() with flag SCI_FLAG_EMPTY must have been called in advance * - * * - * Parameter description: * - * sci_ioaddr_t ioaddress : This is the address on the PCI bus that a PCI bus * - * master has to use to write to the specified memory * - * void * address : This is the (mapped) virtual address that the * - * application has to use to access the device. * - * This means that the device has to be mapped in * - * advance bye the devices own driver. * - * If the device is not to be accessed by the local * - * CPU, the address pointer shold be set to NULL * - * Flags * - * * - * None * - * * - * * - * Specific error codes for this function: * - * * - * * - *********************************************************************************/ -#define SCIAttachPhysicalMemory _SISCI_EXPANDE_FUNCTION_NAME(SCIAttachPhysicalMemory) -DLL void SCIAttachPhysicalMemory(sci_ioaddr_t ioaddress, - void *address, - unsigned int busNo, - unsigned int size, - sci_local_segment_t segment, - unsigned int flags, - sci_error_t *error); - - - -/********************************************************************************* - * * - * S C I Q U E R Y * - * * - * Flags * - * None. * - * * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_ILLEGAL_QUERY - Unrecognized command. * - * * - *********************************************************************************/ -#define SCIQuery _SISCI_EXPANDE_FUNCTION_NAME(SCIQuery) -DLL void SCIQuery(unsigned int command, - void *data, - unsigned int flags, - sci_error_t *error); - - -/* MAJOR QUERY COMMANDS */ - -/* This command requires a pointer to a structure of type */ -/* "sci_query_string". The string will be filled in by the query. */ -#define SCI_Q_VENDORID _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_VENDORID) -extern const unsigned int SCI_Q_VENDORID; - - -/* Same as for SCI_VENDOR_ID */ -#define SCI_Q_API _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_API) -extern const unsigned int SCI_Q_API; - - -/* User passes a pointer to an allocated object of the */ -/* "sci_query_adapter" struct. */ -#define SCI_Q_ADAPTER _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER) -extern const unsigned int SCI_Q_ADAPTER; - - -/* User passes a pointer to an allocated object of the */ -/* "sci_query_system" struct. */ -#define SCI_Q_SYSTEM _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_SYSTEM) -extern const unsigned int SCI_Q_SYSTEM; - -#define SCI_Q_LOCAL_SEGMENT _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_LOCAL_SEGMENT) -extern const unsigned int SCI_Q_LOCAL_SEGMENT; - -#define SCI_Q_REMOTE_SEGMENT _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_REMOTE_SEGMENT) -extern const unsigned int SCI_Q_REMOTE_SEGMENT; - -#define SCI_Q_MAP _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_MAP) -extern const unsigned int SCI_Q_MAP; - -typedef struct { - char *str; /* Pointer to a string of minimum "length" characters */ - unsigned int length; -} sci_query_string_t; - - -typedef struct { - unsigned int localAdapterNo; /* The adapter no. that the query concern. */ - unsigned int portNo; /* The SCI Link port number that the query concern. */ - unsigned int subcommand; /* A subcommand as specified below. */ - void *data; /* A pointer to an unsigned int that will return */ - /* the response to the query. */ -} sci_query_adapter_t; - - -typedef struct { - unsigned int subcommand; /* A subcommand as specified below. */ - void *data; /* A pointer to an unsigned int that will return */ - /* the response to the query. */ -} sci_query_system_t; - -typedef struct { - sci_local_segment_t segment; - unsigned int subcommand; - union { - sci_ioaddr_t ioaddr; - } data; -} sci_query_local_segment_t; - -typedef struct { - sci_remote_segment_t segment; - unsigned int subcommand; - union { - sci_ioaddr_t ioaddr; - } data; -} sci_query_remote_segment_t; - -typedef struct { - sci_map_t map; - unsigned int subcommand; - unsigned int data; -} sci_query_map_t; - -/* Minor query commands (sub-commands) for adapter specific information SCI_ADAPTER */ -#define SCI_Q_ADAPTER_DMA_SIZE_ALIGNMENT _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_DMA_SIZE_ALIGNMENT) -extern const unsigned int SCI_Q_ADAPTER_DMA_SIZE_ALIGNMENT; - -#define SCI_Q_ADAPTER_DMA_OFFSET_ALIGNMENT _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_DMA_OFFSET_ALIGNMENT) -extern const unsigned int SCI_Q_ADAPTER_DMA_OFFSET_ALIGNMENT; - -#define SCI_Q_ADAPTER_DMA_MTU _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_DMA_MTU) -extern const unsigned int SCI_Q_ADAPTER_DMA_MTU; - -#define SCI_Q_ADAPTER_SUGGESTED_MIN_DMA_SIZE _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_SUGGESTED_MIN_DMA_SIZE) -extern const unsigned int SCI_Q_ADAPTER_SUGGESTED_MIN_DMA_SIZE; - -#define SCI_Q_ADAPTER_SUGGESTED_MIN_BLOCK_SIZE _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_SUGGESTED_MIN_BLOCK_SIZE) -extern const unsigned int SCI_Q_ADAPTER_SUGGESTED_MIN_BLOCK_SIZE; - -#define SCI_Q_ADAPTER_NODEID _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_NODEID) -extern const unsigned int SCI_Q_ADAPTER_NODEID; - -#define SCI_Q_ADAPTER_SERIAL_NUMBER _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_SERIAL_NUMBER) -extern const unsigned int SCI_Q_ADAPTER_SERIAL_NUMBER; - -#define SCI_Q_ADAPTER_CARD_TYPE _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_CARD_TYPE) -extern const unsigned int SCI_Q_ADAPTER_CARD_TYPE; - -#define SCI_Q_ADAPTER_NUMBER_OF_STREAMS _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_NUMBER_OF_STREAMS) -extern const unsigned int SCI_Q_ADAPTER_NUMBER_OF_STREAMS; - -#define SCI_Q_ADAPTER_STREAM_BUFFER_SIZE _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_STREAM_BUFFER_SIZE) -extern const unsigned int SCI_Q_ADAPTER_STREAM_BUFFER_SIZE; - -#define SCI_Q_ADAPTER_CONFIGURED _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_CONFIGURED) -extern const unsigned int SCI_Q_ADAPTER_CONFIGURED; - -#define SCI_Q_ADAPTER_LINK_OPERATIONAL _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_LINK_OPERATIONAL) -extern const unsigned int SCI_Q_ADAPTER_LINK_OPERATIONAL; - -#define SCI_Q_ADAPTER_HW_LINK_STATUS_IS_OK _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_HW_LINK_STATUS_IS_OK) -extern const unsigned int SCI_Q_ADAPTER_HW_LINK_STATUS_IS_OK; - -#define SCI_Q_ADAPTER_NUMBER _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_NUMBER) -extern const unsigned int SCI_Q_ADAPTER_NUMBER; - -#define SCI_Q_ADAPTER_INSTANCE_NUMBER _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_INSTANCE_NUMBER) -extern const unsigned int SCI_Q_ADAPTER_INSTANCE_NUMBER; - -#define SCI_Q_ADAPTER_FIRMWARE_OK _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_FIRMWARE_OK) -extern const unsigned int SCI_Q_ADAPTER_FIRMWARE_OK; - -#define SCI_Q_ADAPTER_CONNECTED_TO_SWITCH _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_CONNECTED_TO_SWITCH) -extern const unsigned int SCI_Q_ADAPTER_CONNECTED_TO_SWITCH; - -#define SCI_Q_ADAPTER_LOCAL_SWITCH_TYPE _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_LOCAL_SWITCH_TYPE) -extern const unsigned int SCI_Q_ADAPTER_LOCAL_SWITCH_TYPE; - -#define SCI_Q_ADAPTER_LOCAL_SWITCH_PORT_NUMBER _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_LOCAL_SWITCH_PORT_NUMBER) -extern const unsigned int SCI_Q_ADAPTER_LOCAL_SWITCH_PORT_NUMBER; - -#define SCI_Q_ADAPTER_CONNECTED_TO_EXPECTED_SWITCH_PORT _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_CONNECTED_TO_EXPECTED_SWITCH_PORT) -extern const unsigned int SCI_Q_ADAPTER_CONNECTED_TO_EXPECTED_SWITCH_PORT; - -#define SCI_Q_ADAPTER_ATT_PAGE_SIZE _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_ATT_PAGE_SIZE) -extern const unsigned int SCI_Q_ADAPTER_ATT_PAGE_SIZE; - -#define SCI_Q_ADAPTER_ATT_NUMBER_OF_ENTRIES _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_ATT_NUMBER_OF_ENTRIES) -extern const unsigned int SCI_Q_ADAPTER_ATT_NUMBER_OF_ENTRIES; - -#define SCI_Q_ADAPTER_ATT_AVAILABLE_ENTRIES _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_ATT_AVAILABLE_ENTRIES) -extern const unsigned int SCI_Q_ADAPTER_ATT_AVAILABLE_ENTRIES; - -#define SCI_Q_ADAPTER_PHYS_MEM_NODEID _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_SCI_Q_ADAPTER_PHYS_MEM_NODEID) -extern const unsigned int SCI_Q_ADAPTER_PHYS_MEM_NODEID; - -#define SCI_Q_ADAPTER_PHYS_MBX_NODEID _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_SCI_Q_ADAPTER_PHYS_MBX_NODEID) -extern const unsigned int SCI_Q_ADAPTER_PHYS_MBX_NODEID; - -#define SCI_Q_ADAPTER_PHYS_LINK_PORT_NODEID _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_PHYS_LINK_PORT_NODEID) -extern const unsigned int SCI_Q_ADAPTER_PHYS_LINK_PORT_NODEID; - -#define SCI_Q_ADAPTER_SCI_LINK_FREQUENCY _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_SCI_LINK_FREQUENCY) -extern const unsigned int SCI_Q_ADAPTER_SCI_LINK_FREQUENCY; - -#define SCI_Q_ADAPTER_B_LINK_FREQUENCY _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_B_LINK_FREQUENCY) -extern const unsigned int SCI_Q_ADAPTER_B_LINK_FREQUENCY; - -#define SCI_Q_ADAPTER_IO_BUS_FREQUENCY _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_IO_BUS_FREQUENCY) -extern const unsigned int SCI_Q_ADAPTER_IO_BUS_FREQUENCY; - -/* Minor query commands (sub-commands) for adapter specific information SCI_SYSTEM */ -#define SCI_Q_SYSTEM_HOSTBRIDGE _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_SYSTEM_HOSTBRIDGE) -extern const unsigned int SCI_Q_SYSTEM_HOSTBRIDGE; - -#define SCI_Q_SYSTEM_WRITE_POSTING_ENABLED _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_SYSTEM_WRITE_POSTING_ENABLED) -extern const unsigned int SCI_Q_SYSTEM_WRITE_POSTING_ENABLED; - -#define SCI_Q_SYSTEM_WRITE_COMBINING_ENABLED _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_SYSTEM_WRITE_COMBINING_ENABLED) -extern const unsigned int SCI_Q_SYSTEM_WRITE_COMBINING_ENABLED; - -#define SCI_Q_LOCAL_SEGMENT_IOADDR _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_LOCAL_SEGMENT_IOADDR) -extern const unsigned int SCI_Q_LOCAL_SEGMENT_IOADDR; - -#define SCI_Q_REMOTE_SEGMENT_IOADDR _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_REMOTE_SEGMENT_IOADDR) -extern const unsigned int SCI_Q_REMOTE_SEGMENT_IOADDR; - -#define SCI_Q_MAP_MAPPED_TO_LOCAL_TARGET _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_MAP_MAPPED_TO_LOCAL_TARGET) -extern const unsigned int SCI_Q_MAP_MAPPED_TO_LOCAL_TARGET; - -#define SCI_Q_MAP_QUERY_REMOTE_MAPPED_TO_LOCAL_TARGET _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_MAP_QUERY_REMOTE_MAPPED_TO_LOCAL_TARGET) -extern const unsigned int SCI_Q_MAP_QUERY_REMOTE_MAPPED_TO_LOCAL_TARGET; - -#define HOSTBRIDGE_NOT_AVAILABLE _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_NOT_AVAILABLE) -extern const unsigned int HOSTBRIDGE_NOT_AVAILABLE; - -#define HOSTBRIDGE_UNKNOWN _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_UNKNOWN) -extern const unsigned int HOSTBRIDGE_UNKNOWN; - -#define HOSTBRIDGE_440FX _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_440FX) -extern const unsigned int HOSTBRIDGE_440FX; - -#define HOSTBRIDGE_440LX _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_440LX) -extern const unsigned int HOSTBRIDGE_440LX; - -#define HOSTBRIDGE_440BX_A _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_440BX_A) -extern const unsigned int HOSTBRIDGE_440BX_A; - -#define HOSTBRIDGE_440BX_B _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_440BX_B) -extern const unsigned int HOSTBRIDGE_440BX_B; - -#define HOSTBRIDGE_440GX _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_440GX) -extern const unsigned int HOSTBRIDGE_440GX; - -#define HOSTBRIDGE_450KX _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_450KX) -extern const unsigned int HOSTBRIDGE_450KX; - -#define HOSTBRIDGE_430NX _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_430NX) -extern const unsigned int HOSTBRIDGE_430NX; - -#define HOSTBRIDGE_450NX _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_450NX) -extern const unsigned int HOSTBRIDGE_450NX; - -#define HOSTBRIDGE_450NX_MICO _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_450NX_MICO) -extern const unsigned int HOSTBRIDGE_450NX_MICO; - -#define HOSTBRIDGE_450NX_PXB _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_450NX_PXB) -extern const unsigned int HOSTBRIDGE_450NX_PXB; - -#define HOSTBRIDGE_I810 _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_I810) -extern const unsigned int HOSTBRIDGE_I810; - -#define HOSTBRIDGE_I810_DC100 _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_I810_DC100) -extern const unsigned int HOSTBRIDGE_I810_DC100; - -#define HOSTBRIDGE_I810E _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_I810E) -extern const unsigned int HOSTBRIDGE_I810E; - -#define HOSTBRIDGE_I815 _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_I815) -extern const unsigned int HOSTBRIDGE_I815; - -#define HOSTBRIDGE_I840 _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_I840) -extern const unsigned int HOSTBRIDGE_I840; - -#define HOSTBRIDGE_I850 _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_I850) -extern const unsigned int HOSTBRIDGE_I850; - -#define HOSTBRIDGE_I860 _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_I860) -extern const unsigned int HOSTBRIDGE_I860; - -#define HOSTBRIDGE_INTEL_E7500 _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_INTEL_E7500) -extern const unsigned int HOSTBRIDGE_INTEL_E7500; - -#define HOSTBRIDGE_VIA_KT133 _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_VIA_KT133) -extern const unsigned int HOSTBRIDGE_VIA_KT133; - -#define HOSTBRIDGE_VIA_KX133 _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_VIA_KX133) -extern const unsigned int HOSTBRIDGE_VIA_KX133; - -#define HOSTBRIDGE_VIA_APOLLO_PRO_133A _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_VIA_APOLLO_PRO_133A) -extern const unsigned int HOSTBRIDGE_VIA_APOLLO_PRO_133A; - -#define HOSTBRIDGE_VIA_APOLLO_PRO_266 _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_VIA_APOLLO_PRO_266) -extern const unsigned int HOSTBRIDGE_VIA_APOLLO_PRO_266; - -#define HOSTBRIDGE_AMD_760_MP _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_AMD_760_MP) -extern const unsigned int HOSTBRIDGE_AMD_760_MP; - -#define HOSTBRIDGE_AMD_HAMMER _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_AMD_HAMMER) -extern const unsigned int HOSTBRIDGE_AMD_HAMMER; - -#define HOSTBRIDGE_SERVERWORKS_HE _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_SERVERWORKS_HE) -extern const unsigned int HOSTBRIDGE_SERVERWORKS_HE; - -#define HOSTBRIDGE_SERVERWORKS_HE_B _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_SERVERWORKS_HE_B) -extern const unsigned int HOSTBRIDGE_SERVERWORKS_HE_B; - -#define HOSTBRIDGE_SERVERWORKS_LE _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_SERVERWORKS_LE) -extern const unsigned int HOSTBRIDGE_SERVERWORKS_LE; - -#define HOSTBRIDGE_SERVERWORKS_GC_HE _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_SERVERWORKS_GC_HE) -extern const unsigned int HOSTBRIDGE_SERVERWORKS_GC_HE; - -#define HOSTBRIDGE_SERVERWORKS_GC_LE _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_SERVERWORKS_GC_LE) -extern const unsigned int HOSTBRIDGE_SERVERWORKS_GC_LE; - -#define HOSTBRIDGE_SERVERWORKS_GC_WS _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_SERVERWORKS_GC_WS) -extern const unsigned int HOSTBRIDGE_SERVERWORKS_GC_WS; - -#define HOSTBRIDGE_SERVERWORKS_GC_SL _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_SERVERWORKS_GC_SL) -extern const unsigned int HOSTBRIDGE_SERVERWORKS_GC_SL; - - -#define HOSTBRIDGE_WRITE_POSTING_DISABLED _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_WRITE_POSTING_DISABLED) -extern const unsigned int HOSTBRIDGE_WRITE_POSTING_DISABLED; - -#define HOSTBRIDGE_WRITE_POSTING_ENABLED _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_WRITE_POSTING_ENABLED) -extern const unsigned int HOSTBRIDGE_WRITE_POSTING_ENABLED; - - - - -/********************************************************************************* - * * - * S C I C R E A T E D M A Q U E U E * - * * - * Flags * - * * - * SCI_FLAG_DMA_PHDMA : Create physical DMA queue. Please note that this is an * - * priveleged operation. * - * * - * * - * * - * Specific error codes for this function: * - * * - *********************************************************************************/ -#define SCICreateDMAQueue _SISCI_EXPANDE_FUNCTION_NAME(SCICreateDMAQueue) -DLL void SCICreateDMAQueue(sci_desc_t sd, - sci_dma_queue_t *dq, - unsigned int localAdapterNo, - unsigned int maxEntries, - unsigned int flags, - sci_error_t *error); - - - -/********************************************************************************* - * * - * S C I R E M O V E D M A Q U E U E * - * * - * Flags * - * None. * * - * * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_ILLEGAL_OPERATION - Not allowed in this queue state. * - * * - *********************************************************************************/ -#define SCIRemoveDMAQueue _SISCI_EXPANDE_FUNCTION_NAME(SCIRemoveDMAQueue) -DLL void SCIRemoveDMAQueue(sci_dma_queue_t dq, - unsigned int flags, - sci_error_t *error); - - - -/********************************************************************************* - * * - * S C I E N Q U E U E D M A T R A N S F E R * - * * - * Flags: * - * * - * SCI_FLAG_DMA_READ - The DMA will be remote --> local * - * (default is local --> remote) * - * * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_OUT_OF_RANGE - The sum of the offset and size is larger * - * than the segment size or larger than max * - * DMA size. * - * SCI_ERR_MAX_ENTRIES - The DMA queue is full * - * SCI_ERR_ILLEGAL_OPERATION - Illegal operation * - * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as required * - * by the implementation. * - * SCI_ERR_OFFSET_ALIGNMENT - Offset is not correctly aligned as required * - * by the implementation. * - * SCI_ERR_SEGMENT_NOT_PREPARED - The local segment has not been prepared for * - * access from the adapter associated with the * - * queue. * - * SCI_ERR_SEGMENT_NOT_CONNECTED - The remote segment is not connected through * - * the adapter associated with the queue. * - *********************************************************************************/ -#define SCIEnqueueDMATransfer _SISCI_EXPANDE_FUNCTION_NAME(SCIEnqueueDMATransfer) -DLL sci_dma_queue_state_t SCIEnqueueDMATransfer(sci_dma_queue_t dq, - sci_local_segment_t localSegment, - sci_remote_segment_t remoteSegment, - unsigned int localOffset, - unsigned int remoteOffset, - unsigned int size, - unsigned int flags, - sci_error_t *error); - - - -/********************************************************************************* - * * - * S C I P O S T D M A Q U E U E * - * * - * Flags: * - * * - * SCI_FLAG_USE_CALLBACK - The end of the transfer will cause the callback * - * function to be invoked. * - * * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_ILLEGAL_OPERATION - Illegal operation * - * * - *********************************************************************************/ -#define SCIPostDMAQueue _SISCI_EXPANDE_FUNCTION_NAME(SCIPostDMAQueue) -DLL void SCIPostDMAQueue(sci_dma_queue_t dq, - sci_cb_dma_t callback, - void *callbackArg, - unsigned int flags, - sci_error_t *error); - - - -/********************************************************************************* - * * - * S C I A B O R T D M A Q U E U E * - * * - * Flags * - * None. * - * * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_ILLEGAL_OPERATION - Illegal operation * - * * - *********************************************************************************/ -#define SCIAbortDMAQueue _SISCI_EXPANDE_FUNCTION_NAME(SCIAbortDMAQueue) -DLL void SCIAbortDMAQueue(sci_dma_queue_t dq, - unsigned int flags, - sci_error_t *error); - - -/********************************************************************************* - * * - * S C I R E S E T D M A Q U E U E * - * * - * Flags * - * None. * * - * * - * * - * Specific error codes for this function: * - * * - * * - *********************************************************************************/ -#define SCIResetDMAQueue _SISCI_EXPANDE_FUNCTION_NAME(SCIResetDMAQueue) -DLL void SCIResetDMAQueue(sci_dma_queue_t dq, - unsigned int flags, - sci_error_t *error); - - - -/********************************************************************************* - * * - * S C I D M A Q U E U E S T A T E * - * * - *********************************************************************************/ -#define SCIDMAQueueState _SISCI_EXPANDE_FUNCTION_NAME(SCIDMAQueueState) -DLL sci_dma_queue_state_t SCIDMAQueueState(sci_dma_queue_t dq); - - - -/********************************************************************************* - * * - * S C I W A I T F O R D M A Q U E U E * - * * - * Flags * - * None. * - * * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_ILLEGAL_OPERATION - Illegal operation * - * SCI_ERR_TIMEOUT - The function timed out after specified * - * timeout value. * - * * - *********************************************************************************/ -#define SCIWaitForDMAQueue _SISCI_EXPANDE_FUNCTION_NAME(SCIWaitForDMAQueue) -DLL sci_dma_queue_state_t SCIWaitForDMAQueue(sci_dma_queue_t dq, - unsigned int timeout, - unsigned int flags, - sci_error_t *error); - - - - -/********************************************************************************* - * * - * S C I P H D M A E N Q U E U E * - * * - * SISCI Priveleged function * - * * - * Flags * - * * - * SCI_FLAG_DMA_READ * - * * - * Specific error codes for this function: * - * * - *********************************************************************************/ -#define SCIphDmaEnqueue _SISCI_EXPANDE_FUNCTION_NAME(SCIphDmaEnqueue) -DLL void SCIphDmaEnqueue(sci_dma_queue_t dmaqueue, - unsigned int size, - sci_ioaddr_t localBusAddr, - unsigned int remote_nodeid, - unsigned int remote_highaddr, - unsigned int remote_lowaddr, - unsigned int flags, - sci_error_t *error); - -/********************************************************************************* - * * - * S C I P H D M A S T A R T * - * * - * Flags * - * * - * SCI_FLAG_DMA_WAIT * - * SCI_FLAG_USE_CALLBACK * - * SCI_FLAG_DMA_RESET * - * * - * Specific error codes for this function: * - * * - *********************************************************************************/ -#define SCIphDmaStart _SISCI_EXPANDE_FUNCTION_NAME(SCIphDmaStart) -DLL sci_dma_queue_state_t SCIphDmaStart(sci_dma_queue_t dmaqueue, - sci_cb_dma_t callback, - void *callbackArg, - unsigned int flags, - sci_error_t *error); - -/********************************************************************************* - * * - * S C I C R E A T E I N T E R R U P T * - * * - * Flags * - * * - * SCI_FLAG_USE_CALLBACK * - * SCI_FLAG_FIXED_INTNO * - * SCI_FLAG_SHARED_INT * - * * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_INTNO_USED - This interrupt number is already used. * - * * - *********************************************************************************/ -#define SCICreateInterrupt _SISCI_EXPANDE_FUNCTION_NAME(SCICreateInterrupt) -DLL void SCICreateInterrupt(sci_desc_t sd, - sci_local_interrupt_t *interrupt, - unsigned int localAdapterNo, - unsigned int *interruptNo, - sci_cb_interrupt_t callback, - void *callbackArg, - unsigned int flags, - sci_error_t *error); - - - -/********************************************************************************* - * * - * S C I R E M O V E I N T E R R U P T * - * * - * Flags * - * None. * - * * - * * - * Specific error codes for this function: * - * * - *********************************************************************************/ -#define SCIRemoveInterrupt _SISCI_EXPANDE_FUNCTION_NAME(SCIRemoveInterrupt) -DLL void SCIRemoveInterrupt(sci_local_interrupt_t interrupt, - unsigned int flags, - sci_error_t *error); - - - - -/********************************************************************************* - * * - * S C I W A I T F O R I N T E R R U P T * - * * - * Flags * - * None. * - * * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_TIMEOUT - The function timed out after specified timeout value. * - * SCI_ERR_CANCELLED - The wait was interrupted by a call to * - * SCIRemoveInterrupt. * - * The handle is invalid when this error code is returned.* - * * - *********************************************************************************/ -#define SCIWaitForInterrupt _SISCI_EXPANDE_FUNCTION_NAME(SCIWaitForInterrupt) -DLL void SCIWaitForInterrupt(sci_local_interrupt_t interrupt, - unsigned int timeout, - unsigned int flags, - sci_error_t *error); - - - - -/********************************************************************************* - * * - * S C I C O N N E C T I N T E R R U P T * - * * - * Flags * - * None. * - * * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_NO_SUCH_INTNO - No such interrupt number. * - * SCI_ERR_CONNECTION_REFUSED - Connection attempt refused by remote node. * - * SCI_ERR_TIMEOUT - The function timed out after specified * - * timeout value. * - * * - *********************************************************************************/ -#define SCIConnectInterrupt _SISCI_EXPANDE_FUNCTION_NAME(SCIConnectInterrupt) -DLL void SCIConnectInterrupt(sci_desc_t sd, - sci_remote_interrupt_t *interrupt, - unsigned int nodeId, - unsigned int localAdapterNo, - unsigned int interruptNo, - unsigned int timeout, - unsigned int flags, - sci_error_t *error); - - -/********************************************************************************* - * * - * S C I D I S C O N N E C T I N T E R R U P T * - * * - * Flags * - * None. * - * * - * * - * Specific error codes for this function: * - * * - * * - *********************************************************************************/ -#define SCIDisconnectInterrupt _SISCI_EXPANDE_FUNCTION_NAME(SCIDisconnectInterrupt) -DLL void SCIDisconnectInterrupt(sci_remote_interrupt_t interrupt, - unsigned int flags, - sci_error_t *error); - - - - -/********************************************************************************* - * * - * S C I T R I G G E R I N T E R R U P T * - * * - * Flags * - * None. * - * * - * * - * Specific error codes for this function: * - * * - * * - *********************************************************************************/ -#define SCITriggerInterrupt _SISCI_EXPANDE_FUNCTION_NAME(SCITriggerInterrupt) -DLL void SCITriggerInterrupt(sci_remote_interrupt_t interrupt, - unsigned int flags, - sci_error_t *error); - - - - -/********************************************************************************* - * * - * S C I R E G I S T E R I N T E R R U P T F L A G * - * * - * * - * This function register an "interrupt flag" that is identified as an unique * - * location within a local segment. If successful, the resulting interrupt * - * handle will have been associated with the specified local segment. * - * * - * It is up to the (remote) client(s) to set up an "interrupt mapping" for the * - * corresponding segment offset using either the * - * * - * - SCI_FLAG_CONDITIONAL_INTERRUPT_MAP * - * * - * or the * - * * - * - SCI_FLAG_UNCONDITIONAL_DATA_INTERRUPT_MAP * - * * - * option to "SCIMapRemoteSegment()". - I.e. after having established a * - * connection to the corresponding segment. A trigger operation can then * - * be implemented using a store operation via the relevant "interrupt map". * - * * - * * - * * - * * - * * - * Flags: * - * * - * SCI_FLAG_CONDITIONAL_INTERRUPT - Triggering is to take place using * - * "conditional interrupts". * - * * - * * - * * - * Specific error codes for this function: * - * None. * - * * - *********************************************************************************/ -#define SCIRegisterInterruptFlag _SISCI_EXPANDE_FUNCTION_NAME(SCIRegisterInterruptFlag) -DLL void SCIRegisterInterruptFlag( - unsigned int localAdapterNo, - sci_local_interrupt_t *interrupt, - sci_local_segment_t segment, - unsigned int offset, - sci_cb_interrupt_t callback, - void *callbackArg, - unsigned int flags, - sci_error_t *error); - - - - -/********************************************************************************* - * * - * S C I E N A B L E C O N D I T I O N A L I N T E R R U P T * - * * - * * - * This function make sure that another HW interrupt will take place the next * - * time the corresponding interrupt flag is triggered by a * - * "conditional interrupt" operation. * - * * - * Default semantics: * - * * - * When successful, the client can rely on that the first subsequent trigger * - * operation will cause a HW interrupt and subsequently cause the client * - * handler function to be invoked. * - * * - * If an interrupt was triggered in parallell with the enable operation, then * - * the operation will fail (SCI_ERR_COND_INT_RACE_PROBLEM), and the client can * - * not rely on another trigger operation will lead to handler invocation. * - * Hence, any state checking normally associated with handling the * - * corresponding interrupt should take place before attempting to enable * - * again. * - * * - * * - * Flags * - * None. * - * * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_COND_INT_RACE_PROBLEM - The enable operation failed because an * - * incomming trigger operation happened * - * concurrently. * - * * - *********************************************************************************/ -#define SCIEnableConditionalInterrupt _SISCI_EXPANDE_FUNCTION_NAME(SCIEnableConditionalInterrupt) -DLL void SCIEnableConditionalInterrupt( - sci_local_interrupt_t interrupt, - unsigned int flags, - sci_error_t *error); - - - - -/********************************************************************************* - * * - * S C I D I S A B L E C O N D I T I O N A L I N T E R R U P T * - * * - * * - * Prevent subsequent "conditional interrupt"trigger operations for * - * the specified interupt flag from causing HW interrupt and handler * - * invocations. * - * * - * * - * Default semantics: * - * * - * If successful, no subsequent HW interrupts will take place, but handler * - * invocations that have already been scheduled may still take place. * - * * - * * - * Flags * - * None. * - * * - * * - * Specific error codes for this function: * - * * - * * - *********************************************************************************/ -#define SCIDisableConditionalInterrupt _SISCI_EXPANDE_FUNCTION_NAME(SCIDisableConditionalInterrupt) -DLL void SCIDisableConditionalInterrupt( - sci_local_interrupt_t interrupt, - unsigned int flags, - sci_error_t *error); - - - -/********************************************************************************* - * * - * S C I G E T C O N D I T I O N A L I N T E R R U P T C O U N T E R * - * * - * * - * Returns a value that indicates the number of times this flag has * - * been trigged since the last time it was enabled or disabled. * - * Calling the SCIEnableConditionalInterrupt / SCIDisableConditionalInterrupt * - * functions will reset the counter value. * - * * - * Default semantics: * - * * - * If successful, the current trig count is returned in the * - * interruptTrigCounter parameter. * - * * - * Flags * - * None. * - * * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_OVERFLOW - The number of trig operations have exceeded the range * - * that can be counted. * - *********************************************************************************/ -#define SCIGetConditionalInterruptTrigCounter _SISCI_EXPANDE_FUNCTION_NAME(SCIGetConditionalInterruptTrigCounter) -DLL void SCIGetConditionalInterruptTrigCounter( - sci_local_interrupt_t interrupt, - unsigned int *interruptTrigCounter, - unsigned int flags, - sci_error_t *error); - - - - -/********************************************************************************* - * * - * S C I T R A N S F E R B L O C K * - * * - * Flags * - * None. * - * * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_OUT_OF_RANGE - The sum of the size and offset is larger * - * than the corresponding map size. * - * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as required * - * by the implementation. * - * SCI_ERR_OFFSET_ALIGNMENT - Offset is not correctly aligned as required * - * by the implementation. * - * SCI_ERR_TRANSFER_FAILED - The data transfer failed. * - * * - *********************************************************************************/ -#define SCITransferBlock _SISCI_EXPANDE_FUNCTION_NAME(SCITransferBlock) -DLL void SCITransferBlock(sci_map_t sourceMap, - unsigned int sourceOffset, - sci_map_t destinationMap, - unsigned int destinationOffset, - unsigned int size, - unsigned int flags, - sci_error_t *error); - - - - -/********************************************************************************* - * * - * S C I T R A N S F E R B L O C K A S Y N C * - * * - * Flags * - * * - * SCI_FLAG_BLOCK_READ * - * SCI_FLAG_USE_CALLBACK * - * * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_OUT_OF_RANGE - The sum of the size and offset is larger than * - * the corresponding map size. * - * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as required by * - * the implementation. * - * SCI_ERR_OFFSET_ALIGNMENT - Offset is not correctly aligned as required * - * by the implementation. * - * SCI_ERR_TRANSFER_FAILED - The data transfer failed. * - * * - *********************************************************************************/ -#define SCITransferBlockAsync _SISCI_EXPANDE_FUNCTION_NAME(SCITransferBlockAsync) -DLL void SCITransferBlockAsync(sci_map_t sourceMap, - unsigned int sourceOffset, - sci_map_t destinationMap, - unsigned int destinationOffset, - unsigned int size, - sci_block_transfer_t *block, - sci_cb_block_transfer_t callback, - void *callbackArg, - unsigned int flags, - sci_error_t *error); - - - - -/********************************************************************************* - * * - * S C I W A I T F O R B L O C K T R A N S F E R * - * * - * Flags * - * None. * - * * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_ILLEGAL_OPERATION - Illegal operation * - * SCI_ERR_TIMEOUT - The function timed out after specified * - * timeout value. * - * * - *********************************************************************************/ -#define SCIWaitForBlockTransfer _SISCI_EXPANDE_FUNCTION_NAME(SCIWaitForBlockTransfer) -DLL void SCIWaitForBlockTransfer(sci_block_transfer_t block, - unsigned int timeout, - unsigned int flags, - sci_error_t *error); - - - -/********************************************************************************* - * * - * S C I A B O R T B L O C K T R A N S F E R * - * * - * Flags * - * None. * - * * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_ILLEGAL_OPERATION - Illegal operation * - * * - *********************************************************************************/ -#define SCIAbortBlockTransfer _SISCI_EXPANDE_FUNCTION_NAME(SCIAbortBlockTransfer) -DLL void SCIAbortBlockTransfer(sci_block_transfer_t block, - unsigned int flags, - sci_error_t *error); - - - - -/********************************************************************************* - * * - * S C I M E M C P Y * - * * - * Flags: * - * SCI_FLAG_BLOCK_READ * - * SCI_FLAG_ERROR_CHECK * - * * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_OUT_OF_RANGE - The sum of the size and offset is larger * - * than the corresponding map size. * - * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as required * - * by the implementation. * - * SCI_ERR_OFFSET_ALIGNMENT - Offset is not correctly aligned as required * - * by the implementation. * - * SCI_ERR_TRANSFER_FAILED - The data transfer failed. * - * * - *********************************************************************************/ - -#define SCIMemCpy _SISCI_EXPANDE_FUNCTION_NAME(SCIMemCpy) -DLL void SCIMemCpy(sci_sequence_t sequence, - void *memAddr, - sci_map_t remoteMap, - unsigned int remoteOffset, - unsigned int size, - unsigned int flags, - sci_error_t *error); - - - -/********************************************************************************* - * * - * S C I M E M C O P Y * - * * - * Flags: * - * SCI_FLAG_BLOCK_READ * - * SCI_FLAG_ERROR_CHECK * - * * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_OUT_OF_RANGE - The sum of the size and offset is larger * - * than the corresponding map size. * - * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as required * - * by the implementation. * - * SCI_ERR_OFFSET_ALIGNMENT - Offset is not correctly aligned as required * - * by the implementation. * - * SCI_ERR_TRANSFER_FAILED - The data transfer failed. * - * * - *********************************************************************************/ - - -#define SCIMemCopy _SISCI_EXPANDE_FUNCTION_NAME(SCIMemCopy) -DLL void SCIMemCopy(void *memAddr, - sci_map_t remoteMap, - unsigned int remoteOffset, - unsigned int size, - unsigned int flags, - sci_error_t *error); - - - -/********************************************************************************* - * * - * S C I R E G I S T E R S E G M E N T M E M O R Y * - * * - * Flags * - * None. * - * * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as required by * - * the implementation. * - * SCI_ERR_ILLEGAL_ADDRESS - Illegal address. * - * SCI_ERR_OUT_OF_RANGE - Size is larger than the maximum size for the * - * local segment. * - * * - *********************************************************************************/ -#define SCIRegisterSegmentMemory _SISCI_EXPANDE_FUNCTION_NAME(SCIRegisterSegmentMemory) -DLL void SCIRegisterSegmentMemory(void *address, - unsigned int size, - sci_local_segment_t segment, - unsigned int flags, - sci_error_t *error); - - - - - -/********************************************************************************* - * * - * S C I C O N N E C T S C I S P A C E * - * * - * SISCI Priveleged function * - * * - * * - * Flags * - * None. * - * * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as required * - * by the implementation. * - * SCI_ERR_CONNECTION_REFUSED - Connection attempt refused by remote node. * - * * - *********************************************************************************/ -#define SCIConnectSCISpace _SISCI_EXPANDE_FUNCTION_NAME(SCIConnectSCISpace) -DLL void SCIConnectSCISpace(sci_desc_t sd, - unsigned int localAdapterNo, - sci_remote_segment_t *segment, - sci_address_t address, - unsigned int size, - unsigned int flags, - sci_error_t *error); - - - -/* - * ===================================================================================== - * - * S C I A T T A C H L O C A L S E G M E N T - * Description: - * - * SCIAttachLocalSegment() permits an application to "attach" to an already existing - * local segment, implying that two or more application want - * share the same local segment. The prerequest, is that the - * application which originally created the segment ("owner") has - * preformed a SCIShareSegment() in order to mark the segment - * "shareable". - * - * - * Flags: - * - * SCI_FLAG_USE_CALLBACK - The callback function will be invoked for events - * on this segment. - * - * - * Specific error codes for this function: - * - * SCI_ERR_ACCESS - No such shared segment - * SCI_ERR_NO_SUCH_SEGMENT - No such segment - * Note: Current implenentation will return SCI_ERR_ACCESS for both cases. This will - * change from next release. Application should handle both cases. - * - * ===================================================================================== - */ -#define SCIAttachLocalSegment _SISCI_EXPANDE_FUNCTION_NAME(SCIAttachLocalSegment) - -DLL void -SCIAttachLocalSegment(sci_desc_t sd, - sci_local_segment_t *segment, - unsigned int segmentId, - unsigned int *size, - sci_cb_local_segment_t callback, - void *callbackArg, - unsigned int flags, - sci_error_t *error); -/* - * ===================================================================================== - * - * S C I S H A R E S E G M E N T - * - * Description: - * - * SCIShareSegment() permits other application to "attach" to an already existing - * local segment, implying that two or more application want - * share the same local segment. The prerequest, is that the - * application which originally created the segment ("owner") has - * preformed a SCIShareSegment() in order to mark the segment - * "shareable". - * - * - * Flags: - * none - * - * Specific error codes for this function: - * - * - * - * ===================================================================================== - */ -#define SCIShareSegment _SISCI_EXPANDE_FUNCTION_NAME(SCIShareSegment) - -DLL void -SCIShareSegment(sci_local_segment_t segment, - unsigned int flags, - sci_error_t *error); - - -/********************************************************************************* - * * - * S C I F L U S H * - * * - * This function will flush the CPU buffers and the PSB buffers. * - * * - * Flags * - * SCI_FLAG_FLUSH_CPU_BUFFERS_ONLY : * - * Only flush CPU buffers ( Write combining * - * etc buffers). * - * * - *********************************************************************************/ - -#define SCIFlush _SISCI_EXPANDE_FUNCTION_NAME(SCIFlush) -DLL void SCIFlush(sci_sequence_t sequence, - unsigned int flags); - -#if defined(CPLUSPLUS) || defined(__cplusplus) -} -#endif - - -#endif - - - - - - - - - - - diff --git a/ndb/src/external/LINUX.x86/sci/include/sisci_demolib.h b/ndb/src/external/LINUX.x86/sci/include/sisci_demolib.h deleted file mode 100644 index 4284fc5585c..00000000000 --- a/ndb/src/external/LINUX.x86/sci/include/sisci_demolib.h +++ /dev/null @@ -1,226 +0,0 @@ -/* $Id: sisci_demolib.h,v 1.1 2002/12/13 12:17:21 hin Exp $ */ - -/******************************************************************************* - * * - * Copyright (C) 1993 - 2000 * - * Dolphin Interconnect Solutions AS * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, * - * or (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the Free Software * - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - * * - *******************************************************************************/ - -#ifndef _SISCI_DEMOLIB_H -#define _SISCI_DEMOLIB_H - - -#if defined(_REENTRANT) - -#define _SISCI_DEMOLIB_EXPAND_NAME(name) _SISCI_DEMOLIB_MT_ ## name - -#else - -#define _SISCI_DEMOLIB_EXPAND_NAME(name) _SISCI_DEMOLIB_ST_ ## name - -#endif - -/*********************************************************************************/ -/* Q U E R Y A D A P T E R */ -/* */ -/*********************************************************************************/ - -#define QueryAdapter _SISCI_DEMOLIB_EXPAND_NAME(QueryAdapter) - -sci_error_t QueryAdapter( - unsigned int subcommand, - unsigned int localAdapterNo, - unsigned int portNo, - unsigned int *data); - - -/*********************************************************************************/ -/* Q U E R Y S Y S T E M */ -/* */ -/*********************************************************************************/ - -#define QuerySystem _SISCI_DEMOLIB_EXPAND_NAME(QuerySystem) - -sci_error_t QuerySystem( - unsigned int subcommand, - unsigned int *data); - - -/*********************************************************************************/ -/* D E T E C T F I R S T A D A P T E R C A R D */ -/* */ -/*********************************************************************************/ - -#define DetectFirstAdapterCard _SISCI_DEMOLIB_EXPAND_NAME(DetectFirstAdapterCard) - -sci_error_t DetectFirstAdapterCard( - unsigned int *localAdapterNo, - unsigned int *localNodeId); - - -/*********************************************************************************/ -/* G E T A D A P T E R T Y P E */ -/* */ -/*********************************************************************************/ - -#define GetAdapterType _SISCI_DEMOLIB_EXPAND_NAME(GetAdapterType) - -sci_error_t GetAdapterType(unsigned int localAdapterNo, - unsigned int *adapterType); - - -/*********************************************************************************/ -/* G E T L O C A L N O D E I D */ -/* */ -/*********************************************************************************/ - -#define GetLocalNodeId _SISCI_DEMOLIB_EXPAND_NAME(GetLocalNodeId) - -sci_error_t GetLocalNodeId( - unsigned int localAdapterNo, - unsigned int *localNodeId); - - -/*********************************************************************************/ -/* G E T A D A P T E R S E R I A L N U M B E R */ -/* */ -/*********************************************************************************/ - -#define GetAdapterSerialNumber _SISCI_DEMOLIB_EXPAND_NAME(GetAdapterSerialNumber) - -sci_error_t GetAdapterSerialNumber( - unsigned int localAdapterNo, - unsigned int *serialNo); - - - -/*********************************************************************************/ -/* G E T H O S T B R I D G E T Y P E */ -/* */ -/*********************************************************************************/ - -#define GetHostbridgeType _SISCI_DEMOLIB_EXPAND_NAME(GetHostbridgeType) - -sci_error_t GetHostbridgeType(unsigned int *hostbridgeType); - - - -/*********************************************************************************/ -/* P R I N T H O S T B R I D G E T Y P E */ -/* */ -/*********************************************************************************/ - -#define PrintHostbridgeType _SISCI_DEMOLIB_EXPAND_NAME(PrintHostbridgeType) - -void PrintHostbridgeType(unsigned int hostbridge); - - - -/*********************************************************************************/ -/* G E T A P I V E R S I O N S T R I N G */ -/* */ -/*********************************************************************************/ - -#define GetAPIVersionString _SISCI_DEMOLIB_EXPAND_NAME(GetAPIVersionString) - -sci_error_t GetAPIVersionString(char str[], unsigned int strLength); - - - -/*********************************************************************************/ -/* G E T A D A P T E R I O B U S F R E Q U E N C Y */ -/* */ -/*********************************************************************************/ - -sci_error_t GetAdapterIoBusFrequency(unsigned int localAdapterNo, - unsigned int *ioBusFrequency); - - - -/*********************************************************************************/ -/* G E T A D A P T E R S C I L I N K F R E Q U E N C Y */ -/* */ -/*********************************************************************************/ - -sci_error_t GetAdapterSciLinkFrequency(unsigned int localAdapterNo, - unsigned int *sciLinkFrequency); - - - -/*********************************************************************************/ -/* G E T A D A P T E R B L I N K F R E Q U E N C Y */ -/* */ -/*********************************************************************************/ - -sci_error_t GetAdapterBlinkFrequency(unsigned int localAdapterNo, - unsigned int *bLinkFrequency); - - -/*********************************************************************************/ -/* S E N D I N T E R R U P T */ -/* */ -/*********************************************************************************/ - -#define SendInterrupt _SISCI_DEMOLIB_EXPAND_NAME(SendInterrupt) - -sci_error_t SendInterrupt( - sci_desc_t sd, - unsigned int localAdapterNo, - unsigned int localNodeId, - unsigned int remoteNodeId, - unsigned int interruptNo); - - -/*********************************************************************************/ -/* R E C E I V E I N T E R R U P T */ -/* */ -/*********************************************************************************/ - -#define ReceiveInterrupt _SISCI_DEMOLIB_EXPAND_NAME(ReceiveInterrupt) - -sci_error_t ReceiveInterrupt( - sci_desc_t sd, - unsigned int localAdapterNo, - unsigned int localNodeId, - unsigned int interruptNo); - - -/*********************************************************************************/ -/* E N D I A N S W A P */ -/* */ -/*********************************************************************************/ - -#define EndianSwap _SISCI_DEMOLIB_EXPAND_NAME(EndianSwap) - -unsigned int EndianSwap (unsigned int value); - - -/*********************************************************************************/ -/* S L E E P M I L L I S E C O N D S */ -/* */ -/*********************************************************************************/ - -#define SleepMilliseconds _SISCI_DEMOLIB_EXPAND_NAME(SleepMilliseconds) - -void SleepMilliseconds(int milliseconds); - - - - -#endif diff --git a/ndb/src/external/LINUX.x86/sci/include/sisci_error.h b/ndb/src/external/LINUX.x86/sci/include/sisci_error.h deleted file mode 100644 index c53fe8ad5d9..00000000000 --- a/ndb/src/external/LINUX.x86/sci/include/sisci_error.h +++ /dev/null @@ -1,89 +0,0 @@ -/* $Id: sisci_error.h,v 1.1 2002/12/13 12:17:21 hin Exp $ */ - -/******************************************************************************* - * * - * Copyright (C) 1993 - 2000 * - * Dolphin Interconnect Solutions AS * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, * - * or (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the Free Software * - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - * * - *******************************************************************************/ - - - - -#ifndef _SISCI_ERROR_H_ -#define _SISCI_ERROR_H_ - - -/* SCI Error return values always have 30 bit set */ -#define SCI_ERR_MASK 0x40000000 -#define SCI_ERR_REMOTE_MASK 0x01 /* Remote errors should have bit 0 set */ - -#define SCI_ERR(u) ((unsigned32)(u)&0x7FFFFFFF ) - -/* Error codes */ -typedef enum { - SCI_ERR_OK = 0x000, - - - SCI_ERR_BUSY = (0x900 | SCI_ERR_MASK), - SCI_ERR_FLAG_NOT_IMPLEMENTED = (0x901 | SCI_ERR_MASK), - SCI_ERR_ILLEGAL_FLAG = (0x902 | SCI_ERR_MASK), - SCI_ERR_NOSPC = (0x904 | SCI_ERR_MASK), - SCI_ERR_API_NOSPC = (0x905 | SCI_ERR_MASK), - SCI_ERR_HW_NOSPC = (0x906 | SCI_ERR_MASK), - SCI_ERR_NOT_IMPLEMENTED = (0x907 | SCI_ERR_MASK), - SCI_ERR_ILLEGAL_ADAPTERNO = (0x908 | SCI_ERR_MASK), - SCI_ERR_NO_SUCH_ADAPTERNO = (0x909 | SCI_ERR_MASK), - SCI_ERR_TIMEOUT = (0x90A | SCI_ERR_MASK), - SCI_ERR_OUT_OF_RANGE = (0x90B | SCI_ERR_MASK), - SCI_ERR_NO_SUCH_SEGMENT = (0x90C | SCI_ERR_MASK), - SCI_ERR_ILLEGAL_NODEID = (0x90D | SCI_ERR_MASK), - SCI_ERR_CONNECTION_REFUSED = (0x90E | SCI_ERR_MASK), - SCI_ERR_SEGMENT_NOT_CONNECTED = (0x90F | SCI_ERR_MASK), - SCI_ERR_SIZE_ALIGNMENT = (0x910 | SCI_ERR_MASK), - SCI_ERR_OFFSET_ALIGNMENT = (0x911 | SCI_ERR_MASK), - SCI_ERR_ILLEGAL_PARAMETER = (0x912 | SCI_ERR_MASK), - SCI_ERR_MAX_ENTRIES = (0x913 | SCI_ERR_MASK), - SCI_ERR_SEGMENT_NOT_PREPARED = (0x914 | SCI_ERR_MASK), - SCI_ERR_ILLEGAL_ADDRESS = (0x915 | SCI_ERR_MASK), - SCI_ERR_ILLEGAL_OPERATION = (0x916 | SCI_ERR_MASK), - SCI_ERR_ILLEGAL_QUERY = (0x917 | SCI_ERR_MASK), - SCI_ERR_SEGMENTID_USED = (0x918 | SCI_ERR_MASK), - SCI_ERR_SYSTEM = (0x919 | SCI_ERR_MASK), - SCI_ERR_CANCELLED = (0x91A | SCI_ERR_MASK), - SCI_ERR_NOT_CONNECTED = (0x91B | SCI_ERR_MASK), - SCI_ERR_NOT_AVAILABLE = (0x91C | SCI_ERR_MASK), - SCI_ERR_INCONSISTENT_VERSIONS = (0x91D | SCI_ERR_MASK), - SCI_ERR_COND_INT_RACE_PROBLEM = (0x91E | SCI_ERR_MASK), - SCI_ERR_OVERFLOW = (0x91F | SCI_ERR_MASK), - SCI_ERR_NOT_INITIALIZED = (0x920 | SCI_ERR_MASK), - - SCI_ERR_ACCESS = (0x921 | SCI_ERR_MASK), - - SCI_ERR_NO_SUCH_NODEID = (0xA00 | SCI_ERR_MASK), - SCI_ERR_NODE_NOT_RESPONDING = (0xA02 | SCI_ERR_MASK), - SCI_ERR_NO_REMOTE_LINK_ACCESS = (0xA04 | SCI_ERR_MASK), - SCI_ERR_NO_LINK_ACCESS = (0xA05 | SCI_ERR_MASK), - SCI_ERR_TRANSFER_FAILED = (0xA06 | SCI_ERR_MASK) -} sci_error_t; - - -#endif /* _SCI_ERROR_H_ */ - - - diff --git a/ndb/src/external/LINUX.x86/sci/include/sisci_types.h b/ndb/src/external/LINUX.x86/sci/include/sisci_types.h deleted file mode 100644 index f4125fdec69..00000000000 --- a/ndb/src/external/LINUX.x86/sci/include/sisci_types.h +++ /dev/null @@ -1,133 +0,0 @@ -/* $Id: sisci_types.h,v 1.1 2002/12/13 12:17:21 hin Exp $ */ - -/******************************************************************************* - * * - * Copyright (C) 1993 - 2000 * - * Dolphin Interconnect Solutions AS * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, * - * or (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the Free Software * - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - * * - *******************************************************************************/ - - -#ifndef _SISCI_TYPES_H -#define _SISCI_TYPES_H - -#include "sisci_error.h" - -#ifndef IN -#define IN -#endif - -#ifndef OUT -#define OUT -#endif - -#ifndef IN_OUT -#define IN_OUT -#endif - -/* Opaque data types for descriptors/handles */ -typedef struct sci_desc *sci_desc_t; -typedef struct sci_local_segment *sci_local_segment_t; -typedef struct sci_remote_segment *sci_remote_segment_t; - -typedef struct sci_map *sci_map_t; -typedef struct sci_sequence *sci_sequence_t; -#ifndef KERNEL -typedef struct sci_dma_queue *sci_dma_queue_t; -#endif -typedef struct sci_remote_interrupt *sci_remote_interrupt_t; -typedef struct sci_local_interrupt *sci_local_interrupt_t; -typedef struct sci_block_transfer *sci_block_transfer_t; - -/* - * Constants defining reasons for segment callbacks: - */ - -typedef enum { - SCI_CB_CONNECT = 1, - SCI_CB_DISCONNECT, - SCI_CB_NOT_OPERATIONAL, - SCI_CB_OPERATIONAL, - SCI_CB_LOST -} sci_segment_cb_reason_t; - -#define MAX_CB_REASON SCI_CB_LOST - -/* dma_queue_states is identical to the dma_queue_state_t in genif.h, they must be consistent.*/ -typedef enum { - SCI_DMAQUEUE_IDLE, - SCI_DMAQUEUE_GATHER, - SCI_DMAQUEUE_POSTED, - SCI_DMAQUEUE_DONE, - SCI_DMAQUEUE_ABORTED, - SCI_DMAQUEUE_ERROR -} sci_dma_queue_state_t; - - -typedef enum { - SCI_SEQ_OK, - SCI_SEQ_RETRIABLE, - SCI_SEQ_NOT_RETRIABLE, - SCI_SEQ_PENDING -} sci_sequence_status_t; - - -typedef struct { - unsigned short nodeId; /* SCI Address bit 63 - 48 */ - unsigned short offsHi; /* SCI Address bit 47 - 32 */ - unsigned int offsLo; /* SCI Address bit 31 - 0 */ -} sci_address_t; - - -typedef unsigned int sci_ioaddr_t; - -typedef enum { - SCI_CALLBACK_CANCEL = 1, - SCI_CALLBACK_CONTINUE -} sci_callback_action_t; - -#ifndef KERNEL -typedef sci_callback_action_t (*sci_cb_local_segment_t)(void *arg, - sci_local_segment_t segment, - sci_segment_cb_reason_t reason, - unsigned int nodeId, - unsigned int localAdapterNo, - sci_error_t error); - -typedef sci_callback_action_t (*sci_cb_remote_segment_t)(void *arg, - sci_remote_segment_t segment, - sci_segment_cb_reason_t reason, - sci_error_t status); - - -typedef sci_callback_action_t (*sci_cb_dma_t)(void IN *arg, - sci_dma_queue_t queue, - sci_error_t status); - - -typedef int (*sci_cb_block_transfer_t)(void *arg, - sci_block_transfer_t block, - sci_error_t status); - - -typedef sci_callback_action_t (*sci_cb_interrupt_t)(void *arg, - sci_local_interrupt_t interrupt, - sci_error_t status); - -#endif /* KERNEL */ -#endif diff --git a/ndb/src/external/LINUX.x86/sci/include/sisci_version.h b/ndb/src/external/LINUX.x86/sci/include/sisci_version.h deleted file mode 100644 index f1807c33aa5..00000000000 --- a/ndb/src/external/LINUX.x86/sci/include/sisci_version.h +++ /dev/null @@ -1,91 +0,0 @@ -/* $Id: sisci_version.h,v 1.1 2002/12/13 12:17:21 hin Exp $ */ - -/******************************************************************************* - * * - * Copyright (C) 1993 - 2000 * - * Dolphin Interconnect Solutions AS * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU Lesser General Public License as published by * - * the Free Software Foundation; either version 2.1 of the License, * - * or (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU Lesser General Public License * - * along with this program; if not, write to the Free Software * - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - * * - *******************************************************************************/ - - -#ifndef SISCI_VERSION_H -#define SISCI_VERSION_H - - -#define SISCI_API_VER_MAJOR 0x01 -#define SISCI_API_VER_MAJORC "1" - -#define SISCI_API_VER_MINOR 0x010 -#define SISCI_API_VER_MINORC "10" -#define SISCI_API_VER_MICRO 0x005 -#define SISCI_API_VER_MICROC "5" - -#define SISCI_SIGN_VERSION_MASK 0xfffff000 /* used to mask off API_VER_MICRO */ - -#define SISCI_API_VERSION (SISCI_API_VER_MAJOR << 24 | SISCI_API_VER_MINOR << 12 | SISCI_API_VER_MICRO) - -/* the rules are: - * - * Changes in API_VER_MICRO should be binary compatible, New flags, functions added. No changes to user code - * required if new features is not needed. - * - * Changes in API_VER_MINOR requires recompilation of user code. - * - * Changes in the API_VER_MAJOR will most likely require changes to user code. This should not happen very - * often... - * - */ - -#ifndef BUILD_DATE -#define BUILD_DATE __DATE__ -#endif - -#ifndef BUILD_NAME -#define BUILD_NAME "" -#endif - -#define API_VERSION "SISCI API version " SISCI_API_VER_MAJORC "." SISCI_API_VER_MINORC "."SISCI_API_VER_MICROC " ( "BUILD_NAME" "BUILD_DATE" )" - -#endif - - -/* Version info: */ -/* */ -/* 1.5.2 First SISCI version */ -/* 1.5.3 Some bug fixes */ -/* 1.5.4 Some bug fixes */ -/* 1.5.5 No release */ -/* 1.5.6 Lock flag implemented in function SCIConnectSegment */ -/* 1.5.7 Expanded query functionality */ -/* 1.5.8 Updated error checking (sequence) functionality for D320 */ -/* 1.6.0 Updated error checking (sequence) D320 and IRM 1.9 support */ -/* 1.9.0 Ported to Solaris_sparc, Solaris_x86 and Linux. IRM 1.9. */ -/* 1.9.1 Some bug fixes */ -/* 1.9.2 Added more adapter queries */ -/* 1.9.3 Bug fix in SCIMapLocalSegment and SCIMapRemoteSegment */ -/* 1.9.4 NT Release Developers Kit 2.40 */ -/* 1.9.5 Added flush after data transfer in SCIMemCopy() */ -/* 1.9.5 NT Release Developers Kit 2.44 */ -/* 1.10.0: - * New SCIInitialize(), SCITerminate() functions. - * Support for D330 - * - * - */ - - diff --git a/ndb/src/external/LINUX.x86/sci/include/version.h b/ndb/src/external/LINUX.x86/sci/include/version.h deleted file mode 100644 index a0e1fa6c5cd..00000000000 --- a/ndb/src/external/LINUX.x86/sci/include/version.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef _VERSION_H -#define _VERSION_H - - -/* -#define DEMO_VER_MAJOR "1" -#define DEMO_VER_MINOR "5" -#define DEMO_VER_MICRO "0" -*/ - -#ifndef BUILD_DATE -#define BUILD_DATE __DATE__ -#endif - -#ifndef BUILD_NAME -#define BUILD_NAME "" -#endif - -/* -#define DEMO_VERSION "version " DEMO_VER_MAJOR "." DEMO_VER_MINOR "."DEMO_VER_MICRO " ("BUILD_NAME" "BUILD_DATE" )" -*/ -#define DEMO_VERSION " ("BUILD_NAME" "BUILD_DATE" )" - - -#endif diff --git a/ndb/src/external/SOLARIS.SPARC/sci/include/sisci_api.h b/ndb/src/external/SOLARIS.SPARC/sci/include/sisci_api.h deleted file mode 100644 index d02d3aafe7f..00000000000 --- a/ndb/src/external/SOLARIS.SPARC/sci/include/sisci_api.h +++ /dev/null @@ -1,2148 +0,0 @@ -/* $Id: sisci_api.h,v 1.1 2002/12/13 12:17:22 hin Exp $ */ -/******************************************************************************* - * * - * Copyright (C) 1993 - 2001 * - * Dolphin Interconnect Solutions AS * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU Lesser General Public License as published by * - * the Free Software Foundation; either version 2.1 of the License, * - * or (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU Lesser General Public License * - * along with this program; if not, write to the Free Software * - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - * * - *******************************************************************************/ - -#ifndef _SISCI_API_H -#define _SISCI_API_H - -#include "sisci_types.h" -#include "sisci_error.h" - - -#ifdef WIN32 -#ifdef API_DLL -#define DLL __declspec(dllexport) -#elif CLIENT_DLL -#define DLL __declspec(dllimport) -#endif -#endif /* WIN32 */ - - -#ifndef DLL -#define DLL -#endif - -#if defined(_REENTRANT) -#define _SISCI_EXPANDE_FUNCTION_NAME(name) _SISCI_PUBLIC_FUNC_MT_ ## name -#define _SISCI_EXPANDE_VARIABLE_NAME(name) _SISCI_PUBLIC_VAR_MT_ ## name -#else -#define _SISCI_EXPANDE_FUNCTION_NAME(name) _SISCI_PUBLIC_FUNC_ST_ ## name -#define _SISCI_EXPANDE_VARIABLE_NAME(name) _SISCI_PUBLIC_VAR_ST_ ## name -#endif -#define _SISCI_EXPANDE_CONSTANT_NAME(name) _SISCI_PUBLIC_CONST_ ## name - -#if defined(CPLUSPLUS) || defined(__cplusplus) -extern "C" { -#endif - - -/*********************************************************************************/ -/* FLAG VALUES */ -/*********************************************************************************/ - -#define SCI_FLAG_FIXED_INTNO _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_FIXED_INTNO) -extern const unsigned int SCI_FLAG_FIXED_INTNO; - -#define SCI_FLAG_SHARED_INT _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_SHARED_INT) -extern const unsigned int SCI_FLAG_SHARED_INT; - -#define SCI_FLAG_FIXED_MAP_ADDR _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_FIXED_MAP_ADDR) -extern const unsigned int SCI_FLAG_FIXED_MAP_ADDR; - -#define SCI_FLAG_READONLY_MAP _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_READONLY_MAP) -extern const unsigned int SCI_FLAG_READONLY_MAP; - -#define SCI_FLAG_USE_CALLBACK _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_USE_CALLBACK) -extern const unsigned int SCI_FLAG_USE_CALLBACK; - -#define SCI_FLAG_BLOCK_READ _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_BLOCK_READ) -extern const unsigned int SCI_FLAG_BLOCK_READ; - -#define SCI_FLAG_THREAD_SAFE _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_THREAD_SAFE) -extern const unsigned int SCI_FLAG_THREAD_SAFE; - -#define SCI_FLAG_ASYNCHRONOUS_CONNECT _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_ASYNCHRONOUS_CONNECT) -extern const unsigned int SCI_FLAG_ASYNCHRONOUS_CONNECT; - -#define SCI_FLAG_EMPTY _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_EMPTY) -extern const unsigned int SCI_FLAG_EMPTY; - -#define SCI_FLAG_PRIVATE _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_PRIVATE) -extern const unsigned int SCI_FLAG_PRIVATE; - -#define SCI_FLAG_FORCE_DISCONNECT _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_FORCE_DISCONNECT) -extern const unsigned int SCI_FLAG_FORCE_DISCONNECT; - -#define SCI_FLAG_NOTIFY _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_NOTIFY) -extern const unsigned int SCI_FLAG_NOTIFY; - -#define SCI_FLAG_DMA_READ _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_DMA_READ) -extern const unsigned int SCI_FLAG_DMA_READ; - -#define SCI_FLAG_DMA_POST _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_DMA_POST) -extern const unsigned int SCI_FLAG_DMA_POST; - -#define SCI_FLAG_DMA_WAIT _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_DMA_WAIT) -extern const unsigned int SCI_FLAG_DMA_WAIT; - -#define SCI_FLAG_DMA_RESET _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_DMA_RESET) -extern const unsigned int SCI_FLAG_DMA_RESET; - -#define SCI_FLAG_NO_FLUSH _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_NO_FLUSH) -extern const unsigned int SCI_FLAG_NO_FLUSH; - -#define SCI_FLAG_NO_STORE_BARRIER _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_NO_STORE_BARRIER) -extern const unsigned int SCI_FLAG_NO_STORE_BARRIER; - -#define SCI_FLAG_FAST_BARRIER _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_FAST_BARRIER) -extern const unsigned int SCI_FLAG_FAST_BARRIER; - -#define SCI_FLAG_ERROR_CHECK _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_ERROR_CHECK) -extern const unsigned int SCI_FLAG_ERROR_CHECK; - -#define SCI_FLAG_FLUSH_CPU_BUFFERS_ONLY _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_FLUSH_CPU_BUFFERS_ONLY) -extern const unsigned int SCI_FLAG_FLUSH_CPU_BUFFERS_ONLY; - -/* the FLUSH_CPU_BUFFERS_ONLY flag is for backwards compabillity only and should never be used */ -#define FLUSH_CPU_BUFFERS_ONLY _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_FLUSH_CPU_BUFFERS_ONLY) - -#define SCI_FLAG_LOCK_OPERATION _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_LOCK_OPERATION) -extern const unsigned int SCI_FLAG_LOCK_OPERATION; - -#define SCI_FLAG_READ_PREFETCH_AGGR_HOLD_MAP _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_READ_PREFETCH_AGGR_HOLD_MAP) -extern const unsigned int SCI_FLAG_READ_PREFETCH_AGGR_HOLD_MAP; - -#define SCI_FLAG_READ_PREFETCH_NO_HOLD_MAP _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_READ_PREFETCH_NO_HOLD_MAP) -extern const unsigned int SCI_FLAG_READ_PREFETCH_NO_HOLD_MAP; - -#define SCI_FLAG_IO_MAP_IOSPACE _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_IO_MAP_IOSPACE) -extern const unsigned int SCI_FLAG_IO_MAP_IOSPACE; - -#define SCI_FLAG_DMOVE_MAP _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_DMOVE_MAP) -extern const unsigned int SCI_FLAG_DMOVE_MAP; - -#define SCI_FLAG_WRITES_DISABLE_GATHER_MAP _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_WRITES_DISABLE_GATHER_MAP) -extern const unsigned int SCI_FLAG_WRITES_DISABLE_GATHER_MAP; - -#define SCI_FLAG_DISABLE_128_BYTES_PACKETS _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_DISABLE_128_BYTES_PACKETS) -extern const unsigned int SCI_FLAG_DISABLE_128_BYTES_PACKETS; - -#define SCI_FLAG_DMA_SOURCE_ONLY _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_DMA_SOURCE_ONLY) -extern const unsigned int SCI_FLAG_DMA_SOURCE_ONLY; - -#define SCI_FLAG_CONDITIONAL_INTERRUPT _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_CONDITIONAL_INTERRUPT) -extern const unsigned int SCI_FLAG_CONDITIONAL_INTERRUPT; - -#define SCI_FLAG_CONDITIONAL_INTERRUPT_MAP _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_CONDITIONAL_INTERRUPT_MAP) -extern const unsigned int SCI_FLAG_CONDITIONAL_INTERRUPT_MAP; - -#define SCI_FLAG_UNCONDITIONAL_DATA_INTERRUPT_MAP _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_UNCONDITIONAL_DATA_INTERRUPT_MAP) -extern const unsigned int SCI_FLAG_UNCONDITIONAL_DATA_INTERRUPT_MAP; - -#define SCI_FLAG_NO_MEMORY_LOOPBACK_MAP _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_NO_MEMORY_LOOPBACK_MAP) -extern const unsigned int SCI_FLAG_NO_MEMORY_LOOPBACK_MAP; - -#if defined(OS_IS_LYNXOS) || defined(OS_IS_VXWORKS) -#define SCI_FLAG_WRITE_BACK_CACHE_MAP _SISCI_EXPANDE_CONSTANT_NAME(WRITE_BACK_CACHE_MAP) -extern const unsigned int SCI_FLAG_WRITE_BACK_CACHE_MAP; -#endif - -#define SCI_FLAG_DMA_PHDMA _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_DMA_PHDMA) -extern const unsigned int SCI_FLAG_DMA_PHDMA; - -/*********************************************************************************/ -/* GENERAL VALUES */ -/*********************************************************************************/ -#define SCI_LOCAL_HOST _SISCI_EXPANDE_CONSTANT_NAME(SCI_LOCAL_HOST) -extern const unsigned int SCI_LOCAL_HOST; - -#define SCI_INFINITE_TIMEOUT _SISCI_EXPANDE_CONSTANT_NAME(SCI_INFINITE_TIMEOUT) -extern const unsigned int SCI_INFINITE_TIMEOUT; - -/*********************************************************************************/ -/* GENERAL ERROR CODES */ -/* */ -/* SCI_ERR_ILLEGAL_FLAG - Illegal flag value. */ -/* SCI_ERR_FLAG_NOT_IMPLEMENTED - Flag legal but flag feature not implemented. */ -/* SCI_ERR_NOT_IMPLEMENTED - Function not implemented. */ -/* SCI_ERR_SYSTEM - A system error. Check errno. */ -/* SCI_ERR_NOSPC - Unable to allocate OS resources. */ -/* SCI_ERR_API_NOSPC - Unable to allocate API resources. */ -/* SCI_ERR_HW_NOSPC - Unable to allocate HW resources (Hardware) */ -/* */ -/*********************************************************************************/ - - -/*********************************************************************************/ -/* GENERAL "ADAPTER" ERROR CODES */ -/* */ -/* SCI_ERR_NO_SUCH_ADAPTERNO - Adapter number is legal but does not exist. */ -/* SCI_ERR_ILLEGAL_ADAPTERNO - Illegal local adapter number (i.e. outside */ -/* legal range). */ -/* */ -/*********************************************************************************/ - - -/*********************************************************************************/ -/* GENERAL "NODEID" ERROR CODES */ -/* */ -/* SCI_ERR_NO_SUCH_NODEID - The remote adapter identified by nodeId does */ -/* not respond, but the intermediate link(s) */ -/* seem(s) to be operational. */ -/* SCI_ERR_ILLEGAL_NODEID - Illegal NodeId. */ -/* */ -/*********************************************************************************/ - - - -/********************************************************************************* - * * - * S C I I N I T I A L I Z E * - * * - * This function initializes the SISCI library. * - * The function must be called before SCIOpen(). * - * * - * Flags: * - * None * - * * - * Specific error codes for this function: * - * * - * None * - * * - *********************************************************************************/ -#define SCIInitialize _SISCI_EXPANDE_FUNCTION_NAME(SCIInitialize) -DLL void SCIInitialize(unsigned int flags, - sci_error_t *error); -#if 0 -unsigned int __Internal_SISCI_version_var; -#endif - -/********************************************************************************* - * * - * S C I T E R M I N A T E * - * * - * This function terminates the SISCI library. * - * The function must be called after SCIClose(). * - * * - * * - *********************************************************************************/ -#define SCITerminate _SISCI_EXPANDE_FUNCTION_NAME(SCITerminate) -DLL void SCITerminate(void); - -/********************************************************************************* - * * - * S C I O P E N * - * * - * * - * Opens a SCI virtual device. * - * Caller must supply a pointer to a variable of type sci_desc_t to be * - * initialized. * - * * - * Flags * - * SCI_FLAG_THREAD_SAFE - Operations on resources associated with this * - * descriptor will be performed in a multithread-safe * - * manner. * - * * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_INCONSISTENT_VERSIONS - Inconsistency between the SISCI library * - * and the SISCI driver versions. * - * * - * * - *********************************************************************************/ -#define SCIOpen _SISCI_EXPANDE_FUNCTION_NAME(SCIOpen) -DLL void SCIOpen(sci_desc_t *sd, - unsigned int flags, - sci_error_t *error); - - - - -/********************************************************************************* - * * - * S C I C L O S E * - * * - * This function closes an open SCI virtual device. * - * * - * Flags: * - * None * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_BUSY - All resources are not deallocated. * - * * - *********************************************************************************/ -#define SCIClose _SISCI_EXPANDE_FUNCTION_NAME(SCIClose) -DLL void SCIClose(sci_desc_t sd, - unsigned int flags, - sci_error_t *error); - - - - -/********************************************************************************* - * * - * S C I C O N N E C T S E G M E N T * - * * - * Connects to a remote shared memory segment located at with the * - * identifier . * - * The user may then call SCIMapRemoteSegment() to map shared memory * - * into user space. * - * * - * Flags * - * SCI_FLAG_USE_CALLBACK * - * SCI_FLAG_ASYNCHRONOUS_CONNECT * - * * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_NO_SUCH_SEGMENT - Could not find the remote segment with the * - * given segmentId. * - * SCI_ERR_CONNECTION_REFUSED - Connection attempt refused by remote node. * - * SCI_ERR_TIMEOUT - The function timed out after specified * - * timeout value. * - * SCI_ERR_NO_LINK_ACCESS - It was not possible to communicate via the * - * local adapter. * - * SCI_ERR_NO_REMOTE_LINK_ACCESS - It was not possible to communicate via a * - * remote switch port. * - * * - *********************************************************************************/ -#define SCIConnectSegment _SISCI_EXPANDE_FUNCTION_NAME(SCIConnectSegment) -DLL void SCIConnectSegment(sci_desc_t sd, - sci_remote_segment_t *segment, - unsigned int nodeId, - unsigned int segmentId, - unsigned int localAdapterNo, - sci_cb_remote_segment_t callback, - void *callbackArg, - unsigned int timeout, - unsigned int flags, - sci_error_t *error); - - -/********************************************************************************* - * * - * S C I D I S C O N N E C T S E G M E N T * - * * - * Disconnects from the give mapped shared memory segment * - * * - * Flags * - * None. * - * * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_BUSY - The segment is currently mapped or in use. * - * * - *********************************************************************************/ -#define SCIDisconnectSegment _SISCI_EXPANDE_FUNCTION_NAME(SCIDisconnectSegment) -DLL void SCIDisconnectSegment(sci_remote_segment_t segment, - unsigned int flags, - sci_error_t *error); - - - -/********************************************************************************* - * * - * S C I G E T R E M O T E S E G M E N T S I Z E * - * * - *********************************************************************************/ -#define SCIGetRemoteSegmentSize _SISCI_EXPANDE_FUNCTION_NAME(SCIGetRemoteSegmentSize) -DLL unsigned int SCIGetRemoteSegmentSize(sci_remote_segment_t segment); - - - -/********************************************************************************* - * * - * S C I W A I T F O R R E M O T E S E G M E N T E V E N T * - * * - * Flags * - * None. * - * * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_TIMEOUT - The function timed out after specified * - * timeout value. * - * SCI_ERR_ILLEGAL_OPERATION - Illegal operation. * - * SCI_ERR_CANCELLED - The wait operation has been cancelled du * - * to a SCIDisconnectSegment() on the same * - * handle. The handle is invalid when this * - * error is returned. * - * * - *********************************************************************************/ -#define SCIWaitForRemoteSegmentEvent _SISCI_EXPANDE_FUNCTION_NAME(SCIWaitForRemoteSegmentEvent) -DLL sci_segment_cb_reason_t SCIWaitForRemoteSegmentEvent( - sci_remote_segment_t segment, - sci_error_t *status, - unsigned int timeout, - unsigned int flags, - sci_error_t *error); - - - - -/********************************************************************************* - * * - * S C I M A P R E M O T E S E G M E N T * - * * - * This function is used to include a shared memory segment in the virtual * - * address space of the application. * - * * - * Flags: * - * * - * SCI_FLAG_FIXED_MAP_ADDR - Map at the suggested virtual address * - * SCI_FLAG_READONLY_MAP - The segment is mapped in read-only mode * - * SCI_FLAG_LOCK_OPERATION - Enable Lock operations (fetch and add) * - * SCI_FLAG_READ_PREFETCH_AGGR_HOLD_MAP * - * - Enable aggressive prefetch with speculative * - * hold. * - * * - * SCI_FLAG_READ_PREFETCH_NO_HOLD_MAP * - * - The PSB66 will prefetch 64 bytes. As soon * - * as the PCI read retry has been accepted, * - * the stream will change state to FREE, even * - * if less than 64 bytes were actually read. * - * * - * SCI_FLAG_IO_MAP_IOSPACE - Enable No Prefetch, no speculative hold. * - * * - * SCI_FLAG_DMOVE_MAP - Enable DMOVE packet type. The stream will be * - * set into FREE state immediately. * - * * - * SCI_FLAG_WRITES_DISABLE_GATHER_MAP * - * - Disable use of gather. * - * * - * SCI_FLAG_DISABLE_128_BYTES_PACKETS * - * - Disable use of 128-Byte packets * - * * - * SCI_FLAG_CONDITIONAL_INTERRUPT_MAP * - * - Write operations through this map will cause * - * an atomic "fetch-and-add-one" operation on * - * remote memory, but in addition an interrupt * - * will be generated if the target memory * - * location contained a "null value" before the * - * add operation was carried out. * - * The conditional interrupt flag must also be * - * specified in the SCIRegisterInterruptFlag() * - * function. * - * * - * SCI_FLAG_UNCONDITIONAL_INTERRUPT_MAP * - * - Write operations through this map will cause * - * an interrupt for the remote adapter * - * "in addition to" updating the corresponding * - * remote memory location with the data being * - * written. * - * The unconditional interrupt flag must also * - * be specified in the * - * SCIRegisterInterruptFlag() function. * - * * - * SCI_FLAG_WRITE_BACK_CACHE_MAP * - * - Enable cacheing of the mapped region. * - * Writes through this map will be written to a * - * write back cache, hence no remote SCI updates* - * until the cache line is flushed. The * - * application is responsible for the cache * - * flush operation. * - * The SCImemCopy() function will handle this * - * correctly by doing cache flushes internally. * - * This feature is architechture dependent and * - * not be available on all plattforms. * - * * - * SCI_FLAG_NO_MEMORY_LOOPBACK_MAP * - * - Forces a map to a remote segment located * - * in the local machine to be mapped using * - * SCI loopback. This is useful i.e. if you * - * want to use a regular map access to be * - * serialized with lock operations. * - * The default behaviour is to access a remte * - * segment located in the local machine as a * - * local MMU operation. * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_OUT_OF_RANGE - The sum of the offset and size is * - * larger than the segment size. * - * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as * - * required by the implementation. * - * SCI_ERR_OFFSET_ALIGNMENT - Offset is not correctly aligned as * - * required by the implementation. * - * * - *********************************************************************************/ -#define SCIMapRemoteSegment _SISCI_EXPANDE_FUNCTION_NAME(SCIMapRemoteSegment) -DLL volatile void *SCIMapRemoteSegment( - sci_remote_segment_t segment, - sci_map_t *map, - unsigned int offset, - unsigned int size, - void *addr, - unsigned int flags, - sci_error_t *error); - - - - -/********************************************************************************* - * * - * S C I M A P L O C A L S E G M E N T * - * * - * Flags * - * * - * SCI_FLAG_FIXED_MAP_ADDR * - * SCI_FLAG_READONLY_MAP * - * * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_OUT_OF_RANGE - The sum of the offset and size is * - * larger than the segment size. * - * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as * - * required by the implementation. * - * SCI_ERR_OFFSET_ALIGNMENT - Offset is not correctly aligned as * - * required by the implementation. * - * * - *********************************************************************************/ -#define SCIMapLocalSegment _SISCI_EXPANDE_FUNCTION_NAME(SCIMapLocalSegment) -DLL void *SCIMapLocalSegment(sci_local_segment_t segment, - sci_map_t *map, - unsigned int offset, - unsigned int size, - void *addr, - unsigned int flags, - sci_error_t *error); - - - -/********************************************************************************* - * * - * S C I U N M A P S E G M E N T * - * * - * This function unmaps pages of shared memory from the callers virtual * - * address space. * - * * - * Flags * - * None. * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_BUSY - The map is currently in use. * - * * - *********************************************************************************/ -#define SCIUnmapSegment _SISCI_EXPANDE_FUNCTION_NAME(SCIUnmapSegment) -DLL void SCIUnmapSegment(sci_map_t map, - unsigned int flags, - sci_error_t *error); - - - - -/********************************************************************************* - * * - * S C I C R E A T E S E G M E N T * - * * - * Make the specified segment available for connections via the specified * - * adapter. If successful, the segment can be accessed from remote nodes * - * via the specified adapter. * - * * - * Flags: * - * * - * SCI_FLAG_USE_CALLBACK - The callback function will be invoked for events * - * on this segment. * - * SCI_FLAG_EMPTY - No memory will be allocated for the segment. * - * SCI_FLAG_PRIVATE - The segment will be private meaning it will never * - * be any connections to it. * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_SEGMENTID_USED - The segment with this segmentId is already used * - * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as required * - * by the implementation. * - * * - *********************************************************************************/ -#define SCICreateSegment _SISCI_EXPANDE_FUNCTION_NAME(SCICreateSegment) -DLL void SCICreateSegment(sci_desc_t sd, - sci_local_segment_t *segment, - unsigned int segmentId, - unsigned int size, - sci_cb_local_segment_t callback, - void *callbackArg, - unsigned int flags, - sci_error_t *error); - - - -/********************************************************************************* - * * - * S C I W A I T F O R L O C A L S E G M E N T E V E N T * - * * - * Flags * - * None. * - * * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_TIMEOUT - The function timed out after specified timeout value. * - * SCI_ERR_CANCELLED - The wait operation has been cancelled du to a * - * SCIRemoveSegment() on the same handle. * - * The handle is invalid when this error is returned. * - * * - *********************************************************************************/ -#define SCIWaitForLocalSegmentEvent _SISCI_EXPANDE_FUNCTION_NAME(SCIWaitForLocalSegmentEvent) -DLL sci_segment_cb_reason_t SCIWaitForLocalSegmentEvent( - sci_local_segment_t segment, - unsigned int *sourcenodeId, - unsigned int *localAdapterNo, - unsigned int timeout, - unsigned int flags, - sci_error_t *error); - - - -/********************************************************************************* - * * - * S C I P R E P A R E S E G M E N T * - * * - * Flags * - * * - * SCI_FLAG_DMA_SOURCE_ONLY - The segment will be used as a source segment * - * for DMA operations. On some system types this * - * will enable the SISCI driver to use performance * - * improving features. * - * * - * Specific error codes for this function: * - * * - * * - *********************************************************************************/ -#define SCIPrepareSegment _SISCI_EXPANDE_FUNCTION_NAME(SCIPrepareSegment) -DLL void SCIPrepareSegment(sci_local_segment_t segment, - unsigned int localAdapterNo, - unsigned int flags, - sci_error_t *error); - - - -/********************************************************************************* - * * - * S C I R E M O V E S E G M E N T * - * * - * Flags * - * None. * - * * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_BUSY - Unable to remove the segment. The segment is currently * - * in use. * - * * - *********************************************************************************/ -#define SCIRemoveSegment _SISCI_EXPANDE_FUNCTION_NAME(SCIRemoveSegment) -DLL void SCIRemoveSegment(sci_local_segment_t segment, - unsigned int flags, - sci_error_t *error); - - - - -/********************************************************************************* - * * - * S C I S E T S E G M E N T A V A I L A B L E * - * * - * Flags * - * None. * - * * - * * - * SCI_ERR_SEGMENT_NOT_PREPARED - The segment has not been prepared for access * - * from this adapter. * - * SCI_ERR_ILLEGAL_OPERATION - The segment is created with the * - * SCI_FLAG_PRIVATE flag specified and * - * therefore has no segmentId. * - * * - *********************************************************************************/ -#define SCISetSegmentAvailable _SISCI_EXPANDE_FUNCTION_NAME(SCISetSegmentAvailable) -DLL void SCISetSegmentAvailable(sci_local_segment_t segment, - unsigned int localAdapterNo, - unsigned int flags, - sci_error_t *error); - - - -/********************************************************************************* - * * - * S C I S E T S E G M E N T U N A V A I L A B L E * - * * - * Flags * - * * - * SCI_FLAG_FORCE_DISCONNECT * - * SCI_FLAG_NOTIFY * - * * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_ILLEGAL_OPERATION - Illegal operation. * - * * - *********************************************************************************/ -#define SCISetSegmentUnavailable _SISCI_EXPANDE_FUNCTION_NAME(SCISetSegmentUnavailable) -DLL void SCISetSegmentUnavailable(sci_local_segment_t segment, - unsigned int localAdapterNo, - unsigned int flags, - sci_error_t *error); - - - - -/********************************************************************************* - * * - * S C I C R E A T E M A P S E Q U E N C E * - * * - * Flags: * - * * - * SCI_FLAG_FAST_BARRIER * - * * - * * - * Specific error codes for this function: * - * * - *********************************************************************************/ -#define SCICreateMapSequence _SISCI_EXPANDE_FUNCTION_NAME(SCICreateMapSequence) -DLL void SCICreateMapSequence(sci_map_t map, - sci_sequence_t *sequence, - unsigned int flags, - sci_error_t *error); - - - -/********************************************************************************* - * * - * S C I R E M O V E S E Q U E N C E * - * * - * Flags: * - * None * - * * - * Specific error codes for this function: * - * * - *********************************************************************************/ -#define SCIRemoveSequence _SISCI_EXPANDE_FUNCTION_NAME(SCIRemoveSequence) -DLL void SCIRemoveSequence(sci_sequence_t sequence, - unsigned int flags, - sci_error_t *error); - - - -/********************************************************************************* - * * - * S C I S T A R T S E Q U E N C E * - * * - * Flags * - * None. * - * * - * * - * Specific error codes for this function: * - * * - * * - *********************************************************************************/ -#define SCIStartSequence _SISCI_EXPANDE_FUNCTION_NAME(SCIStartSequence) -DLL sci_sequence_status_t SCIStartSequence(sci_sequence_t sequence, - unsigned int flags, - sci_error_t *error); - - - -/********************************************************************************* - * * - * S C I C H E C K S E Q U E N CE * - * * - * Flags * - * * - * SCI_FLAG_NO_FLUSH * - * SCI_FLAG_NO_STORE_BARRIER * - * * - * * - * Specific error codes for this function: * - * * - *********************************************************************************/ -#define SCICheckSequence _SISCI_EXPANDE_FUNCTION_NAME(SCICheckSequence) -DLL sci_sequence_status_t SCICheckSequence(sci_sequence_t sequence, - unsigned int flags, - sci_error_t *error); - - - -/********************************************************************************* - * * - * S C I S T O R E B A R R I E R * - * * - * Flags * - * None. * - * * - * * - * * - *********************************************************************************/ -#define SCIStoreBarrier _SISCI_EXPANDE_FUNCTION_NAME(SCIStoreBarrier) -DLL void SCIStoreBarrier(sci_sequence_t sequence, - unsigned int flags); - - - - -/********************************************************************************* - * * - * S C I F L U S H R E A D B U F F E R S * - * * - *********************************************************************************/ -#define SCIFlushReadBuffers _SISCI_EXPANDE_FUNCTION_NAME(SCIFlushReadBuffers) -DLL void SCIFlushReadBuffers(sci_sequence_t sequence); - - - - -/********************************************************************************* - * * - * S C I P R O B E N O D E * - * * - * Flags * - * None. * - * * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_NO_LINK_ACCESS - It was not possible to communicate via the * - * local adapter. * - * SCI_ERR_NO_REMOTE_LINK_ACCESS - It was not possible to communicate via a * - * remote switch port. * - * * - *********************************************************************************/ -#define SCIProbeNode _SISCI_EXPANDE_FUNCTION_NAME(SCIProbeNode) -DLL int SCIProbeNode(sci_desc_t sd, - unsigned int localAdapterNo, - unsigned int nodeId, - unsigned int flags, - sci_error_t *error); - - - -/********************************************************************************* - * * - * S C I G E T C S R R E G I S T E R * - * * - * SISCI Priveleged function * - * * - * * - * Flags * - * None. * - * * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_NO_LINK_ACCESS - It was not possible to communicate via the * - * local adapter. * - * SCI_ERR_NO_REMOTE_LINK_ACCESS - It was not possible to communicate via a * - * remote switch port. * - * * - *********************************************************************************/ -#define SCIGetCSRRegister _SISCI_EXPANDE_FUNCTION_NAME(SCIGetCSRRegister) -DLL unsigned int SCIGetCSRRegister(sci_desc_t sd, - unsigned int localAdapterNo, - unsigned int SCINodeId, - unsigned int CSROffset, - unsigned int flags, - sci_error_t *error); - - - -/********************************************************************************* - * * - * S C I S E T C S R R E G I S T E R * - * * - * SISCI Priveleged function * - * * - * * - * Flags * - * None. * - * * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_NO_LINK_ACCESS - It was not possible to communicate via the * - * local adapter. * - * SCI_ERR_NO_REMOTE_LINK_ACCESS - It was not possible to communicate via a * - * remote switch port. * - * * - *********************************************************************************/ -#define SCISetCSRRegister _SISCI_EXPANDE_FUNCTION_NAME(SCISetCSRRegister) -DLL void SCISetCSRRegister(sci_desc_t sd, - unsigned int localAdapterNo, - unsigned int SCINodeId, - unsigned int CSROffset, - unsigned int CSRValue, - unsigned int flags, - sci_error_t *error); - - -/********************************************************************************* - * * - * S C I G E T L O C A L C S R * - * * - * SISCI Priveleged function * - * * - * Flags * - * None. * - * * - * * - * Specific error codes for this function: * - * * - * * - *********************************************************************************/ -#define SCIGetLocalCSR _SISCI_EXPANDE_FUNCTION_NAME(SCIGetLocalCSR) -DLL unsigned int SCIGetLocalCSR(sci_desc_t sd, - unsigned int localAdapterNo, - unsigned int CSROffset, - unsigned int flags, - sci_error_t *error); - - - -/********************************************************************************* - * * - * S C I S E T L O C A L C S R * - * * - * SISCI Priveleged function - * - * Flags * - * None. * - * * - * * - * Specific error codes for this function: * - * * - * * - *********************************************************************************/ -#define SCISetLocalCSR _SISCI_EXPANDE_FUNCTION_NAME(SCISetLocalCSR) -DLL void SCISetLocalCSR(sci_desc_t sd, - unsigned int localAdapterNo, - unsigned int CSROffset, - unsigned int CSRValue, - unsigned int flags, - sci_error_t *error); - - - -/********************************************************************************* - * * - * S C I A T T A C H P H Y S I C A L M E M O R Y * - * * - * SISCI Priveleged function * - * * - * Description: * - * * - * This function enables usage of physical devices and memory regions where the * - * Physical PCI bus address ( and mapped CPU address ) are already known. * - * The function will register the physical memory as a SISCI segment which can * - * be connected and mapped as a regular SISCI segment. * - * * - * Requirements: * - * * - * SCICreateSegment() with flag SCI_FLAG_EMPTY must have been called in advance * - * * - * Parameter description: * - * sci_ioaddr_t ioaddress : This is the address on the PCI bus that a PCI bus * - * master has to use to write to the specified memory * - * void * address : This is the (mapped) virtual address that the * - * application has to use to access the device. * - * This means that the device has to be mapped in * - * advance bye the devices own driver. * - * If the device is not to be accessed by the local * - * CPU, the address pointer shold be set to NULL * - * Flags * - * * - * None * - * * - * * - * Specific error codes for this function: * - * * - * * - *********************************************************************************/ -#define SCIAttachPhysicalMemory _SISCI_EXPANDE_FUNCTION_NAME(SCIAttachPhysicalMemory) -DLL void SCIAttachPhysicalMemory(sci_ioaddr_t ioaddress, - void *address, - unsigned int busNo, - unsigned int size, - sci_local_segment_t segment, - unsigned int flags, - sci_error_t *error); - - - -/********************************************************************************* - * * - * S C I Q U E R Y * - * * - * Flags * - * None. * - * * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_ILLEGAL_QUERY - Unrecognized command. * - * * - *********************************************************************************/ -#define SCIQuery _SISCI_EXPANDE_FUNCTION_NAME(SCIQuery) -DLL void SCIQuery(unsigned int command, - void *data, - unsigned int flags, - sci_error_t *error); - - -/* MAJOR QUERY COMMANDS */ - -/* This command requires a pointer to a structure of type */ -/* "sci_query_string". The string will be filled in by the query. */ -#define SCI_Q_VENDORID _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_VENDORID) -extern const unsigned int SCI_Q_VENDORID; - - -/* Same as for SCI_VENDOR_ID */ -#define SCI_Q_API _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_API) -extern const unsigned int SCI_Q_API; - - -/* User passes a pointer to an allocated object of the */ -/* "sci_query_adapter" struct. */ -#define SCI_Q_ADAPTER _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER) -extern const unsigned int SCI_Q_ADAPTER; - - -/* User passes a pointer to an allocated object of the */ -/* "sci_query_system" struct. */ -#define SCI_Q_SYSTEM _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_SYSTEM) -extern const unsigned int SCI_Q_SYSTEM; - -#define SCI_Q_LOCAL_SEGMENT _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_LOCAL_SEGMENT) -extern const unsigned int SCI_Q_LOCAL_SEGMENT; - -#define SCI_Q_REMOTE_SEGMENT _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_REMOTE_SEGMENT) -extern const unsigned int SCI_Q_REMOTE_SEGMENT; - -#define SCI_Q_MAP _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_MAP) -extern const unsigned int SCI_Q_MAP; - -typedef struct { - char *str; /* Pointer to a string of minimum "length" characters */ - unsigned int length; -} sci_query_string_t; - - -typedef struct { - unsigned int localAdapterNo; /* The adapter no. that the query concern. */ - unsigned int portNo; /* The SCI Link port number that the query concern. */ - unsigned int subcommand; /* A subcommand as specified below. */ - void *data; /* A pointer to an unsigned int that will return */ - /* the response to the query. */ -} sci_query_adapter_t; - - -typedef struct { - unsigned int subcommand; /* A subcommand as specified below. */ - void *data; /* A pointer to an unsigned int that will return */ - /* the response to the query. */ -} sci_query_system_t; - -typedef struct { - sci_local_segment_t segment; - unsigned int subcommand; - union { - sci_ioaddr_t ioaddr; - } data; -} sci_query_local_segment_t; - -typedef struct { - sci_remote_segment_t segment; - unsigned int subcommand; - union { - sci_ioaddr_t ioaddr; - } data; -} sci_query_remote_segment_t; - -typedef struct { - sci_map_t map; - unsigned int subcommand; - unsigned int data; -} sci_query_map_t; - -/* Minor query commands (sub-commands) for adapter specific information SCI_ADAPTER */ -#define SCI_Q_ADAPTER_DMA_SIZE_ALIGNMENT _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_DMA_SIZE_ALIGNMENT) -extern const unsigned int SCI_Q_ADAPTER_DMA_SIZE_ALIGNMENT; - -#define SCI_Q_ADAPTER_DMA_OFFSET_ALIGNMENT _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_DMA_OFFSET_ALIGNMENT) -extern const unsigned int SCI_Q_ADAPTER_DMA_OFFSET_ALIGNMENT; - -#define SCI_Q_ADAPTER_DMA_MTU _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_DMA_MTU) -extern const unsigned int SCI_Q_ADAPTER_DMA_MTU; - -#define SCI_Q_ADAPTER_SUGGESTED_MIN_DMA_SIZE _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_SUGGESTED_MIN_DMA_SIZE) -extern const unsigned int SCI_Q_ADAPTER_SUGGESTED_MIN_DMA_SIZE; - -#define SCI_Q_ADAPTER_SUGGESTED_MIN_BLOCK_SIZE _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_SUGGESTED_MIN_BLOCK_SIZE) -extern const unsigned int SCI_Q_ADAPTER_SUGGESTED_MIN_BLOCK_SIZE; - -#define SCI_Q_ADAPTER_NODEID _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_NODEID) -extern const unsigned int SCI_Q_ADAPTER_NODEID; - -#define SCI_Q_ADAPTER_SERIAL_NUMBER _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_SERIAL_NUMBER) -extern const unsigned int SCI_Q_ADAPTER_SERIAL_NUMBER; - -#define SCI_Q_ADAPTER_CARD_TYPE _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_CARD_TYPE) -extern const unsigned int SCI_Q_ADAPTER_CARD_TYPE; - -#define SCI_Q_ADAPTER_NUMBER_OF_STREAMS _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_NUMBER_OF_STREAMS) -extern const unsigned int SCI_Q_ADAPTER_NUMBER_OF_STREAMS; - -#define SCI_Q_ADAPTER_STREAM_BUFFER_SIZE _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_STREAM_BUFFER_SIZE) -extern const unsigned int SCI_Q_ADAPTER_STREAM_BUFFER_SIZE; - -#define SCI_Q_ADAPTER_CONFIGURED _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_CONFIGURED) -extern const unsigned int SCI_Q_ADAPTER_CONFIGURED; - -#define SCI_Q_ADAPTER_LINK_OPERATIONAL _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_LINK_OPERATIONAL) -extern const unsigned int SCI_Q_ADAPTER_LINK_OPERATIONAL; - -#define SCI_Q_ADAPTER_HW_LINK_STATUS_IS_OK _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_HW_LINK_STATUS_IS_OK) -extern const unsigned int SCI_Q_ADAPTER_HW_LINK_STATUS_IS_OK; - -#define SCI_Q_ADAPTER_NUMBER _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_NUMBER) -extern const unsigned int SCI_Q_ADAPTER_NUMBER; - -#define SCI_Q_ADAPTER_INSTANCE_NUMBER _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_INSTANCE_NUMBER) -extern const unsigned int SCI_Q_ADAPTER_INSTANCE_NUMBER; - -#define SCI_Q_ADAPTER_FIRMWARE_OK _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_FIRMWARE_OK) -extern const unsigned int SCI_Q_ADAPTER_FIRMWARE_OK; - -#define SCI_Q_ADAPTER_CONNECTED_TO_SWITCH _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_CONNECTED_TO_SWITCH) -extern const unsigned int SCI_Q_ADAPTER_CONNECTED_TO_SWITCH; - -#define SCI_Q_ADAPTER_LOCAL_SWITCH_TYPE _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_LOCAL_SWITCH_TYPE) -extern const unsigned int SCI_Q_ADAPTER_LOCAL_SWITCH_TYPE; - -#define SCI_Q_ADAPTER_LOCAL_SWITCH_PORT_NUMBER _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_LOCAL_SWITCH_PORT_NUMBER) -extern const unsigned int SCI_Q_ADAPTER_LOCAL_SWITCH_PORT_NUMBER; - -#define SCI_Q_ADAPTER_CONNECTED_TO_EXPECTED_SWITCH_PORT _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_CONNECTED_TO_EXPECTED_SWITCH_PORT) -extern const unsigned int SCI_Q_ADAPTER_CONNECTED_TO_EXPECTED_SWITCH_PORT; - -#define SCI_Q_ADAPTER_ATT_PAGE_SIZE _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_ATT_PAGE_SIZE) -extern const unsigned int SCI_Q_ADAPTER_ATT_PAGE_SIZE; - -#define SCI_Q_ADAPTER_ATT_NUMBER_OF_ENTRIES _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_ATT_NUMBER_OF_ENTRIES) -extern const unsigned int SCI_Q_ADAPTER_ATT_NUMBER_OF_ENTRIES; - -#define SCI_Q_ADAPTER_ATT_AVAILABLE_ENTRIES _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_ATT_AVAILABLE_ENTRIES) -extern const unsigned int SCI_Q_ADAPTER_ATT_AVAILABLE_ENTRIES; - -#define SCI_Q_ADAPTER_PHYS_MEM_NODEID _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_SCI_Q_ADAPTER_PHYS_MEM_NODEID) -extern const unsigned int SCI_Q_ADAPTER_PHYS_MEM_NODEID; - -#define SCI_Q_ADAPTER_PHYS_MBX_NODEID _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_SCI_Q_ADAPTER_PHYS_MBX_NODEID) -extern const unsigned int SCI_Q_ADAPTER_PHYS_MBX_NODEID; - -#define SCI_Q_ADAPTER_PHYS_LINK_PORT_NODEID _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_PHYS_LINK_PORT_NODEID) -extern const unsigned int SCI_Q_ADAPTER_PHYS_LINK_PORT_NODEID; - -#define SCI_Q_ADAPTER_SCI_LINK_FREQUENCY _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_SCI_LINK_FREQUENCY) -extern const unsigned int SCI_Q_ADAPTER_SCI_LINK_FREQUENCY; - -#define SCI_Q_ADAPTER_B_LINK_FREQUENCY _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_B_LINK_FREQUENCY) -extern const unsigned int SCI_Q_ADAPTER_B_LINK_FREQUENCY; - -#define SCI_Q_ADAPTER_IO_BUS_FREQUENCY _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_IO_BUS_FREQUENCY) -extern const unsigned int SCI_Q_ADAPTER_IO_BUS_FREQUENCY; - -/* Minor query commands (sub-commands) for adapter specific information SCI_SYSTEM */ -#define SCI_Q_SYSTEM_HOSTBRIDGE _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_SYSTEM_HOSTBRIDGE) -extern const unsigned int SCI_Q_SYSTEM_HOSTBRIDGE; - -#define SCI_Q_SYSTEM_WRITE_POSTING_ENABLED _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_SYSTEM_WRITE_POSTING_ENABLED) -extern const unsigned int SCI_Q_SYSTEM_WRITE_POSTING_ENABLED; - -#define SCI_Q_SYSTEM_WRITE_COMBINING_ENABLED _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_SYSTEM_WRITE_COMBINING_ENABLED) -extern const unsigned int SCI_Q_SYSTEM_WRITE_COMBINING_ENABLED; - -#define SCI_Q_LOCAL_SEGMENT_IOADDR _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_LOCAL_SEGMENT_IOADDR) -extern const unsigned int SCI_Q_LOCAL_SEGMENT_IOADDR; - -#define SCI_Q_REMOTE_SEGMENT_IOADDR _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_REMOTE_SEGMENT_IOADDR) -extern const unsigned int SCI_Q_REMOTE_SEGMENT_IOADDR; - -#define SCI_Q_MAP_MAPPED_TO_LOCAL_TARGET _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_MAP_MAPPED_TO_LOCAL_TARGET) -extern const unsigned int SCI_Q_MAP_MAPPED_TO_LOCAL_TARGET; - -#define SCI_Q_MAP_QUERY_REMOTE_MAPPED_TO_LOCAL_TARGET _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_MAP_QUERY_REMOTE_MAPPED_TO_LOCAL_TARGET) -extern const unsigned int SCI_Q_MAP_QUERY_REMOTE_MAPPED_TO_LOCAL_TARGET; - -#define HOSTBRIDGE_NOT_AVAILABLE _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_NOT_AVAILABLE) -extern const unsigned int HOSTBRIDGE_NOT_AVAILABLE; - -#define HOSTBRIDGE_UNKNOWN _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_UNKNOWN) -extern const unsigned int HOSTBRIDGE_UNKNOWN; - -#define HOSTBRIDGE_440FX _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_440FX) -extern const unsigned int HOSTBRIDGE_440FX; - -#define HOSTBRIDGE_440LX _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_440LX) -extern const unsigned int HOSTBRIDGE_440LX; - -#define HOSTBRIDGE_440BX_A _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_440BX_A) -extern const unsigned int HOSTBRIDGE_440BX_A; - -#define HOSTBRIDGE_440BX_B _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_440BX_B) -extern const unsigned int HOSTBRIDGE_440BX_B; - -#define HOSTBRIDGE_440GX _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_440GX) -extern const unsigned int HOSTBRIDGE_440GX; - -#define HOSTBRIDGE_450KX _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_450KX) -extern const unsigned int HOSTBRIDGE_450KX; - -#define HOSTBRIDGE_430NX _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_430NX) -extern const unsigned int HOSTBRIDGE_430NX; - -#define HOSTBRIDGE_450NX _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_450NX) -extern const unsigned int HOSTBRIDGE_450NX; - -#define HOSTBRIDGE_450NX_MICO _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_450NX_MICO) -extern const unsigned int HOSTBRIDGE_450NX_MICO; - -#define HOSTBRIDGE_450NX_PXB _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_450NX_PXB) -extern const unsigned int HOSTBRIDGE_450NX_PXB; - -#define HOSTBRIDGE_I810 _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_I810) -extern const unsigned int HOSTBRIDGE_I810; - -#define HOSTBRIDGE_I810_DC100 _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_I810_DC100) -extern const unsigned int HOSTBRIDGE_I810_DC100; - -#define HOSTBRIDGE_I810E _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_I810E) -extern const unsigned int HOSTBRIDGE_I810E; - -#define HOSTBRIDGE_I815 _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_I815) -extern const unsigned int HOSTBRIDGE_I815; - -#define HOSTBRIDGE_I840 _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_I840) -extern const unsigned int HOSTBRIDGE_I840; - -#define HOSTBRIDGE_I850 _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_I850) -extern const unsigned int HOSTBRIDGE_I850; - -#define HOSTBRIDGE_I860 _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_I860) -extern const unsigned int HOSTBRIDGE_I860; - -#define HOSTBRIDGE_VIA_KT133 _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_VIA_KT133) -extern const unsigned int HOSTBRIDGE_VIA_KT133; - -#define HOSTBRIDGE_VIA_KX133 _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_VIA_KX133) -extern const unsigned int HOSTBRIDGE_VIA_KX133; - -#define HOSTBRIDGE_VIA_APOLLO_PRO_133A _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_VIA_APOLLO_PRO_133A) -extern const unsigned int HOSTBRIDGE_VIA_APOLLO_PRO_133A; - -#define HOSTBRIDGE_VIA_APOLLO_PRO_266 _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_VIA_APOLLO_PRO_266) -extern const unsigned int HOSTBRIDGE_VIA_APOLLO_PRO_266; - -#define HOSTBRIDGE_AMD_760_MP _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_AMD_760_MP) -extern const unsigned int HOSTBRIDGE_AMD_760_MP; - -#define HOSTBRIDGE_SERVERWORKS_HE _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_SERVERWORKS_HE) -extern const unsigned int HOSTBRIDGE_SERVERWORKS_HE; - -#define HOSTBRIDGE_SERVERWORKS_HE_B _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_SERVERWORKS_HE_B) -extern const unsigned int HOSTBRIDGE_SERVERWORKS_HE_B; - -#define HOSTBRIDGE_SERVERWORKS_LE _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_SERVERWORKS_LE) -extern const unsigned int HOSTBRIDGE_SERVERWORKS_LE; - - - -#define HOSTBRIDGE_WRITE_POSTING_DISABLED _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_WRITE_POSTING_DISABLED) -extern const unsigned int HOSTBRIDGE_WRITE_POSTING_DISABLED; - -#define HOSTBRIDGE_WRITE_POSTING_ENABLED _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_WRITE_POSTING_ENABLED) -extern const unsigned int HOSTBRIDGE_WRITE_POSTING_ENABLED; - - - - -/********************************************************************************* - * * - * S C I C R E A T E D M A Q U E U E * - * * - * Flags * - * * - * SCI_FLAG_DMA_PHDMA : Create physical DMA queue. Please note that this is an * - * priveleged operation. * - * * - * * - * * - * Specific error codes for this function: * - * * - *********************************************************************************/ -#define SCICreateDMAQueue _SISCI_EXPANDE_FUNCTION_NAME(SCICreateDMAQueue) -DLL void SCICreateDMAQueue(sci_desc_t sd, - sci_dma_queue_t *dq, - unsigned int localAdapterNo, - unsigned int maxEntries, - unsigned int flags, - sci_error_t *error); - - - -/********************************************************************************* - * * - * S C I R E M O V E D M A Q U E U E * - * * - * Flags * - * None. * * - * * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_ILLEGAL_OPERATION - Not allowed in this queue state. * - * * - *********************************************************************************/ -#define SCIRemoveDMAQueue _SISCI_EXPANDE_FUNCTION_NAME(SCIRemoveDMAQueue) -DLL void SCIRemoveDMAQueue(sci_dma_queue_t dq, - unsigned int flags, - sci_error_t *error); - - - -/********************************************************************************* - * * - * S C I E N Q U E U E D M A T R A N S F E R * - * * - * Flags: * - * * - * SCI_FLAG_DMA_READ - The DMA will be remote --> local * - * (default is local --> remote) * - * * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_OUT_OF_RANGE - The sum of the offset and size is larger * - * than the segment size or larger than max * - * DMA size. * - * SCI_ERR_MAX_ENTRIES - The DMA queue is full * - * SCI_ERR_ILLEGAL_OPERATION - Illegal operation * - * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as required * - * by the implementation. * - * SCI_ERR_OFFSET_ALIGNMENT - Offset is not correctly aligned as required * - * by the implementation. * - * SCI_ERR_SEGMENT_NOT_PREPARED - The local segment has not been prepared for * - * access from the adapter associated with the * - * queue. * - * SCI_ERR_SEGMENT_NOT_CONNECTED - The remote segment is not connected through * - * the adapter associated with the queue. * - *********************************************************************************/ -#define SCIEnqueueDMATransfer _SISCI_EXPANDE_FUNCTION_NAME(SCIEnqueueDMATransfer) -DLL sci_dma_queue_state_t SCIEnqueueDMATransfer(sci_dma_queue_t dq, - sci_local_segment_t localSegment, - sci_remote_segment_t remoteSegment, - unsigned int localOffset, - unsigned int remoteOffset, - unsigned int size, - unsigned int flags, - sci_error_t *error); - - - -/********************************************************************************* - * * - * S C I P O S T D M A Q U E U E * - * * - * Flags: * - * * - * SCI_FLAG_USE_CALLBACK - The end of the transfer will cause the callback * - * function to be invoked. * - * * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_ILLEGAL_OPERATION - Illegal operation * - * * - *********************************************************************************/ -#define SCIPostDMAQueue _SISCI_EXPANDE_FUNCTION_NAME(SCIPostDMAQueue) -DLL void SCIPostDMAQueue(sci_dma_queue_t dq, - sci_cb_dma_t callback, - void *callbackArg, - unsigned int flags, - sci_error_t *error); - - - -/********************************************************************************* - * * - * S C I A B O R T D M A Q U E U E * - * * - * Flags * - * None. * - * * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_ILLEGAL_OPERATION - Illegal operation * - * * - *********************************************************************************/ -#define SCIAbortDMAQueue _SISCI_EXPANDE_FUNCTION_NAME(SCIAbortDMAQueue) -DLL void SCIAbortDMAQueue(sci_dma_queue_t dq, - unsigned int flags, - sci_error_t *error); - - -/********************************************************************************* - * * - * S C I R E S E T D M A Q U E U E * - * * - * Flags * - * None. * * - * * - * * - * Specific error codes for this function: * - * * - * * - *********************************************************************************/ -#define SCIResetDMAQueue _SISCI_EXPANDE_FUNCTION_NAME(SCIResetDMAQueue) -DLL void SCIResetDMAQueue(sci_dma_queue_t dq, - unsigned int flags, - sci_error_t *error); - - - -/********************************************************************************* - * * - * S C I D M A Q U E U E S T A T E * - * * - *********************************************************************************/ -#define SCIDMAQueueState _SISCI_EXPANDE_FUNCTION_NAME(SCIDMAQueueState) -DLL sci_dma_queue_state_t SCIDMAQueueState(sci_dma_queue_t dq); - - - -/********************************************************************************* - * * - * S C I W A I T F O R D M A Q U E U E * - * * - * Flags * - * None. * - * * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_ILLEGAL_OPERATION - Illegal operation * - * SCI_ERR_TIMEOUT - The function timed out after specified * - * timeout value. * - * * - *********************************************************************************/ -#define SCIWaitForDMAQueue _SISCI_EXPANDE_FUNCTION_NAME(SCIWaitForDMAQueue) -DLL sci_dma_queue_state_t SCIWaitForDMAQueue(sci_dma_queue_t dq, - unsigned int timeout, - unsigned int flags, - sci_error_t *error); - - - - -/********************************************************************************* - * * - * S C I P H D M A E N Q U E U E * - * * - * SISCI Priveleged function * - * * - * Flags * - * * - * SCI_FLAG_DMA_READ * - * * - * Specific error codes for this function: * - * * - *********************************************************************************/ -#define SCIphDmaEnqueue _SISCI_EXPANDE_FUNCTION_NAME(SCIphDmaEnqueue) -DLL void SCIphDmaEnqueue(sci_dma_queue_t dmaqueue, - unsigned int size, - sci_ioaddr_t localBusAddr, - unsigned int remote_nodeid, - unsigned int remote_highaddr, - unsigned int remote_lowaddr, - unsigned int flags, - sci_error_t *error); - -/********************************************************************************* - * * - * S C I P H D M A S T A R T * - * * - * Flags * - * * - * SCI_FLAG_DMA_WAIT * - * SCI_FLAG_USE_CALLBACK * - * SCI_FLAG_DMA_RESET * - * * - * Specific error codes for this function: * - * * - *********************************************************************************/ -#define SCIphDmaStart _SISCI_EXPANDE_FUNCTION_NAME(SCIphDmaStart) -DLL sci_dma_queue_state_t SCIphDmaStart(sci_dma_queue_t dmaqueue, - sci_cb_dma_t callback, - void *callbackArg, - unsigned int flags, - sci_error_t *error); - -/********************************************************************************* - * * - * S C I C R E A T E I N T E R R U P T * - * * - * Flags * - * * - * SCI_FLAG_USE_CALLBACK * - * SCI_FLAG_FIXED_INTNO * - * SCI_FLAG_SHARED_INT * - * * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_INTNO_USED - This interrupt number is already used. * - * * - *********************************************************************************/ -#define SCICreateInterrupt _SISCI_EXPANDE_FUNCTION_NAME(SCICreateInterrupt) -DLL void SCICreateInterrupt(sci_desc_t sd, - sci_local_interrupt_t *interrupt, - unsigned int localAdapterNo, - unsigned int *interruptNo, - sci_cb_interrupt_t callback, - void *callbackArg, - unsigned int flags, - sci_error_t *error); - - - -/********************************************************************************* - * * - * S C I R E M O V E I N T E R R U P T * - * * - * Flags * - * None. * - * * - * * - * Specific error codes for this function: * - * * - *********************************************************************************/ -#define SCIRemoveInterrupt _SISCI_EXPANDE_FUNCTION_NAME(SCIRemoveInterrupt) -DLL void SCIRemoveInterrupt(sci_local_interrupt_t interrupt, - unsigned int flags, - sci_error_t *error); - - - - -/********************************************************************************* - * * - * S C I W A I T F O R I N T E R R U P T * - * * - * Flags * - * None. * - * * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_TIMEOUT - The function timed out after specified timeout value. * - * SCI_ERR_CANCELLED - The wait was interrupted by a call to * - * SCIRemoveInterrupt. * - * The handle is invalid when this error code is returned.* - * * - *********************************************************************************/ -#define SCIWaitForInterrupt _SISCI_EXPANDE_FUNCTION_NAME(SCIWaitForInterrupt) -DLL void SCIWaitForInterrupt(sci_local_interrupt_t interrupt, - unsigned int timeout, - unsigned int flags, - sci_error_t *error); - - - - -/********************************************************************************* - * * - * S C I C O N N E C T I N T E R R U P T * - * * - * Flags * - * None. * - * * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_NO_SUCH_INTNO - No such interrupt number. * - * SCI_ERR_CONNECTION_REFUSED - Connection attempt refused by remote node. * - * SCI_ERR_TIMEOUT - The function timed out after specified * - * timeout value. * - * * - *********************************************************************************/ -#define SCIConnectInterrupt _SISCI_EXPANDE_FUNCTION_NAME(SCIConnectInterrupt) -DLL void SCIConnectInterrupt(sci_desc_t sd, - sci_remote_interrupt_t *interrupt, - unsigned int nodeId, - unsigned int localAdapterNo, - unsigned int interruptNo, - unsigned int timeout, - unsigned int flags, - sci_error_t *error); - - -/********************************************************************************* - * * - * S C I D I S C O N N E C T I N T E R R U P T * - * * - * Flags * - * None. * - * * - * * - * Specific error codes for this function: * - * * - * * - *********************************************************************************/ -#define SCIDisconnectInterrupt _SISCI_EXPANDE_FUNCTION_NAME(SCIDisconnectInterrupt) -DLL void SCIDisconnectInterrupt(sci_remote_interrupt_t interrupt, - unsigned int flags, - sci_error_t *error); - - - - -/********************************************************************************* - * * - * S C I T R I G G E R I N T E R R U P T * - * * - * Flags * - * None. * - * * - * * - * Specific error codes for this function: * - * * - * * - *********************************************************************************/ -#define SCITriggerInterrupt _SISCI_EXPANDE_FUNCTION_NAME(SCITriggerInterrupt) -DLL void SCITriggerInterrupt(sci_remote_interrupt_t interrupt, - unsigned int flags, - sci_error_t *error); - - - - -/********************************************************************************* - * * - * S C I R E G I S T E R I N T E R R U P T F L A G * - * * - * * - * This function register an "interrupt flag" that is identified as an unique * - * location within a local segment. If successful, the resulting interrupt * - * handle will have been associated with the specified local segment. * - * * - * It is up to the (remote) client(s) to set up an "interrupt mapping" for the * - * corresponding segment offset using either the * - * * - * - SCI_FLAG_CONDITIONAL_INTERRUPT_MAP * - * * - * or the * - * * - * - SCI_FLAG_UNCONDITIONAL_DATA_INTERRUPT_MAP * - * * - * option to "SCIMapRemoteSegment()". - I.e. after having established a * - * connection to the corresponding segment. A trigger operation can then * - * be implemented using a store operation via the relevant "interrupt map". * - * * - * * - * * - * * - * * - * Flags: * - * * - * SCI_FLAG_CONDITIONAL_INTERRUPT - Triggering is to take place using * - * "conditional interrupts". * - * * - * * - * * - * Specific error codes for this function: * - * None. * - * * - *********************************************************************************/ -#define SCIRegisterInterruptFlag _SISCI_EXPANDE_FUNCTION_NAME(SCIRegisterInterruptFlag) -DLL void SCIRegisterInterruptFlag( - unsigned int localAdapterNo, - sci_local_interrupt_t *interrupt, - sci_local_segment_t segment, - unsigned int offset, - sci_cb_interrupt_t callback, - void *callbackArg, - unsigned int flags, - sci_error_t *error); - - - - -/********************************************************************************* - * * - * S C I E N A B L E C O N D I T I O N A L I N T E R R U P T * - * * - * * - * This function make sure that another HW interrupt will take place the next * - * time the corresponding interrupt flag is triggered by a * - * "conditional interrupt" operation. * - * * - * Default semantics: * - * * - * When successful, the client can rely on that the first subsequent trigger * - * operation will cause a HW interrupt and subsequently cause the client * - * handler function to be invoked. * - * * - * If an interrupt was triggered in parallell with the enable operation, then * - * the operation will fail (SCI_ERR_COND_INT_RACE_PROBLEM), and the client can * - * not rely on another trigger operation will lead to handler invocation. * - * Hence, any state checking normally associated with handling the * - * corresponding interrupt should take place before attempting to enable * - * again. * - * * - * * - * Flags * - * None. * - * * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_COND_INT_RACE_PROBLEM - The enable operation failed because an * - * incomming trigger operation happened * - * concurrently. * - * * - *********************************************************************************/ -#define SCIEnableConditionalInterrupt _SISCI_EXPANDE_FUNCTION_NAME(SCIEnableConditionalInterrupt) -DLL void SCIEnableConditionalInterrupt( - sci_local_interrupt_t interrupt, - unsigned int flags, - sci_error_t *error); - - - - -/********************************************************************************* - * * - * S C I D I S A B L E C O N D I T I O N A L I N T E R R U P T * - * * - * * - * Prevent subsequent "conditional interrupt"trigger operations for * - * the specified interupt flag from causing HW interrupt and handler * - * invocations. * - * * - * * - * Default semantics: * - * * - * If successful, no subsequent HW interrupts will take place, but handler * - * invocations that have already been scheduled may still take place. * - * * - * * - * Flags * - * None. * - * * - * * - * Specific error codes for this function: * - * * - * * - *********************************************************************************/ -#define SCIDisableConditionalInterrupt _SISCI_EXPANDE_FUNCTION_NAME(SCIDisableConditionalInterrupt) -DLL void SCIDisableConditionalInterrupt( - sci_local_interrupt_t interrupt, - unsigned int flags, - sci_error_t *error); - - - -/********************************************************************************* - * * - * S C I G E T C O N D I T I O N A L I N T E R R U P T C O U N T E R * - * * - * * - * Returns a value that indicates the number of times this flag has * - * been trigged since the last time it was enabled or disabled. * - * Calling the SCIEnableConditionalInterrupt / SCIDisableConditionalInterrupt * - * functions will reset the counter value. * - * * - * Default semantics: * - * * - * If successful, the current trig count is returned in the * - * interruptTrigCounter parameter. * - * * - * Flags * - * None. * - * * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_OVERFLOW - The number of trig operations have exceeded the range * - * that can be counted. * - *********************************************************************************/ -#define SCIGetConditionalInterruptTrigCounter _SISCI_EXPANDE_FUNCTION_NAME(SCIGetConditionalInterruptTrigCounter) -DLL void SCIGetConditionalInterruptTrigCounter( - sci_local_interrupt_t interrupt, - unsigned int *interruptTrigCounter, - unsigned int flags, - sci_error_t *error); - - - - -/********************************************************************************* - * * - * S C I T R A N S F E R B L O C K * - * * - * Flags * - * None. * - * * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_OUT_OF_RANGE - The sum of the size and offset is larger * - * than the corresponding map size. * - * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as required * - * by the implementation. * - * SCI_ERR_OFFSET_ALIGNMENT - Offset is not correctly aligned as required * - * by the implementation. * - * SCI_ERR_TRANSFER_FAILED - The data transfer failed. * - * * - *********************************************************************************/ -#define SCITransferBlock _SISCI_EXPANDE_FUNCTION_NAME(SCITransferBlock) -DLL void SCITransferBlock(sci_map_t sourceMap, - unsigned int sourceOffset, - sci_map_t destinationMap, - unsigned int destinationOffset, - unsigned int size, - unsigned int flags, - sci_error_t *error); - - - - -/********************************************************************************* - * * - * S C I T R A N S F E R B L O C K A S Y N C * - * * - * Flags * - * * - * SCI_FLAG_BLOCK_READ * - * SCI_FLAG_USE_CALLBACK * - * * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_OUT_OF_RANGE - The sum of the size and offset is larger than * - * the corresponding map size. * - * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as required by * - * the implementation. * - * SCI_ERR_OFFSET_ALIGNMENT - Offset is not correctly aligned as required * - * by the implementation. * - * SCI_ERR_TRANSFER_FAILED - The data transfer failed. * - * * - *********************************************************************************/ -#define SCITransferBlockAsync _SISCI_EXPANDE_FUNCTION_NAME(SCITransferBlockAsync) -DLL void SCITransferBlockAsync(sci_map_t sourceMap, - unsigned int sourceOffset, - sci_map_t destinationMap, - unsigned int destinationOffset, - unsigned int size, - sci_block_transfer_t *block, - sci_cb_block_transfer_t callback, - void *callbackArg, - unsigned int flags, - sci_error_t *error); - - - - -/********************************************************************************* - * * - * S C I W A I T F O R B L O C K T R A N S F E R * - * * - * Flags * - * None. * - * * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_ILLEGAL_OPERATION - Illegal operation * - * SCI_ERR_TIMEOUT - The function timed out after specified * - * timeout value. * - * * - *********************************************************************************/ -#define SCIWaitForBlockTransfer _SISCI_EXPANDE_FUNCTION_NAME(SCIWaitForBlockTransfer) -DLL void SCIWaitForBlockTransfer(sci_block_transfer_t block, - unsigned int timeout, - unsigned int flags, - sci_error_t *error); - - - -/********************************************************************************* - * * - * S C I A B O R T B L O C K T R A N S F E R * - * * - * Flags * - * None. * - * * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_ILLEGAL_OPERATION - Illegal operation * - * * - *********************************************************************************/ -#define SCIAbortBlockTransfer _SISCI_EXPANDE_FUNCTION_NAME(SCIAbortBlockTransfer) -DLL void SCIAbortBlockTransfer(sci_block_transfer_t block, - unsigned int flags, - sci_error_t *error); - - - - -/********************************************************************************* - * * - * S C I M E M C P Y * - * * - * Flags: * - * SCI_FLAG_BLOCK_READ * - * SCI_FLAG_ERROR_CHECK * - * * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_OUT_OF_RANGE - The sum of the size and offset is larger * - * than the corresponding map size. * - * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as required * - * by the implementation. * - * SCI_ERR_OFFSET_ALIGNMENT - Offset is not correctly aligned as required * - * by the implementation. * - * SCI_ERR_TRANSFER_FAILED - The data transfer failed. * - * * - *********************************************************************************/ - -#define SCIMemCpy _SISCI_EXPANDE_FUNCTION_NAME(SCIMemCpy) -DLL void SCIMemCpy(sci_sequence_t sequence, - void *memAddr, - sci_map_t remoteMap, - unsigned int remoteOffset, - unsigned int size, - unsigned int flags, - sci_error_t *error); - - - -/********************************************************************************* - * * - * S C I M E M C O P Y * - * * - * Flags: * - * SCI_FLAG_BLOCK_READ * - * SCI_FLAG_ERROR_CHECK * - * * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_OUT_OF_RANGE - The sum of the size and offset is larger * - * than the corresponding map size. * - * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as required * - * by the implementation. * - * SCI_ERR_OFFSET_ALIGNMENT - Offset is not correctly aligned as required * - * by the implementation. * - * SCI_ERR_TRANSFER_FAILED - The data transfer failed. * - * * - *********************************************************************************/ - - -#define SCIMemCopy _SISCI_EXPANDE_FUNCTION_NAME(SCIMemCopy) -DLL void SCIMemCopy(void *memAddr, - sci_map_t remoteMap, - unsigned int remoteOffset, - unsigned int size, - unsigned int flags, - sci_error_t *error); - - - -/********************************************************************************* - * * - * S C I R E G I S T E R S E G M E N T M E M O R Y * - * * - * Flags * - * None. * - * * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as required by * - * the implementation. * - * SCI_ERR_ILLEGAL_ADDRESS - Illegal address. * - * SCI_ERR_OUT_OF_RANGE - Size is larger than the maximum size for the * - * local segment. * - * * - *********************************************************************************/ -#define SCIRegisterSegmentMemory _SISCI_EXPANDE_FUNCTION_NAME(SCIRegisterSegmentMemory) -DLL void SCIRegisterSegmentMemory(void *address, - unsigned int size, - sci_local_segment_t segment, - unsigned int flags, - sci_error_t *error); - - - - - -/********************************************************************************* - * * - * S C I C O N N E C T S C I S P A C E * - * * - * SISCI Priveleged function * - * * - * * - * Flags * - * None. * - * * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as required * - * by the implementation. * - * SCI_ERR_CONNECTION_REFUSED - Connection attempt refused by remote node. * - * * - *********************************************************************************/ -#define SCIConnectSCISpace _SISCI_EXPANDE_FUNCTION_NAME(SCIConnectSCISpace) -DLL void SCIConnectSCISpace(sci_desc_t sd, - unsigned int localAdapterNo, - sci_remote_segment_t *segment, - sci_address_t address, - unsigned int size, - unsigned int flags, - sci_error_t *error); - - - -/* - * ===================================================================================== - * - * S C I A T T A C H L O C A L S E G M E N T - * Description: - * - * SCIAttachLocalSegment() permits an application to "attach" to an already existing - * local segment, implying that two or more application want - * share the same local segment. The prerequest, is that the - * application which originally created the segment ("owner") has - * preformed a SCIShareSegment() in order to mark the segment - * "shareable". - * - * - * Flags: - * - * SCI_FLAG_USE_CALLBACK - The callback function will be invoked for events - * on this segment. - * - * - * Specific error codes for this function: - * - * SCI_ERR_ACCESS - No such shared segment - * SCI_ERR_NO_SUCH_SEGMENT - No such segment - * Note: Current implenentation will return SCI_ERR_ACCESS for both cases. This will - * change from next release. Application should handle both cases. - * - * ===================================================================================== - */ -#define SCIAttachLocalSegment _SISCI_EXPANDE_FUNCTION_NAME(SCIAttachLocalSegment) - -DLL void -SCIAttachLocalSegment(sci_desc_t sd, - sci_local_segment_t *segment, - unsigned int segmentId, - unsigned int *size, - sci_cb_local_segment_t callback, - void *callbackArg, - unsigned int flags, - sci_error_t *error); -/* - * ===================================================================================== - * - * S C I S H A R E S E G M E N T - * - * Description: - * - * SCIShareSegment() permits other application to "attach" to an already existing - * local segment, implying that two or more application want - * share the same local segment. The prerequest, is that the - * application which originally created the segment ("owner") has - * preformed a SCIShareSegment() in order to mark the segment - * "shareable". - * - * - * Flags: - * none - * - * Specific error codes for this function: - * - * - * - * ===================================================================================== - */ -#define SCIShareSegment _SISCI_EXPANDE_FUNCTION_NAME(SCIShareSegment) - -DLL void -SCIShareSegment(sci_local_segment_t segment, - unsigned int flags, - sci_error_t *error); - - -/********************************************************************************* - * * - * S C I F L U S H * - * * - * This function will flush the CPU buffers and the PSB buffers. * - * * - * Flags * - * SCI_FLAG_FLUSH_CPU_BUFFERS_ONLY : * - * Only flush CPU buffers ( Write combining * - * etc buffers). * - * * - *********************************************************************************/ - -#define SCIFlush _SISCI_EXPANDE_FUNCTION_NAME(SCIFlush) -DLL void SCIFlush(sci_sequence_t sequence, - unsigned int flags); - -#if defined(CPLUSPLUS) || defined(__cplusplus) -} -#endif - - -#endif - - - - - - - - - - - diff --git a/ndb/src/external/SOLARIS.SPARC/sci/include/sisci_error.h b/ndb/src/external/SOLARIS.SPARC/sci/include/sisci_error.h deleted file mode 100644 index aab7c136d3a..00000000000 --- a/ndb/src/external/SOLARIS.SPARC/sci/include/sisci_error.h +++ /dev/null @@ -1,89 +0,0 @@ -/* $Id: sisci_error.h,v 1.1 2002/12/13 12:17:22 hin Exp $ */ - -/******************************************************************************* - * * - * Copyright (C) 1993 - 2000 * - * Dolphin Interconnect Solutions AS * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, * - * or (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the Free Software * - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - * * - *******************************************************************************/ - - - - -#ifndef _SISCI_ERROR_H_ -#define _SISCI_ERROR_H_ - - -/* SCI Error return values always have 30 bit set */ -#define SCI_ERR_MASK 0x40000000 -#define SCI_ERR_REMOTE_MASK 0x01 /* Remote errors should have bit 0 set */ - -#define SCI_ERR(u) ((unsigned32)(u)&0x7FFFFFFF ) - -/* Error codes */ -typedef enum { - SCI_ERR_OK = 0x000, - - - SCI_ERR_BUSY = (0x900 | SCI_ERR_MASK), - SCI_ERR_FLAG_NOT_IMPLEMENTED = (0x901 | SCI_ERR_MASK), - SCI_ERR_ILLEGAL_FLAG = (0x902 | SCI_ERR_MASK), - SCI_ERR_NOSPC = (0x904 | SCI_ERR_MASK), - SCI_ERR_API_NOSPC = (0x905 | SCI_ERR_MASK), - SCI_ERR_HW_NOSPC = (0x906 | SCI_ERR_MASK), - SCI_ERR_NOT_IMPLEMENTED = (0x907 | SCI_ERR_MASK), - SCI_ERR_ILLEGAL_ADAPTERNO = (0x908 | SCI_ERR_MASK), - SCI_ERR_NO_SUCH_ADAPTERNO = (0x909 | SCI_ERR_MASK), - SCI_ERR_TIMEOUT = (0x90A | SCI_ERR_MASK), - SCI_ERR_OUT_OF_RANGE = (0x90B | SCI_ERR_MASK), - SCI_ERR_NO_SUCH_SEGMENT = (0x90C | SCI_ERR_MASK), - SCI_ERR_ILLEGAL_NODEID = (0x90D | SCI_ERR_MASK), - SCI_ERR_CONNECTION_REFUSED = (0x90E | SCI_ERR_MASK), - SCI_ERR_SEGMENT_NOT_CONNECTED = (0x90F | SCI_ERR_MASK), - SCI_ERR_SIZE_ALIGNMENT = (0x910 | SCI_ERR_MASK), - SCI_ERR_OFFSET_ALIGNMENT = (0x911 | SCI_ERR_MASK), - SCI_ERR_ILLEGAL_PARAMETER = (0x912 | SCI_ERR_MASK), - SCI_ERR_MAX_ENTRIES = (0x913 | SCI_ERR_MASK), - SCI_ERR_SEGMENT_NOT_PREPARED = (0x914 | SCI_ERR_MASK), - SCI_ERR_ILLEGAL_ADDRESS = (0x915 | SCI_ERR_MASK), - SCI_ERR_ILLEGAL_OPERATION = (0x916 | SCI_ERR_MASK), - SCI_ERR_ILLEGAL_QUERY = (0x917 | SCI_ERR_MASK), - SCI_ERR_SEGMENTID_USED = (0x918 | SCI_ERR_MASK), - SCI_ERR_SYSTEM = (0x919 | SCI_ERR_MASK), - SCI_ERR_CANCELLED = (0x91A | SCI_ERR_MASK), - SCI_ERR_NOT_CONNECTED = (0x91B | SCI_ERR_MASK), - SCI_ERR_NOT_AVAILABLE = (0x91C | SCI_ERR_MASK), - SCI_ERR_INCONSISTENT_VERSIONS = (0x91D | SCI_ERR_MASK), - SCI_ERR_COND_INT_RACE_PROBLEM = (0x91E | SCI_ERR_MASK), - SCI_ERR_OVERFLOW = (0x91F | SCI_ERR_MASK), - SCI_ERR_NOT_INITIALIZED = (0x920 | SCI_ERR_MASK), - - SCI_ERR_ACCESS = (0x921 | SCI_ERR_MASK), - - SCI_ERR_NO_SUCH_NODEID = (0xA00 | SCI_ERR_MASK), - SCI_ERR_NODE_NOT_RESPONDING = (0xA02 | SCI_ERR_MASK), - SCI_ERR_NO_REMOTE_LINK_ACCESS = (0xA04 | SCI_ERR_MASK), - SCI_ERR_NO_LINK_ACCESS = (0xA05 | SCI_ERR_MASK), - SCI_ERR_TRANSFER_FAILED = (0xA06 | SCI_ERR_MASK) -} sci_error_t; - - -#endif /* _SCI_ERROR_H_ */ - - - diff --git a/ndb/src/external/SOLARIS.SPARC/sci/include/sisci_types.h b/ndb/src/external/SOLARIS.SPARC/sci/include/sisci_types.h deleted file mode 100644 index 77989ffca59..00000000000 --- a/ndb/src/external/SOLARIS.SPARC/sci/include/sisci_types.h +++ /dev/null @@ -1,133 +0,0 @@ -/* $Id: sisci_types.h,v 1.1 2002/12/13 12:17:22 hin Exp $ */ - -/******************************************************************************* - * * - * Copyright (C) 1993 - 2000 * - * Dolphin Interconnect Solutions AS * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, * - * or (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the Free Software * - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - * * - *******************************************************************************/ - - -#ifndef _SISCI_TYPES_H -#define _SISCI_TYPES_H - -#include "sisci_error.h" - -#ifndef IN -#define IN -#endif - -#ifndef OUT -#define OUT -#endif - -#ifndef IN_OUT -#define IN_OUT -#endif - -/* Opaque data types for descriptors/handles */ -typedef struct sci_desc *sci_desc_t; -typedef struct sci_local_segment *sci_local_segment_t; -typedef struct sci_remote_segment *sci_remote_segment_t; - -typedef struct sci_map *sci_map_t; -typedef struct sci_sequence *sci_sequence_t; -#ifndef KERNEL -typedef struct sci_dma_queue *sci_dma_queue_t; -#endif -typedef struct sci_remote_interrupt *sci_remote_interrupt_t; -typedef struct sci_local_interrupt *sci_local_interrupt_t; -typedef struct sci_block_transfer *sci_block_transfer_t; - -/* - * Constants defining reasons for segment callbacks: - */ - -typedef enum { - SCI_CB_CONNECT = 1, - SCI_CB_DISCONNECT, - SCI_CB_NOT_OPERATIONAL, - SCI_CB_OPERATIONAL, - SCI_CB_LOST -} sci_segment_cb_reason_t; - -#define MAX_CB_REASON SCI_CB_LOST - -/* dma_queue_states is identical to the dma_queue_state_t in genif.h, they must be consistent.*/ -typedef enum { - SCI_DMAQUEUE_IDLE, - SCI_DMAQUEUE_GATHER, - SCI_DMAQUEUE_POSTED, - SCI_DMAQUEUE_DONE, - SCI_DMAQUEUE_ABORTED, - SCI_DMAQUEUE_ERROR -} sci_dma_queue_state_t; - - -typedef enum { - SCI_SEQ_OK, - SCI_SEQ_RETRIABLE, - SCI_SEQ_NOT_RETRIABLE, - SCI_SEQ_PENDING -} sci_sequence_status_t; - - -typedef struct { - unsigned short nodeId; /* SCI Address bit 63 - 48 */ - unsigned short offsHi; /* SCI Address bit 47 - 32 */ - unsigned int offsLo; /* SCI Address bit 31 - 0 */ -} sci_address_t; - - -typedef unsigned int sci_ioaddr_t; - -typedef enum { - SCI_CALLBACK_CANCEL = 1, - SCI_CALLBACK_CONTINUE -} sci_callback_action_t; - -#ifndef KERNEL -typedef sci_callback_action_t (*sci_cb_local_segment_t)(void *arg, - sci_local_segment_t segment, - sci_segment_cb_reason_t reason, - unsigned int nodeId, - unsigned int localAdapterNo, - sci_error_t error); - -typedef sci_callback_action_t (*sci_cb_remote_segment_t)(void *arg, - sci_remote_segment_t segment, - sci_segment_cb_reason_t reason, - sci_error_t status); - - -typedef sci_callback_action_t (*sci_cb_dma_t)(void IN *arg, - sci_dma_queue_t queue, - sci_error_t status); - - -typedef int (*sci_cb_block_transfer_t)(void *arg, - sci_block_transfer_t block, - sci_error_t status); - - -typedef sci_callback_action_t (*sci_cb_interrupt_t)(void *arg, - sci_local_interrupt_t interrupt, - sci_error_t status); - -#endif /* KERNEL */ -#endif diff --git a/ndb/src/external/SOLARIS.SPARC/sci/include/sisci_version.h b/ndb/src/external/SOLARIS.SPARC/sci/include/sisci_version.h deleted file mode 100644 index c2fccb9ec33..00000000000 --- a/ndb/src/external/SOLARIS.SPARC/sci/include/sisci_version.h +++ /dev/null @@ -1,91 +0,0 @@ -/* $Id: sisci_version.h,v 1.1 2002/12/13 12:17:22 hin Exp $ */ - -/******************************************************************************* - * * - * Copyright (C) 1993 - 2000 * - * Dolphin Interconnect Solutions AS * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU Lesser General Public License as published by * - * the Free Software Foundation; either version 2.1 of the License, * - * or (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU Lesser General Public License * - * along with this program; if not, write to the Free Software * - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - * * - *******************************************************************************/ - - -#ifndef SISCI_VERSION_H -#define SISCI_VERSION_H - - -#define SISCI_API_VER_MAJOR 1 -#define SISCI_API_VER_MAJORC "1" - -#define SISCI_API_VER_MINOR 10 -#define SISCI_API_VER_MINORC "10" -#define SISCI_API_VER_MICRO 4 -#define SISCI_API_VER_MICROC "4" - -#define SISCI_SIGN_VERSION_MASK 0xfffff000 /* used to mask off API_VER_MICRO */ - -#define SISCI_API_VERSION (SISCI_API_VER_MAJOR << 24 | SISCI_API_VER_MINOR << 12 | SISCI_API_VER_MICRO) - -/* the rules are: - * - * Changes in API_VER_MICRO should be binary compatible, New flags, functions added. No changes to user code - * required if new features is not needed. - * - * Changes in API_VER_MINOR requires recompilation of user code. - * - * Changes in the API_VER_MAJOR will most likely require changes to user code. This should not happen very - * often... - * - */ - -#ifndef BUILD_DATE -#define BUILD_DATE __DATE__ -#endif - -#ifndef BUILD_NAME -#define BUILD_NAME "" -#endif - -#define API_VERSION "SISCI API version " SISCI_API_VER_MAJORC "." SISCI_API_VER_MINORC "."SISCI_API_VER_MICROC " ( "BUILD_NAME" "BUILD_DATE" )" - -#endif - - -/* Version info: */ -/* */ -/* 1.5.2 First SISCI version */ -/* 1.5.3 Some bug fixes */ -/* 1.5.4 Some bug fixes */ -/* 1.5.5 No release */ -/* 1.5.6 Lock flag implemented in function SCIConnectSegment */ -/* 1.5.7 Expanded query functionality */ -/* 1.5.8 Updated error checking (sequence) functionality for D320 */ -/* 1.6.0 Updated error checking (sequence) D320 and IRM 1.9 support */ -/* 1.9.0 Ported to Solaris_sparc, Solaris_x86 and Linux. IRM 1.9. */ -/* 1.9.1 Some bug fixes */ -/* 1.9.2 Added more adapter queries */ -/* 1.9.3 Bug fix in SCIMapLocalSegment and SCIMapRemoteSegment */ -/* 1.9.4 NT Release Developers Kit 2.40 */ -/* 1.9.5 Added flush after data transfer in SCIMemCopy() */ -/* 1.9.5 NT Release Developers Kit 2.44 */ -/* 1.10.0: - * New SCIInitialize(), SCITerminate() functions. - * Support for D330 - * - * - */ - - diff --git a/ndb/src/external/WIN32.x86/sci/include/rmlib.h b/ndb/src/external/WIN32.x86/sci/include/rmlib.h deleted file mode 100644 index 87ba20db99f..00000000000 --- a/ndb/src/external/WIN32.x86/sci/include/rmlib.h +++ /dev/null @@ -1,212 +0,0 @@ -/* $Id: rmlib.h,v 1.1 2002/12/13 12:17:23 hin Exp $ */ - -/********************************************************************************* - * * - * Copyright (C) 1993 - 2000 * - * Dolphin Interconnect Solutions AS * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU Lesser General Public License as published by * - * the Free Software Foundation; either version 2.1 of the License, * - * or (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU Lesser General Public License * - * along with this program; if not, write to the Free Software * - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - * * - *********************************************************************************/ - -/********************************************************************************/ -/* This header file contains the declarations of the SCI Reflective Memory */ -/* library rmlib. The implementation of the library functions is in rmlib.c. */ -/* The library contains all the functions that operate on the reflective */ -/* memory. */ -/* */ -/* NB! */ -/* */ -/* DOLPHIN'S SCI REFLECTIVE MEMORY FILES ARE UNDER DEVELOPMENT AND MAY CHANGE. */ -/* PLEASE CONTACT DOLPHIN FOR FURTHER INFORMATION. */ -/* */ -/* */ -/********************************************************************************/ - -#include "sisci_error.h" -#include "sisci_api.h" -#include "sisci_demolib.h" -#include "sisci_types.h" - -unsigned int seqerr, syncseqerr; - -#ifndef _RMLIB_H -#define _RMLIB_H - - -#if defined(_REENTRANT) - -#define _RMLIB_EXPAND_NAME(name) _RMLIB_MT_ ## name - -#else - -#define _RMLIB_EXPAND_NAME(name) _RMLIB_ST_ ## name - -#endif - -#ifdef __sparc -#define CACHE_SIZE 2097152 -#else -#define CACHE_SIZE 8192 -#endif - -/*********************************************************************************/ -/* FLAG VALUES */ -/*********************************************************************************/ - -#define REFLECT_ERRCHECK 0x2 - -struct ReflectiveMemorySpace { - unsigned int localAdapterNo; - unsigned int localNodeId; - unsigned int remoteNodeId; - sci_desc_t sd; - sci_desc_t syncsd; - sci_map_t localMap; - sci_map_t remoteMap; - unsigned int localSegmentId; - unsigned int remoteSegmentId; - unsigned int syncSegmentId; - unsigned int sync_rSegmentId; - unsigned int segmentSize; - unsigned int *localMapAddr; - volatile unsigned int *remoteMapAddr; - sci_local_segment_t localSegment; - sci_remote_segment_t remoteSegment; - sci_local_segment_t syncSegment; - sci_remote_segment_t sync_rSegment; - sci_map_t syncMap; - sci_map_t sync_rMap; - sci_sequence_t syncsequence; - sci_sequence_t sequence; - unsigned int protection; - unsigned int retry_value; - sci_sequence_status_t sequenceStatus, syncsequenceStatus; - volatile unsigned int *syncMapAddr; - volatile unsigned int *sync_rMapAddr; -}; - -/*********************************************************************************/ -/* P R I N T R E F L E C T I V E M E M O R Y S P A C E */ -/* */ -/*********************************************************************************/ -#define ReflectPrintParameters _RMLIB_EXPAND_NAME(ReflectPrintParameters) -void ReflectPrintParameters(FILE *stream, struct ReflectiveMemorySpace RM_space); - -/*********************************************************************************/ -/* R E F L E C T D M A S E T U P */ -/* */ -/*********************************************************************************/ -#define ReflectDmaSetup _RMLIB_EXPAND_NAME(ReflectDmaSetup) -sci_error_t ReflectDmaSetup(struct ReflectiveMemorySpace RM_space, sci_dma_queue_t *dmaQueue); - -/*********************************************************************************/ -/* R E F L E C T D M A R E M O V E */ -/* */ -/*********************************************************************************/ -#define ReflectDmaRemove _RMLIB_EXPAND_NAME(ReflectDmaRemove) -sci_error_t ReflectDmaRemove(sci_dma_queue_t dmaQueue); - -/*********************************************************************************/ -/* R E F L E C T D M A R U N */ -/* */ -/*********************************************************************************/ -#define ReflectDmaRun _RMLIB_EXPAND_NAME(ReflectDmaRun) -sci_error_t ReflectDmaRun(struct ReflectiveMemorySpace RM_space, - unsigned int* privateSrc, - unsigned int size, - unsigned int offset, - sci_dma_queue_t dmaQueue); -/*********************************************************************************/ -/* C L O S E R E F L E C T I V E M E M O R Y S P A C E */ -/* */ -/*********************************************************************************/ -#define ReflectClose _RMLIB_EXPAND_NAME(ReflectClose) -sci_error_t ReflectClose(struct ReflectiveMemorySpace RM_space, unsigned int segment_no); - -/*********************************************************************************/ -/* O P E N R E F L E C T I V E M E M O R Y S P A C E */ -/* */ -/*********************************************************************************/ -#define ReflectOpen _RMLIB_EXPAND_NAME(ReflectOpen) -sci_error_t ReflectOpen(struct ReflectiveMemorySpace *RM_space, - unsigned int size, - unsigned int segment_no, - unsigned int localAdapterNo, - unsigned int remoteNodeId, - unsigned int protection, - unsigned int retry_value); - -/*********************************************************************************/ -/* R E F L E C T G E T A C C E S S */ -/* */ -/*********************************************************************************/ -#define ReflectGetAccess _RMLIB_EXPAND_NAME(ReflectGetAccess) -sci_error_t ReflectGetAccess(struct ReflectiveMemorySpace *RM_space); - -/*********************************************************************************/ -/* R E F L E C T R E L E A S E A C C E S S */ -/* */ -/*********************************************************************************/ -#define ReflectReleaseAccess _RMLIB_EXPAND_NAME(ReflectReleaseAccess) -sci_error_t ReflectReleaseAccess(struct ReflectiveMemorySpace *RM_space); - -/*********************************************************************************/ -/* R E F L E C T D M A */ -/* */ -/*********************************************************************************/ -#define ReflectDma _RMLIB_EXPAND_NAME(ReflectDma) -sci_error_t ReflectDma(struct ReflectiveMemorySpace RM_space, - unsigned int* privateSrc, - unsigned int size, - unsigned int offset); - -/*********************************************************************************/ -/* R E F L E C T M E M C O P Y */ -/* */ -/*********************************************************************************/ -#define ReflectMemCopy _RMLIB_EXPAND_NAME(ReflectMemCopy) -sci_error_t ReflectMemCopy(struct ReflectiveMemorySpace RM_space, - unsigned int* privateSrc, - unsigned int size, - unsigned int offset, - unsigned int flags); - -/*********************************************************************************/ -/* R E F L E C T S E T */ -/* */ -/*********************************************************************************/ -#define ReflectSet _RMLIB_EXPAND_NAME(ReflectSet) -sci_error_t ReflectSet(struct ReflectiveMemorySpace RM_space, - unsigned int value, - unsigned int size, - unsigned int offset, - unsigned int flags - ); - -/*********************************************************************************/ -/* R E F L E C T P R I N T */ -/* */ -/*********************************************************************************/ -#define ReflectPrint _RMLIB_EXPAND_NAME(ReflectPrint) -sci_error_t ReflectPrint(FILE *stream, - struct ReflectiveMemorySpace RM_space, - unsigned int size, - unsigned int offset - ); - - -#endif diff --git a/ndb/src/external/WIN32.x86/sci/include/scilib.h b/ndb/src/external/WIN32.x86/sci/include/scilib.h deleted file mode 100644 index d1501082bab..00000000000 --- a/ndb/src/external/WIN32.x86/sci/include/scilib.h +++ /dev/null @@ -1,330 +0,0 @@ -/* $Id: scilib.h,v 1.1 2002/12/13 12:17:23 hin Exp $ */ - -/******************************************************************************* - * * - * Copyright (C) 2002 * - * Dolphin Interconnect Solutions AS * - * * - *******************************************************************************/ - - -#if defined(_REENTRANT) -#define _SCIL_EXPANDE_FUNCTION_NAME(name) _SCIL_PUBLIC_FUNC_MT_ ## name -#define _SCIL_EXPANDE_VARIABLE_NAME(name) _SCIL_PUBLIC_VAR_MT_ ## name -#else -#define _SCIL_EXPANDE_FUNCTION_NAME(name) _SCIL_PUBLIC_FUNC_ST_ ## name -#define _SCIL_EXPANDE_VARIABLE_NAME(name) _SCIL_PUBLIC_VAR_ST_ ## name -#endif -#define _SCIL_EXPANDE_CONSTANT_NAME(name) _SCIL_PUBLIC_CONST_ ## name - -#include "sisci_api.h" - -#if defined(CPLUSPLUS) || defined(__cplusplus) -extern "C" { -#endif - - -/* - * SISCI segment id pollution: - * =========================== - * The SISCI library uses regular SISCI segmens internally. - * The MSG_QUEUE_LIB_IDENTIFIER_MASK is a mask which is used by the SISCI - * library to identify internal SISCI segments ids, from segments used directly - * by the user. - * - * Future versions of the library may have its own namespace. - * - */ - -#define MSG_QUEUE_LIB_IDENTIFIER_MASK 0x10000000 - - -/*********************************************************************************/ -/* FLAG VALUES */ -/*********************************************************************************/ - -#define SCIL_FLAG_ERROR_CHECK_DATA _SCIL_EXPANDE_CONSTANT_NAME(SCIL_FLAG_ERROR_CHECK_DATA) -extern const unsigned int SCIL_FLAG_ERROR_CHECK_DATA; - -#define SCIL_FLAG_ERROR_CHECK_PROT _SCIL_EXPANDE_CONSTANT_NAME(SCIL_FLAG_ERROR_CHECK_PROT) -extern const unsigned int SCIL_FLAG_ERROR_CHECK_PROT; - -#define SCIL_FLAG_FULL_ERROR_CHECK _SCIL_EXPANDE_CONSTANT_NAME(SCIL_FLAG_FULL_ERROR_CHECK) -extern const unsigned int SCIL_FLAG_FULL_ERROR_CHECK; - - - - - -typedef struct sci_msq_queue *sci_msq_queue_t; - - -/********************************************************************************* - * * - * S C I L C r e a t e M s g Q u e u e * - * * - * Parameters: * - * * - * Creates a message queue. The message queue identifier object will be allocated* - * if the sci_msq_queue_t * msg pointer is NULL. The function will create a * - * remote connection. If this connection times out, the function shoud be * - * repeated until connection is established. SCILRemoveMsgQueue() must be called * - * to remove the connection and deallocate the message queue identifier. * - * * - * sci_msq_queue_t *msq : Message queue identifier * - * The function must be called with a null pointer * - * the first time. * - * unsigned int localAdapterNo: Local Adapter Number * - * unsigned int remoteNodeId : Remote nodeId * - * unsigned int msqId : Message queue number * - * unsigned int maxMsgCount : The maximum count of messages in queue * - * unsigned int maxMsgSize, : The maximum size of each messages in queue * - * unsigned int timeout : Time to wait for successful connection * - * unsigned int flags : Flags. * - * * - * Flags * - * * - * None * - * * - * Specific error codes for this function: * - * * - * None. Normal SISIC error codes. * - * * - *********************************************************************************/ -#define SCILCreateMsgQueue _SCIL_EXPANDE_FUNCTION_NAME(SCILCreateMsgQueue) -DLL sci_error_t SCILCreateMsgQueue(sci_msq_queue_t *msq, - unsigned int localAdapterNo, - unsigned int remoteNodeId, - unsigned int msqId, - unsigned int maxMsgCount, - unsigned int maxMsgSize, - unsigned int timeout, - unsigned int flags); - - -/********************************************************************************* - * * - * S C I L R e c e i v e M s g * - * * - * * - * Receives a message from the queue. * - * * - * Paremeters * - * * - * sci_msq_queue_t msq : message queue identifier * - * void *msg : Location to store received data * - * unsigned int size : Size of message to read * - * unsigned int *sizeLeft: Bytes left in buffer, after current receive. This is * - * just a hint. There may be more. * - * * - * Flags * - * * - * SCIL_FLAG_ERROR_CHECK_PROT: The internal buffer management is done using full* - * error checking. - * * - * Specific error codes for this function: * - * * - * SCI_ERR_EWOULD_BLOCK : There is not enough data in the message buffer * - * to read the specified number of bytes. * - * . * - * SCI_ERR_NOT_CONNECTED : The connection is not established. * - * * - *********************************************************************************/ -#define SCILReceiveMsg _SCIL_EXPANDE_FUNCTION_NAME(SCILReceiveMsg) -DLL sci_error_t SCILReceiveMsg( - sci_msq_queue_t msq, - void *msg, - unsigned int size, - unsigned int *sizeLeft, - unsigned int flags); - - - -/********************************************************************************* - * * - * S C I L S e n d M s g * - * * - * * - * Sends a message to the queue. * - * * - * Paremeters * - * * - * sci_msq_queue_t msq : Message queue identifier * - * void *msg : Send data * - * unsigned int size : Size of message to send * - * unsigned int *sizeFree: Bytes free in buffer, after current send. This is * - * just a hint. There may be more. * - * * - * Flags * - * * - * SCIL_FLAG_ERROR_CHECK_DATA: The data is transmitted using full error checking* - * SCIL_FLAG_ERROR_CHECK_PROT: The internal buffer management is done using full* - * error checking. * - * SCIL_FLSG_FULL_ERROR_CHECK: This flag is an combination of both above. * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_EWOULD_BLOCK : There is not enough data in the message buffer * - * to send the specified number of bytes. * - * . * - * SCI_ERR_NOT_CONNECTED : The connection is not established. * - * * - *********************************************************************************/ -#define SCILSendMsg _SCIL_EXPANDE_FUNCTION_NAME(SCILSendMsg) -DLL sci_error_t SCILSendMsg( - sci_msq_queue_t msq, - void *msg, - unsigned int size, - unsigned int *sizeFree, - unsigned int flags); - - -/********************************************************************************* - * * - * S C I L R e m o v e M s g Q u e ue * - * * - * * - * Removes a message queue. * - * * - * sci_msq_queue_t msq : Message queue identifier * - * * - * Flags * - * * - * None * - * * - * Specific error codes for this function: * - * * - * None * - * * - *********************************************************************************/ -#define SCILRemoveMsgQueue _SCIL_EXPANDE_FUNCTION_NAME(SCILRemoveMsgQueue) -DLL sci_error_t SCILRemoveMsgQueue( - sci_msq_queue_t *msq, - unsigned int flags); - - - -/********************************************************************************* - * * - * S C I L I n i t * - * * - * * - * Initializes the SCI library. This function must be called before any other * - * function in the library. * - * * - * Flags * - * * - * None * - * * - * Specific error codes for this function: * - * * - * None * - * . * - *********************************************************************************/ -#define SCILInit _SCIL_EXPANDE_FUNCTION_NAME(SCILInit) -DLL sci_error_t SCILInit(unsigned int flags); - - - -/********************************************************************************* - * * - * S C I L D e s t r o y * - * * - * * - * Removes internal resources allocated by the SCI Library. No other library * - * function should be called after this function. * - * * - * Flags * - * * - * None * - * * - * Specific error codes for this function: * - * * - * None * - * * - *********************************************************************************/ -#define SCILDestroy _SCIL_EXPANDE_FUNCTION_NAME(SCILDestroy) -DLL sci_error_t SCILDestroy(unsigned int flags); - - - -/********************************************************************************* - * * - * S C I L C o n n e c t M s g Q u e u e * - * * - * * - * Makes a connection to a remote message queue. This must be done before * - * SCILSendMsg() is called. * - * * - * Parameters: * - * * - * sci_msq_queue_t *msq : Message queue identifier * - * unsigned int localAdapterNo: Local Adapter Number * - * unsigned int remoteNodeId : Remote nodeId * - * unsigned int msqId : Message queue number * - * unsigned int maxMsgCount : The maximum count of messages in queue * - * unsigned int maxMsgSize, : The maximum size of each messages in queue * - * unsigned int timeout : Time to wait for successful connection * - * unsigned int flags : Flags. * - * * - * Flags * - * * - * None * - * * - * Specific error codes for this function: * - * * - * None. Normal SISIC error codes. * - * * - *********************************************************************************/ -#define SCILConnectMsgQueue _SCIL_EXPANDE_FUNCTION_NAME(SCILConnectMsgQueue) -DLL sci_error_t SCILConnectMsgQueue(sci_msq_queue_t *msq, - unsigned int localAdapterNo, - unsigned int remoteNodeId, - unsigned int rmsgId, - unsigned int maxMsgCount, - unsigned int maxMsgSize, - unsigned int timeout, - unsigned int flags); - - - - -/********************************************************************************* - * * - * S C I L D i s c o n n e c t M s g Q u e u e * - * * - * * - * Disconnects from a remote message queue. * - * * - * Parameters: * - * * - * sci_msq_queue_t *msq : Message queue identifier * - * * - * Flags * - * * - * None * - * * - * Specific error codes for this function: * - * * - * None * - * * - *********************************************************************************/ -#define SCILDisconnectMsgQueue _SCIL_EXPANDE_FUNCTION_NAME(SCILDisconnectMsgQueue) -DLL sci_error_t SCILDisconnectMsgQueue(sci_msq_queue_t *msq, - unsigned int flags); - - - -#if defined(CPLUSPLUS) || defined(__cplusplus) -} -#endif - - - - - - - - - - diff --git a/ndb/src/external/WIN32.x86/sci/include/sisci_api.h b/ndb/src/external/WIN32.x86/sci/include/sisci_api.h deleted file mode 100644 index 9f4a1ddffb3..00000000000 --- a/ndb/src/external/WIN32.x86/sci/include/sisci_api.h +++ /dev/null @@ -1,2217 +0,0 @@ -/* $Id: sisci_api.h,v 1.1 2002/12/13 12:17:23 hin Exp $ */ -/******************************************************************************* - * * - * Copyright (C) 1993 - 2001 * - * Dolphin Interconnect Solutions AS * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU Lesser General Public License as published by * - * the Free Software Foundation; either version 2.1 of the License, * - * or (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU Lesser General Public License * - * along with this program; if not, write to the Free Software * - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - * * - *******************************************************************************/ - -#ifndef _SISCI_API_H -#define _SISCI_API_H - -#include "sisci_types.h" -#include "sisci_error.h" - - -#ifdef WIN32 -#ifdef API_DLL -#define DLL __declspec(dllexport) -#elif CLIENT_DLL -#define DLL __declspec(dllimport) -#endif -#endif /* WIN32 */ - - -#ifndef DLL -#define DLL -#endif - -#if defined(_REENTRANT) -#define _SISCI_EXPANDE_FUNCTION_NAME(name) _SISCI_PUBLIC_FUNC_MT_ ## name -#define _SISCI_EXPANDE_VARIABLE_NAME(name) _SISCI_PUBLIC_VAR_MT_ ## name -#else -#define _SISCI_EXPANDE_FUNCTION_NAME(name) _SISCI_PUBLIC_FUNC_ST_ ## name -#define _SISCI_EXPANDE_VARIABLE_NAME(name) _SISCI_PUBLIC_VAR_ST_ ## name -#endif -#define _SISCI_EXPANDE_CONSTANT_NAME(name) _SISCI_PUBLIC_CONST_ ## name - -#if defined(CPLUSPLUS) || defined(__cplusplus) -extern "C" { -#endif - - -/*********************************************************************************/ -/* FLAG VALUES */ -/*********************************************************************************/ - -#define SCI_FLAG_FIXED_INTNO _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_FIXED_INTNO) -extern const unsigned int SCI_FLAG_FIXED_INTNO; - -#define SCI_FLAG_SHARED_INT _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_SHARED_INT) -extern const unsigned int SCI_FLAG_SHARED_INT; - -#define SCI_FLAG_COUNTING_INT _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_COUNTING_INT) -extern const unsigned int SCI_FLAG_COUNTING_INT; - -#define SCI_FLAG_FIXED_MAP_ADDR _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_FIXED_MAP_ADDR) -extern const unsigned int SCI_FLAG_FIXED_MAP_ADDR; - -#define SCI_FLAG_READONLY_MAP _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_READONLY_MAP) -extern const unsigned int SCI_FLAG_READONLY_MAP; - -#define SCI_FLAG_USE_CALLBACK _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_USE_CALLBACK) -extern const unsigned int SCI_FLAG_USE_CALLBACK; - -#define SCI_FLAG_BLOCK_READ _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_BLOCK_READ) -extern const unsigned int SCI_FLAG_BLOCK_READ; - -#define SCI_FLAG_THREAD_SAFE _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_THREAD_SAFE) -extern const unsigned int SCI_FLAG_THREAD_SAFE; - -#define SCI_FLAG_ASYNCHRONOUS_CONNECT _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_ASYNCHRONOUS_CONNECT) -extern const unsigned int SCI_FLAG_ASYNCHRONOUS_CONNECT; - -#define SCI_FLAG_EMPTY _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_EMPTY) -extern const unsigned int SCI_FLAG_EMPTY; - -#define SCI_FLAG_PRIVATE _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_PRIVATE) -extern const unsigned int SCI_FLAG_PRIVATE; - -#define SCI_FLAG_FORCE_DISCONNECT _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_FORCE_DISCONNECT) -extern const unsigned int SCI_FLAG_FORCE_DISCONNECT; - -#define SCI_FLAG_NOTIFY _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_NOTIFY) -extern const unsigned int SCI_FLAG_NOTIFY; - -#define SCI_FLAG_DMA_READ _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_DMA_READ) -extern const unsigned int SCI_FLAG_DMA_READ; - -#define SCI_FLAG_DMA_POST _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_DMA_POST) -extern const unsigned int SCI_FLAG_DMA_POST; - -#define SCI_FLAG_DMA_WAIT _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_DMA_WAIT) -extern const unsigned int SCI_FLAG_DMA_WAIT; - -#define SCI_FLAG_DMA_RESET _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_DMA_RESET) -extern const unsigned int SCI_FLAG_DMA_RESET; - -#define SCI_FLAG_NO_FLUSH _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_NO_FLUSH) -extern const unsigned int SCI_FLAG_NO_FLUSH; - -#define SCI_FLAG_NO_STORE_BARRIER _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_NO_STORE_BARRIER) -extern const unsigned int SCI_FLAG_NO_STORE_BARRIER; - -#define SCI_FLAG_FAST_BARRIER _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_FAST_BARRIER) -extern const unsigned int SCI_FLAG_FAST_BARRIER; - -#define SCI_FLAG_ERROR_CHECK _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_ERROR_CHECK) -extern const unsigned int SCI_FLAG_ERROR_CHECK; - -#define SCI_FLAG_FLUSH_CPU_BUFFERS_ONLY _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_FLUSH_CPU_BUFFERS_ONLY) -extern const unsigned int SCI_FLAG_FLUSH_CPU_BUFFERS_ONLY; - -/* the FLUSH_CPU_BUFFERS_ONLY flag is for backwards compabillity only and should never be used */ -#define FLUSH_CPU_BUFFERS_ONLY _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_FLUSH_CPU_BUFFERS_ONLY) - -#define SCI_FLAG_LOCK_OPERATION _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_LOCK_OPERATION) -extern const unsigned int SCI_FLAG_LOCK_OPERATION; - -#define SCI_FLAG_READ_PREFETCH_AGGR_HOLD_MAP _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_READ_PREFETCH_AGGR_HOLD_MAP) -extern const unsigned int SCI_FLAG_READ_PREFETCH_AGGR_HOLD_MAP; - -#define SCI_FLAG_READ_PREFETCH_NO_HOLD_MAP _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_READ_PREFETCH_NO_HOLD_MAP) -extern const unsigned int SCI_FLAG_READ_PREFETCH_NO_HOLD_MAP; - -#define SCI_FLAG_IO_MAP_IOSPACE _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_IO_MAP_IOSPACE) -extern const unsigned int SCI_FLAG_IO_MAP_IOSPACE; - -#define SCI_FLAG_DMOVE_MAP _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_DMOVE_MAP) -extern const unsigned int SCI_FLAG_DMOVE_MAP; - -#define SCI_FLAG_WRITES_DISABLE_GATHER_MAP _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_WRITES_DISABLE_GATHER_MAP) -extern const unsigned int SCI_FLAG_WRITES_DISABLE_GATHER_MAP; - -#define SCI_FLAG_DISABLE_128_BYTES_PACKETS _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_DISABLE_128_BYTES_PACKETS) -extern const unsigned int SCI_FLAG_DISABLE_128_BYTES_PACKETS; - -#define SCI_FLAG_SHARED_MAP _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_SHARED_MAP) -extern const unsigned int SCI_FLAG_SHARED_MAP; - -#define SCI_FLAG_DMA_SOURCE_ONLY _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_DMA_SOURCE_ONLY) -extern const unsigned int SCI_FLAG_DMA_SOURCE_ONLY; - -#define SCI_FLAG_CONDITIONAL_INTERRUPT _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_CONDITIONAL_INTERRUPT) -extern const unsigned int SCI_FLAG_CONDITIONAL_INTERRUPT; - -#define SCI_FLAG_CONDITIONAL_INTERRUPT_MAP _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_CONDITIONAL_INTERRUPT_MAP) -extern const unsigned int SCI_FLAG_CONDITIONAL_INTERRUPT_MAP; - -#define SCI_FLAG_UNCONDITIONAL_DATA_INTERRUPT_MAP _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_UNCONDITIONAL_DATA_INTERRUPT_MAP) -extern const unsigned int SCI_FLAG_UNCONDITIONAL_DATA_INTERRUPT_MAP; - -#define SCI_FLAG_NO_MEMORY_LOOPBACK_MAP _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_NO_MEMORY_LOOPBACK_MAP) -extern const unsigned int SCI_FLAG_NO_MEMORY_LOOPBACK_MAP; - -#if defined(OS_IS_LYNXOS) || defined(OS_IS_VXWORKS) -#define SCI_FLAG_WRITE_BACK_CACHE_MAP _SISCI_EXPANDE_CONSTANT_NAME(WRITE_BACK_CACHE_MAP) -extern const unsigned int SCI_FLAG_WRITE_BACK_CACHE_MAP; -#endif - -#define SCI_FLAG_DMA_PHDMA _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_DMA_PHDMA) -extern const unsigned int SCI_FLAG_DMA_PHDMA; - -/*********************************************************************************/ -/* GENERAL VALUES */ -/*********************************************************************************/ -#define SCI_LOCAL_HOST _SISCI_EXPANDE_CONSTANT_NAME(SCI_LOCAL_HOST) -extern const unsigned int SCI_LOCAL_HOST; - -#define SCI_INFINITE_TIMEOUT _SISCI_EXPANDE_CONSTANT_NAME(SCI_INFINITE_TIMEOUT) -extern const unsigned int SCI_INFINITE_TIMEOUT; - -/*********************************************************************************/ -/* GENERAL ERROR CODES */ -/* */ -/* SCI_ERR_ILLEGAL_FLAG - Illegal flag value. */ -/* SCI_ERR_FLAG_NOT_IMPLEMENTED - Flag legal but flag feature not implemented. */ -/* SCI_ERR_NOT_IMPLEMENTED - Function not implemented. */ -/* SCI_ERR_SYSTEM - A system error. Check errno. */ -/* SCI_ERR_NOSPC - Unable to allocate OS resources. */ -/* SCI_ERR_API_NOSPC - Unable to allocate API resources. */ -/* SCI_ERR_HW_NOSPC - Unable to allocate HW resources (Hardware) */ -/* */ -/*********************************************************************************/ - - -/*********************************************************************************/ -/* GENERAL "ADAPTER" ERROR CODES */ -/* */ -/* SCI_ERR_NO_SUCH_ADAPTERNO - Adapter number is legal but does not exist. */ -/* SCI_ERR_ILLEGAL_ADAPTERNO - Illegal local adapter number (i.e. outside */ -/* legal range). */ -/* */ -/*********************************************************************************/ - - -/*********************************************************************************/ -/* GENERAL "NODEID" ERROR CODES */ -/* */ -/* SCI_ERR_NO_SUCH_NODEID - The remote adapter identified by nodeId does */ -/* not respond, but the intermediate link(s) */ -/* seem(s) to be operational. */ -/* SCI_ERR_ILLEGAL_NODEID - Illegal NodeId. */ -/* */ -/*********************************************************************************/ - - - -/********************************************************************************* - * * - * S C I I N I T I A L I Z E * - * * - * This function initializes the SISCI library. * - * The function must be called before SCIOpen(). * - * * - * Flags: * - * None * - * * - * Specific error codes for this function: * - * * - * None * - * * - *********************************************************************************/ -#define SCIInitialize _SISCI_EXPANDE_FUNCTION_NAME(SCIInitialize) -DLL void SCIInitialize(unsigned int flags, - sci_error_t *error); -#if 0 -unsigned int __Internal_SISCI_version_var; -#endif - -/********************************************************************************* - * * - * S C I T E R M I N A T E * - * * - * This function terminates the SISCI library. * - * The function must be called after SCIClose(). * - * * - * * - *********************************************************************************/ -#define SCITerminate _SISCI_EXPANDE_FUNCTION_NAME(SCITerminate) -DLL void SCITerminate(void); - -/********************************************************************************* - * * - * S C I O P E N * - * * - * * - * Opens a SCI virtual device. * - * Caller must supply a pointer to a variable of type sci_desc_t to be * - * initialized. * - * * - * Flags * - * SCI_FLAG_THREAD_SAFE - Operations on resources associated with this * - * descriptor will be performed in a multithread-safe * - * manner. * - * * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_INCONSISTENT_VERSIONS - Inconsistency between the SISCI library * - * and the SISCI driver versions. * - * * - * * - *********************************************************************************/ -#define SCIOpen _SISCI_EXPANDE_FUNCTION_NAME(SCIOpen) -DLL void SCIOpen(sci_desc_t *sd, - unsigned int flags, - sci_error_t *error); - - - - -/********************************************************************************* - * * - * S C I C L O S E * - * * - * This function closes an open SCI virtual device. * - * * - * Flags: * - * None * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_BUSY - All resources are not deallocated. * - * * - *********************************************************************************/ -#define SCIClose _SISCI_EXPANDE_FUNCTION_NAME(SCIClose) -DLL void SCIClose(sci_desc_t sd, - unsigned int flags, - sci_error_t *error); - - - - -/********************************************************************************* - * * - * S C I C O N N E C T S E G M E N T * - * * - * Connects to a remote shared memory segment located at with the * - * identifier . * - * The user may then call SCIMapRemoteSegment() to map shared memory * - * into user space. * - * * - * Flags * - * SCI_FLAG_USE_CALLBACK * - * SCI_FLAG_ASYNCHRONOUS_CONNECT * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_NO_SUCH_SEGMENT - Could not find the remote segment with the * - * given segmentId. * - * SCI_ERR_CONNECTION_REFUSED - Connection attempt refused by remote node. * - * SCI_ERR_TIMEOUT - The function timed out after specified * - * timeout value. * - * SCI_ERR_NO_LINK_ACCESS - It was not possible to communicate via the * - * local adapter. * - * SCI_ERR_NO_REMOTE_LINK_ACCESS - It was not possible to communicate via a * - * remote switch port. * - * * - *********************************************************************************/ -#define SCIConnectSegment _SISCI_EXPANDE_FUNCTION_NAME(SCIConnectSegment) -DLL void SCIConnectSegment(sci_desc_t sd, - sci_remote_segment_t *segment, - unsigned int nodeId, - unsigned int segmentId, - unsigned int localAdapterNo, - sci_cb_remote_segment_t callback, - void *callbackArg, - unsigned int timeout, - unsigned int flags, - sci_error_t *error); - - -/********************************************************************************* - * * - * S C I D I S C O N N E C T S E G M E N T * - * * - * Disconnects from the give mapped shared memory segment * - * * - * Flags * - * None. * - * * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_BUSY - The segment is currently mapped or in use. * - * * - *********************************************************************************/ -#define SCIDisconnectSegment _SISCI_EXPANDE_FUNCTION_NAME(SCIDisconnectSegment) -DLL void SCIDisconnectSegment(sci_remote_segment_t segment, - unsigned int flags, - sci_error_t *error); - - - -/********************************************************************************* - * * - * S C I G E T R E M O T E S E G M E N T S I Z E * - * * - *********************************************************************************/ -#define SCIGetRemoteSegmentSize _SISCI_EXPANDE_FUNCTION_NAME(SCIGetRemoteSegmentSize) -DLL unsigned int SCIGetRemoteSegmentSize(sci_remote_segment_t segment); - - - -/********************************************************************************* - * * - * S C I W A I T F O R R E M O T E S E G M E N T E V E N T * - * * - * Flags * - * None. * - * * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_TIMEOUT - The function timed out after specified * - * timeout value. * - * SCI_ERR_ILLEGAL_OPERATION - Illegal operation. * - * SCI_ERR_CANCELLED - The wait operation has been cancelled du * - * to a SCIDisconnectSegment() on the same * - * handle. The handle is invalid when this * - * error is returned. * - * * - *********************************************************************************/ -#define SCIWaitForRemoteSegmentEvent _SISCI_EXPANDE_FUNCTION_NAME(SCIWaitForRemoteSegmentEvent) -DLL sci_segment_cb_reason_t SCIWaitForRemoteSegmentEvent( - sci_remote_segment_t segment, - sci_error_t *status, - unsigned int timeout, - unsigned int flags, - sci_error_t *error); - - - - -/********************************************************************************* - * * - * S C I M A P R E M O T E S E G M E N T * - * * - * This function is used to include a shared memory segment in the virtual * - * address space of the application. * - * * - * Flags: * - * * - * SCI_FLAG_SHARED_MAP - The low level physical map may be shared by * - * other applications. * - * * - * SCI_FLAG_FIXED_MAP_ADDR - Map at the suggested virtual address * - * SCI_FLAG_READONLY_MAP - The segment is mapped in read-only mode * - * SCI_FLAG_LOCK_OPERATION - Enable Lock operations (fetch and add) * - * SCI_FLAG_READ_PREFETCH_AGGR_HOLD_MAP * - * - Enable aggressive prefetch with speculative * - * hold. * - * * - * SCI_FLAG_READ_PREFETCH_NO_HOLD_MAP * - * - The PSB66 will prefetch 64 bytes. As soon * - * as the PCI read retry has been accepted, * - * the stream will change state to FREE, even * - * if less than 64 bytes were actually read. * - * * - * SCI_FLAG_IO_MAP_IOSPACE - Enable No Prefetch, no speculative hold. * - * * - * SCI_FLAG_DMOVE_MAP - Enable DMOVE packet type. The stream will be * - * set into FREE state immediately. * - * * - * SCI_FLAG_WRITES_DISABLE_GATHER_MAP * - * - Disable use of gather. * - * * - * SCI_FLAG_DISABLE_128_BYTES_PACKETS * - * - Disable use of 128-Byte packets * - * * - * SCI_FLAG_CONDITIONAL_INTERRUPT_MAP * - * - Write operations through this map will cause * - * an atomic "fetch-and-add-one" operation on * - * remote memory, but in addition an interrupt * - * will be generated if the target memory * - * location contained a "null value" before the * - * add operation was carried out. * - * The conditional interrupt flag must also be * - * specified in the SCIRegisterInterruptFlag() * - * function. * - * * - * SCI_FLAG_UNCONDITIONAL_INTERRUPT_MAP * - * - Write operations through this map will cause * - * an interrupt for the remote adapter * - * "in addition to" updating the corresponding * - * remote memory location with the data being * - * written. * - * The unconditional interrupt flag must also * - * be specified in the * - * SCIRegisterInterruptFlag() function. * - * * - * SCI_FLAG_WRITE_BACK_CACHE_MAP * - * - Enable cacheing of the mapped region. * - * Writes through this map will be written to a * - * write back cache, hence no remote SCI updates* - * until the cache line is flushed. The * - * application is responsible for the cache * - * flush operation. * - * The SCImemCopy() function will handle this * - * correctly by doing cache flushes internally. * - * This feature is architechture dependent and * - * not be available on all plattforms. * - * * - * SCI_FLAG_NO_MEMORY_LOOPBACK_MAP * - * - Forces a map to a remote segment located * - * in the local machine to be mapped using * - * SCI loopback. This is useful i.e. if you * - * want to use a regular map access to be * - * serialized with lock operations. * - * The default behaviour is to access a remte * - * segment located in the local machine as a * - * local MMU operation. * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_OUT_OF_RANGE - The sum of the offset and size is * - * larger than the segment size. * - * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as * - * required by the implementation. * - * SCI_ERR_OFFSET_ALIGNMENT - Offset is not correctly aligned as * - * required by the implementation. * - * * - *********************************************************************************/ -#define SCIMapRemoteSegment _SISCI_EXPANDE_FUNCTION_NAME(SCIMapRemoteSegment) -DLL volatile void *SCIMapRemoteSegment( - sci_remote_segment_t segment, - sci_map_t *map, - unsigned int offset, - unsigned int size, - void *addr, - unsigned int flags, - sci_error_t *error); - - - - -/********************************************************************************* - * * - * S C I M A P L O C A L S E G M E N T * - * * - * Flags * - * * - * SCI_FLAG_FIXED_MAP_ADDR * - * SCI_FLAG_READONLY_MAP * - * * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_OUT_OF_RANGE - The sum of the offset and size is * - * larger than the segment size. * - * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as * - * required by the implementation. * - * SCI_ERR_OFFSET_ALIGNMENT - Offset is not correctly aligned as * - * required by the implementation. * - * * - *********************************************************************************/ -#define SCIMapLocalSegment _SISCI_EXPANDE_FUNCTION_NAME(SCIMapLocalSegment) -DLL void *SCIMapLocalSegment(sci_local_segment_t segment, - sci_map_t *map, - unsigned int offset, - unsigned int size, - void *addr, - unsigned int flags, - sci_error_t *error); - - - -/********************************************************************************* - * * - * S C I U N M A P S E G M E N T * - * * - * This function unmaps pages of shared memory from the callers virtual * - * address space. * - * * - * Flags * - * None. * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_BUSY - The map is currently in use. * - * * - *********************************************************************************/ -#define SCIUnmapSegment _SISCI_EXPANDE_FUNCTION_NAME(SCIUnmapSegment) -DLL void SCIUnmapSegment(sci_map_t map, - unsigned int flags, - sci_error_t *error); - - - - -/********************************************************************************* - * * - * S C I C R E A T E S E G M E N T * - * * - * Make the specified segment available for connections via the specified * - * adapter. If successful, the segment can be accessed from remote nodes * - * via the specified adapter. * - * * - * Flags: * - * * - * SCI_FLAG_USE_CALLBACK - The callback function will be invoked for events * - * on this segment. * - * SCI_FLAG_EMPTY - No memory will be allocated for the segment. * - * SCI_FLAG_PRIVATE - The segment will be private meaning it will never * - * be any connections to it. * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_SEGMENTID_USED - The segment with this segmentId is already used * - * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as required * - * by the implementation. * - * * - *********************************************************************************/ -#define SCICreateSegment _SISCI_EXPANDE_FUNCTION_NAME(SCICreateSegment) -DLL void SCICreateSegment(sci_desc_t sd, - sci_local_segment_t *segment, - unsigned int segmentId, - unsigned int size, - sci_cb_local_segment_t callback, - void *callbackArg, - unsigned int flags, - sci_error_t *error); - - - -/********************************************************************************* - * * - * S C I W A I T F O R L O C A L S E G M E N T E V E N T * - * * - * Flags * - * None. * - * * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_TIMEOUT - The function timed out after specified timeout value. * - * SCI_ERR_CANCELLED - The wait operation has been cancelled du to a * - * SCIRemoveSegment() on the same handle. * - * The handle is invalid when this error is returned. * - * * - *********************************************************************************/ -#define SCIWaitForLocalSegmentEvent _SISCI_EXPANDE_FUNCTION_NAME(SCIWaitForLocalSegmentEvent) -DLL sci_segment_cb_reason_t SCIWaitForLocalSegmentEvent( - sci_local_segment_t segment, - unsigned int *sourcenodeId, - unsigned int *localAdapterNo, - unsigned int timeout, - unsigned int flags, - sci_error_t *error); - - - -/********************************************************************************* - * * - * S C I P R E P A R E S E G M E N T * - * * - * Flags * - * * - * SCI_FLAG_DMA_SOURCE_ONLY - The segment will be used as a source segment * - * for DMA operations. On some system types this * - * will enable the SISCI driver to use performance * - * improving features. * - * * - * Specific error codes for this function: * - * * - * * - *********************************************************************************/ -#define SCIPrepareSegment _SISCI_EXPANDE_FUNCTION_NAME(SCIPrepareSegment) -DLL void SCIPrepareSegment(sci_local_segment_t segment, - unsigned int localAdapterNo, - unsigned int flags, - sci_error_t *error); - - - -/********************************************************************************* - * * - * S C I R E M O V E S E G M E N T * - * * - * Flags * - * None. * - * * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_BUSY - Unable to remove the segment. The segment is currently * - * in use. * - * * - *********************************************************************************/ -#define SCIRemoveSegment _SISCI_EXPANDE_FUNCTION_NAME(SCIRemoveSegment) -DLL void SCIRemoveSegment(sci_local_segment_t segment, - unsigned int flags, - sci_error_t *error); - - - - -/********************************************************************************* - * * - * S C I S E T S E G M E N T A V A I L A B L E * - * * - * Flags * - * None. * - * * - * * - * SCI_ERR_SEGMENT_NOT_PREPARED - The segment has not been prepared for access * - * from this adapter. * - * SCI_ERR_ILLEGAL_OPERATION - The segment is created with the * - * SCI_FLAG_PRIVATE flag specified and * - * therefore has no segmentId. * - * * - *********************************************************************************/ -#define SCISetSegmentAvailable _SISCI_EXPANDE_FUNCTION_NAME(SCISetSegmentAvailable) -DLL void SCISetSegmentAvailable(sci_local_segment_t segment, - unsigned int localAdapterNo, - unsigned int flags, - sci_error_t *error); - - - -/********************************************************************************* - * * - * S C I S E T S E G M E N T U N A V A I L A B L E * - * * - * Flags * - * * - * SCI_FLAG_FORCE_DISCONNECT * - * SCI_FLAG_NOTIFY * - * * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_ILLEGAL_OPERATION - Illegal operation. * - * * - *********************************************************************************/ -#define SCISetSegmentUnavailable _SISCI_EXPANDE_FUNCTION_NAME(SCISetSegmentUnavailable) -DLL void SCISetSegmentUnavailable(sci_local_segment_t segment, - unsigned int localAdapterNo, - unsigned int flags, - sci_error_t *error); - - - - -/********************************************************************************* - * * - * S C I C R E A T E M A P S E Q U E N C E * - * * - * Flags: * - * * - * SCI_FLAG_FAST_BARRIER * - * * - * * - * Specific error codes for this function: * - * * - *********************************************************************************/ -#define SCICreateMapSequence _SISCI_EXPANDE_FUNCTION_NAME(SCICreateMapSequence) -DLL void SCICreateMapSequence(sci_map_t map, - sci_sequence_t *sequence, - unsigned int flags, - sci_error_t *error); - - - -/********************************************************************************* - * * - * S C I R E M O V E S E Q U E N C E * - * * - * Flags: * - * None * - * * - * Specific error codes for this function: * - * * - *********************************************************************************/ -#define SCIRemoveSequence _SISCI_EXPANDE_FUNCTION_NAME(SCIRemoveSequence) -DLL void SCIRemoveSequence(sci_sequence_t sequence, - unsigned int flags, - sci_error_t *error); - - - -/********************************************************************************* - * * - * S C I S T A R T S E Q U E N C E * - * * - * Flags * - * None. * - * * - * * - * Specific error codes for this function: * - * * - * * - *********************************************************************************/ -#define SCIStartSequence _SISCI_EXPANDE_FUNCTION_NAME(SCIStartSequence) -DLL sci_sequence_status_t SCIStartSequence(sci_sequence_t sequence, - unsigned int flags, - sci_error_t *error); - - - -/********************************************************************************* - * * - * S C I C H E C K S E Q U E N CE * - * * - * Flags * - * * - * SCI_FLAG_NO_FLUSH * - * SCI_FLAG_NO_STORE_BARRIER * - * * - * * - * Specific error codes for this function: * - * * - *********************************************************************************/ -#define SCICheckSequence _SISCI_EXPANDE_FUNCTION_NAME(SCICheckSequence) -DLL sci_sequence_status_t SCICheckSequence(sci_sequence_t sequence, - unsigned int flags, - sci_error_t *error); - - - -/********************************************************************************* - * * - * S C I S T O R E B A R R I E R * - * * - * Flags * - * None. * - * * - * * - * * - *********************************************************************************/ -#define SCIStoreBarrier _SISCI_EXPANDE_FUNCTION_NAME(SCIStoreBarrier) -DLL void SCIStoreBarrier(sci_sequence_t sequence, - unsigned int flags); - - - - -/********************************************************************************* - * * - * S C I F L U S H R E A D B U F F E R S * - * * - *********************************************************************************/ -#define SCIFlushReadBuffers _SISCI_EXPANDE_FUNCTION_NAME(SCIFlushReadBuffers) -DLL void SCIFlushReadBuffers(sci_sequence_t sequence); - - - - -/********************************************************************************* - * * - * S C I P R O B E N O D E * - * * - * Flags * - * None. * - * * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_NO_LINK_ACCESS - It was not possible to communicate via the * - * local adapter. * - * SCI_ERR_NO_REMOTE_LINK_ACCESS - It was not possible to communicate via a * - * remote switch port. * - * * - *********************************************************************************/ -#define SCIProbeNode _SISCI_EXPANDE_FUNCTION_NAME(SCIProbeNode) -DLL int SCIProbeNode(sci_desc_t sd, - unsigned int localAdapterNo, - unsigned int nodeId, - unsigned int flags, - sci_error_t *error); - - - -/********************************************************************************* - * * - * S C I G E T C S R R E G I S T E R * - * * - * SISCI Priveleged function * - * * - * * - * Flags * - * None. * - * * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_NO_LINK_ACCESS - It was not possible to communicate via the * - * local adapter. * - * SCI_ERR_NO_REMOTE_LINK_ACCESS - It was not possible to communicate via a * - * remote switch port. * - * * - *********************************************************************************/ -#define SCIGetCSRRegister _SISCI_EXPANDE_FUNCTION_NAME(SCIGetCSRRegister) -DLL unsigned int SCIGetCSRRegister(sci_desc_t sd, - unsigned int localAdapterNo, - unsigned int SCINodeId, - unsigned int CSROffset, - unsigned int flags, - sci_error_t *error); - - - -/********************************************************************************* - * * - * S C I S E T C S R R E G I S T E R * - * * - * SISCI Priveleged function * - * * - * * - * Flags * - * None. * - * * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_NO_LINK_ACCESS - It was not possible to communicate via the * - * local adapter. * - * SCI_ERR_NO_REMOTE_LINK_ACCESS - It was not possible to communicate via a * - * remote switch port. * - * * - *********************************************************************************/ -#define SCISetCSRRegister _SISCI_EXPANDE_FUNCTION_NAME(SCISetCSRRegister) -DLL void SCISetCSRRegister(sci_desc_t sd, - unsigned int localAdapterNo, - unsigned int SCINodeId, - unsigned int CSROffset, - unsigned int CSRValue, - unsigned int flags, - sci_error_t *error); - - -/********************************************************************************* - * * - * S C I G E T L O C A L C S R * - * * - * SISCI Priveleged function * - * * - * Flags * - * None. * - * * - * * - * Specific error codes for this function: * - * * - * * - *********************************************************************************/ -#define SCIGetLocalCSR _SISCI_EXPANDE_FUNCTION_NAME(SCIGetLocalCSR) -DLL unsigned int SCIGetLocalCSR(sci_desc_t sd, - unsigned int localAdapterNo, - unsigned int CSROffset, - unsigned int flags, - sci_error_t *error); - - - -/********************************************************************************* - * * - * S C I S E T L O C A L C S R * - * * - * SISCI Priveleged function - * - * Flags * - * None. * - * * - * * - * Specific error codes for this function: * - * * - * * - *********************************************************************************/ -#define SCISetLocalCSR _SISCI_EXPANDE_FUNCTION_NAME(SCISetLocalCSR) -DLL void SCISetLocalCSR(sci_desc_t sd, - unsigned int localAdapterNo, - unsigned int CSROffset, - unsigned int CSRValue, - unsigned int flags, - sci_error_t *error); - - - -/********************************************************************************* - * * - * S C I A T T A C H P H Y S I C A L M E M O R Y * - * * - * SISCI Priveleged function * - * * - * Description: * - * * - * This function enables usage of physical devices and memory regions where the * - * Physical PCI bus address ( and mapped CPU address ) are already known. * - * The function will register the physical memory as a SISCI segment which can * - * be connected and mapped as a regular SISCI segment. * - * * - * Requirements: * - * * - * SCICreateSegment() with flag SCI_FLAG_EMPTY must have been called in advance * - * * - * Parameter description: * - * sci_ioaddr_t ioaddress : This is the address on the PCI bus that a PCI bus * - * master has to use to write to the specified memory * - * void * address : This is the (mapped) virtual address that the * - * application has to use to access the device. * - * This means that the device has to be mapped in * - * advance bye the devices own driver. * - * If the device is not to be accessed by the local * - * CPU, the address pointer shold be set to NULL * - * Flags * - * * - * None * - * * - * * - * Specific error codes for this function: * - * * - * * - *********************************************************************************/ -#define SCIAttachPhysicalMemory _SISCI_EXPANDE_FUNCTION_NAME(SCIAttachPhysicalMemory) -DLL void SCIAttachPhysicalMemory(sci_ioaddr_t ioaddress, - void *address, - unsigned int busNo, - unsigned int size, - sci_local_segment_t segment, - unsigned int flags, - sci_error_t *error); - - - -/********************************************************************************* - * * - * S C I Q U E R Y * - * * - * Flags * - * None. * - * * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_ILLEGAL_QUERY - Unrecognized command. * - * * - *********************************************************************************/ -#define SCIQuery _SISCI_EXPANDE_FUNCTION_NAME(SCIQuery) -DLL void SCIQuery(unsigned int command, - void *data, - unsigned int flags, - sci_error_t *error); - - -/* MAJOR QUERY COMMANDS */ - -/* This command requires a pointer to a structure of type */ -/* "sci_query_string". The string will be filled in by the query. */ -#define SCI_Q_VENDORID _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_VENDORID) -extern const unsigned int SCI_Q_VENDORID; - - -/* Same as for SCI_VENDOR_ID */ -#define SCI_Q_API _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_API) -extern const unsigned int SCI_Q_API; - - -/* User passes a pointer to an allocated object of the */ -/* "sci_query_adapter" struct. */ -#define SCI_Q_ADAPTER _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER) -extern const unsigned int SCI_Q_ADAPTER; - - -/* User passes a pointer to an allocated object of the */ -/* "sci_query_system" struct. */ -#define SCI_Q_SYSTEM _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_SYSTEM) -extern const unsigned int SCI_Q_SYSTEM; - -#define SCI_Q_LOCAL_SEGMENT _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_LOCAL_SEGMENT) -extern const unsigned int SCI_Q_LOCAL_SEGMENT; - -#define SCI_Q_REMOTE_SEGMENT _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_REMOTE_SEGMENT) -extern const unsigned int SCI_Q_REMOTE_SEGMENT; - -#define SCI_Q_MAP _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_MAP) -extern const unsigned int SCI_Q_MAP; - -typedef char* sci_semaphoreId_t; - -#ifdef WIN32 -struct _semaphoreid { - char *semaphoreName; -}; -#endif /*WIN32*/ - -typedef struct { - char *str; /* Pointer to a string of minimum "length" characters */ - unsigned int length; -} sci_query_string_t; - - -typedef struct { - unsigned int localAdapterNo; /* The adapter no. that the query concern. */ - unsigned int portNo; /* The SCI Link port number that the query concern. */ - unsigned int subcommand; /* A subcommand as specified below. */ - void *data; /* A pointer to an unsigned int that will return */ - /* the response to the query. */ -} sci_query_adapter_t; - - -typedef struct { - unsigned int subcommand; /* A subcommand as specified below. */ - void *data; /* A pointer to an unsigned int that will return */ - /* the response to the query. */ -} sci_query_system_t; - -typedef struct { - sci_local_segment_t segment; - unsigned int subcommand; - union { - sci_ioaddr_t ioaddr; - } data; -} sci_query_local_segment_t; - -typedef struct { - sci_remote_segment_t segment; - unsigned int subcommand; - union { - sci_ioaddr_t ioaddr; - } data; -} sci_query_remote_segment_t; - -typedef struct { - sci_map_t map; - unsigned int subcommand; - unsigned int data; -} sci_query_map_t; - -/* Minor query commands (sub-commands) for adapter specific information SCI_ADAPTER */ -#define SCI_Q_ADAPTER_DMA_SIZE_ALIGNMENT _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_DMA_SIZE_ALIGNMENT) -extern const unsigned int SCI_Q_ADAPTER_DMA_SIZE_ALIGNMENT; - -#define SCI_Q_ADAPTER_DMA_OFFSET_ALIGNMENT _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_DMA_OFFSET_ALIGNMENT) -extern const unsigned int SCI_Q_ADAPTER_DMA_OFFSET_ALIGNMENT; - -#define SCI_Q_ADAPTER_DMA_MTU _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_DMA_MTU) -extern const unsigned int SCI_Q_ADAPTER_DMA_MTU; - -#define SCI_Q_ADAPTER_SUGGESTED_MIN_DMA_SIZE _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_SUGGESTED_MIN_DMA_SIZE) -extern const unsigned int SCI_Q_ADAPTER_SUGGESTED_MIN_DMA_SIZE; - -#define SCI_Q_ADAPTER_SUGGESTED_MIN_BLOCK_SIZE _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_SUGGESTED_MIN_BLOCK_SIZE) -extern const unsigned int SCI_Q_ADAPTER_SUGGESTED_MIN_BLOCK_SIZE; - -#define SCI_Q_ADAPTER_NODEID _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_NODEID) -extern const unsigned int SCI_Q_ADAPTER_NODEID; - -#define SCI_Q_ADAPTER_SERIAL_NUMBER _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_SERIAL_NUMBER) -extern const unsigned int SCI_Q_ADAPTER_SERIAL_NUMBER; - -#define SCI_Q_ADAPTER_CARD_TYPE _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_CARD_TYPE) -extern const unsigned int SCI_Q_ADAPTER_CARD_TYPE; - -#define SCI_Q_ADAPTER_NUMBER_OF_STREAMS _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_NUMBER_OF_STREAMS) -extern const unsigned int SCI_Q_ADAPTER_NUMBER_OF_STREAMS; - -#define SCI_Q_ADAPTER_STREAM_BUFFER_SIZE _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_STREAM_BUFFER_SIZE) -extern const unsigned int SCI_Q_ADAPTER_STREAM_BUFFER_SIZE; - -#define SCI_Q_ADAPTER_CONFIGURED _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_CONFIGURED) -extern const unsigned int SCI_Q_ADAPTER_CONFIGURED; - -#define SCI_Q_ADAPTER_LINK_OPERATIONAL _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_LINK_OPERATIONAL) -extern const unsigned int SCI_Q_ADAPTER_LINK_OPERATIONAL; - -#define SCI_Q_ADAPTER_HW_LINK_STATUS_IS_OK _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_HW_LINK_STATUS_IS_OK) -extern const unsigned int SCI_Q_ADAPTER_HW_LINK_STATUS_IS_OK; - -#define SCI_Q_ADAPTER_NUMBER _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_NUMBER) -extern const unsigned int SCI_Q_ADAPTER_NUMBER; - -#define SCI_Q_ADAPTER_INSTANCE_NUMBER _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_INSTANCE_NUMBER) -extern const unsigned int SCI_Q_ADAPTER_INSTANCE_NUMBER; - -#define SCI_Q_ADAPTER_FIRMWARE_OK _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_FIRMWARE_OK) -extern const unsigned int SCI_Q_ADAPTER_FIRMWARE_OK; - -#define SCI_Q_ADAPTER_CONNECTED_TO_SWITCH _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_CONNECTED_TO_SWITCH) -extern const unsigned int SCI_Q_ADAPTER_CONNECTED_TO_SWITCH; - -#define SCI_Q_ADAPTER_LOCAL_SWITCH_TYPE _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_LOCAL_SWITCH_TYPE) -extern const unsigned int SCI_Q_ADAPTER_LOCAL_SWITCH_TYPE; - -#define SCI_Q_ADAPTER_LOCAL_SWITCH_PORT_NUMBER _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_LOCAL_SWITCH_PORT_NUMBER) -extern const unsigned int SCI_Q_ADAPTER_LOCAL_SWITCH_PORT_NUMBER; - -#define SCI_Q_ADAPTER_CONNECTED_TO_EXPECTED_SWITCH_PORT _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_CONNECTED_TO_EXPECTED_SWITCH_PORT) -extern const unsigned int SCI_Q_ADAPTER_CONNECTED_TO_EXPECTED_SWITCH_PORT; - -#define SCI_Q_ADAPTER_ATT_PAGE_SIZE _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_ATT_PAGE_SIZE) -extern const unsigned int SCI_Q_ADAPTER_ATT_PAGE_SIZE; - -#define SCI_Q_ADAPTER_ATT_NUMBER_OF_ENTRIES _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_ATT_NUMBER_OF_ENTRIES) -extern const unsigned int SCI_Q_ADAPTER_ATT_NUMBER_OF_ENTRIES; - -#define SCI_Q_ADAPTER_ATT_AVAILABLE_ENTRIES _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_ATT_AVAILABLE_ENTRIES) -extern const unsigned int SCI_Q_ADAPTER_ATT_AVAILABLE_ENTRIES; - -#define SCI_Q_ADAPTER_PHYS_MEM_NODEID _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_SCI_Q_ADAPTER_PHYS_MEM_NODEID) -extern const unsigned int SCI_Q_ADAPTER_PHYS_MEM_NODEID; - -#define SCI_Q_ADAPTER_PHYS_MBX_NODEID _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_SCI_Q_ADAPTER_PHYS_MBX_NODEID) -extern const unsigned int SCI_Q_ADAPTER_PHYS_MBX_NODEID; - -#define SCI_Q_ADAPTER_PHYS_LINK_PORT_NODEID _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_PHYS_LINK_PORT_NODEID) -extern const unsigned int SCI_Q_ADAPTER_PHYS_LINK_PORT_NODEID; - -#define SCI_Q_ADAPTER_SCI_LINK_FREQUENCY _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_SCI_LINK_FREQUENCY) -extern const unsigned int SCI_Q_ADAPTER_SCI_LINK_FREQUENCY; - -#define SCI_Q_ADAPTER_B_LINK_FREQUENCY _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_B_LINK_FREQUENCY) -extern const unsigned int SCI_Q_ADAPTER_B_LINK_FREQUENCY; - -#define SCI_Q_ADAPTER_IO_BUS_FREQUENCY _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_IO_BUS_FREQUENCY) -extern const unsigned int SCI_Q_ADAPTER_IO_BUS_FREQUENCY; - -/* Minor query commands (sub-commands) for adapter specific information SCI_SYSTEM */ -#define SCI_Q_SYSTEM_HOSTBRIDGE _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_SYSTEM_HOSTBRIDGE) -extern const unsigned int SCI_Q_SYSTEM_HOSTBRIDGE; - -#define SCI_Q_SYSTEM_WRITE_POSTING_ENABLED _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_SYSTEM_WRITE_POSTING_ENABLED) -extern const unsigned int SCI_Q_SYSTEM_WRITE_POSTING_ENABLED; - -#define SCI_Q_SYSTEM_WRITE_COMBINING_ENABLED _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_SYSTEM_WRITE_COMBINING_ENABLED) -extern const unsigned int SCI_Q_SYSTEM_WRITE_COMBINING_ENABLED; - -#define SCI_Q_LOCAL_SEGMENT_IOADDR _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_LOCAL_SEGMENT_IOADDR) -extern const unsigned int SCI_Q_LOCAL_SEGMENT_IOADDR; - -#define SCI_Q_REMOTE_SEGMENT_IOADDR _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_REMOTE_SEGMENT_IOADDR) -extern const unsigned int SCI_Q_REMOTE_SEGMENT_IOADDR; - -#define SCI_Q_MAP_MAPPED_TO_LOCAL_TARGET _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_MAP_MAPPED_TO_LOCAL_TARGET) -extern const unsigned int SCI_Q_MAP_MAPPED_TO_LOCAL_TARGET; - -#define SCI_Q_MAP_QUERY_REMOTE_MAPPED_TO_LOCAL_TARGET _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_MAP_QUERY_REMOTE_MAPPED_TO_LOCAL_TARGET) -extern const unsigned int SCI_Q_MAP_QUERY_REMOTE_MAPPED_TO_LOCAL_TARGET; - -#define HOSTBRIDGE_NOT_AVAILABLE _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_NOT_AVAILABLE) -extern const unsigned int HOSTBRIDGE_NOT_AVAILABLE; - -#define HOSTBRIDGE_UNKNOWN _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_UNKNOWN) -extern const unsigned int HOSTBRIDGE_UNKNOWN; - -#define HOSTBRIDGE_440FX _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_440FX) -extern const unsigned int HOSTBRIDGE_440FX; - -#define HOSTBRIDGE_440LX _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_440LX) -extern const unsigned int HOSTBRIDGE_440LX; - -#define HOSTBRIDGE_440BX_A _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_440BX_A) -extern const unsigned int HOSTBRIDGE_440BX_A; - -#define HOSTBRIDGE_440BX_B _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_440BX_B) -extern const unsigned int HOSTBRIDGE_440BX_B; - -#define HOSTBRIDGE_440GX _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_440GX) -extern const unsigned int HOSTBRIDGE_440GX; - -#define HOSTBRIDGE_450KX _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_450KX) -extern const unsigned int HOSTBRIDGE_450KX; - -#define HOSTBRIDGE_430NX _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_430NX) -extern const unsigned int HOSTBRIDGE_430NX; - -#define HOSTBRIDGE_450NX _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_450NX) -extern const unsigned int HOSTBRIDGE_450NX; - -#define HOSTBRIDGE_450NX_MICO _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_450NX_MICO) -extern const unsigned int HOSTBRIDGE_450NX_MICO; - -#define HOSTBRIDGE_450NX_PXB _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_450NX_PXB) -extern const unsigned int HOSTBRIDGE_450NX_PXB; - -#define HOSTBRIDGE_I810 _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_I810) -extern const unsigned int HOSTBRIDGE_I810; - -#define HOSTBRIDGE_I810_DC100 _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_I810_DC100) -extern const unsigned int HOSTBRIDGE_I810_DC100; - -#define HOSTBRIDGE_I810E _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_I810E) -extern const unsigned int HOSTBRIDGE_I810E; - -#define HOSTBRIDGE_I815 _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_I815) -extern const unsigned int HOSTBRIDGE_I815; - -#define HOSTBRIDGE_I840 _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_I840) -extern const unsigned int HOSTBRIDGE_I840; - -#define HOSTBRIDGE_I850 _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_I850) -extern const unsigned int HOSTBRIDGE_I850; - -#define HOSTBRIDGE_I860 _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_I860) -extern const unsigned int HOSTBRIDGE_I860; - -#define HOSTBRIDGE_INTEL_E7500 _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_INTEL_E7500) -extern const unsigned int HOSTBRIDGE_INTEL_E7500; - -#define HOSTBRIDGE_VIA_KT133 _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_VIA_KT133) -extern const unsigned int HOSTBRIDGE_VIA_KT133; - -#define HOSTBRIDGE_VIA_KX133 _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_VIA_KX133) -extern const unsigned int HOSTBRIDGE_VIA_KX133; - -#define HOSTBRIDGE_VIA_APOLLO_PRO_133A _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_VIA_APOLLO_PRO_133A) -extern const unsigned int HOSTBRIDGE_VIA_APOLLO_PRO_133A; - -#define HOSTBRIDGE_VIA_APOLLO_PRO_266 _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_VIA_APOLLO_PRO_266) -extern const unsigned int HOSTBRIDGE_VIA_APOLLO_PRO_266; - -#define HOSTBRIDGE_AMD_760_MP _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_AMD_760_MP) -extern const unsigned int HOSTBRIDGE_AMD_760_MP; - -#define HOSTBRIDGE_AMD_HAMMER _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_AMD_HAMMER) -extern const unsigned int HOSTBRIDGE_AMD_HAMMER; - -#define HOSTBRIDGE_SERVERWORKS_HE _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_SERVERWORKS_HE) -extern const unsigned int HOSTBRIDGE_SERVERWORKS_HE; - -#define HOSTBRIDGE_SERVERWORKS_HE_B _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_SERVERWORKS_HE_B) -extern const unsigned int HOSTBRIDGE_SERVERWORKS_HE_B; - -#define HOSTBRIDGE_SERVERWORKS_LE _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_SERVERWORKS_LE) -extern const unsigned int HOSTBRIDGE_SERVERWORKS_LE; - -#define HOSTBRIDGE_SERVERWORKS_GC_HE _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_SERVERWORKS_GC_HE) -extern const unsigned int HOSTBRIDGE_SERVERWORKS_GC_HE; - -#define HOSTBRIDGE_SERVERWORKS_GC_LE _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_SERVERWORKS_GC_LE) -extern const unsigned int HOSTBRIDGE_SERVERWORKS_GC_LE; - -#define HOSTBRIDGE_SERVERWORKS_GC_WS _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_SERVERWORKS_GC_WS) -extern const unsigned int HOSTBRIDGE_SERVERWORKS_GC_WS; - -#define HOSTBRIDGE_SERVERWORKS_GC_SL _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_SERVERWORKS_GC_SL) -extern const unsigned int HOSTBRIDGE_SERVERWORKS_GC_SL; - - -#define HOSTBRIDGE_WRITE_POSTING_DISABLED _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_WRITE_POSTING_DISABLED) -extern const unsigned int HOSTBRIDGE_WRITE_POSTING_DISABLED; - -#define HOSTBRIDGE_WRITE_POSTING_ENABLED _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_WRITE_POSTING_ENABLED) -extern const unsigned int HOSTBRIDGE_WRITE_POSTING_ENABLED; - - - - -/********************************************************************************* - * * - * S C I C R E A T E D M A Q U E U E * - * * - * Flags * - * * - * SCI_FLAG_DMA_PHDMA : Create physical DMA queue. Please note that this is an * - * priveleged operation. * - * * - * * - * * - * Specific error codes for this function: * - * * - *********************************************************************************/ -#define SCICreateDMAQueue _SISCI_EXPANDE_FUNCTION_NAME(SCICreateDMAQueue) -DLL void SCICreateDMAQueue(sci_desc_t sd, - sci_dma_queue_t *dq, - unsigned int localAdapterNo, - unsigned int maxEntries, - unsigned int flags, - sci_error_t *error); - - - -/********************************************************************************* - * * - * S C I R E M O V E D M A Q U E U E * - * * - * Flags * - * None. * * - * * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_ILLEGAL_OPERATION - Not allowed in this queue state. * - * * - *********************************************************************************/ -#define SCIRemoveDMAQueue _SISCI_EXPANDE_FUNCTION_NAME(SCIRemoveDMAQueue) -DLL void SCIRemoveDMAQueue(sci_dma_queue_t dq, - unsigned int flags, - sci_error_t *error); - - - -/********************************************************************************* - * * - * S C I E N Q U E U E D M A T R A N S F E R * - * * - * Flags: * - * * - * SCI_FLAG_DMA_READ - The DMA will be remote --> local * - * (default is local --> remote) * - * * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_OUT_OF_RANGE - The sum of the offset and size is larger * - * than the segment size or larger than max * - * DMA size. * - * SCI_ERR_MAX_ENTRIES - The DMA queue is full * - * SCI_ERR_ILLEGAL_OPERATION - Illegal operation * - * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as required * - * by the implementation. * - * SCI_ERR_OFFSET_ALIGNMENT - Offset is not correctly aligned as required * - * by the implementation. * - * SCI_ERR_SEGMENT_NOT_PREPARED - The local segment has not been prepared for * - * access from the adapter associated with the * - * queue. * - * SCI_ERR_SEGMENT_NOT_CONNECTED - The remote segment is not connected through * - * the adapter associated with the queue. * - *********************************************************************************/ -#define SCIEnqueueDMATransfer _SISCI_EXPANDE_FUNCTION_NAME(SCIEnqueueDMATransfer) -DLL sci_dma_queue_state_t SCIEnqueueDMATransfer(sci_dma_queue_t dq, - sci_local_segment_t localSegment, - sci_remote_segment_t remoteSegment, - unsigned int localOffset, - unsigned int remoteOffset, - unsigned int size, - unsigned int flags, - sci_error_t *error); - - - -/********************************************************************************* - * * - * S C I P O S T D M A Q U E U E * - * * - * Flags: * - * * - * SCI_FLAG_USE_CALLBACK - The end of the transfer will cause the callback * - * function to be invoked. * - * * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_ILLEGAL_OPERATION - Illegal operation * - * * - *********************************************************************************/ -#define SCIPostDMAQueue _SISCI_EXPANDE_FUNCTION_NAME(SCIPostDMAQueue) -DLL void SCIPostDMAQueue(sci_dma_queue_t dq, - sci_cb_dma_t callback, - void *callbackArg, - unsigned int flags, - sci_error_t *error); - - - -/********************************************************************************* - * * - * S C I A B O R T D M A Q U E U E * - * * - * Flags * - * None. * - * * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_ILLEGAL_OPERATION - Illegal operation * - * * - *********************************************************************************/ -#define SCIAbortDMAQueue _SISCI_EXPANDE_FUNCTION_NAME(SCIAbortDMAQueue) -DLL void SCIAbortDMAQueue(sci_dma_queue_t dq, - unsigned int flags, - sci_error_t *error); - - -/********************************************************************************* - * * - * S C I R E S E T D M A Q U E U E * - * * - * Flags * - * None. * * - * * - * * - * Specific error codes for this function: * - * * - * * - *********************************************************************************/ -#define SCIResetDMAQueue _SISCI_EXPANDE_FUNCTION_NAME(SCIResetDMAQueue) -DLL void SCIResetDMAQueue(sci_dma_queue_t dq, - unsigned int flags, - sci_error_t *error); - - - -/********************************************************************************* - * * - * S C I D M A Q U E U E S T A T E * - * * - *********************************************************************************/ -#define SCIDMAQueueState _SISCI_EXPANDE_FUNCTION_NAME(SCIDMAQueueState) -DLL sci_dma_queue_state_t SCIDMAQueueState(sci_dma_queue_t dq); - - - -/********************************************************************************* - * * - * S C I W A I T F O R D M A Q U E U E * - * * - * Flags * - * None. * - * * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_ILLEGAL_OPERATION - Illegal operation * - * SCI_ERR_TIMEOUT - The function timed out after specified * - * timeout value. * - * * - *********************************************************************************/ -#define SCIWaitForDMAQueue _SISCI_EXPANDE_FUNCTION_NAME(SCIWaitForDMAQueue) -DLL sci_dma_queue_state_t SCIWaitForDMAQueue(sci_dma_queue_t dq, - unsigned int timeout, - unsigned int flags, - sci_error_t *error); - - - - -/********************************************************************************* - * * - * S C I P H D M A E N Q U E U E * - * * - * SISCI Priveleged function * - * * - * Flags * - * * - * SCI_FLAG_DMA_READ * - * * - * Specific error codes for this function: * - * * - *********************************************************************************/ -#define SCIphDmaEnqueue _SISCI_EXPANDE_FUNCTION_NAME(SCIphDmaEnqueue) -DLL void SCIphDmaEnqueue(sci_dma_queue_t dmaqueue, - unsigned int size, - sci_ioaddr_t localBusAddr, - unsigned int remote_nodeid, - unsigned int remote_highaddr, - unsigned int remote_lowaddr, - unsigned int flags, - sci_error_t *error); - -/********************************************************************************* - * * - * S C I P H D M A S T A R T * - * * - * Flags * - * * - * SCI_FLAG_DMA_WAIT * - * SCI_FLAG_USE_CALLBACK * - * SCI_FLAG_DMA_RESET * - * * - * Specific error codes for this function: * - * * - *********************************************************************************/ -#define SCIphDmaStart _SISCI_EXPANDE_FUNCTION_NAME(SCIphDmaStart) -DLL sci_dma_queue_state_t SCIphDmaStart(sci_dma_queue_t dmaqueue, - sci_cb_dma_t callback, - void *callbackArg, - unsigned int flags, - sci_error_t *error); - -#ifdef WIN32 -/********************************************************************************* - * * - * S C I C R E A T E N A M E D I N T E R R U P T * - * * - * Flags * - * * - * SCI_FLAG_USE_CALLBACK * - * SCI_FLAG_FIXED_INTNO * - * SCI_FLAG_SHARED_INT * - * * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_INTNO_USED - This interrupt number is already used. * - * * - *********************************************************************************/ -#define SCICreateNamedInterrupt _SISCI_EXPANDE_FUNCTION_NAME(SCICreateNamedInterrupt) -DLL void SCICreateNamedInterrupt(sci_desc_t sd, - sci_local_interrupt_t *interrupt, - unsigned int localAdapterNo, - unsigned int *interruptNo, - sci_cb_interrupt_t callback, - void *callbackArg, - unsigned int flags, - sci_semaphoreId_t semId, - sci_error_t *error); -#endif /*WIN32*/ - -/********************************************************************************* - * * - * S C I C R E A T E I N T E R R U P T * - * * - * Flags * - * * - * SCI_FLAG_USE_CALLBACK * - * SCI_FLAG_FIXED_INTNO * - * SCI_FLAG_SHARED_INT * - * SCI_FLAG_COUNTING_INT: This flag will enable counting interrupts. This means * - * that the number of trigged interrupts is equal to the * - * number of received interrupts. * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_INTNO_USED - This interrupt number is already used. * - * * - *********************************************************************************/ -#define SCICreateInterrupt _SISCI_EXPANDE_FUNCTION_NAME(SCICreateInterrupt) -DLL void SCICreateInterrupt(sci_desc_t sd, - sci_local_interrupt_t *interrupt, - unsigned int localAdapterNo, - unsigned int *interruptNo, - sci_cb_interrupt_t callback, - void *callbackArg, - unsigned int flags, - sci_error_t *error); - - - -/********************************************************************************* - * * - * S C I R E M O V E I N T E R R U P T * - * * - * Flags * - * None. * - * * - * * - * Specific error codes for this function: * - * * - *********************************************************************************/ -#define SCIRemoveInterrupt _SISCI_EXPANDE_FUNCTION_NAME(SCIRemoveInterrupt) -DLL void SCIRemoveInterrupt(sci_local_interrupt_t interrupt, - unsigned int flags, - sci_error_t *error); - - -/********************************************************************************* - * * - * S C I W A I T F O R I N T E R R U P T * - * * - * Flags * - * None. * - * * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_TIMEOUT - The function timed out after specified timeout value. * - * SCI_ERR_CANCELLED - The wait was interrupted by a call to * - * SCIRemoveInterrupt. * - * The handle is invalid when this error code is returned.* - * * - *********************************************************************************/ -#define SCIWaitForInterrupt _SISCI_EXPANDE_FUNCTION_NAME(SCIWaitForInterrupt) -DLL void SCIWaitForInterrupt(sci_local_interrupt_t interrupt, - unsigned int timeout, - unsigned int flags, - sci_error_t *error); - - - - -/********************************************************************************* - * * - * S C I C O N N E C T I N T E R R U P T * - * * - * Flags * - * * - * SCI_FLAG_COUNTING_INT: This flag will enable counting interrupts. This means * - * that the number of trigged interrupts is equal to the * - * number of received interrupts. * - * if SCI_FLAG_COUNTING_INT is not used, the interface * - * guarentees that there always will be an remote * - * interrupt generated after the first and after the last* - * trigger. If interupts is triggered faster than the * - * remote interrupt handler can handle, interrupts may be* - * lost. * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_NO_SUCH_INTNO - No such interrupt number. * - * SCI_ERR_CONNECTION_REFUSED - Connection attempt refused by remote node. * - * SCI_ERR_TIMEOUT - The function timed out after specified * - * timeout value. * - * * - *********************************************************************************/ -#define SCIConnectInterrupt _SISCI_EXPANDE_FUNCTION_NAME(SCIConnectInterrupt) -DLL void SCIConnectInterrupt(sci_desc_t sd, - sci_remote_interrupt_t *interrupt, - unsigned int nodeId, - unsigned int localAdapterNo, - unsigned int interruptNo, - unsigned int timeout, - unsigned int flags, - sci_error_t *error); - - -/********************************************************************************* - * * - * S C I D I S C O N N E C T I N T E R R U P T * - * * - * Flags * - * None. * - * * - * * - * Specific error codes for this function: * - * * - * * - *********************************************************************************/ -#define SCIDisconnectInterrupt _SISCI_EXPANDE_FUNCTION_NAME(SCIDisconnectInterrupt) -DLL void SCIDisconnectInterrupt(sci_remote_interrupt_t interrupt, - unsigned int flags, - sci_error_t *error); - - - -/********************************************************************************* - * * - * S C I T R I G G E R I N T E R R U P T * - * * - * Flags * - * None. * - * * - * * - * Specific error codes for this function: * - * * - * * - *********************************************************************************/ -#define SCITriggerInterrupt _SISCI_EXPANDE_FUNCTION_NAME(SCITriggerInterrupt) -DLL void SCITriggerInterrupt(sci_remote_interrupt_t interrupt, - unsigned int flags, - sci_error_t *error); - - - - -/********************************************************************************* - * * - * S C I R E G I S T E R I N T E R R U P T F L A G * - * * - * * - * This function register an "interrupt flag" that is identified as an unique * - * location within a local segment. If successful, the resulting interrupt * - * handle will have been associated with the specified local segment. * - * * - * It is up to the (remote) client(s) to set up an "interrupt mapping" for the * - * corresponding segment offset using either the * - * * - * - SCI_FLAG_CONDITIONAL_INTERRUPT_MAP * - * * - * or the * - * * - * - SCI_FLAG_UNCONDITIONAL_DATA_INTERRUPT_MAP * - * * - * option to "SCIMapRemoteSegment()". - I.e. after having established a * - * connection to the corresponding segment. A trigger operation can then * - * be implemented using a store operation via the relevant "interrupt map". * - * * - * * - * * - * * - * * - * Flags: * - * * - * SCI_FLAG_CONDITIONAL_INTERRUPT - Triggering is to take place using * - * "conditional interrupts". * - * * - * * - * * - * Specific error codes for this function: * - * None. * - * * - *********************************************************************************/ -#define SCIRegisterInterruptFlag _SISCI_EXPANDE_FUNCTION_NAME(SCIRegisterInterruptFlag) -DLL void SCIRegisterInterruptFlag( - unsigned int localAdapterNo, - sci_local_interrupt_t *interrupt, - sci_local_segment_t segment, - unsigned int offset, - sci_cb_interrupt_t callback, - void *callbackArg, - unsigned int flags, - sci_error_t *error); - - - - -/********************************************************************************* - * * - * S C I E N A B L E C O N D I T I O N A L I N T E R R U P T * - * * - * * - * This function make sure that another HW interrupt will take place the next * - * time the corresponding interrupt flag is triggered by a * - * "conditional interrupt" operation. * - * * - * Default semantics: * - * * - * When successful, the client can rely on that the first subsequent trigger * - * operation will cause a HW interrupt and subsequently cause the client * - * handler function to be invoked. * - * * - * If an interrupt was triggered in parallell with the enable operation, then * - * the operation will fail (SCI_ERR_COND_INT_RACE_PROBLEM), and the client can * - * not rely on another trigger operation will lead to handler invocation. * - * Hence, any state checking normally associated with handling the * - * corresponding interrupt should take place before attempting to enable * - * again. * - * * - * * - * Flags * - * None. * - * * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_COND_INT_RACE_PROBLEM - The enable operation failed because an * - * incomming trigger operation happened * - * concurrently. * - * * - *********************************************************************************/ -#define SCIEnableConditionalInterrupt _SISCI_EXPANDE_FUNCTION_NAME(SCIEnableConditionalInterrupt) -DLL void SCIEnableConditionalInterrupt( - sci_local_interrupt_t interrupt, - unsigned int flags, - sci_error_t *error); - - - - -/********************************************************************************* - * * - * S C I D I S A B L E C O N D I T I O N A L I N T E R R U P T * - * * - * * - * Prevent subsequent "conditional interrupt"trigger operations for * - * the specified interupt flag from causing HW interrupt and handler * - * invocations. * - * * - * * - * Default semantics: * - * * - * If successful, no subsequent HW interrupts will take place, but handler * - * invocations that have already been scheduled may still take place. * - * * - * * - * Flags * - * None. * - * * - * * - * Specific error codes for this function: * - * * - * * - *********************************************************************************/ -#define SCIDisableConditionalInterrupt _SISCI_EXPANDE_FUNCTION_NAME(SCIDisableConditionalInterrupt) -DLL void SCIDisableConditionalInterrupt( - sci_local_interrupt_t interrupt, - unsigned int flags, - sci_error_t *error); - - - -/********************************************************************************* - * * - * S C I G E T C O N D I T I O N A L I N T E R R U P T C O U N T E R * - * * - * * - * Returns a value that indicates the number of times this flag has * - * been trigged since the last time it was enabled or disabled. * - * Calling the SCIEnableConditionalInterrupt / SCIDisableConditionalInterrupt * - * functions will reset the counter value. * - * * - * Default semantics: * - * * - * If successful, the current trig count is returned in the * - * interruptTrigCounter parameter. * - * * - * Flags * - * None. * - * * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_OVERFLOW - The number of trig operations have exceeded the range * - * that can be counted. * - *********************************************************************************/ -#define SCIGetConditionalInterruptTrigCounter _SISCI_EXPANDE_FUNCTION_NAME(SCIGetConditionalInterruptTrigCounter) -DLL void SCIGetConditionalInterruptTrigCounter( - sci_local_interrupt_t interrupt, - unsigned int *interruptTrigCounter, - unsigned int flags, - sci_error_t *error); - - - - -/********************************************************************************* - * * - * S C I T R A N S F E R B L O C K * - * * - * Flags * - * None. * - * * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_OUT_OF_RANGE - The sum of the size and offset is larger * - * than the corresponding map size. * - * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as required * - * by the implementation. * - * SCI_ERR_OFFSET_ALIGNMENT - Offset is not correctly aligned as required * - * by the implementation. * - * SCI_ERR_TRANSFER_FAILED - The data transfer failed. * - * * - *********************************************************************************/ -#define SCITransferBlock _SISCI_EXPANDE_FUNCTION_NAME(SCITransferBlock) -DLL void SCITransferBlock(sci_map_t sourceMap, - unsigned int sourceOffset, - sci_map_t destinationMap, - unsigned int destinationOffset, - unsigned int size, - unsigned int flags, - sci_error_t *error); - - - - -/********************************************************************************* - * * - * S C I T R A N S F E R B L O C K A S Y N C * - * * - * Flags * - * * - * SCI_FLAG_BLOCK_READ * - * SCI_FLAG_USE_CALLBACK * - * * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_OUT_OF_RANGE - The sum of the size and offset is larger than * - * the corresponding map size. * - * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as required by * - * the implementation. * - * SCI_ERR_OFFSET_ALIGNMENT - Offset is not correctly aligned as required * - * by the implementation. * - * SCI_ERR_TRANSFER_FAILED - The data transfer failed. * - * * - *********************************************************************************/ -#define SCITransferBlockAsync _SISCI_EXPANDE_FUNCTION_NAME(SCITransferBlockAsync) -DLL void SCITransferBlockAsync(sci_map_t sourceMap, - unsigned int sourceOffset, - sci_map_t destinationMap, - unsigned int destinationOffset, - unsigned int size, - sci_block_transfer_t *block, - sci_cb_block_transfer_t callback, - void *callbackArg, - unsigned int flags, - sci_error_t *error); - - - - -/********************************************************************************* - * * - * S C I W A I T F O R B L O C K T R A N S F E R * - * * - * Flags * - * None. * - * * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_ILLEGAL_OPERATION - Illegal operation * - * SCI_ERR_TIMEOUT - The function timed out after specified * - * timeout value. * - * * - *********************************************************************************/ -#define SCIWaitForBlockTransfer _SISCI_EXPANDE_FUNCTION_NAME(SCIWaitForBlockTransfer) -DLL void SCIWaitForBlockTransfer(sci_block_transfer_t block, - unsigned int timeout, - unsigned int flags, - sci_error_t *error); - - - -/********************************************************************************* - * * - * S C I A B O R T B L O C K T R A N S F E R * - * * - * Flags * - * None. * - * * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_ILLEGAL_OPERATION - Illegal operation * - * * - *********************************************************************************/ -#define SCIAbortBlockTransfer _SISCI_EXPANDE_FUNCTION_NAME(SCIAbortBlockTransfer) -DLL void SCIAbortBlockTransfer(sci_block_transfer_t block, - unsigned int flags, - sci_error_t *error); - - - - -/********************************************************************************* - * * - * S C I M E M C P Y * - * * - * Flags: * - * SCI_FLAG_BLOCK_READ * - * SCI_FLAG_ERROR_CHECK * - * * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_OUT_OF_RANGE - The sum of the size and offset is larger * - * than the corresponding map size. * - * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as required * - * by the implementation. * - * SCI_ERR_OFFSET_ALIGNMENT - Offset is not correctly aligned as required * - * by the implementation. * - * SCI_ERR_TRANSFER_FAILED - The data transfer failed. * - * * - *********************************************************************************/ - -#define SCIMemCpy _SISCI_EXPANDE_FUNCTION_NAME(SCIMemCpy) -DLL void SCIMemCpy(sci_sequence_t sequence, - void *memAddr, - sci_map_t remoteMap, - unsigned int remoteOffset, - unsigned int size, - unsigned int flags, - sci_error_t *error); - - - -/********************************************************************************* - * * - * S C I M E M C O P Y * - * * - * Flags: * - * SCI_FLAG_BLOCK_READ * - * SCI_FLAG_ERROR_CHECK * - * * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_OUT_OF_RANGE - The sum of the size and offset is larger * - * than the corresponding map size. * - * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as required * - * by the implementation. * - * SCI_ERR_OFFSET_ALIGNMENT - Offset is not correctly aligned as required * - * by the implementation. * - * SCI_ERR_TRANSFER_FAILED - The data transfer failed. * - * * - *********************************************************************************/ - - -#define SCIMemCopy _SISCI_EXPANDE_FUNCTION_NAME(SCIMemCopy) -DLL void SCIMemCopy(void *memAddr, - sci_map_t remoteMap, - unsigned int remoteOffset, - unsigned int size, - unsigned int flags, - sci_error_t *error); - - - -/********************************************************************************* - * * - * S C I R E G I S T E R S E G M E N T M E M O R Y * - * * - * Flags * - * None. * - * * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as required by * - * the implementation. * - * SCI_ERR_ILLEGAL_ADDRESS - Illegal address. * - * SCI_ERR_OUT_OF_RANGE - Size is larger than the maximum size for the * - * local segment. * - * * - *********************************************************************************/ -#define SCIRegisterSegmentMemory _SISCI_EXPANDE_FUNCTION_NAME(SCIRegisterSegmentMemory) -DLL void SCIRegisterSegmentMemory(void *address, - unsigned int size, - sci_local_segment_t segment, - unsigned int flags, - sci_error_t *error); - - - - - -/********************************************************************************* - * * - * S C I C O N N E C T S C I S P A C E * - * * - * SISCI Priveleged function * - * * - * * - * Flags * - * None. * - * * - * * - * Specific error codes for this function: * - * * - * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as required * - * by the implementation. * - * SCI_ERR_CONNECTION_REFUSED - Connection attempt refused by remote node. * - * * - *********************************************************************************/ -#define SCIConnectSCISpace _SISCI_EXPANDE_FUNCTION_NAME(SCIConnectSCISpace) -DLL void SCIConnectSCISpace(sci_desc_t sd, - unsigned int localAdapterNo, - sci_remote_segment_t *segment, - sci_address_t address, - unsigned int size, - unsigned int flags, - sci_error_t *error); - - - -/* - * ===================================================================================== - * - * S C I A T T A C H L O C A L S E G M E N T - * Description: - * - * SCIAttachLocalSegment() permits an application to "attach" to an already existing - * local segment, implying that two or more application want - * share the same local segment. The prerequest, is that the - * application which originally created the segment ("owner") has - * preformed a SCIShareSegment() in order to mark the segment - * "shareable". - * - * - * Flags: - * - * SCI_FLAG_USE_CALLBACK - The callback function will be invoked for events - * on this segment. - * - * - * Specific error codes for this function: - * - * SCI_ERR_ACCESS - No such shared segment - * SCI_ERR_NO_SUCH_SEGMENT - No such segment - * Note: Current implenentation will return SCI_ERR_ACCESS for both cases. This will - * change from next release. Application should handle both cases. - * - * ===================================================================================== - */ -#define SCIAttachLocalSegment _SISCI_EXPANDE_FUNCTION_NAME(SCIAttachLocalSegment) - -DLL void -SCIAttachLocalSegment(sci_desc_t sd, - sci_local_segment_t *segment, - unsigned int segmentId, - unsigned int *size, - sci_cb_local_segment_t callback, - void *callbackArg, - unsigned int flags, - sci_error_t *error); -/* - * ===================================================================================== - * - * S C I S H A R E S E G M E N T - * - * Description: - * - * SCIShareSegment() permits other application to "attach" to an already existing - * local segment, implying that two or more application want - * share the same local segment. The prerequest, is that the - * application which originally created the segment ("owner") has - * preformed a SCIShareSegment() in order to mark the segment - * "shareable". - * - * - * Flags: - * none - * - * Specific error codes for this function: - * - * - * - * ===================================================================================== - */ -#define SCIShareSegment _SISCI_EXPANDE_FUNCTION_NAME(SCIShareSegment) - -DLL void -SCIShareSegment(sci_local_segment_t segment, - unsigned int flags, - sci_error_t *error); - - -/********************************************************************************* - * * - * S C I F L U S H * - * * - * This function will flush the CPU buffers and the PSB buffers. * - * * - * Flags * - * SCI_FLAG_FLUSH_CPU_BUFFERS_ONLY : * - * Only flush CPU buffers ( Write combining * - * etc buffers). * - * * - *********************************************************************************/ - -#define SCIFlush _SISCI_EXPANDE_FUNCTION_NAME(SCIFlush) -DLL void SCIFlush(sci_sequence_t sequence, - unsigned int flags); - -#if defined(CPLUSPLUS) || defined(__cplusplus) -} -#endif - - -#endif - - - - - - - - - - - diff --git a/ndb/src/external/WIN32.x86/sci/include/sisci_demolib.h b/ndb/src/external/WIN32.x86/sci/include/sisci_demolib.h deleted file mode 100644 index ce5bb2aec8e..00000000000 --- a/ndb/src/external/WIN32.x86/sci/include/sisci_demolib.h +++ /dev/null @@ -1,226 +0,0 @@ -/* $Id: sisci_demolib.h,v 1.1 2002/12/13 12:17:23 hin Exp $ */ - -/******************************************************************************* - * * - * Copyright (C) 1993 - 2000 * - * Dolphin Interconnect Solutions AS * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, * - * or (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the Free Software * - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - * * - *******************************************************************************/ - -#ifndef _SISCI_DEMOLIB_H -#define _SISCI_DEMOLIB_H - - -#if defined(_REENTRANT) - -#define _SISCI_DEMOLIB_EXPAND_NAME(name) _SISCI_DEMOLIB_MT_ ## name - -#else - -#define _SISCI_DEMOLIB_EXPAND_NAME(name) _SISCI_DEMOLIB_ST_ ## name - -#endif - -/*********************************************************************************/ -/* Q U E R Y A D A P T E R */ -/* */ -/*********************************************************************************/ - -#define QueryAdapter _SISCI_DEMOLIB_EXPAND_NAME(QueryAdapter) - -sci_error_t QueryAdapter( - unsigned int subcommand, - unsigned int localAdapterNo, - unsigned int portNo, - unsigned int *data); - - -/*********************************************************************************/ -/* Q U E R Y S Y S T E M */ -/* */ -/*********************************************************************************/ - -#define QuerySystem _SISCI_DEMOLIB_EXPAND_NAME(QuerySystem) - -sci_error_t QuerySystem( - unsigned int subcommand, - unsigned int *data); - - -/*********************************************************************************/ -/* D E T E C T F I R S T A D A P T E R C A R D */ -/* */ -/*********************************************************************************/ - -#define DetectFirstAdapterCard _SISCI_DEMOLIB_EXPAND_NAME(DetectFirstAdapterCard) - -sci_error_t DetectFirstAdapterCard( - unsigned int *localAdapterNo, - unsigned int *localNodeId); - - -/*********************************************************************************/ -/* G E T A D A P T E R T Y P E */ -/* */ -/*********************************************************************************/ - -#define GetAdapterType _SISCI_DEMOLIB_EXPAND_NAME(GetAdapterType) - -sci_error_t GetAdapterType(unsigned int localAdapterNo, - unsigned int *adapterType); - - -/*********************************************************************************/ -/* G E T L O C A L N O D E I D */ -/* */ -/*********************************************************************************/ - -#define GetLocalNodeId _SISCI_DEMOLIB_EXPAND_NAME(GetLocalNodeId) - -sci_error_t GetLocalNodeId( - unsigned int localAdapterNo, - unsigned int *localNodeId); - - -/*********************************************************************************/ -/* G E T A D A P T E R S E R I A L N U M B E R */ -/* */ -/*********************************************************************************/ - -#define GetAdapterSerialNumber _SISCI_DEMOLIB_EXPAND_NAME(GetAdapterSerialNumber) - -sci_error_t GetAdapterSerialNumber( - unsigned int localAdapterNo, - unsigned int *serialNo); - - - -/*********************************************************************************/ -/* G E T H O S T B R I D G E T Y P E */ -/* */ -/*********************************************************************************/ - -#define GetHostbridgeType _SISCI_DEMOLIB_EXPAND_NAME(GetHostbridgeType) - -sci_error_t GetHostbridgeType(unsigned int *hostbridgeType); - - - -/*********************************************************************************/ -/* P R I N T H O S T B R I D G E T Y P E */ -/* */ -/*********************************************************************************/ - -#define PrintHostbridgeType _SISCI_DEMOLIB_EXPAND_NAME(PrintHostbridgeType) - -void PrintHostbridgeType(unsigned int hostbridge); - - - -/*********************************************************************************/ -/* G E T A P I V E R S I O N S T R I N G */ -/* */ -/*********************************************************************************/ - -#define GetAPIVersionString _SISCI_DEMOLIB_EXPAND_NAME(GetAPIVersionString) - -sci_error_t GetAPIVersionString(char str[], unsigned int strLength); - - - -/*********************************************************************************/ -/* G E T A D A P T E R I O B U S F R E Q U E N C Y */ -/* */ -/*********************************************************************************/ - -sci_error_t GetAdapterIoBusFrequency(unsigned int localAdapterNo, - unsigned int *ioBusFrequency); - - - -/*********************************************************************************/ -/* G E T A D A P T E R S C I L I N K F R E Q U E N C Y */ -/* */ -/*********************************************************************************/ - -sci_error_t GetAdapterSciLinkFrequency(unsigned int localAdapterNo, - unsigned int *sciLinkFrequency); - - - -/*********************************************************************************/ -/* G E T A D A P T E R B L I N K F R E Q U E N C Y */ -/* */ -/*********************************************************************************/ - -sci_error_t GetAdapterBlinkFrequency(unsigned int localAdapterNo, - unsigned int *bLinkFrequency); - - -/*********************************************************************************/ -/* S E N D I N T E R R U P T */ -/* */ -/*********************************************************************************/ - -#define SendInterrupt _SISCI_DEMOLIB_EXPAND_NAME(SendInterrupt) - -sci_error_t SendInterrupt( - sci_desc_t sd, - unsigned int localAdapterNo, - unsigned int localNodeId, - unsigned int remoteNodeId, - unsigned int interruptNo); - - -/*********************************************************************************/ -/* R E C E I V E I N T E R R U P T */ -/* */ -/*********************************************************************************/ - -#define ReceiveInterrupt _SISCI_DEMOLIB_EXPAND_NAME(ReceiveInterrupt) - -sci_error_t ReceiveInterrupt( - sci_desc_t sd, - unsigned int localAdapterNo, - unsigned int localNodeId, - unsigned int interruptNo); - - -/*********************************************************************************/ -/* E N D I A N S W A P */ -/* */ -/*********************************************************************************/ - -#define EndianSwap _SISCI_DEMOLIB_EXPAND_NAME(EndianSwap) - -unsigned int EndianSwap (unsigned int value); - - -/*********************************************************************************/ -/* S L E E P M I L L I S E C O N D S */ -/* */ -/*********************************************************************************/ - -#define SleepMilliseconds _SISCI_DEMOLIB_EXPAND_NAME(SleepMilliseconds) - -void SleepMilliseconds(int milliseconds); - - - - -#endif diff --git a/ndb/src/external/WIN32.x86/sci/include/sisci_error.h b/ndb/src/external/WIN32.x86/sci/include/sisci_error.h deleted file mode 100644 index 56fa0d18b3a..00000000000 --- a/ndb/src/external/WIN32.x86/sci/include/sisci_error.h +++ /dev/null @@ -1,94 +0,0 @@ -/* $Id: sisci_error.h,v 1.1 2002/12/13 12:17:23 hin Exp $ */ - -/******************************************************************************* - * * - * Copyright (C) 1993 - 2000 * - * Dolphin Interconnect Solutions AS * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, * - * or (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the Free Software * - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - * * - *******************************************************************************/ - - - - -#ifndef _SISCI_ERROR_H_ -#define _SISCI_ERROR_H_ - - -/* SCI Error return values always have 30 bit set */ -#define SCI_ERR_MASK 0x40000000 -#define SCI_ERR_REMOTE_MASK 0x01 /* Remote errors should have bit 0 set */ - -#define SCI_ERR(u) ((unsigned32)(u)&0x7FFFFFFF ) - -/* Error codes */ -typedef enum { - SCI_ERR_OK = 0x000, - - - SCI_ERR_BUSY = (0x900 | SCI_ERR_MASK), - SCI_ERR_FLAG_NOT_IMPLEMENTED = (0x901 | SCI_ERR_MASK), - SCI_ERR_ILLEGAL_FLAG = (0x902 | SCI_ERR_MASK), - SCI_ERR_NOSPC = (0x904 | SCI_ERR_MASK), - SCI_ERR_API_NOSPC = (0x905 | SCI_ERR_MASK), - SCI_ERR_HW_NOSPC = (0x906 | SCI_ERR_MASK), - SCI_ERR_NOT_IMPLEMENTED = (0x907 | SCI_ERR_MASK), - SCI_ERR_ILLEGAL_ADAPTERNO = (0x908 | SCI_ERR_MASK), - SCI_ERR_NO_SUCH_ADAPTERNO = (0x909 | SCI_ERR_MASK), - SCI_ERR_TIMEOUT = (0x90A | SCI_ERR_MASK), - SCI_ERR_OUT_OF_RANGE = (0x90B | SCI_ERR_MASK), - SCI_ERR_NO_SUCH_SEGMENT = (0x90C | SCI_ERR_MASK), - SCI_ERR_ILLEGAL_NODEID = (0x90D | SCI_ERR_MASK), - SCI_ERR_CONNECTION_REFUSED = (0x90E | SCI_ERR_MASK), - SCI_ERR_SEGMENT_NOT_CONNECTED = (0x90F | SCI_ERR_MASK), - SCI_ERR_SIZE_ALIGNMENT = (0x910 | SCI_ERR_MASK), - SCI_ERR_OFFSET_ALIGNMENT = (0x911 | SCI_ERR_MASK), - SCI_ERR_ILLEGAL_PARAMETER = (0x912 | SCI_ERR_MASK), - SCI_ERR_MAX_ENTRIES = (0x913 | SCI_ERR_MASK), - SCI_ERR_SEGMENT_NOT_PREPARED = (0x914 | SCI_ERR_MASK), - SCI_ERR_ILLEGAL_ADDRESS = (0x915 | SCI_ERR_MASK), - SCI_ERR_ILLEGAL_OPERATION = (0x916 | SCI_ERR_MASK), - SCI_ERR_ILLEGAL_QUERY = (0x917 | SCI_ERR_MASK), - SCI_ERR_SEGMENTID_USED = (0x918 | SCI_ERR_MASK), - SCI_ERR_SYSTEM = (0x919 | SCI_ERR_MASK), - SCI_ERR_CANCELLED = (0x91A | SCI_ERR_MASK), - SCI_ERR_NOT_CONNECTED = (0x91B | SCI_ERR_MASK), - SCI_ERR_NOT_AVAILABLE = (0x91C | SCI_ERR_MASK), - SCI_ERR_INCONSISTENT_VERSIONS = (0x91D | SCI_ERR_MASK), - SCI_ERR_COND_INT_RACE_PROBLEM = (0x91E | SCI_ERR_MASK), - SCI_ERR_OVERFLOW = (0x91F | SCI_ERR_MASK), - SCI_ERR_NOT_INITIALIZED = (0x920 | SCI_ERR_MASK), - - SCI_ERR_ACCESS = (0x921 | SCI_ERR_MASK), - - SCI_ERR_NO_SUCH_NODEID = (0xA00 | SCI_ERR_MASK), - SCI_ERR_NODE_NOT_RESPONDING = (0xA02 | SCI_ERR_MASK), - SCI_ERR_NO_REMOTE_LINK_ACCESS = (0xA04 | SCI_ERR_MASK), - SCI_ERR_NO_LINK_ACCESS = (0xA05 | SCI_ERR_MASK), - SCI_ERR_TRANSFER_FAILED = (0xA06 | SCI_ERR_MASK), - - SCI_ERR_EWOULD_BLOCK = ( 0xB00 | SCI_ERR_MASK), - SCI_ERR_SEMAPHORE_COUNT_EXCEEDED = ( 0xB01 | SCI_ERR_MASK), - SCI_ERR_IRQL_ILLEGAL = ( 0xB02 | SCI_ERR_MASK) - -} sci_error_t; - - -#endif /* _SCI_ERROR_H_ */ - - - diff --git a/ndb/src/external/WIN32.x86/sci/include/sisci_types.h b/ndb/src/external/WIN32.x86/sci/include/sisci_types.h deleted file mode 100644 index 03e7957c3f2..00000000000 --- a/ndb/src/external/WIN32.x86/sci/include/sisci_types.h +++ /dev/null @@ -1,133 +0,0 @@ -/* $Id: sisci_types.h,v 1.1 2002/12/13 12:17:23 hin Exp $ */ - -/******************************************************************************* - * * - * Copyright (C) 1993 - 2000 * - * Dolphin Interconnect Solutions AS * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, * - * or (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the Free Software * - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - * * - *******************************************************************************/ - - -#ifndef _SISCI_TYPES_H -#define _SISCI_TYPES_H - -#include "sisci_error.h" - -#ifndef IN -#define IN -#endif - -#ifndef OUT -#define OUT -#endif - -#ifndef IN_OUT -#define IN_OUT -#endif - -/* Opaque data types for descriptors/handles */ -typedef struct sci_desc *sci_desc_t; -typedef struct sci_local_segment *sci_local_segment_t; -typedef struct sci_remote_segment *sci_remote_segment_t; - -typedef struct sci_map *sci_map_t; -typedef struct sci_sequence *sci_sequence_t; -#ifndef KERNEL -typedef struct sci_dma_queue *sci_dma_queue_t; -#endif -typedef struct sci_remote_interrupt *sci_remote_interrupt_t; -typedef struct sci_local_interrupt *sci_local_interrupt_t; -typedef struct sci_block_transfer *sci_block_transfer_t; - -/* - * Constants defining reasons for segment callbacks: - */ - -typedef enum { - SCI_CB_CONNECT = 1, - SCI_CB_DISCONNECT, - SCI_CB_NOT_OPERATIONAL, - SCI_CB_OPERATIONAL, - SCI_CB_LOST -} sci_segment_cb_reason_t; - -#define MAX_CB_REASON SCI_CB_LOST - -/* dma_queue_states is identical to the dma_queue_state_t in genif.h, they must be consistent.*/ -typedef enum { - SCI_DMAQUEUE_IDLE, - SCI_DMAQUEUE_GATHER, - SCI_DMAQUEUE_POSTED, - SCI_DMAQUEUE_DONE, - SCI_DMAQUEUE_ABORTED, - SCI_DMAQUEUE_ERROR -} sci_dma_queue_state_t; - - -typedef enum { - SCI_SEQ_OK, - SCI_SEQ_RETRIABLE, - SCI_SEQ_NOT_RETRIABLE, - SCI_SEQ_PENDING -} sci_sequence_status_t; - - -typedef struct { - unsigned short nodeId; /* SCI Address bit 63 - 48 */ - unsigned short offsHi; /* SCI Address bit 47 - 32 */ - unsigned int offsLo; /* SCI Address bit 31 - 0 */ -} sci_address_t; - - -typedef unsigned int sci_ioaddr_t; - -typedef enum { - SCI_CALLBACK_CANCEL = 1, - SCI_CALLBACK_CONTINUE -} sci_callback_action_t; - -#ifndef KERNEL -typedef sci_callback_action_t (*sci_cb_local_segment_t)(void *arg, - sci_local_segment_t segment, - sci_segment_cb_reason_t reason, - unsigned int nodeId, - unsigned int localAdapterNo, - sci_error_t error); - -typedef sci_callback_action_t (*sci_cb_remote_segment_t)(void *arg, - sci_remote_segment_t segment, - sci_segment_cb_reason_t reason, - sci_error_t status); - - -typedef sci_callback_action_t (*sci_cb_dma_t)(void IN *arg, - sci_dma_queue_t queue, - sci_error_t status); - - -typedef int (*sci_cb_block_transfer_t)(void *arg, - sci_block_transfer_t block, - sci_error_t status); - - -typedef sci_callback_action_t (*sci_cb_interrupt_t)(void *arg, - sci_local_interrupt_t interrupt, - sci_error_t status); - -#endif /* KERNEL */ -#endif diff --git a/ndb/test/odbc/tpcb/Makefile b/ndb/test/odbc/tpcb/Makefile deleted file mode 100644 index 8ab429c8ea1..00000000000 --- a/ndb/test/odbc/tpcb/Makefile +++ /dev/null @@ -1,30 +0,0 @@ -include .defs.mk - -TYPE = * - -BIN_TARGET = tpcb - -SOURCES = ttTime.c tpcb.cpp - -CCFLAGS_LOC += \ - -I$(NDB_TOP)/include \ - -I$(NDB_TOP)/include/ndbapi \ - -I$(NDB_TOP)/include/portlib \ - -I$(NDB_TOP)/include/util \ - -I$(NDB_TOP)/test/include \ - -I/usr/local/include - -CCFLAGS_WARNINGS += -Wno-unused -Wno-sign-compare -Wformat - -CCFLAGS_TOP += -DndbODBC - -BIN_TARGET_LIBS = NDB_API_pic NDB_ODBC_pic NDBT - -ifeq ($(NDB_OS),SOLARIS) -BIN_TARGET_LIBS += dmallocthcxx -CCFLAGS_TOP += -DDMALLOC -endif - -include $(NDB_TOP)/Epilogue.mk - -$(BIN_DIR)$(BIN_TARGET): Makefile diff --git a/ndb/test/odbc/tpcb/Makefile_mysql b/ndb/test/odbc/tpcb/Makefile_mysql deleted file mode 100644 index 4e1b9a25fe2..00000000000 --- a/ndb/test/odbc/tpcb/Makefile_mysql +++ /dev/null @@ -1,33 +0,0 @@ -include $(NDB_TOP)/Defs.mk - -TYPE = odbcclient - -BIN_TARGET = tpcb - -SOURCES = ttTime.c tpcb.cpp - -CCFLAGS_LOC += -I/usr/local/include \ - -I$(NDB_TOP)/test/include \ - -I$(NDB_TOP)/include \ - -I$(NDB_TOP)/include/util \ - -I$(NDB_TOP)/src/client/odbc/common - - - - -#CCFLAGS_WARNINGS += -Wno-unused - -LIBS_LOC += -L/usr/local/lib -BIN_TARGET_LIBS_DIRS += /usr/local/lib -BIN_TARGET_LIBS += odbc odbcinst - -#LIBS_SPEC += -pg -# -lNDBT \ -# -lodbc \ -# -lodbcinst \ -# -lportlib - - - -include $(NDB_TOP)/Epilogue.mk - diff --git a/ndb/test/odbc/tpcb/Makefile_ndb b/ndb/test/odbc/tpcb/Makefile_ndb deleted file mode 100644 index 85960413ef0..00000000000 --- a/ndb/test/odbc/tpcb/Makefile_ndb +++ /dev/null @@ -1,30 +0,0 @@ -include $(NDB_TOP)/Defs.mk - -TYPE = * - -BIN_TARGET = tpcb - -SOURCES = ttTime.c tpcb.cpp - -CCFLAGS_LOC += \ - -I$(NDB_TOP)/include \ - -I$(NDB_TOP)/include/ndbapi \ - -I$(NDB_TOP)/include/portlib \ - -I$(NDB_TOP)/include/util \ - -I$(NDB_TOP)/test/include \ - -I/usr/local/include - -CCFLAGS_WARNINGS += -Wno-unused -Wno-sign-compare -Wformat - -CCFLAGS_TOP += -DndbODBC - -BIN_TARGET_LIBS = NDB_API_pic NDB_ODBC_pic NDBT - -ifeq ($(NDB_OS),SOLARIS) -BIN_TARGET_LIBS += dmallocthcxx -CCFLAGS_TOP += -DDMALLOC -endif - -include $(NDB_TOP)/Epilogue.mk - -$(BIN_DIR)$(BIN_TARGET): Makefile diff --git a/ndb/test/odbc/tpcb/readme.txt b/ndb/test/odbc/tpcb/readme.txt deleted file mode 100644 index 008cafb9d2f..00000000000 --- a/ndb/test/odbc/tpcb/readme.txt +++ /dev/null @@ -1,15 +0,0 @@ -'tpcb' requires an .odbc.ini file in -/etc/ -or in -/home/user/ - -The .odbc.ini file must contain a DSN entry called ndb: - -#--------- .odbc.ini example -------------------- - -[ndb] -Driver = /path_to_installation/lib/libNDB_ODBC.so - -#--------- End of example ----------------------- - - diff --git a/ndb/test/odbc/tpcb/timesten.h b/ndb/test/odbc/tpcb/timesten.h deleted file mode 100644 index 45579f9d277..00000000000 --- a/ndb/test/odbc/tpcb/timesten.h +++ /dev/null @@ -1,188 +0,0 @@ -/* Copyright (C) 2003 MySQL AB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - -/* - * $Revision: 1.1 $ - * (c) Copyright 1997-2003, TimesTen, Inc. - * All rights reserved. - */ - -#ifndef TIMESTEN_H_INCLUDED -#define TIMESTEN_H_INCLUDED - -#ifdef _WIN32 -#include -#endif - -#include -#include -#include -/* - * TimesTen extension to application data types; only usable - * when application directly linked to the TimesTen driver. - */ -#define SQL_C_ADDR 100 - -#ifndef SQL_C_SBIGINT -#if (ODBCVER < 0x0300) -#define SQL_C_SBIGINT (SQL_BIGINT+SQL_SIGNED_OFFSET) -#define SQL_C_UBIGINT (SQL_BIGINT+SQL_UNSIGNED_OFFSET) -#endif -#endif - -#define SQL_C_BIGINT SQL_C_SBIGINT - -#if (ODBCVER < 0x0300) -#ifdef _WIN32 -typedef __int64 SQLBIGINT; -/* On Unix platforms SQLBIGINT is defined in odbcinclude directory*/ -#endif -#endif - -#define BIGINT SQLBIGINT - -#ifdef _WIN32 -#define UBIGINT unsigned __int64 -#else -#define UBIGINT unsigned long long -#endif - - -#define SQL_WCHAR (-8) -#define SQL_WVARCHAR (-9) -#define SQL_WLONGVARCHAR (-10) -#define SQL_C_WCHAR SQL_WCHAR - -/* SQLGetInfo() InfoTypes */ -#define SQL_CONVERT_WCHAR 122 -#define SQL_CONVERT_WLONGVARCHAR 125 -#define SQL_CONVERT_WVARCHAR 126 - -/* TimesTen specific SQLGetInfo types */ -#define TT_REPLICATION_INVALID (SQL_INFO_DRIVER_START + 2000) - -/* SQLGetInfo() return value bitmasks */ -#ifndef SQL_CVT_WCHAR -/* -** These definitions differ from Microsoft in that they are not -** specified as long (e.g. 0x00200000L), hence they are protected -** by the ifndef above. -*/ -#define SQL_CVT_WCHAR 0x00200000 -#define SQL_CVT_WLONGVARCHAR 0x00400000 -#define SQL_CVT_WVARCHAR 0x00800000 -#endif - -/* -** The Microsoft Driver Manager SQLBindParameter() will not pass SQL_WCHAR -** through. Use this hack to get around it. -*/ -#define SQL_WCHAR_DM_SQLBINDPARAMETER_BYPASS -888 - -/* This is an extension to ODBC's isolation levels. It reflects an - * earlier implementation of read-committed that released locks on - * next fetch, rather than releasing locks before returning value to - * application. */ -#define SQL_TXN_CURSOR_STABILITY 0x00001000 -#define SQL_TXN_NOBLOCK_DELETE 0x00002000 - -/* TimesTen-specific connection option */ -#define TT_PREFETCH_CLOSE 10001 -#define TT_PREFETCH_CLOSE_OFF 0 -#define TT_PREFETCH_CLOSE_ON 1 - -/* Adding a new sql connection option */ -#define TT_PREFETCH_COUNT 10003 -#define TT_PREFETCH_COUNT_MAX 128 - -/* - * Platform specific data types for integers that scale - * with pointer size - */ - -#ifdef _IA64_ -typedef signed __int64 tt_ptrint; -typedef unsigned __int64 tt_uptrint; -#else -#ifdef _WIN32 -typedef signed long tt_ptrint; -typedef unsigned long tt_uptrint; -#else -typedef signed long tt_ptrint; -typedef unsigned long tt_uptrint; -#endif -#endif - -#ifdef _WIN32 -typedef signed __int64 tt_int8; -typedef unsigned __int64 tt_uint8; -#else -typedef signed long long tt_int8; -typedef unsigned long long tt_uint8; -#endif - -/* printf formats for pointer-sized integers */ -#ifdef _IA64_ /* 64-bit NT */ -#define PTRINT_FMT "I64d" -#define UPTRINT_FMT "I64u" -#define xPTRINT_FMT "I64x" -#define XPTRINT_FMT "I64X" -#else -#ifdef _WIN32 /* 32-bit NT */ -#define PTRINT_FMT "ld" -#define UPTRINT_FMT "lu" -#define xPTRINT_FMT "lx" -#define XPTRINT_FMT "lX" -#else /* 32 and 64-bit UNIX */ -#define PTRINT_FMT "ld" -#define UPTRINT_FMT "lu" -#define xPTRINT_FMT "lx" -#define XPTRINT_FMT "lX" -#endif -#endif - -/* printf formats for 8-byte integers */ -#ifndef INT8_FMT_DEFINED -#ifdef _WIN32 /* 32 and 64-bit NT */ -#define INT8_FMT "I64d" -#define UINT8_FMT "I64u" -#define xINT8_FMT "I64x" -#define XINT8_FMT "I64X" -#else /* 32 and 64-bit UNIX */ -#define INT8_FMT "lld" -#define UINT8_FMT "llu" -#define xINT8_FMT "llx" -#define XINT8_FMT "llX" -#endif -#define INT8_FMT_DEFINED 1 -#endif - -/* The following types are defined in the newer odbc include files - from Microsoft -*/ -#if defined (_WIN32) && !defined (_IA64_) -#ifndef SQLROWSETSIZE -#define SQLROWSETSIZE SQLUINTEGER -#define SQLLEN SQLINTEGER -#define SQLROWOFFSET SQLINTEGER -#define SQLROWCOUNT SQLUINTEGER -#define SQLULEN SQLUINTEGER -#define SQLSETPOSIROW SQLUSMALLINT -#endif -#endif - - -#endif diff --git a/ndb/test/odbc/tpcb/tpcb.cpp b/ndb/test/odbc/tpcb/tpcb.cpp deleted file mode 100644 index 60d746e7844..00000000000 --- a/ndb/test/odbc/tpcb/tpcb.cpp +++ /dev/null @@ -1,1415 +0,0 @@ -/* Copyright (C) 2003 MySQL AB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - -static const volatile char cvsid[] = "$Id: tpcb.cpp,v 1.4 2003/09/26 09:04:34 johan Exp $"; -/* - * $Revision: 1.4 $ - * (c) Copyright 1996-2003, TimesTen, Inc. - * All rights reserved. - */ - -/* This source is best displayed with a tabstop of 4 */ - -#define NDB - -//#define MYSQL - -#ifdef WIN32 -#include -#include "ttRand.h" -#else -#if !defined NDB && !defined MYSQL -#include -#endif -#include -#include -#include -#ifdef SB_P_OS_CHORUS -#include "ttRand.h" -#endif -#endif - -#include -#include -#include -#include -#include -#include - -#if !defined NDB && !defined MYSQL -#include "ttTime.h" -#include "utils.h" -#include "tt_version.h" -#include "timesten.h" -#endif - -#if defined NDB || defined MYSQL -#include -#include - -#include -#include -extern "C" { -#include "ttTime.h" -#include "timesten.h" - void ttGetWallClockTime(ttWallClockTime* timeP); - void ttCalcElapsedWallClockTime(ttWallClockTime* beforeP, - ttWallClockTime* afterP, - double* nmillisecondsP); - void ttGetThreadTimes(ttThreadTimes * endRes); - void ttCalcElapsedThreadTimes(ttThreadTimes* startRes, - ttThreadTimes * endRes, - double * kernel, - double * user); -} - -#define app_exit exit -#define status_msg0 ndbout_c -#define status_msg1 ndbout_c -#define status_msg2 ndbout_c -#define err_msg0 ndbout_c -#define err_msg1 ndbout_c -#define err_msg3 ndbout_c -#define out_msg0 ndbout_c -#define out_msg1 ndbout_c -#define out_msg3 ndbout_c -#define CONN_STR_LEN 255 -#define DBMS_TIMESTEN 1 -#define DBMS_MSSQL 2 -#define DBMS_UNKNOWN 3 -#define ABORT_DISCONNECT_EXIT 1 -#define NO_EXIT 0 -#define ERROR_EXIT 1 -#define DISCONNECT_EXIT 2 -#endif - -#define VERBOSE_NOMSGS 0 -/* this value is used for results (and err msgs) only */ -#define VERBOSE_RESULTS 1 -/* this value is the default for the cmdline demo */ -#define VERBOSE_DFLT 2 -#define VERBOSE_ALL 3 - -#ifdef MYSQL -#define DSNNAME "DSN=myodbc3" -#elif defined NDB -#define DSNNAME "DSN=ndb" -#else -#define DSNNAME "DSN=" -#endif - -/* number of branches, tellers, and accounts */ - -#define NumBranches 1 -#define TellersPerBranch 10 -#define AccountsPerBranch 10000 - -/* number of transactions to execute */ - -#define NumXacts 25000 - -/* starting seed value for the random number generator */ - -#define SeedVal 84773 - -/* for MS SQL, the drop, create and use database statements */ - -#define DatabaseDropStmt "drop database tpcbDB;" -#ifdef MYSQL -#define DatabaseCreateStmt "create database tpcbDB;" -#else -#define DatabaseCreateStmt "create database tpcbDB ON DEFAULT = %d;" -#endif -#define DatabaseUseStmt "use tpcbDB;" - -/* - * Specifications of table columns. - * Fillers of 80, 80, 84, and 24 bytes, respectively, are used - * to ensure that rows are the width required by the benchmark. - * - * Note: The TimesTen and MS SQL CREATE TABLE statements for the - * accounts, tellers and branches tables are different. - * - */ - -#define TuplesPerPage 256 - - -#ifdef MYSQL - -#define AccountCrTblStmt "create table accounts \ -(number integer not null primary key, \ -branchnum integer not null, \ -balance float not null, \ -filler char(80));" - -#define TellerCrTblStmt "create table tellers \ -(number integer not null primary key, \ -branchnum integer not null, \ -balance float not null, \ -filler char(80));" - -#define BranchCrTblStmt "create table branches \ -(number integer not null primary key, \ -balance float not null, \ -filler char(84));" - -#endif - - -#ifdef NDB -#define AccountCrTblStmt "create table accounts \ -(number integer not null primary key, \ -branchnum integer not null, \ -balance float not null, \ -filler char(80)) nologging" - -#define TellerCrTblStmt "create table tellers \ -(number integer not null primary key, \ -branchnum integer not null, \ -balance float not null, \ -filler char(80)) nologging" - -#define BranchCrTblStmt "create table branches \ -(number integer not null primary key, \ -balance float not null, \ -filler char(84)) nologging" -#endif - -#ifdef NDB - -#define HistoryCrTblStmt "create table History \ -(tellernum integer not null, \ -branchnum integer not null, \ -accountnum integer not null, \ -delta float not null, \ -createtime integer not null, \ -filler char(24), \ -primary key (tellernum, branchnum, accountnum, delta, createtime)) nologging" - -#else - -#ifdef MYSQL - -#define HistoryCrTblStmt "create table History \ -(tellernum integer not null, \ -branchnum integer not null, \ -accountnum integer not null, \ -delta float(53) not null, \ -createtime integer not null, \ -filler char(24))" -#endif - -#define HistoryCrTblStmt "create table History \ -(tellernum integer not null, \ -branchnum integer not null, \ -accountnum integer not null, \ -delta float(53) not null, \ -createtime integer not null, \ -filler char(24));" -#endif - -#define TTAccountCrTblStmt "create table accounts \ -(number integer not null primary key, \ -branchnum integer not null, \ -balance float(53) not null, \ -filler char(80)) unique hash on (number) pages = %" PTRINT_FMT ";" - -#define TTTellerCrTblStmt "create table tellers \ -(number integer not null primary key, \ -branchnum integer not null, \ -balance float(53) not null, \ -filler char(80)) unique hash on (number) pages = %" PTRINT_FMT ";" - -#define TTBranchCrTblStmt "create table branches \ -(number integer not null primary key, \ -balance float(53) not null, \ -filler char(84)) unique hash on (number) pages = %" PTRINT_FMT ";" - - -/* Insertion statements used to populate the tables */ - -#define NumInsStmts 3 -char* insStmt[NumInsStmts] = { - "insert into branches values (?, 0.0, NULL)", - "insert into tellers values (?, ?, 0.0, NULL)", - "insert into accounts values (?, ?, 0.0, NULL)" -}; - -/* Transaction statements used to update the tables */ - -#define NumXactStmts 5 - -#ifdef NDB -char* tpcbXactStmt[NumXactStmts] = { - "update accounts \ -set balance = balance + ? \ -where number = ?", - - "select balance \ -from accounts \ -where number = ?", - - "update tellers \ -set balance = balance + ? \ -where number = ?", - - "update branches \ -set balance = balance + ? \ -where number = ?", - - "insert into History(tellernum, branchnum, \ -accountnum, delta, createtime, filler) \ -values (?, ?, ?, ?, ?, NULL)" -}; - -#else -char* tpcbXactStmt[NumXactStmts] = { - "update accounts \ -set balance = balance + ? \ -where number = ?;", - - "select balance \ -from accounts \ -where number = ?;", - - "update tellers \ -set balance = balance + ? \ -where number = ?;", - - "update branches \ -set balance = balance + ? \ -where number = ?;", - - "insert into History \ -values (?, ?, ?, ?, ?, NULL);" -}; - - -#endif - -/* Global parameters and flags (typically set by parse_args()) */ - -int tabFlag = 0; /* Default is NOT tab output mode */ -char szConnStrIn[CONN_STR_LEN]; /* ODBC Connection String */ -int printXactTimes = 0; /* Transaction statistics - * gathering flag */ -char statFile[FILENAME_MAX]; /* Transaction statistics filename */ -int scaleFactor = 2; /* Default TPS scale factor */ -int numBranchTups; /* Number of branches */ -int numTellerTups; /* Number of tellers */ -int numAccountTups; /* Number of accounts */ -int numNonLocalAccountTups; /* Number of local accounts */ -int numXacts = NumXacts; /* Default number of transactions */ -int verbose = VERBOSE_DFLT; /* Verbose level */ -FILE *statusfp; /* File for status messages */ - - - -int DBMSType; /* DBMS type (DBMS_TIMESTEN, DBMS_MSSQL...) */ - - -SQLHENV henv; /* Environment handle */ - - - - - - - -void handle_errors( SQLHDBC hdbc, SQLHSTMT hstmt, int errcode, int action, char * msg, - char * file, int line) { - - if (errcode == SQL_SUCCESS) - return; - - if(errcode == SQL_ERROR) { - int ret; - long diagCount=0; - short length=0; - SQLCHAR state[10] = ""; - SQLCHAR message[200] = ""; - long native = 0; - if(hstmt != 0) { - ret = SQLGetDiagField(SQL_HANDLE_STMT, hstmt, 0, SQL_DIAG_NUMBER, &diagCount, SQL_IS_INTEGER, 0); - - for(long i = 0; i < diagCount; i++) { - ret = SQLGetDiagRec(SQL_HANDLE_STMT, hstmt, i, (SQLCHAR*)state, &native, (SQLCHAR*)message, 200, &length); - ndbout_c("GetDiagRec: Message : %s ", message); - } - } - } - - if(errcode != SQL_SUCCESS) { - ndbout_c("Message: %s", msg); - switch(errcode) { - case SQL_SUCCESS_WITH_INFO: - ndbout_c("SQL_SUCCESS_WITH_INFO"); - break; - case SQL_STILL_EXECUTING: - ndbout_c("SQL_STILL_EXECUTING"); - break; - case SQL_ERROR: - ndbout_c("SQL_ERROR"); - break; - case SQL_INVALID_HANDLE: - ndbout_c("SQL_INVALID_HANDLE"); - break; - default: - ndbout_c("Some other error"); - } - exit(1); - } - - -} - - - - - -/********************************************************************* - * FUNCTION: usage - * - * DESCRIPTION: This function prints a usage message describing - * the command line options of the program. - * - * PARAMETERS: char* prog full program path name - * - * RETURNS: void - * - * NOTES: NONE - * - *********************************************************************/ - -static void usage(char *prog) -{ - char *progname; - - /* Get the name of the program (sans path). */ - -#ifdef WIN32 - progname = strrchr(prog, '\\'); -#else - progname = strrchr(prog, '/'); -#endif - if (progname == 0) - progname = prog; - else - ++progname; - - /* Print the usage message */ - - fprintf(stderr, - "Usage:\t%s [-h] [-help] [-V] [-connStr ] [-v ]\n" - "\t\t[-xact ] [-scale ] [-tabs] [-s ]\n\n" - " -h Prints this message and exits.\n" - " -help Same as -h.\n" - " -V Prints version number and exits.\n" - " -connStr Specifies an ODBC connection string to replace the\n" - " default DSN for the program. The default is\n" - " \"DSN=TpcbData;OverWrite=1\".\n" - " -v Verbose level\n" - " 0 = errors only\n" - " 1 = results only\n" - " 2 = results and some status messages (default)\n" - " 3 = all messages\n" - " -xact Specifies the number of transactions to be run\n" - " The default is 25000 transactions.\n" - " -scale Specifies a scale factor which determines the\n" - " number of branches (scale), tellers (scale x 10),\n" - " accounts (scale x 10000) and non-local accounts\n" - " ((scale-1) x 10000. The default scale factor is 2.\n" - " -tabs Specifies that the output be a tab-separated\n" - " format suitable for import into a spreadsheet.\n" - " Results only go to stdout; status and other\n" - " messages go to stderr.\n" - " -s Prints individual transaction times to .\n", - progname); -} - -/********************************************************************* - * - * FUNCTION: parse_args - * - * DESCRIPTION: This function parses the command line arguments - * passed to main(), setting the appropriate global - * variables and issuing a usage message for - * invalid arguments. - * - * PARAMETERS: int argc # of arguments from main() - * char *argv[] arguments from main() - * - * RETURNS: void - * - * NOTES: NONE - * - *********************************************************************/ - -void -parse_args(int argc, char *argv[]) -{ - int i = 1; - - *szConnStrIn = 0; - - while (i < argc) { - - if ( !strcmp(argv[i], "-h") || !strcmp(argv[i], "-help") ) { - usage(argv[0]); - app_exit(0); - } - /* - if (!strcmp(argv[i], "-V")) { - printf("%s\n", TTVERSION_STRING); - app_exit(0); - } - */ - if (strcmp(argv[i], "-s") == 0) { - if (argc < i+2 ) { - usage(argv[0]); - app_exit(1); - } - if (sscanf(argv[i+1], "%s", statFile) == 0) { - usage(argv[0]); - app_exit(1); - } - printXactTimes = 1; - i += 2; - } - else if (!strcmp(argv[i], "-connStr")) { - if (argc < i+2 ) { - usage(argv[0]); - app_exit(1); - } - strcpy(szConnStrIn, argv[i+1]); - i += 2; - continue; - } - else if (strcmp("-v", argv[i]) == 0) { - if (argc < i+2 ) { - usage(argv[0]); - app_exit(1); - } - if (sscanf(argv[i+1], "%d", &verbose) == -1 || - verbose < 0 || verbose > 3) { - fprintf(stderr, "-v flag requires an integer parameter (0-3)\n"); - usage(argv[0]); - app_exit(1); - } - i += 2; - } - else if (strcmp("-xact",argv[i]) == 0) { - if (argc < i+2 ) { - usage(argv[0]); - app_exit(1); - } - - if (sscanf(argv[i+1], "%" PTRINT_FMT, &numXacts) == -1 || numXacts < 0) { - fprintf(stderr, "-xact flag requires a non-negative integer argument\n"); - usage(argv[0]); - app_exit(1); - } - - i += 2; - } - else if (strcmp("-scale",argv[i]) == 0) { - if (argc < i+2 ) { - usage(argv[0]); - app_exit(1); - } - if (sscanf(argv[i+1], "%d", &scaleFactor) == -1 || scaleFactor < 1) { - fprintf(stderr, "-scale flag requires an integer argument >= 1\n"); - usage(argv[0]); - app_exit(1); - } - /* Calculate tuple sizes */ - numBranchTups = NumBranches * scaleFactor; - numTellerTups = TellersPerBranch * scaleFactor; - numAccountTups = AccountsPerBranch * scaleFactor; - numNonLocalAccountTups = AccountsPerBranch * (scaleFactor-1); - i += 2; - } - else if (strcmp("-tabs",argv[i]) == 0) { - tabFlag = 1; - statusfp = stderr; - i += 1; - } - else { - usage(argv[0]); - app_exit(1); - } - } -} - -/********************************************************************* - * - * FUNCTION: doImmed - * - * DESCRIPTION: This function executes and frees the specified - * statement. It is used as a direct means to - * create the tables used by this benchmark, - * - * PARAMETERS: SQLHDBC hdbc SQL Connection handle - * SQLHSTMT hs SQL Statement handle - * char* cmd SQL Statement text - * - * RETURNS: void - * - * NOTES: NONE - * - *********************************************************************/ - -void -doImmed(SQLHDBC hdbc, SQLHSTMT hs, char* cmd) -{ - SQLRETURN rc; - - /* Execute the command */ - - rc = SQLExecDirect(hs, (SQLCHAR *) cmd, SQL_NTS); - handle_errors(hdbc, hs, rc, ABORT_DISCONNECT_EXIT, - "Error executing statement", __FILE__, __LINE__); - - /* Close associated cursor and drop pending results */ - - rc = SQLFreeStmt(hs, SQL_CLOSE); - handle_errors(hdbc, hs, rc, ABORT_DISCONNECT_EXIT, - "closing statement handle", - __FILE__, __LINE__); - -} - - -/********************************************************************* - * - * FUNCTION: main - * - * DESCRIPTION: This is the main function of the tpcb benchmark. - * It connects to an ODBC data source, creates and - * populates tables, updates the tables in a user- - * specified number of transactions and reports on - * on the transaction times. - * - * PARAMETERS: int argc # of command line arguments - * char *argv[] command line arguments - * - * RETURNS: void - * - * NOTES: NONE - * - *********************************************************************/ - -int -main(int argc, char *argv[]) -{ - - /* variables used for setting up the tables */ - - char cmdStr[1024]; - char errstr[4096]; - - /* variables used during transactions */ - - int accountNum; - int tellerNum; - int branchNum; - int timeStamp; - double delta; - unsigned int lrand; - unsigned short *srands, localLimit; - int lp64; - - /* variables used for timing and statistics */ - - int warmup; - double kernel, user, real; - ttThreadTimes startRes, endRes; - ttWallClockTime startT, endT; - ttWallClockTime** rtStart; - ttWallClockTime** rtEnd; - double** resTime; - double maxTime, totTime; - int i; - int j; - int numLocalXacts=0, numRemoteXacts=0; - - /* variables for ODBC */ - - SQLHDBC hdbc; - SQLHSTMT hstmt; - SQLHSTMT txstmt[NumXactStmts]; - SQLRETURN rc; - char DBMSName[32]; - char DBMSVersion[32]; - int databaseSize; - - int fThreadTime = 1; - -#ifdef WIN32 - OSVERSIONINFO sysInfo; - - sysInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); - GetVersionEx (&sysInfo); - - /* GetThreadTimes is not supported on 95/98. Hence, - we do not support Resource/User/System times */ - if (sysInfo.dwPlatformId != VER_PLATFORM_WIN32_NT) - fThreadTime = 0; -#endif -#if defined(TTCLIENTSERVER) && defined(__hpux) && !defined(__LP64__) - /* HP requires this for C main programs that call aC++ shared libs */ - _main(); -#endif /* hpux32 */ - - /* Set up default signal handlers */ - -#ifndef NDB - /* StopRequestClear(); - if (HandleSignals() != 0) { - err_msg0("Unable to set signal handlers\n"); - return 1; - } - */ -#endif - /* set IO mode for demo */ - /* set_io_mode(); */ - - /* initialize the file for status messages */ - statusfp = stdout; - - /* set variable for 8-byte longs */ - lp64 = (sizeof(lrand) == 8); - - /* set the default tuple sizes */ - - numBranchTups = NumBranches * scaleFactor; - numTellerTups = TellersPerBranch * scaleFactor; - numAccountTups = AccountsPerBranch * scaleFactor; - numNonLocalAccountTups = AccountsPerBranch * (scaleFactor-1); - - /* parse the command arguments */ - parse_args(argc, argv); - - /* allocate the transaction-based variables */ - - rtStart = (ttWallClockTime**) malloc(numXacts * sizeof(ttWallClockTime*)); - if (!rtStart) { - err_msg0("Cannot allocate the transaction timing structures"); - app_exit(1); - } - for (i = 0; i < numXacts; i++) { - rtStart[i] = (ttWallClockTime*) malloc(sizeof(ttWallClockTime)); - if (!rtStart[i]) { - err_msg0("Cannot allocate the transaction timing structures"); - app_exit(1); - } - } - - rtEnd = (ttWallClockTime**) malloc(numXacts * sizeof(ttWallClockTime*)); - if (!rtEnd) { - err_msg0("Cannot allocate the transaction timing structures"); - app_exit(1); - } - for (i = 0; i < numXacts; i++) { - rtEnd[i] = (ttWallClockTime*) malloc(sizeof(ttWallClockTime)); - if (!rtEnd[i]) { - err_msg0("Cannot allocate the transaction timing structures"); - app_exit(1); - } - } - - resTime = (double**) malloc(numXacts * sizeof(double*)); - if (!resTime) { - err_msg0("Cannot allocate the transaction timing structures"); - app_exit(1); - } - for (i = 0; i < numXacts; i++) { - resTime[i] = (double*) malloc(sizeof(double)); - if (!resTime[i]) { - err_msg0("Cannot allocate the transaction timing structures"); - app_exit(1); - } - } - - /* ODBC initialization */ - - rc = SQLAllocEnv(&henv); - if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - /* error occurred -- don't bother calling handle_errors, since handle - * is not valid so SQLError won't work */ - err_msg3("ERROR in %s, line %d: %s\n", - __FILE__, __LINE__, "allocating an environment handle"); - app_exit(1); - } - SQLSetEnvAttr(henv, SQL_ATTR_ODBC_VERSION, (SQLPOINTER)SQL_OV_ODBC3, SQL_IS_INTEGER); - - /* call this in case of warning */ - handle_errors(NULL, NULL, rc, NO_EXIT, - "allocating execution environment", - __FILE__, __LINE__); - - rc = SQLAllocConnect(henv, &hdbc); - handle_errors(NULL, NULL, rc, ERROR_EXIT, - "allocating connection handle", - __FILE__, __LINE__); - - /* Connect to data store */ - - status_msg0("Connecting to the data source...\n"); - - /* Set up the connection options if not specified on the command line - * (default to TimesTen settings). - */ - - if ( !*szConnStrIn ) { - /* Running the benchmark with a scale factor creates (scale) branches, - * (scale x 10) tellers, (scale x 10000) accounts and ((scale-1) x 10000) - * non-local accounts. The size of the table rows are branches (141) - * tellers (141) and accounts (141). Therefore the data size requirements - * of this benchmark is: - * size ~= 141 * ((scale * 20011) - 10000) (bytes) - * - * Multiply data size by 20% to account for additional DB overhead (e.g. - * indexes), and round up the nearest 10Mb for safety. - */ - - int est_size = (int) (3.6 * scaleFactor + 10.0); - est_size = est_size - (est_size % 10); - - sprintf(szConnStrIn,"OverWrite=1;PermSize=%d;%s", - est_size, DSNNAME); - status_msg0("Connecting to the data source... %s \n", szConnStrIn); - } - - rc = SQLDriverConnect(hdbc, NULL, (SQLCHAR *) szConnStrIn, SQL_NTS, - NULL, 0, NULL, - SQL_DRIVER_NOPROMPT); - - status_msg0("Connected to the data source...\n"); - sprintf(errstr, "connecting to driver (connect string %s)\n", - szConnStrIn); - handle_errors(hdbc, NULL, rc, ERROR_EXIT, - errstr, __FILE__, __LINE__); - - /* Turn auto-commit off */ - - rc = SQLSetConnectOption(hdbc, SQL_AUTOCOMMIT, SQL_AUTOCOMMIT_OFF); - handle_errors(hdbc, NULL, rc, DISCONNECT_EXIT, - "switching off the AUTO_COMMIT option", - __FILE__, __LINE__); - - /* Allocate a statement handle */ - - rc = SQLAllocStmt(hdbc, &hstmt); - handle_errors(hdbc, NULL, rc, DISCONNECT_EXIT, - "allocating a statement handle", - __FILE__, __LINE__); - - /* (Implicit) Transaction begin */ - - /* Determine the DBMS Type*/ - - DBMSName[0] = '\0'; - rc = SQLGetInfo(hdbc, SQL_DBMS_NAME, (PTR) &DBMSName, - sizeof(DBMSName), NULL); - rc = SQLGetInfo(hdbc, SQL_DRIVER_VER, (PTR) &DBMSVersion, - sizeof(DBMSVersion), NULL); - - if (strcmp(DBMSName, "TimesTen") == 0) - DBMSType = DBMS_TIMESTEN; - else if (strcmp(DBMSName, "Microsoft SQL Server") == 0) - DBMSType = DBMS_MSSQL; - else DBMSType = DBMS_UNKNOWN; - - /* if not TimesTen: delete (if it exists), create & use the new database */ - - if (DBMSType != DBMS_TIMESTEN) { - status_msg0("Deleting the database...\n"); - rc = SQLExecDirect(hstmt, (SQLCHAR *) DatabaseDropStmt, SQL_NTS); - - /* estimate database size, size = data space + log space - * data space = (#tuples)/(tuples per page) * 2K bytes/page - * tuples per page = useable page size / row size (no index) = 2016/(96+2) - * log space = #transactions * average log size for the program transaction mix - * database size is in MB - */ - - databaseSize = (int) ceil((((numBranchTups + numTellerTups + numAccountTups)/ - (2016/98)) * 2048 + (numXacts * 600)) / 1000000.0); - - status_msg1("Creating the database (%dMB)...\n", databaseSize); -#ifndef NDB - sprintf(cmdStr, DatabaseCreateStmt, databaseSize); - doImmed(hdbc, hstmt, cmdStr); - strcpy(cmdStr, DatabaseUseStmt); - doImmed(hdbc, hstmt, cmdStr); -#endif - } - - status_msg2("Connected to '%s' version '%s'...\n", DBMSName, DBMSVersion); - - /* create branches table */ - status_msg0("Creating tasddbles...\n"); -#ifndef NDB - if (DBMSType == DBMS_TIMESTEN) - sprintf(cmdStr, TTBranchCrTblStmt, numBranchTups/TuplesPerPage + 1); - else -#endif - sprintf(cmdStr, BranchCrTblStmt); - doImmed(hdbc, hstmt, cmdStr); - - /* create tellers table */ -#ifndef NDB - if (DBMSType == DBMS_TIMESTEN) - sprintf(cmdStr, TTTellerCrTblStmt, numTellerTups/TuplesPerPage + 1); - - else -#endif - sprintf(cmdStr, TellerCrTblStmt); - doImmed(hdbc, hstmt, cmdStr); - - /* create accounts table */ -#ifndef NDB - if (DBMSType == DBMS_TIMESTEN) - sprintf(cmdStr, TTAccountCrTblStmt, numAccountTups/TuplesPerPage + 1); - else -#endif - sprintf(cmdStr, AccountCrTblStmt); - doImmed(hdbc, hstmt, cmdStr); - - /* create History table */ - - doImmed(hdbc, hstmt, HistoryCrTblStmt); - - /* lock the database during population */ -#ifndef NDB - if ( DBMSType == DBMS_TIMESTEN ) { - rc = SQLExecDirect(hstmt, (SQLCHAR *)"call ttlocklevel('DS')", SQL_NTS); - handle_errors(hdbc, hstmt, rc, ABORT_DISCONNECT_EXIT, - "specifying dbs lock usage", - __FILE__, __LINE__); - /* make sure dbs lock take effect in next transaction */ - rc = SQLTransact(henv,hdbc,SQL_COMMIT); - if ( rc != SQL_SUCCESS) { - handle_errors(hdbc, SQL_NULL_HSTMT, rc, ERROR_EXIT, - "committing transaction", - __FILE__, __LINE__); - } - } -#endif - /* populate branches table */ - - - rc = SQLPrepare(hstmt, (SQLCHAR *) insStmt[0], SQL_NTS); - handle_errors(hdbc, hstmt, rc, ABORT_DISCONNECT_EXIT, - "preparing statement", - __FILE__, __LINE__); - - rc = SQLBindParameter(hstmt, 1, SQL_PARAM_INPUT, SQL_C_SLONG, SQL_INTEGER, 10, 0, &branchNum, sizeof branchNum, NULL); - - handle_errors(hdbc, hstmt, rc, ABORT_DISCONNECT_EXIT, - "binding parameter", - __FILE__, __LINE__); - - - status_msg1("Populating branches table (%" PTRINT_FMT " rows)...\n", - numBranchTups); - - - for (i=0; i= 0; warmup--) { - - int max_i = (warmup ? numXacts/10 : numXacts); - - /* Execute tpcb transaction max_i times.*/ - - if (warmup) { - status_msg1("\nWarming up with %d tpcb transactions...\n", max_i); - } - else { - status_msg1("Executing and timing %d tpcb transactions...\n", max_i); - } - - ttGetWallClockTime(&startT); - ttGetThreadTimes(&startRes); - - for (i = 0; i < max_i; i++) { - - lrand = lrand48(); - srands = (unsigned short *)(&lrand); - if (lp64) srands += 2; /* skip high half -- all zero */ - - /* randomly choose a teller */ - - tellerNum = srands[0] % numTellerTups; - - /* compute branch */ - - branchNum = (tellerNum / TellersPerBranch); - - /* randomly choose an account */ - - if (srands[1] < localLimit || numBranchTups == 1) { - - /* choose account local to selected branch */ - - accountNum = branchNum * AccountsPerBranch + - (lrand48() % AccountsPerBranch); - - ++numLocalXacts; - - } - else { - /* choose account not local to selected branch */ - - /* first select account in range [0,numNonLocalAccountTups) */ - - accountNum = lrand48() % numNonLocalAccountTups; - - /* if branch number of selected account is at least as big - * as local branch number, then increment account number - * by AccountsPerBranch to skip over local accounts - */ - - if ((accountNum/AccountsPerBranch) >= branchNum) - accountNum += AccountsPerBranch; - - ++numRemoteXacts; - } - - /* select delta amount, -999,999 to +999,999 */ - - delta = ((lrand48() % 1999999) - 999999); - - - /* begin timing the "residence time" */ - - ttGetWallClockTime(rtStart[i]); - - for ( j = 0; j < NumXactStmts - 2; j++) { - rc = SQLExecute(txstmt[j]); - handle_errors(hdbc, txstmt[j], rc, ABORT_DISCONNECT_EXIT, - "Error executing statement1", - __FILE__, __LINE__); - - /* Close the handle after the SELECT statement - * (txstmt[1]) for non TimesTen DBMS' */ - - if ((DBMSType != DBMS_TIMESTEN) && (j == 1)) { - SQLFreeStmt(txstmt[1], SQL_CLOSE); - } - - - } - - /* note that time must be taken within the */ - timeStamp = time(NULL); - - rc = SQLExecute(txstmt[NumXactStmts - 1]); - handle_errors(hdbc, txstmt[NumXactStmts - 1], rc, - ABORT_DISCONNECT_EXIT, "Error executing statement2", - __FILE__, __LINE__); - - rc = SQLTransact(henv, hdbc, SQL_COMMIT); - handle_errors(hdbc, NULL, rc, ERROR_EXIT, - "Error committing transaction", - __FILE__, __LINE__); - - ttGetWallClockTime(rtEnd[i]); - - } /* end fortransaction loop */ - - - - - ttGetThreadTimes(&endRes); - ttGetWallClockTime(&endT); - ttCalcElapsedThreadTimes(&startRes, &endRes, &kernel, &user); - ttCalcElapsedWallClockTime(&startT, &endT, &real); - - if (warmup) { - if (!tabFlag) { - if (verbose) { - if (fThreadTime) { - out_msg0(" time user system\n"); - - out_msg3("Warmup time (sec): %12.3f %12.3f %12.3f\n\n", - real/1000.0, user, kernel); - } else { - out_msg1("Warmup time (sec): %12.3f\n\n", real/1000.0); - } - } - } else { - if (verbose) { - if (fThreadTime) { - out_msg0("\ttime\tuser\tsystem\n"); - - out_msg3("Warmup time (sec):\t%12.3f\t%12.3f\t%12.3f\n", - real/1000.0, user, kernel); - } else { - out_msg1("Warmup time (sec):\t%12.3f\n", real/1000.0); - } - } - } - } - } - - status_msg0("\nExecution completed...\n"); - - /* Compute and report timing statistics */ - - maxTime = 0.0; - totTime = 0.0; - - for (i = 0; i < numXacts; i++) { - ttCalcElapsedWallClockTime(rtStart[i], rtEnd[i], resTime[i]); - totTime += *(resTime[i]); - - if (*(resTime[i]) > maxTime) maxTime = *(resTime[i]); - } - - if (!tabFlag) { - if (verbose) { - if (fThreadTime) { - out_msg0(" time user system\n"); - out_msg3("Total time (sec): %12.3f %12.3f %12.3f\n", - real/1000.0, user, kernel); - } else { - out_msg1("Total time (sec): %12.3f\n", real/1000.0); - } - } - - if (verbose) - out_msg1("\nAverage transaction time (msec):%12.3f\n", - totTime/numXacts); - if (verbose) - out_msg1("Maximum transaction time (msec):%12.3f\n", maxTime); - if (verbose) - out_msg1("\nLocal transactions: %7" PTRINT_FMT "\n", numLocalXacts); - if (verbose) - out_msg1("Remote transactions: %7" PTRINT_FMT "\n", numRemoteXacts); - - } else { - if (verbose) { - if (fThreadTime) { - out_msg0("\ttime\tuser\tsystem\n"); - out_msg3("Total time (sec):\t%12.3f\t%12.3f\t%12.3f\n", - real/1000.0, user, kernel); - } else { - out_msg1("Total time (sec):\t%12.3f\n", real/1000.0); - } - } - - if (verbose) - out_msg1("\nAverage transaction time (msec):\t%12.3f\n", - totTime/numXacts); - if (verbose) - out_msg1("Maximum transaction time (msec):\t%12.3f\n", maxTime); - if (verbose) - out_msg1("Local transactions:\t%7" PTRINT_FMT "\n", numLocalXacts); - - if (verbose) - out_msg1("Remote transactions:\t%7" PTRINT_FMT "\n", numRemoteXacts); - - - - } - - /* If the statfile option is selected, print each transaction's time */ - - if (printXactTimes) { - FILE * fp; - if ( (fp = fopen (statFile, "w")) == NULL ) { - err_msg1("Unable to open stat file %s for writing\n\n", statFile); - } else { - for (int i = 0; i < numXacts; i++) - fprintf(fp,"%6d: %12.3f\n", i, *(resTime[i])); - fclose(fp); - } - } - - /* Disconnect and return */ - - rc = SQLFreeStmt(hstmt, SQL_DROP); - handle_errors(hdbc, hstmt, rc, ABORT_DISCONNECT_EXIT, - "dropping the statement handle", - __FILE__, __LINE__); - - for (int i=0; i= VERBOSE_DFLT) - status_msg0("Disconnecting from the data source...\n"); - - rc = SQLDisconnect(hdbc); - handle_errors(hdbc, NULL, rc, ERROR_EXIT, - "disconnecting", - __FILE__, __LINE__); - - rc = SQLFreeConnect(hdbc); - handle_errors(hdbc, NULL, rc, ERROR_EXIT, - "freeing connection handle", - __FILE__, __LINE__); - - rc = SQLFreeEnv(henv); - handle_errors(NULL, NULL, rc, ERROR_EXIT, - "freeing environment handle", - __FILE__, __LINE__); - - app_exit(0); - return 0; -} - - - - - -/* Emacs variable settings */ -/* Local Variables: */ -/* tab-width:8 */ -/* indent-tabs-mode:nil */ -/* c-basic-offset:2 */ -/* End: */ - - - diff --git a/ndb/test/odbc/tpcb/ttTime.c b/ndb/test/odbc/tpcb/ttTime.c deleted file mode 100644 index 8f10b0c6b91..00000000000 --- a/ndb/test/odbc/tpcb/ttTime.c +++ /dev/null @@ -1,366 +0,0 @@ -/* Copyright (C) 2003 MySQL AB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - -static const volatile char cvsid[] = "$Id: ttTime.c,v 1.1 2003/09/23 12:43:46 johan Exp $"; -/* - * $Revision: 1.1 $ - * (c) Copyright 1996-2003, TimesTen, Inc. - * All rights reserved. - * - */ - - -/* Contains functions for performing elapsed-time calculations - in a portable manner */ - -#include "ttTime.h" - -#ifdef WIN32 - -#include -#include - -/*------------*/ -/* NT VERSION */ -/*------------*/ - -/********************************************************************* - * - * FUNCTION: ttGetThreadTimes - * - * DESCRIPTION: This function sets the supplied parameter's - * user and kernel time for the current thread. - * - * PARAMETERS: ttThreadTimes* timesP thread time structure - * - * RETURNS: void - * - * NOTES: NONE - * - *********************************************************************/ - -void -ttGetThreadTimes(ttThreadTimes* timesP) -{ - BOOL rc; - HANDLE curThread; - FILETIME creationTime; - FILETIME exitTime; - FILETIME kTime; - FILETIME uTime; - - memset (&kTime, 0, sizeof (FILETIME)); - memset (&uTime, 0, sizeof (FILETIME)); - - curThread = GetCurrentThread(); - rc = GetThreadTimes(curThread, - &creationTime, - &exitTime, - &kTime, - &uTime); - - timesP->kernelTime = kTime; - timesP->userTime = uTime; - -} - -/********************************************************************* - * - * FUNCTION: ttCalcElapsedThreadTimes - * - * DESCRIPTION: This function calculates the user and kernel - * time deltas. - * - * PARAMETERS: ttThreadTimes* beforeP beginning timestamp (IN) - * ttThreadTimes* afterP ending timestamp (IN) - * double* kernelDeltaP kernel time delta (OUT) - * double* userDeltaP user time delta (OUT) - * - * RETURNS: void - * - * NOTES: NONE - * - *********************************************************************/ - -void -ttCalcElapsedThreadTimes(ttThreadTimes* beforeP, - ttThreadTimes* afterP, - double* kernelDeltaP, - double* userDeltaP) -{ - static const double secPerHi = (double) 4.294967296; /* 2**32 * 10**-9 */ - FILETIME *before, *after; - - before = &beforeP->kernelTime; - after = &afterP->kernelTime; - *kernelDeltaP = (double) ((after->dwHighDateTime - before->dwHighDateTime) * secPerHi - + (after->dwLowDateTime - before->dwLowDateTime) * 100e-9); - before = &beforeP->userTime; - after = &afterP->userTime; - *userDeltaP = (double) ((after->dwHighDateTime - before->dwHighDateTime) * secPerHi - + (after->dwLowDateTime - before->dwLowDateTime) * 100e-9); -} - -/********************************************************************* - * - * FUNCTION: ttGetWallClockTime - * - * DESCRIPTION: This function gets the current wall-clock time. - * - * PARAMETERS: ttWallClockTime* timeP tms time structure (OUT) - * - * RETURNS: void - * - * NOTES: NONE - * - *********************************************************************/ - -void -ttGetWallClockTime(ttWallClockTime* timeP) -{ - LARGE_INTEGER frequency; - if ( QueryPerformanceFrequency(&frequency) ) { - QueryPerformanceCounter(&(timeP->time64)); - } - else { - _ftime(&(timeP->notSoLargeTime)); - } -} - -/********************************************************************* - * - * FUNCTION: ttCalcElapsedWallClockTime - * - * DESCRIPTION: This function calculates the elapsed wall-clock - * time in msec. - * - * PARAMETERS: ttWallClockTime* beforeP starting timestamp - * ttWallClockTime* afterP ending timestamp - * double* nmillisecondsP elapsed time (OUT) - * - * RETURNS: void - * - * NOTES: NONE - * - *********************************************************************/ - -void -ttCalcElapsedWallClockTime(ttWallClockTime* beforeP, - ttWallClockTime* afterP, - double* nmillisecondsP) -{ - LARGE_INTEGER frequency; - - if ( QueryPerformanceFrequency(&frequency) ) { - *nmillisecondsP = 1000 * ((double) (afterP->time64.QuadPart - - beforeP->time64.QuadPart)) - / frequency.QuadPart; - - } - else { - double start; - double end; - - start = (double) beforeP->notSoLargeTime.time * 1000. + - (double) beforeP->notSoLargeTime.millitm; - end = (double) afterP->notSoLargeTime.time * 1000. + - (double) afterP->notSoLargeTime.millitm; - - *nmillisecondsP = (double) (end - start); - } -} - -#elif defined (RTSYS_VXWORKS) - -/*-----------------*/ -/* VxWorks VERSION */ -/*-----------------*/ - -/* - * The TimeBase registers have a period of 60ns, i.e. - * 0.00000006 or (6e-8) seconds. - */ -#define TIMER_MSEC_PER_CYC (6e-5) - -void -ttGetWallClockTime(ttWallClockTime* timeP) -{ - vxTimeBaseGet(&timeP->sep.upper32, &timeP->sep.lower32); -} - - -void -ttCalcElapsedWallClockTime(ttWallClockTime* beforeP, - ttWallClockTime* afterP, - double* nmillisecondsP) -{ - *nmillisecondsP = (double)(afterP->val - beforeP->val) * TIMER_MSEC_PER_CYC; -} - - -#else - -/*--------------*/ -/* UNIX VERSION */ -/*--------------*/ - -#include - -/********************************************************************* - * - * FUNCTION: ttGetThreadTimes - * - * DESCRIPTION: This function sets the supplied parameter's - * tms structure. - * - * PARAMETERS: ttThreadTimes* timesP tms time structure - * - * RETURNS: void - * - * NOTES: NONE - * - *********************************************************************/ - -#ifdef SB_P_OS_CHORUS -void ttGetThreadTimes(ttThreadTimes* timesP) -{ - KnCap actorCap; - - if (acap (agetId(), &actorCap) == -1) { - timesP->ins.tmSec = 0; - timesP->ins.tmNSec = 0; - timesP->ext.tmSec = 0; - timesP->ext.tmNSec = 0; - } - else { - (void) threadTimes (&actorCap, K_ALLACTORTHREADS, - ×P->ins, ×P->ext); - } -} -#else -void ttGetThreadTimes(ttThreadTimes* timesP) -{ - (void) times(timesP); -} -#endif - -/********************************************************************* - * - * FUNCTION: ttCalcElapsedThreadTimes - * - * DESCRIPTION: This function calculates the user and kernel - * time deltas. - * - * PARAMETERS: ttThreadTimes* beforeP beginning timestamp (IN) - * ttThreadTimes* afterP ending timestamp (IN) - * double* kernelDeltaP kernel time delta (OUT) - * double* userDeltaP user time delta (OUT) - * - * RETURNS: void - * - * NOTES: NONE - * - *********************************************************************/ - -#ifdef SB_P_OS_CHORUS -void -ttCalcElapsedThreadTimes(ttThreadTimes* beforeP, - ttThreadTimes* afterP, - double* kernelDeltaP, - double* userDeltaP) -{ - double kernelBefore; - double kernelAfter; - double userBefore; - double userAfter; - - kernelBefore = (beforeP->ext.tmSec) + (beforeP->ext.tmNSec / 1e9); - kernelAfter = (afterP->ext.tmSec) + (afterP->ext.tmNSec / 1e9); - *kernelDeltaP = kernelAfter - kernelBefore; - - userBefore = (beforeP->ins.tmSec) + (beforeP->ins.tmNSec / 1e9); - userAfter = (afterP->ins.tmSec) + (afterP->ins.tmNSec / 1e9); - *userDeltaP = userAfter - userBefore; - -} -#else -void -ttCalcElapsedThreadTimes(ttThreadTimes* beforeP, - ttThreadTimes* afterP, - double* kernelDeltaP, - double* userDeltaP) -{ - double ticks = (double)sysconf(_SC_CLK_TCK); - - *kernelDeltaP = (afterP->tms_stime - beforeP->tms_stime) / ticks; - *userDeltaP = (afterP->tms_utime - beforeP->tms_utime) / ticks; -} -#endif - -/********************************************************************* - * - * FUNCTION: ttGetWallClockTime - * - * DESCRIPTION: This function gets the current wall-clock time. - * - * PARAMETERS: ttWallClockTime* timeP tms time structure (OUT) - * - * RETURNS: void - * - * NOTES: NONE - * - *********************************************************************/ - -void -ttGetWallClockTime(ttWallClockTime* timeP) -{ - gettimeofday(timeP, NULL); -} - -/********************************************************************* - * - * FUNCTION: ttCalcElapsedWallClockTime - * - * DESCRIPTION: This function calculates the elapsed wall-clock - * time is msec. - * - * PARAMETERS: ttWallClockTime* beforeP starting timestamp - * ttWallClockTime* afterP ending timestamp - * double* nmillisecondsP elapsed time (OUT) - * - * RETURNS: void - * - * NOTES: NONE - * - *********************************************************************/ - -void -ttCalcElapsedWallClockTime(ttWallClockTime* beforeP, - ttWallClockTime* afterP, - double* nmillisP) -{ - *nmillisP = (afterP->tv_sec - beforeP->tv_sec)*1000.0 + - (afterP->tv_usec - beforeP->tv_usec)/1000.0; -} - -#endif - -/* Emacs variable settings */ -/* Local Variables: */ -/* tab-width:8 */ -/* indent-tabs-mode:nil */ -/* c-basic-offset:2 */ -/* End: */ diff --git a/ndb/test/odbc/tpcb/ttTime.h b/ndb/test/odbc/tpcb/ttTime.h deleted file mode 100644 index f78b71667fe..00000000000 --- a/ndb/test/odbc/tpcb/ttTime.h +++ /dev/null @@ -1,125 +0,0 @@ -/* Copyright (C) 2003 MySQL AB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - -/* - * $Revision: 1.1 $ - * (c) Copyright 1996-2003, TimesTen, Inc. - * All rights reserved. - * - */ - -#ifndef __TT_TIME -#define __TT_TIME - - -#ifdef WIN32 - -#include -#include -#include - -typedef struct { - FILETIME kernelTime; - FILETIME userTime; -} ttThreadTimes; - - -typedef union { - LARGE_INTEGER time64; - struct _timeb notSoLargeTime; -} ttWallClockTime; - -#elif defined(RTSYS_VXWORKS) - -#define srand48(x) sb_srand48((x)) -#define drand48() sb_drand48() - -#ifdef SB_P_OS_VXPPC -/* For little-endian switch the lower, upper fields */ -typedef union { - struct { - unsigned int upper32; - unsigned int lower32; - } sep; - long long val; -} ttWallClockTime; - -/* - * This is a VxWorks private function to read the PPC's 64 bit Time Base - * Register. This is the assembler dump of this function. - 001126e4 7cad42e6 mftb r5, TBU - 001126e8 7ccc42e6 mftb r6, TBL - 001126ec 7ced42e6 mftb r7, TBU - 001126f0 7c053800 cmp crf0, 0, r5, r7 - 001126f4 4082fff0 bc 0x4, 0x2, vxTimeBaseGet - 001126f8 90a30000 stw r5, 0x0(r3) - 001126fc 90c40000 stw r6, 0x0(r4) - 00112700 4e800020 blr - * This is a fine grained timer with a period of 60ns. - */ -void vxTimeBaseGet(unsigned int* pUpper32, unsigned int* pLower32); -#endif /* SB_P_OS_VXPPC */ - -#elif defined(SB_P_OS_CHORUS) -#include -#include -#include - -#include - -struct chrTimes { - KnTimeVal ins; - KnTimeVal ext; -}; -typedef struct chrTimes ttThreadTimes; - -typedef struct timeval ttWallClockTime; - -#else -/* UNIX version */ - -#include -#include - -typedef struct tms ttThreadTimes; - -typedef struct timeval ttWallClockTime; - -#endif /* NT, VxWorks, Chorus, Unix */ - - -#ifndef RTSYS_VXWORKS -void ttGetThreadTimes(ttThreadTimes* timesP); -void ttCalcElapsedThreadTimes(ttThreadTimes* beforeP, ttThreadTimes* afterP, - double* kernelDeltaP, double* userDeltaP); -#endif /* ! VXWORKS */ -void ttGetWallClockTime(ttWallClockTime* timeP); -void ttCalcElapsedWallClockTime(ttWallClockTime* beforeP, - ttWallClockTime* afterP, - double* nmillisecondsP); - - - - - -#endif /* __TT_TIME */ - -/* Emacs variable settings */ -/* Local Variables: */ -/* tab-width:8 */ -/* indent-tabs-mode:nil */ -/* c-basic-offset:2 */ -/* End: */ From 9bd7def36943eca0be244a5da30d9a007f8aa935 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 5 Nov 2004 22:15:24 -0800 Subject: [PATCH 25/28] join_outer.result, join_outer.test: Added cases for bugs #6307 and #6460. sql_select.cc: Fixed the problem of bug reports #6307 and #6460. The reported wrong result sets were due to the fact that the added call of the fix_fields method for the built AND condition that joined WHERE and ON conditions broke ON expression, as it removed extra AND levels in the built condition. It looks like that no attributes of the built condition are needed, so we don't have to call fix_fields here. sql/sql_select.cc: Fixed the problem of bug report #6307 and #6460. The reported wrong result sets were due to the fact that the added call of the fix_fields method for the built AND condition that joined WHERE and ON conditions broke ON expression. It looks like that no attributes of the built condition are needed, so we don't have to call fix_fields here. mysql-test/t/join_outer.test: Added cases for bugs #6307 and #6460. mysql-test/r/join_outer.result: Added cases for bugs #6307 and #6460. --- mysql-test/r/join_outer.result | 65 +++++++++++++++++++++++++++++ mysql-test/t/join_outer.test | 76 ++++++++++++++++++++++++++++++++++ sql/sql_select.cc | 11 ++++- 3 files changed, 151 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/join_outer.result b/mysql-test/r/join_outer.result index 75bf96cb401..c045aa0d00a 100644 --- a/mysql-test/r/join_outer.result +++ b/mysql-test/r/join_outer.result @@ -751,3 +751,68 @@ player_id match_1_h * match_id home UUX 7 4 * 1 2 2 3 3 * 1 2 1 drop table t1, t2; +create table t1 (a int, b int, unique index idx (a, b)); +create table t2 (a int, b int, c int, unique index idx (a, b)); +insert into t1 values (1, 10), (1,11), (2,10), (2,11); +insert into t2 values (1,10,3); +select t1.a, t1.b, t2.c from t1 left join t2 +on t1.a=t2.a and t1.b=t2.b and t2.c=3 +where t1.a=1 and t2.c is null; +a b c +1 11 NULL +drop table t1, t2; +CREATE TABLE t1 ( +ts_id bigint(20) default NULL, +inst_id tinyint(4) default NULL, +flag_name varchar(64) default NULL, +flag_value text, +UNIQUE KEY ts_id (ts_id,inst_id,flag_name) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +CREATE TABLE t2 ( +ts_id bigint(20) default NULL, +inst_id tinyint(4) default NULL, +flag_name varchar(64) default NULL, +flag_value text, +UNIQUE KEY ts_id (ts_id,inst_id,flag_name) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +INSERT INTO t1 VALUES +(111056548820001, 0, 'flag1', NULL), +(111056548820001, 0, 'flag2', NULL), +(2, 0, 'other_flag', NULL); +INSERT INTO t2 VALUES +(111056548820001, 3, 'flag1', 'sss'); +SELECT t1.flag_name,t2.flag_value +FROM t1 LEFT JOIN t2 +ON (t1.ts_id = t2.ts_id AND t1.flag_name = t2.flag_name AND +t2.inst_id = 3) +WHERE t1.inst_id = 0 AND t1.ts_id=111056548820001 AND +t2.flag_value IS NULL; +flag_name flag_value +flag2 NULL +DROP TABLE t1,t2; +CREATE TABLE invoice ( +id int(11) unsigned NOT NULL auto_increment, +text_id int(10) unsigned default NULL, +PRIMARY KEY (id) +); +INSERT INTO invoice VALUES("1", "0"); +INSERT INTO invoice VALUES("2", "10"); +CREATE TABLE text_table ( +text_id char(3) NOT NULL default '', +language_id char(3) NOT NULL default '', +text_data text, +PRIMARY KEY (text_id,language_id) +); +INSERT INTO text_table VALUES("0", "EN", "0-EN"); +INSERT INTO text_table VALUES("0", "SV", "0-SV"); +INSERT INTO text_table VALUES("10", "EN", "10-EN"); +INSERT INTO text_table VALUES("10", "SV", "10-SV"); +SELECT invoice.id, invoice.text_id, text_table.text_data +FROM invoice LEFT JOIN text_table +ON invoice.text_id = text_table.text_id +AND text_table.language_id = 'SV' + WHERE (invoice.id LIKE '%' OR text_table.text_data LIKE '%'); +id text_id text_data +1 0 0-SV +2 10 10-SV +DROP TABLE invoice, text_table; diff --git a/mysql-test/t/join_outer.test b/mysql-test/t/join_outer.test index bc96318ae2e..d177a68e685 100644 --- a/mysql-test/t/join_outer.test +++ b/mysql-test/t/join_outer.test @@ -506,3 +506,79 @@ select s.*, '*', m.*, (s.match_1_h - m.home) UUX from order by UUX desc; drop table t1, t2; + +# Tests for bugs #6307 and 6460 + +create table t1 (a int, b int, unique index idx (a, b)); +create table t2 (a int, b int, c int, unique index idx (a, b)); + +insert into t1 values (1, 10), (1,11), (2,10), (2,11); +insert into t2 values (1,10,3); + +select t1.a, t1.b, t2.c from t1 left join t2 + on t1.a=t2.a and t1.b=t2.b and t2.c=3 + where t1.a=1 and t2.c is null; + +drop table t1, t2; + +CREATE TABLE t1 ( + ts_id bigint(20) default NULL, + inst_id tinyint(4) default NULL, + flag_name varchar(64) default NULL, + flag_value text, + UNIQUE KEY ts_id (ts_id,inst_id,flag_name) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; + +CREATE TABLE t2 ( + ts_id bigint(20) default NULL, + inst_id tinyint(4) default NULL, + flag_name varchar(64) default NULL, + flag_value text, + UNIQUE KEY ts_id (ts_id,inst_id,flag_name) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; + +INSERT INTO t1 VALUES + (111056548820001, 0, 'flag1', NULL), + (111056548820001, 0, 'flag2', NULL), + (2, 0, 'other_flag', NULL); + +INSERT INTO t2 VALUES + (111056548820001, 3, 'flag1', 'sss'); + +SELECT t1.flag_name,t2.flag_value + FROM t1 LEFT JOIN t2 + ON (t1.ts_id = t2.ts_id AND t1.flag_name = t2.flag_name AND + t2.inst_id = 3) + WHERE t1.inst_id = 0 AND t1.ts_id=111056548820001 AND + t2.flag_value IS NULL; + +DROP TABLE t1,t2; + +CREATE TABLE invoice ( + id int(11) unsigned NOT NULL auto_increment, + text_id int(10) unsigned default NULL, + PRIMARY KEY (id) +); + +INSERT INTO invoice VALUES("1", "0"); +INSERT INTO invoice VALUES("2", "10"); + +CREATE TABLE text_table ( + text_id char(3) NOT NULL default '', + language_id char(3) NOT NULL default '', + text_data text, + PRIMARY KEY (text_id,language_id) +); + +INSERT INTO text_table VALUES("0", "EN", "0-EN"); +INSERT INTO text_table VALUES("0", "SV", "0-SV"); +INSERT INTO text_table VALUES("10", "EN", "10-EN"); +INSERT INTO text_table VALUES("10", "SV", "10-SV"); + +SELECT invoice.id, invoice.text_id, text_table.text_data + FROM invoice LEFT JOIN text_table + ON invoice.text_id = text_table.text_id + AND text_table.language_id = 'SV' + WHERE (invoice.id LIKE '%' OR text_table.text_data LIKE '%'); + +DROP TABLE invoice, text_table; diff --git a/sql/sql_select.cc b/sql/sql_select.cc index df74a946b5c..0a921ddb235 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -3507,8 +3507,17 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond) /* Join with outer join condition */ COND *orig_cond=sel->cond; sel->cond= and_conds(sel->cond, tab->on_expr); + + /* + We can't call sel->cond->fix_fields, + as it will break tab->on_expr if it's AND condition + (fix_fields currently removes extra AND/OR levels). + Yet attributes of the just built condition are not needed. + Thus we call sel->cond->quick_fix_field for safety. + */ if (sel->cond && !sel->cond->fixed) - sel->cond->fix_fields(join->thd, 0, &sel->cond); + sel->cond->quick_fix_field(); + if (sel->test_quick_select(join->thd, tab->keys, used_tables & ~ current_map, (join->select_options & From 7c927251645138beaf42f06c762f7d85c07682c5 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 6 Nov 2004 14:01:27 +0100 Subject: [PATCH 26/28] mysql_test_run_new.c: Included header fnmatch.h on Unix Changed C++ comments to C comments Corrected indentation of code written on Windows Split up lines to fit into 80 columns Initiated some variables to avoid warnings Added __attribute__((unused)) to unused function parameters Replace tab characters with space Put space after 'for', 'while' etc Added value to 'return' from non void function removef() On Unix strlwr() was incorrectly declared and a no op, replaced it with a macro that does nothing Split several statements on the same line Other minor changes to conform to coding standard mysql-test/mysql_test_run_new.c: Included header fnmatch.h on Unix Changed C++ comments to C comments Corrected indentation of code written on Windows Split up lines to fit into 80 columns Initiated some variables to avoid warnings Added __attribute__((unused)) to unused function parameters Replace tab characters with space Put space after 'for', 'while' etc Added value to 'return' from non void function removef() On Unix strlwr() was incorrectly declared and a no op, replaced it with a macro that does nothing Split several statements on the same line Other minor changes to conform to coding standard --- mysql-test/my_manage.c | 527 +++++++++--------- mysql-test/my_manage.h | 26 +- mysql-test/mysql_test_run_new.c | 913 +++++++++++++++++--------------- 3 files changed, 750 insertions(+), 716 deletions(-) diff --git a/mysql-test/my_manage.c b/mysql-test/my_manage.c index e23d4f2227e..ba5c674d105 100644 --- a/mysql-test/my_manage.c +++ b/mysql-test/my_manage.c @@ -30,6 +30,7 @@ #ifndef __WIN__ #include #include +#include #else #include #include @@ -52,36 +53,37 @@ extern char **environ; /****************************************************************************** - macros - + macros + ******************************************************************************/ /****************************************************************************** - global variables - + global variables + ******************************************************************************/ /****************************************************************************** - functions - + functions + ******************************************************************************/ /****************************************************************************** - init_args() - - Init an argument list. + init_args() + + Init an argument list. ******************************************************************************/ + void init_args(arg_list_t *al) { ASSERT(al != NULL); - - al->argc = 0; - al->size = ARG_BUF; - al->argv = malloc(al->size * sizeof(char *)); + + al->argc= 0; + al->size= ARG_BUF; + al->argv= malloc(al->size * sizeof(char *)); ASSERT(al->argv != NULL); return; @@ -89,11 +91,12 @@ void init_args(arg_list_t *al) /****************************************************************************** - add_arg() - - Add an argument to a list. + add_arg() + + Add an argument to a list. ******************************************************************************/ + void add_arg(arg_list_t *al, const char *format, ...) { va_list ap; @@ -101,11 +104,11 @@ void add_arg(arg_list_t *al, const char *format, ...) ASSERT(al != NULL); - // increase size + /* increase size */ if (al->argc >= (int)al->size) { - al->size += ARG_BUF; - al->argv = realloc(al->argv, al->size * sizeof(char *)); + al->size+= ARG_BUF; + al->argv= realloc(al->argv, al->size * sizeof(char *)); ASSERT(al->argv != NULL); } @@ -115,7 +118,7 @@ void add_arg(arg_list_t *al, const char *format, ...) vsprintf(temp, format, ap); va_end(ap); - al->argv[al->argc] = malloc(strlen(temp)+1); + al->argv[al->argc]= malloc(strlen(temp)+1); ASSERT(al->argv[al->argc] != NULL); strcpy(al->argv[al->argc], temp); @@ -123,7 +126,7 @@ void add_arg(arg_list_t *al, const char *format, ...) } else { - al->argv[al->argc] = NULL; + al->argv[al->argc]= NULL; } return; @@ -131,102 +134,108 @@ void add_arg(arg_list_t *al, const char *format, ...) /****************************************************************************** - free_args() - - Free an argument list. + free_args() + + Free an argument list. ******************************************************************************/ + void free_args(arg_list_t *al) { int i; ASSERT(al != NULL); - for(i = 0; i < al->argc; i++) + for (i= 0; i < al->argc; i++) { ASSERT(al->argv[i] != NULL); free(al->argv[i]); - al->argv[i] = NULL; + al->argv[i]= NULL; } free(al->argv); - al->argc = 0; - al->argv = NULL; + al->argc= 0; + al->argv= NULL; return; } /****************************************************************************** - sleep_until_file_deleted() - - Sleep until the given file is no longer found. + sleep_until_file_deleted() + + Sleep until the given file is no longer found. ******************************************************************************/ + #ifndef __WIN__ int sleep_until_file_deleted(char *pid_file) #else int sleep_until_file_deleted(HANDLE pid_file) #endif { - int err; + int err= 0; /* Initiate to supress warning */ #ifndef __WIN__ - struct stat buf; - int i; - - for(i = 0; (i < TRY_MAX) && (err = !stat(pid_file, &buf)); i++) sleep(1); - - if (err != 0) err = errno; + struct stat buf; + int i; + + for (i= 0; (i < TRY_MAX) && (err= !stat(pid_file, &buf)); i++) sleep(1); + + if (err != 0) err= errno; #else err= (WaitForSingleObject(pid_file, TRY_MAX*1000) == WAIT_TIMEOUT); #endif - return err; + return err; } /****************************************************************************** - sleep_until_file_exists() + sleep_until_file_exists() - Sleep until the given file exists. + Sleep until the given file exists. ******************************************************************************/ + #ifndef __WIN__ int sleep_until_file_exists(char *pid_file) #else int sleep_until_file_exists(HANDLE pid_file) #endif { - int err; + int err= 0; /* Initiate to supress warning */ #ifndef __WIN__ - struct stat buf; - int i; - - for(i = 0; (i < TRY_MAX) && (err = stat(pid_file, &buf)); i++) sleep(1); - - if (err != 0) err = errno; + struct stat buf; + int i; + + for (i= 0; (i < TRY_MAX) && (err= stat(pid_file, &buf)); i++) sleep(1); + + if (err != 0) err= errno; #else err= (WaitForSingleObject(pid_file, TRY_MAX*1000) == WAIT_TIMEOUT); #endif - return err; + return err; } /****************************************************************************** - wait_for_server_start() - - Wait for the server on the given port to start. + wait_for_server_start() + + Wait for the server on the given port to start. ******************************************************************************/ -int wait_for_server_start(char *bin_dir, char *mysqladmin_file, char *user, char *password, int port,char *tmp_dir) + +int wait_for_server_start(char *bin_dir __attribute__((unused)), + char *mysqladmin_file, + char *user, char *password, int port,char *tmp_dir) { arg_list_t al; - int err, i; + int err= 0, i; char trash[PATH_MAX]; - - // mysqladmin file + + /* mysqladmin file */ snprintf(trash, PATH_MAX, "%s/trash.out",tmp_dir); - - // args + + /* args */ init_args(&al); add_arg(&al, "%s", mysqladmin_file); add_arg(&al, "--no-defaults"); @@ -235,7 +244,7 @@ int wait_for_server_start(char *bin_dir, char *mysqladmin_file, char *user, char add_arg(&al, "--password=%s", password); add_arg(&al, "--silent"); -//#ifdef NOT_USED +/* #ifdef NOT_USED */ #ifndef __NETWARE__ add_arg(&al, "-O"); add_arg(&al, "connect_timeout=10"); @@ -245,20 +254,22 @@ int wait_for_server_start(char *bin_dir, char *mysqladmin_file, char *user, char add_arg(&al, "--host=localhost"); #ifndef __NETWARE__ add_arg(&al, "--protocol=tcp"); -#endif +#endif add_arg(&al, "ping"); - // NetWare does not support the connect timeout in the TCP/IP stack - // -- we will try the ping multiple times + /* + NetWare does not support the connect timeout in the TCP/IP stack + -- we will try the ping multiple times + */ #ifndef __WIN__ - for(i = 0; (i < TRY_MAX) - && (err = spawn(mysqladmin_file, &al, TRUE, NULL, - trash, NULL, NULL)); i++) sleep(1); + for (i= 0; (i < TRY_MAX) + && (err= spawn(mysqladmin_file, &al, TRUE, NULL, + trash, NULL, NULL)); i++) sleep(1); #else - err = spawn(mysqladmin_file, &al, TRUE, NULL,trash, NULL, NULL); + err= spawn(mysqladmin_file, &al, TRUE, NULL,trash, NULL, NULL); #endif - // free args + /* free args */ free_args(&al); return err; @@ -266,38 +277,39 @@ int wait_for_server_start(char *bin_dir, char *mysqladmin_file, char *user, char /****************************************************************************** - spawn() - - Spawn the given path with the given arguments. + spawn() + + Spawn the given path with the given arguments. ******************************************************************************/ + #ifdef __NETWARE__ int spawn(char *path, arg_list_t *al, int join, char *input, char *output, char *error, char *pid_file) { - pid_t pid; - int result = 0; - wiring_t wiring = { FD_UNUSED, FD_UNUSED, FD_UNUSED }; - unsigned long flags = PROC_CURRENT_SPACE | PROC_INHERIT_CWD; + pid_t pid; + int result= 0; + wiring_t wiring= { FD_UNUSED, FD_UNUSED, FD_UNUSED }; + unsigned long flags= PROC_CURRENT_SPACE | PROC_INHERIT_CWD; - // open wiring + /* open wiring */ if (input) - wiring.infd = open(input, O_RDONLY); + wiring.infd= open(input, O_RDONLY); if (output) - wiring.outfd = open(output, O_WRONLY | O_CREAT | O_TRUNC); + wiring.outfd= open(output, O_WRONLY | O_CREAT | O_TRUNC); if (error) - wiring.errfd = open(error, O_WRONLY | O_CREAT | O_TRUNC); + wiring.errfd= open(error, O_WRONLY | O_CREAT | O_TRUNC); - // procve requires a NULL + /* procve requires a NULL */ add_arg(al, NULL); - // go - pid = procve(path, flags, NULL, &wiring, NULL, NULL, 0, - NULL, (const char **)al->argv); + /* go */ + pid= procve(path, flags, NULL, &wiring, NULL, NULL, 0, + NULL, (const char **)al->argv); - // close wiring + /* close wiring */ if (wiring.infd != -1) close(wiring.infd); @@ -307,7 +319,7 @@ int spawn(char *path, arg_list_t *al, int join, char *input, if (wiring.errfd != -1) close(wiring.errfd); - return result; + return result; } #elif __WIN__ @@ -322,18 +334,16 @@ int spawn(char *path, arg_list_t *al, int join, char *input, char win_args[1024]= ""; char command_line[1024]= ""; - /* - Skip the first parameter - */ - for(i = 1; i < al->argc; i++) + /* Skip the first parameter */ + for (i= 1; i < al->argc; i++) { ASSERT(al->argv[i] != NULL); strcat(win_args,al->argv[i]); strcat(win_args," "); - } + } memset(&startup_info,0,sizeof(STARTUPINFO)); - startup_info.cb = sizeof(STARTUPINFO); + startup_info.cb= sizeof(STARTUPINFO); if (input) freopen(input, "rb", stdin); @@ -361,7 +371,8 @@ int spawn(char *path, arg_list_t *al, int join, char *input, { if (join) { - if (WaitForSingleObject(process_information.hProcess, mysqld_timeout) == WAIT_TIMEOUT) + if (WaitForSingleObject(process_information.hProcess, mysqld_timeout) + == WAIT_TIMEOUT) { exit_code= -1; } @@ -393,76 +404,60 @@ int spawn(char *path, arg_list_t *al, int join, char *input, } #else int spawn(char *path, arg_list_t *al, int join, char *input, - char *output, char *error, char *pid_file) + char *output, char *error, char *pid_file __attribute__((unused))) { pid_t pid; - int res_exec = 0; - int result = 0; - - pid = fork(); - + int res_exec= 0; + int result= 0; + + pid= fork(); + if (pid == -1) { fprintf(stderr, "fork was't created\n"); - /* - We can't create the fork...exit with error - */ - return EXIT_FAILURE; + /* We can't create the fork...exit with error */ + return EXIT_FAILURE; } - + if (pid > 0) { - /* - The parent process is waiting for child process if join is not zero - */ + /* The parent process is waiting for child process if join is not zero */ if (join) { - waitpid(pid, &result, 0); - if (WIFEXITED(result) != 0) - { - result = WEXITSTATUS(result); - } - else - { - result = EXIT_FAILURE; - } - } + waitpid(pid, &result, 0); + if (WIFEXITED(result) != 0) + { + result= WEXITSTATUS(result); + } + else + { + result= EXIT_FAILURE; + } + } } else { - - /* - Child process - */ - add_arg(al, NULL); + /* Child process */ + add_arg(al, NULL); - - /* - Reassign streams - */ + /* Reassign streams */ if (input) - freopen(input, "r", stdin); - + freopen(input, "r", stdin); if (output) freopen(output, "w", stdout); - if (error) freopen(error, "w", stderr); /* Spawn the process */ - if ((res_exec = execve(path, al->argv, environ)) < 0) - { + if ((res_exec= execve(path, al->argv, environ)) < 0) exit(EXIT_FAILURE); - } - /* - Restore streams - */ + /* Restore streams */ if (input) - freopen("/dev/tty", "r", stdin); + freopen("/dev/tty", "r", stdin); if (output) freopen("/dev/tty", "w", stdout); @@ -472,32 +467,34 @@ int spawn(char *path, arg_list_t *al, int join, char *input, exit(0); } - + return result; } #endif /****************************************************************************** - stop_server() - - Stop the server with the given port and pid file. + stop_server() + + Stop the server with the given port and pid file. ******************************************************************************/ + +int stop_server(char *bin_dir __attribute__((unused)), char *mysqladmin_file, + char *user, char *password, int port, #ifndef __WIN__ -int stop_server(char *bin_dir, char *mysqladmin_file, char *user, char *password, int port, - char *pid_file,char *tmp_dir) + char *pid_file, #else -int stop_server(char *bin_dir, char *mysqladmin_file, char *user, char *password, int port, - HANDLE pid_file,char *tmp_dir) + HANDLE pid_file, #endif + char *tmp_dir) { arg_list_t al; - int err = 0; + int err= 0; char trash[PATH_MAX]; - + snprintf(trash, PATH_MAX, "%s/trash.out",tmp_dir); - - // args + + /* args */ init_args(&al); add_arg(&al, "%s", mysqladmin_file); add_arg(&al, "--no-defaults"); @@ -508,33 +505,33 @@ int stop_server(char *bin_dir, char *mysqladmin_file, char *user, char *password add_arg(&al, "shutdown_timeout=20"); #ifndef __NETWARE__ add_arg(&al, "--protocol=tcp"); -#endif +#endif add_arg(&al, "shutdown"); - // spawn - if ((err = spawn(mysqladmin_file, &al, TRUE, NULL, - trash, NULL, NULL)) == 0) + /* spawn */ + if ((err= spawn(mysqladmin_file, &al, TRUE, NULL, + trash, NULL, NULL)) == 0) { sleep_until_file_deleted(pid_file); } else { #ifndef __WIN__ - pid_t pid = get_server_pid(pid_file); - - // shutdown failed - kill server + pid_t pid= get_server_pid(pid_file); + + /* shutdown failed - kill server */ kill_server(pid); - + sleep(TRY_MAX); - - // remove pid file if possible - err = remove(pid_file); + + /* remove pid file if possible */ + err= remove(pid_file); #else TerminateProcess(pid_file,err); #endif } - - // free args + + /* free args */ free_args(&al); return err; @@ -542,57 +539,59 @@ int stop_server(char *bin_dir, char *mysqladmin_file, char *user, char *password /****************************************************************************** - get_server_pid() - - Get the VM id with the given pid file. + get_server_pid() + + Get the VM id with the given pid file. ******************************************************************************/ + #ifndef __WIN__ pid_t get_server_pid(char *pid_file) { char buf[PATH_MAX]; int fd, err; char *p; - pid_t id = 0; - - // discover id - fd = open(pid_file, O_RDONLY); - - err = read(fd, buf, PATH_MAX); - - close(fd); - - if (err > 0) - { - // terminate string - if ((p = strchr(buf, '\n')) != NULL) - { - *p = '\0'; - - // check for a '\r' - if ((p = strchr(buf, '\r')) != NULL) - { - *p = '\0'; - } - } - else - { - buf[err] = '\0'; - } - - id = strtol(buf, NULL, 0); - } - + pid_t id= 0; + + /* discover id */ + fd= open(pid_file, O_RDONLY); + + err= read(fd, buf, PATH_MAX); + + close(fd); + + if (err > 0) + { + /* terminate string */ + if ((p= strchr(buf, '\n')) != NULL) + { + *p= '\0'; + + /* check for a '\r' */ + if ((p= strchr(buf, '\r')) != NULL) + { + *p= '\0'; + } + } + else + { + buf[err]= '\0'; + } + + id= strtol(buf, NULL, 0); + } + return id; } /****************************************************************************** - kill_server() - - Force a kill of the server with the given pid. + kill_server() + + Force a kill of the server with the given pid. ******************************************************************************/ + void kill_server(pid_t pid) { if (pid > 0) @@ -603,51 +602,52 @@ void kill_server(pid_t pid) #else /* __NETWARE__ */ /* destroy vm */ NXVmDestroy(pid); -#endif +#endif } } #endif /****************************************************************************** - del_tree() - - Delete the directory and subdirectories. + del_tree() + + Delete the directory and subdirectories. ******************************************************************************/ + void del_tree(char *dir) { #ifndef __WIN__ - DIR *parent = opendir(dir); + DIR *parent= opendir(dir); struct dirent *entry; char temp[PATH_MAX]; - + if (parent == NULL) { return; } - while((entry = readdir(parent)) != NULL) + while ((entry= readdir(parent)) != NULL) { - // create long name + /* create long name */ snprintf(temp, PATH_MAX, "%s/%s", dir, entry->d_name); if (entry->d_name[0] == '.') { - // Skip + /* Skip */ } - else + else if (S_ISDIR(entry->d_type)) { - // delete subdirectory + /* delete subdirectory */ del_tree(temp); } else { - // remove file + /* remove file */ remove(temp); } } - // remove directory + /* remove directory */ rmdir(dir); #else struct _finddata_t parent; @@ -664,50 +664,51 @@ void del_tree(char *dir) do { - // create long name - snprintf(temp, PATH_MAX, "%s/%s", dir, parent.name); + /* create long name */ + snprintf(temp, PATH_MAX, "%s/%s", dir, parent.name); if (parent.name[0] == '.') { - // Skip + /* Skip */ } - else + else if (parent.attrib & _A_SUBDIR) { - // delete subdirectory + /* delete subdirectory */ del_tree(temp); } else { - // remove file + /* remove file */ remove(temp); } } while (_findnext(handle,&parent) == 0); _findclose(handle); - // remove directory + /* remove directory */ _rmdir(dir); #endif } /****************************************************************************** - removef() - + removef() + ******************************************************************************/ + int removef(const char *format, ...) { -#ifdef __NETWARE__ +#ifdef __NETWARE__ va_list ap; char path[PATH_MAX]; - + va_start(ap, format); vsnprintf(path, PATH_MAX, format, ap); - + va_end(ap); return remove(path); - + #eldef __WIN__ { va_list ap; @@ -716,25 +717,23 @@ int removef(const char *format, ...) intptr_t handle; char temp[PATH_MAX]; char *p; - + va_start(ap, format); vsnprintf(path, PATH_MAX, format, ap); - + va_end(ap); - - p = path + strlen(path); + + p= path + strlen(path); while (*p != '\\' && *p != '/' && p > path) p--; if ((handle=_findfirst(path,&parent)) == -1L) { - /* - if there is not files....it's ok. - */ + /* if there is not files....it's ok */ return 0; } - *p = '\0'; + *p= '\0'; do { @@ -754,89 +753,80 @@ int removef(const char *format, ...) va_list ap; char path[PATH_MAX]; char *p; - /* - Get path with mask - */ + /* Get path with mask */ va_start(ap, format); vsnprintf(path, PATH_MAX, format, ap); - + va_end(ap); - - p = path + strlen(path); + + p= path + strlen(path); while (*p != '\\' && *p != '/' && p > path) p--; - *p = '\0'; + *p= '\0'; p++; - - parent = opendir(path); + + parent= opendir(path); if (parent == NULL) { - return; + return 1; /* Error, directory missing */ } - - while((entry = readdir(parent)) != NULL) + + while ((entry= readdir(parent)) != NULL) { - /* - entry is not directory and entry matches with mask - */ + /* entry is not directory and entry matches with mask */ if (!S_ISDIR(entry->d_type) && !fnmatch(p, entry->d_name,0)) { - // create long name + /* create long name */ snprintf(temp, PATH_MAX, "%s/%s", path, entry->d_name); - // Delete only files + /* Delete only files */ remove(temp); } } #endif - return 0; + return 0; } /****************************************************************************** - get_basedir() - + get_basedir() + ******************************************************************************/ + void get_basedir(char *argv0, char *basedir) { char temp[PATH_MAX]; char *p; int position; - + ASSERT(argv0 != NULL); ASSERT(basedir != NULL); strcpy(temp, strlwr(argv0)); - while((p = strchr(temp, '\\')) != NULL) *p = '/'; - - if ((position = strinstr(temp, "/bin/")) != 0) + while ((p= strchr(temp, '\\')) != NULL) *p= '/'; + + if ((position= strinstr(temp, "/bin/")) != 0) { - p = temp + position; - *p = '\0'; + p= temp + position; + *p= '\0'; strcpy(basedir, temp); } } -#if !defined(__NETWARE__) && !defined(__WIN__) -char *strlwr(const char *s) -{ - return s; -} -#endif - uint strinstr(reg1 const char *str,reg4 const char *search) { reg2 my_string i,j; - my_string start = (my_string) str; + my_string start= (my_string) str; skipp: while (*str != '\0') { if (*str++ == *search) { - i=(my_string) str; j= (my_string) search+1; + i=(my_string) str; + j= (my_string) search+1; while (*j) - if (*i++ != *j++) goto skipp; + if (*i++ != *j++) goto skipp; return ((uint) (str - start)); } } @@ -845,13 +835,14 @@ uint strinstr(reg1 const char *str,reg4 const char *search) /****************************************************************************** - remove_empty_file() - + remove_empty_file() + ******************************************************************************/ + void remove_empty_file(const char *file_name) { struct stat file; - + if (!stat(file_name,&file)) { if (!file.st_size) diff --git a/mysql-test/my_manage.h b/mysql-test/my_manage.h index 56ba7ce0496..a61c693c22c 100644 --- a/mysql-test/my_manage.h +++ b/mysql-test/my_manage.h @@ -21,8 +21,8 @@ /****************************************************************************** - includes - + includes + ******************************************************************************/ #include @@ -36,7 +36,7 @@ #ifndef __WIN__ #define strnicmp strncasecmp -char *strlwr(const char *s); +#define strlwr(STRARG) (STRARG) #else int my_vsnprintf_(char *to, size_t n, const char* value, ...); #endif @@ -44,12 +44,12 @@ int my_vsnprintf_(char *to, size_t n, const char* value, ...); /****************************************************************************** - macros - + macros + ******************************************************************************/ -#define ARG_BUF 10 -#define TRY_MAX 5 +#define ARG_BUF 10 +#define TRY_MAX 5 #ifdef __WIN__ #define PATH_MAX _MAX_PATH @@ -71,8 +71,8 @@ bool skip_first_param; /****************************************************************************** - structures - + structures + ******************************************************************************/ typedef struct @@ -90,14 +90,14 @@ typedef int pid_t; #endif /****************************************************************************** - global variables - + global variables + ******************************************************************************/ /****************************************************************************** - prototypes - + prototypes + ******************************************************************************/ void init_args(arg_list_t *); diff --git a/mysql-test/mysql_test_run_new.c b/mysql-test/mysql_test_run_new.c index 6f388fc4a45..1e8a1dded51 100644 --- a/mysql-test/mysql_test_run_new.c +++ b/mysql-test/mysql_test_run_new.c @@ -21,7 +21,7 @@ #include #ifndef __WIN__ #include -#endif +#endif #include #ifdef __NETWARE__ #include @@ -46,51 +46,52 @@ /****************************************************************************** macros - + ******************************************************************************/ #define HEADER "TEST RESULT \n" #define DASH "-------------------------------------------------------\n" -#define NW_TEST_SUFFIX ".nw-test" -#define NW_RESULT_SUFFIX ".nw-result" -#define TEST_SUFFIX ".test" -#define RESULT_SUFFIX ".result" -#define REJECT_SUFFIX ".reject" -#define OUT_SUFFIX ".out" -#define ERR_SUFFIX ".err" +#define NW_TEST_SUFFIX ".nw-test" +#define NW_RESULT_SUFFIX ".nw-result" +#define TEST_SUFFIX ".test" +#define RESULT_SUFFIX ".result" +#define REJECT_SUFFIX ".reject" +#define OUT_SUFFIX ".out" +#define ERR_SUFFIX ".err" -const char *TEST_PASS = "[ pass ]"; -const char *TEST_SKIP = "[ skip ]"; -const char *TEST_FAIL = "[ fail ]"; -const char *TEST_BAD = "[ bad ]"; -const char *TEST_IGNORE = "[ignore]"; +const char *TEST_PASS= "[ pass ]"; +const char *TEST_SKIP= "[ skip ]"; +const char *TEST_FAIL= "[ fail ]"; +const char *TEST_BAD= "[ bad ]"; +const char *TEST_IGNORE= "[ignore]"; /****************************************************************************** global variables - -******************************************************************************/ -#ifdef __NETWARE__ -static char base_dir[PATH_MAX] = "sys:/mysql"; -#else -static char base_dir[PATH_MAX] = ".."; -#endif -static char db[PATH_MAX] = "test"; -static char user[PATH_MAX] = "root"; -static char password[PATH_MAX] = ""; -int master_port = 9306; -int slave_port = 9307; +******************************************************************************/ + +#ifdef __NETWARE__ +static char base_dir[PATH_MAX]= "sys:/mysql"; +#else +static char base_dir[PATH_MAX]= ".."; +#endif +static char db[PATH_MAX]= "test"; +static char user[PATH_MAX]= "root"; +static char password[PATH_MAX]= ""; + +int master_port= 9306; +int slave_port= 9307; #if !defined(__NETWARE__) && !defined(__WIN__) -static char master_socket[PATH_MAX] = "./var/tmp/master.sock"; -static char slave_socket[PATH_MAX] = "./var/tmp/slave.sock"; +static char master_socket[PATH_MAX]= "./var/tmp/master.sock"; +static char slave_socket[PATH_MAX]= "./var/tmp/slave.sock"; #endif -// comma delimited list of tests to skip or empty string +/* comma delimited list of tests to skip or empty string */ #ifndef __WIN__ -static char skip_test[PATH_MAX] = " lowercase_table3 , system_mysql_db_fix "; +static char skip_test[PATH_MAX]= " lowercase_table3 , system_mysql_db_fix "; #else /* The most ignore testes contain the calls of system command @@ -109,9 +110,20 @@ static char skip_test[PATH_MAX] = " lowercase_table3 , system_mysql_db_fix "; mysqldump contains a command system rpl000001 makes non-exit loop...temporary skiped */ -static char skip_test[PATH_MAX] = " lowercase_table3 , system_mysql_db_fix , sp , rpl_EE_error , rpl_loaddatalocal , ndb_autodiscover , rpl_rotate_logs , repair , rpl_trunc_binlog , mysqldump , rpl000001 "; +static char skip_test[PATH_MAX]= +" lowercase_table3 ," +" system_mysql_db_fix ," +" sp ," +" rpl_EE_error ," +" rpl_loaddatalocal ," +" ndb_autodiscover ," +" rpl_rotate_logs ," +" repair ," +" rpl_trunc_binlog ," +" mysqldump ," +" rpl000001 "; #endif -static char ignore_test[PATH_MAX] = ""; +static char ignore_test[PATH_MAX]= ""; static char bin_dir[PATH_MAX]; static char mysql_test_dir[PATH_MAX]; @@ -129,54 +141,54 @@ static char mysqltest_file[PATH_MAX]; #ifndef __WIN__ static char master_pid[PATH_MAX]; static char slave_pid[PATH_MAX]; -static char sh_file[PATH_MAX] = "/bin/sh"; +static char sh_file[PATH_MAX]= "/bin/sh"; #else static HANDLE master_pid; static HANDLE slave_pid; #endif -static char master_opt[PATH_MAX] = ""; -static char slave_opt[PATH_MAX] = ""; +static char master_opt[PATH_MAX]= ""; +static char slave_opt[PATH_MAX]= ""; -static char slave_master_info[PATH_MAX] = ""; +static char slave_master_info[PATH_MAX]= ""; -static char master_init_script[PATH_MAX] = ""; -static char slave_init_script[PATH_MAX] = ""; +static char master_init_script[PATH_MAX]= ""; +static char slave_init_script[PATH_MAX]= ""; -// OpenSSL +/* OpenSSL */ static char ca_cert[PATH_MAX]; static char server_cert[PATH_MAX]; static char server_key[PATH_MAX]; static char client_cert[PATH_MAX]; static char client_key[PATH_MAX]; -int total_skip = 0; -int total_pass = 0; -int total_fail = 0; -int total_test = 0; +int total_skip= 0; +int total_pass= 0; +int total_fail= 0; +int total_test= 0; -int total_ignore = 0; +int total_ignore= 0; -int use_openssl = FALSE; -int master_running = FALSE; -int slave_running = FALSE; -int skip_slave = TRUE; -int single_test = TRUE; +int use_openssl= FALSE; +int master_running= FALSE; +int slave_running= FALSE; +int skip_slave= TRUE; +int single_test= TRUE; -int restarts = 0; +int restarts= 0; -FILE *log_fd = NULL; +FILE *log_fd= NULL; /****************************************************************************** functions - + ******************************************************************************/ /****************************************************************************** prototypes - + ******************************************************************************/ void report_stats(); @@ -205,10 +217,11 @@ void run_init_script(const char *script_name); /****************************************************************************** report_stats() - + Report the gathered statistics. ******************************************************************************/ + void report_stats() { if (total_fail == 0) @@ -217,24 +230,26 @@ void report_stats() } else { - double percent = ((double)total_pass / total_test) * 100; - + double percent= ((double)total_pass / total_test) * 100; + mlog("\nFailed %u/%u test(s), %.02f%% successful.\n", - total_fail, total_test, percent); - mlog("\nThe .out and .err files in %s may give you some\n", result_dir); - mlog("hint of what when wrong.\n"); - mlog("\nIf you want to report this error, please first read the documentation\n"); - mlog("at: http://www.mysql.com/doc/M/y/MySQL_test_suite.html\n"); + total_fail, total_test, percent); + mlog("\nThe .out and .err files in %s may give you some\n", result_dir); + mlog("hint of what when wrong.\n"); + mlog("\nIf you want to report this error, please first read " + "the documentation\n"); + mlog("at: http://www.mysql.com/doc/M/y/MySQL_test_suite.html\n"); } } /****************************************************************************** install_db() - + Install the a database. ******************************************************************************/ + void install_db(char *datadir) { arg_list_t al; @@ -243,16 +258,16 @@ void install_db(char *datadir) char output[PATH_MAX]; char error[PATH_MAX]; - // input file -#ifdef __NETWARE__ + /* input file */ +#ifdef __NETWARE__ snprintf(input, PATH_MAX, "%s/bin/init_db.sql", base_dir); #else snprintf(input, PATH_MAX, "%s/mysql-test/init_db.sql", base_dir); -#endif +#endif snprintf(output, PATH_MAX, "%s/install.out", datadir); snprintf(error, PATH_MAX, "%s/install.err", datadir); - - // args + + /* args */ init_args(&al); add_arg(&al, mysqld_file); add_arg(&al, "--no-defaults"); @@ -265,39 +280,40 @@ void install_db(char *datadir) #ifndef __NETWARE__ add_arg(&al, "--character-sets-dir=%s", char_dir); add_arg(&al, "--language=%s", lang_dir); -#endif +#endif - // spawn - if ((err = spawn(mysqld_file, &al, TRUE, input, output, error, NULL)) != 0) + /* spawn */ + if ((err= spawn(mysqld_file, &al, TRUE, input, output, error, NULL)) != 0) { die("Unable to create database."); } - - // free args + + /* free args */ free_args(&al); } /****************************************************************************** mysql_install_db() - + Install the test databases. ******************************************************************************/ + void mysql_install_db() { char temp[PATH_MAX]; - - // var directory + + /* var directory */ snprintf(temp, PATH_MAX, "%s/var", mysql_test_dir); - - // clean up old direcotry + + /* clean up old direcotry */ del_tree(temp); - - // create var directory + + /* create var directory */ #ifndef __WIN__ mkdir(temp, S_IRWXU); - // create subdirectories + /* create subdirectories */ mlog("Creating test-suite folders...\n"); snprintf(temp, PATH_MAX, "%s/var/run", mysql_test_dir); mkdir(temp, S_IRWXU); @@ -317,7 +333,7 @@ void mysql_install_db() mkdir(temp, S_IRWXU); #else mkdir(temp); - // create subdirectories + /* create subdirectories */ mlog("Creating test-suite folders...\n"); snprintf(temp, PATH_MAX, "%s/var/run", mysql_test_dir); mkdir(temp); @@ -337,7 +353,7 @@ void mysql_install_db() mkdir(temp); #endif - // install databases + /* install databases */ mlog("Creating test databases for master... \n"); install_db(master_dir); mlog("Creating test databases for slave... \n"); @@ -347,49 +363,50 @@ void mysql_install_db() /****************************************************************************** start_master() - + Start the master server. ******************************************************************************/ + void start_master() { arg_list_t al; int err; char master_out[PATH_MAX]; char master_err[PATH_MAX]; -// char temp[PATH_MAX]; +/* char temp[PATH_MAX]; */ char temp2[PATH_MAX]; - // remove old berkeley db log files that can confuse the server + /* remove old berkeley db log files that can confuse the server */ removef("%s/log.*", master_dir); - // remove stale binary logs + /* remove stale binary logs */ removef("%s/var/log/*-bin.*", mysql_test_dir); - // remove stale binary logs + /* remove stale binary logs */ removef("%s/var/log/*.index", mysql_test_dir); - // remove master.info file + /* remove master.info file */ removef("%s/master.info", master_dir); - // remove relay files + /* remove relay files */ removef("%s/var/log/*relay*", mysql_test_dir); - // remove relay-log.info file + /* remove relay-log.info file */ removef("%s/relay-log.info", master_dir); - // init script + /* init script */ if (master_init_script[0] != 0) { #ifdef __NETWARE__ - // TODO: use the scripts + /* TODO: use the scripts */ if (strinstr(master_init_script, "repair_part2-master.sh") != 0) { FILE *fp; - // create an empty index file + /* create an empty index file */ snprintf(temp, PATH_MAX, "%s/test/t1.MYI", master_dir); - fp = fopen(temp, "wb+"); + fp= fopen(temp, "wb+"); fputs("1", fp); @@ -397,10 +414,10 @@ void start_master() } #elif !defined(__WIN__) run_init_script(master_init_script); -#endif +#endif } - // redirection files + /* redirection files */ snprintf(master_out, PATH_MAX, "%s/var/run/master%u.out", mysql_test_dir, restarts); snprintf(master_err, PATH_MAX, "%s/var/run/master%u.err", @@ -416,7 +433,7 @@ void start_master() snprintf(temp2,PATH_MAX,"%s/var/log",mysql_test_dir); mkdir(temp2); #endif - // args + /* args */ init_args(&al); add_arg(&al, "%s", mysqld_file); add_arg(&al, "--no-defaults"); @@ -426,7 +443,7 @@ void start_master() add_arg(&al, "--port=%u", master_port); #if !defined(__NETWARE__) && !defined(__WIN__) add_arg(&al, "--socket=%s",master_socket); -#endif +#endif add_arg(&al, "--local-infile"); add_arg(&al, "--core"); add_arg(&al, "--datadir=%s", master_dir); @@ -436,7 +453,7 @@ void start_master() add_arg(&al, "--character-sets-dir=%s", char_dir); add_arg(&al, "--tmpdir=%s", mysql_tmp_dir); add_arg(&al, "--language=%s", lang_dir); -#ifdef DEBUG //only for debug builds +#ifdef DEBUG /* only for debug builds */ add_arg(&al, "--debug"); #endif @@ -447,11 +464,11 @@ void start_master() add_arg(&al, "--ssl-key=%s", server_key); } - // $MASTER_40_ARGS + /* $MASTER_40_ARGS */ add_arg(&al, "--rpl-recovery-rank=1"); add_arg(&al, "--init-rpl-role=master"); - // $SMALL_SERVER + /* $SMALL_SERVER */ add_arg(&al, "-O"); add_arg(&al, "key_buffer_size=1M"); add_arg(&al, "-O"); @@ -459,44 +476,46 @@ void start_master() add_arg(&al, "-O"); add_arg(&al, "max_heap_table_size=1M"); - // $EXTRA_MASTER_OPT + /* $EXTRA_MASTER_OPT */ if (master_opt[0] != 0) { char *p; - p = (char *)str_tok(master_opt, " \t"); + p= (char *)str_tok(master_opt, " \t"); if (!strstr(master_opt, "timezone")) { while (p) { add_arg(&al, "%s", p); - p = (char *)str_tok(NULL, " \t"); + p= (char *)str_tok(NULL, " \t"); } } } - // remove the pid file if it exists + /* remove the pid file if it exists */ #ifndef __WIN__ remove(master_pid); #endif - // spawn + /* spawn */ #ifdef __WIN__ - if ((err= spawn(mysqld_file, &al, FALSE, NULL, master_out, master_err, &master_pid)) == 0) + if ((err= spawn(mysqld_file, &al, FALSE, NULL, + master_out, master_err, &master_pid)) == 0) #else - if ((err= spawn(mysqld_file, &al, FALSE, NULL, master_out, master_err, master_pid)) == 0) -#endif + if ((err= spawn(mysqld_file, &al, FALSE, NULL, + master_out, master_err, master_pid)) == 0) +#endif { sleep_until_file_exists(master_pid); - if ((err = wait_for_server_start(bin_dir, mysqladmin_file, user, password, master_port, - mysql_tmp_dir)) == 0) + if ((err= wait_for_server_start(bin_dir, mysqladmin_file, user, password, + master_port, mysql_tmp_dir)) == 0) { - master_running = TRUE; + master_running= TRUE; } else { - log_error("The master server went down early."); + log_error("The master server went down early."); } } else @@ -504,17 +523,18 @@ void start_master() log_error("Unable to start master server."); } - // free_args + /* free_args */ free_args(&al); } /****************************************************************************** start_slave() - + Start the slave server. ******************************************************************************/ + void start_slave() { arg_list_t al; @@ -522,43 +542,43 @@ void start_slave() char slave_out[PATH_MAX]; char slave_err[PATH_MAX]; - // skip? + /* skip? */ if (skip_slave) return; - // remove stale binary logs + /* remove stale binary logs */ removef("%s/*-bin.*", slave_dir); - // remove stale binary logs + /* remove stale binary logs */ removef("%s/*.index", slave_dir); - // remove master.info file + /* remove master.info file */ removef("%s/master.info", slave_dir); - // remove relay files + /* remove relay files */ removef("%s/var/log/*relay*", mysql_test_dir); - // remove relay-log.info file + /* remove relay-log.info file */ removef("%s/relay-log.info", slave_dir); - // init script + /* init script */ if (slave_init_script[0] != 0) { #ifdef __NETWARE__ - // TODO: use the scripts + /* TODO: use the scripts */ if (strinstr(slave_init_script, "rpl000016-slave.sh") != 0) { - // create empty master.info file + /* create empty master.info file */ snprintf(temp, PATH_MAX, "%s/master.info", slave_dir); close(open(temp, O_WRONLY | O_CREAT,S_IRWXU|S_IRWXG|S_IRWXO)); } else if (strinstr(slave_init_script, "rpl000017-slave.sh") != 0) { FILE *fp; - - // create a master.info file + + /* create a master.info file */ snprintf(temp, PATH_MAX, "%s/master.info", slave_dir); - fp = fopen(temp, "wb+"); - + fp= fopen(temp, "wb+"); + fputs("master-bin.000001\n", fp); fputs("4\n", fp); fputs("127.0.0.1\n", fp); @@ -572,22 +592,22 @@ void start_slave() } else if (strinstr(slave_init_script, "rpl_rotate_logs-slave.sh") != 0) { - // create empty master.info file + /* create empty master.info file */ snprintf(temp, PATH_MAX, "%s/master.info", slave_dir); close(open(temp, O_WRONLY | O_CREAT,S_IRWXU|S_IRWXG|S_IRWXO)); } -#elif !defined(__WIN__) +#elif !defined(__WIN__) run_init_script(slave_init_script); -#endif +#endif } - // redirection files + /* redirection files */ snprintf(slave_out, PATH_MAX, "%s/var/run/slave%u.out", mysql_test_dir, restarts); snprintf(slave_err, PATH_MAX, "%s/var/run/slave%u.err", mysql_test_dir, restarts); - - // args + + /* args */ init_args(&al); add_arg(&al, "%s", mysqld_file); add_arg(&al, "--no-defaults"); @@ -597,7 +617,7 @@ void start_slave() add_arg(&al, "--port=%u", slave_port); #if !defined(__NETWARE__) && !defined(__WIN__) add_arg(&al, "--socket=%s",slave_socket); -#endif +#endif add_arg(&al, "--datadir=%s", slave_dir); #ifndef __WIN__ add_arg(&al, "--pid-file=%s", slave_pid); @@ -613,7 +633,7 @@ void start_slave() add_arg(&al, "--skip-innodb"); add_arg(&al, "--skip-slave-start"); add_arg(&al, "--slave-load-tmpdir=../../var/tmp"); - + add_arg(&al, "--report-user=%s", user); add_arg(&al, "--report-host=127.0.0.1"); add_arg(&al, "--report-port=%u", slave_port); @@ -621,7 +641,7 @@ void start_slave() add_arg(&al, "--master-retry-count=10"); add_arg(&al, "-O"); add_arg(&al, "slave_net_timeout=10"); -#ifdef DEBUG //only for debug builds +#ifdef DEBUG /* only for debug builds */ add_arg(&al, "--debug"); #endif @@ -632,18 +652,17 @@ void start_slave() add_arg(&al, "--ssl-key=%s", server_key); } - // slave master info + /* slave master info */ if (slave_master_info[0] != 0) { char *p; - p = (char *)str_tok(slave_master_info, " \t"); + p= (char *)str_tok(slave_master_info, " \t"); - while(p) + while (p) { add_arg(&al, "%s", p); - - p = (char *)str_tok(NULL, " \t"); + p= (char *)str_tok(NULL, " \t"); } } else @@ -656,8 +675,8 @@ void start_slave() add_arg(&al, "--server-id=2"); add_arg(&al, "--rpl-recovery-rank=2"); } - - // small server + + /* small server */ add_arg(&al, "-O"); add_arg(&al, "key_buffer_size=1M"); add_arg(&al, "-O"); @@ -666,38 +685,39 @@ void start_slave() add_arg(&al, "max_heap_table_size=1M"); - // opt args + /* opt args */ if (slave_opt[0] != 0) { char *p; - p = (char *)str_tok(slave_opt, " \t"); + p= (char *)str_tok(slave_opt, " \t"); - while(p) + while (p) { add_arg(&al, "%s", p); - - p = (char *)str_tok(NULL, " \t"); + p= (char *)str_tok(NULL, " \t"); } } - - // remove the pid file if it exists + + /* remove the pid file if it exists */ #ifndef __WIN__ remove(slave_pid); #endif - // spawn -#ifdef __WIN__ - if ((err = spawn(mysqld_file, &al, FALSE, NULL, slave_out, slave_err, &slave_pid)) == 0) + /* spawn */ +#ifdef __WIN__ + if ((err= spawn(mysqld_file, &al, FALSE, NULL, + slave_out, slave_err, &slave_pid)) == 0) #else - if ((err = spawn(mysqld_file, &al, FALSE, NULL, slave_out, slave_err, slave_pid)) == 0) -#endif + if ((err= spawn(mysqld_file, &al, FALSE, NULL, + slave_out, slave_err, slave_pid)) == 0) +#endif { sleep_until_file_exists(slave_pid); - - if ((err = wait_for_server_start(bin_dir, mysqladmin_file, user, password, slave_port, - mysql_tmp_dir)) == 0) + + if ((err= wait_for_server_start(bin_dir, mysqladmin_file, user, password, + slave_port, mysql_tmp_dir)) == 0) { - slave_running = TRUE; + slave_running= TRUE; } else { @@ -708,29 +728,30 @@ void start_slave() { log_error("Unable to start slave server."); } - - // free args + + /* free args */ free_args(&al); } /****************************************************************************** mysql_start() - + Start the mysql servers. ******************************************************************************/ + void mysql_start() { -// log_info("Starting the MySQL server(s): %u", ++restarts); +/* log_info("Starting the MySQL server(s): %u", ++restarts); */ start_master(); start_slave(); - // activate the test screen -#ifdef __NETWARE__ + /* activate the test screen */ +#ifdef __NETWARE__ ActivateScreen(getscreenhandle()); -#endif +#endif } /****************************************************************************** @@ -740,18 +761,19 @@ void mysql_start() Stop the slave server. ******************************************************************************/ + void stop_slave() { int err; - // running? + /* running? */ if (!slave_running) return; - // stop - if ((err = stop_server(bin_dir, mysqladmin_file, user, password, slave_port, slave_pid, - mysql_tmp_dir)) == 0) + /* stop */ + if ((err= stop_server(bin_dir, mysqladmin_file, user, password, + slave_port, slave_pid, mysql_tmp_dir)) == 0) { - slave_running = FALSE; + slave_running= FALSE; } else { @@ -766,17 +788,18 @@ void stop_slave() Stop the master server. ******************************************************************************/ + void stop_master() { int err; - // running? + /* running? */ if (!master_running) return; - if ((err = stop_server(bin_dir, mysqladmin_file, user, password, master_port, master_pid, - mysql_tmp_dir)) == 0) + if ((err= stop_server(bin_dir, mysqladmin_file, user, password, + master_port, master_pid, mysql_tmp_dir)) == 0) { - master_running = FALSE; + master_running= FALSE; } else { @@ -791,6 +814,7 @@ void stop_master() Stop the mysql servers. ******************************************************************************/ + void mysql_stop() { @@ -798,10 +822,10 @@ void mysql_stop() stop_slave(); - // activate the test screen -#ifdef __NETWARE__ + /* activate the test screen */ +#ifdef __NETWARE__ ActivateScreen(getscreenhandle()); -#endif +#endif } /****************************************************************************** @@ -811,9 +835,10 @@ void mysql_stop() Restart the mysql servers. ******************************************************************************/ + void mysql_restart() { -// log_info("Restarting the MySQL server(s): %u", ++restarts); +/* log_info("Restarting the MySQL server(s): %u", ++restarts); */ mysql_stop(); @@ -829,55 +854,52 @@ void mysql_restart() Read the option file. ******************************************************************************/ + int read_option(char *opt_file, char *opt) { int fd, err; char *p; char buf[PATH_MAX]; - // copy current option + /* copy current option */ strncpy(buf, opt, PATH_MAX); - // open options file - fd = open(opt_file, O_RDONLY); - - err = read(fd, opt, PATH_MAX); - + /* open options file */ + fd= open(opt_file, O_RDONLY); + err= read(fd, opt, PATH_MAX); close(fd); - + if (err > 0) { - // terminate string - if ((p = strchr(opt, '\n')) != NULL) + /* terminate string */ + if ((p= strchr(opt, '\n')) != NULL) { - *p = 0; - - // check for a '\r' - if ((p = strchr(opt, '\r')) != NULL) + *p= 0; + + /* check for a '\r' */ + if ((p= strchr(opt, '\r')) != NULL) { - *p = 0; + *p= 0; } } else { - opt[err] = 0; + opt[err]= 0; } - // check for $MYSQL_TEST_DIR - if ((p = strstr(opt, "$MYSQL_TEST_DIR")) != NULL) + /* check for $MYSQL_TEST_DIR */ + if ((p= strstr(opt, "$MYSQL_TEST_DIR")) != NULL) { char temp[PATH_MAX]; - - *p = 0; - + + *p= 0; + strcpy(temp, p + strlen("$MYSQL_TEST_DIR")); - strcat(opt, mysql_test_dir); - strcat(opt, temp); } - // Check for double backslash and replace it with single bakslash - if ((p = strstr(opt, "\\\\")) != NULL) + /* Check for double backslash and replace it with single bakslash */ + if ((p= strstr(opt, "\\\\")) != NULL) { /* bmove is guranteed to work byte by byte */ bmove(p, p+1, strlen(p+1)); @@ -885,54 +907,55 @@ int read_option(char *opt_file, char *opt) } else { - // clear option - *opt = 0; + /* clear option */ + *opt= 0; } - - // compare current option with previous + + /* compare current option with previous */ return strcmp(opt, buf); } /****************************************************************************** run_test() - + Run the given test case. ******************************************************************************/ + void run_test(char *test) { char temp[PATH_MAX]; const char *rstr; - int skip = FALSE, ignore=FALSE; - int restart = FALSE; - int flag = FALSE; + int skip= FALSE, ignore=FALSE; + int restart= FALSE; + int flag= FALSE; struct stat info; - - // skip tests in the skip list + + /* skip tests in the skip list */ snprintf(temp, PATH_MAX, " %s ", test); - skip = (strinstr(skip_test, temp) != 0); + skip= (strinstr(skip_test, temp) != 0); if (skip == FALSE) - ignore = (strinstr(ignore_test, temp) != 0); + ignore= (strinstr(ignore_test, temp) != 0); snprintf(master_init_script, PATH_MAX, "%s/%s-master.sh", test_dir, test); snprintf(slave_init_script, PATH_MAX, "%s/%s-slave.sh", test_dir, test); -#ifdef __WIN__ +#ifdef __WIN__ if (! stat(master_init_script, &info)) - skip = TRUE; + skip= TRUE; if (!stat(slave_init_script, &info)) - skip = TRUE; + skip= TRUE; #endif if (ignore) { - // show test + /* show test */ mlog("%-46s ", test); - - // ignore - rstr = TEST_IGNORE; + + /* ignore */ + rstr= TEST_IGNORE; ++total_ignore; - } - else if (!skip) // skip test? + } + else if (!skip) /* skip test? */ { char test_file[PATH_MAX]; char master_opt_file[PATH_MAX]; @@ -945,29 +968,29 @@ void run_test(char *test) int err; arg_list_t al; #ifdef __WIN__ - /* - Clean test database - */ + /* Clean test database */ removef("%s/test/*.*", master_dir); removef("%s/test/*.*", slave_dir); removef("%s/mysqltest/*.*", master_dir); removef("%s/mysqltest/*.*", slave_dir); #endif - // skip slave? - flag = skip_slave; - skip_slave = (strncmp(test, "rpl", 3) != 0); - if (flag != skip_slave) restart = TRUE; - - // create files + /* skip slave? */ + flag= skip_slave; + skip_slave= (strncmp(test, "rpl", 3) != 0); + if (flag != skip_slave) restart= TRUE; + + /* create files */ snprintf(master_opt_file, PATH_MAX, "%s/%s-master.opt", test_dir, test); snprintf(slave_opt_file, PATH_MAX, "%s/%s-slave.opt", test_dir, test); - snprintf(slave_master_info_file, PATH_MAX, "%s/%s.slave-mi", test_dir, test); - snprintf(reject_file, PATH_MAX, "%s/%s%s", result_dir, test, REJECT_SUFFIX); + snprintf(slave_master_info_file, PATH_MAX, "%s/%s.slave-mi", + test_dir, test); + snprintf(reject_file, PATH_MAX, "%s/%s%s", + result_dir, test, REJECT_SUFFIX); snprintf(out_file, PATH_MAX, "%s/%s%s", result_dir, test, OUT_SUFFIX); snprintf(err_file, PATH_MAX, "%s/%s%s", result_dir, test, ERR_SUFFIX); - - // netware specific files + + /* netware specific files */ snprintf(test_file, PATH_MAX, "%s/%s%s", test_dir, test, NW_TEST_SUFFIX); if (stat(test_file, &info)) { @@ -979,45 +1002,46 @@ void run_test(char *test) } } - snprintf(result_file, PATH_MAX, "%s/%s%s", result_dir, test, NW_RESULT_SUFFIX); + snprintf(result_file, PATH_MAX, "%s/%s%s", + result_dir, test, NW_RESULT_SUFFIX); if (stat(result_file, &info)) { - snprintf(result_file, PATH_MAX, "%s/%s%s", result_dir, test, RESULT_SUFFIX); + snprintf(result_file, PATH_MAX, "%s/%s%s", + result_dir, test, RESULT_SUFFIX); } - // init scripts + /* init scripts */ if (stat(master_init_script, &info)) - master_init_script[0] = 0; + master_init_script[0]= 0; else - restart = TRUE; - - if (stat(slave_init_script, &info)) - slave_init_script[0] = 0; - else - restart = TRUE; + restart= TRUE; - // read options - if (read_option(master_opt_file, master_opt)) restart = TRUE; - if (read_option(slave_opt_file, slave_opt)) restart = TRUE; - if (read_option(slave_master_info_file, slave_master_info)) restart = TRUE; - - // cleanup previous run + if (stat(slave_init_script, &info)) + slave_init_script[0]= 0; + else + restart= TRUE; + + /* read options */ + if (read_option(master_opt_file, master_opt)) restart= TRUE; + if (read_option(slave_opt_file, slave_opt)) restart= TRUE; + if (read_option(slave_master_info_file, slave_master_info)) restart= TRUE; + + /* cleanup previous run */ remove(reject_file); remove(out_file); remove(err_file); - - // start or restart? + + /* start or restart? */ if (!master_running) mysql_start(); else if (restart) mysql_restart(); - - // let the system stabalize + + /* let the system stabalize */ sleep(1); - // show test + /* show test */ mlog("%-46s ", test); - - - // args + + /* args */ init_args(&al); add_arg(&al, "%s", mysqltest_file); add_arg(&al, "--no-defaults"); @@ -1025,7 +1049,7 @@ void run_test(char *test) #if !defined(__NETWARE__) && !defined(__WIN__) add_arg(&al, "--socket=%s", master_socket); add_arg(&al, "--tmpdir=%s", mysql_tmp_dir); -#endif +#endif add_arg(&al, "--database=%s", db); add_arg(&al, "--user=%s", user); add_arg(&al, "--password=%s", password); @@ -1043,70 +1067,71 @@ void run_test(char *test) add_arg(&al, "--ssl-key=%s", client_key); } - // spawn - err = spawn(mysqltest_file, &al, TRUE, test_file, out_file, err_file, NULL); - - // free args + /* spawn */ + err= spawn(mysqltest_file, &al, TRUE, test_file, out_file, err_file, NULL); + + /* free args */ free_args(&al); - remove_empty_file(out_file); - remove_empty_file(err_file); - + remove_empty_file(out_file); + remove_empty_file(err_file); + if (err == 0) { - // pass - rstr = TEST_PASS; + /* pass */ + rstr= TEST_PASS; ++total_pass; - - // increment total + + /* increment total */ ++total_test; } else if (err == 2) { - // skip - rstr = TEST_SKIP; + /* skip */ + rstr= TEST_SKIP; ++total_skip; } else if (err == 1) { - // fail - rstr = TEST_FAIL; + /* fail */ + rstr= TEST_FAIL; ++total_fail; - // increment total + /* increment total */ ++total_test; } else { - rstr = TEST_BAD; + rstr= TEST_BAD; } } - else // early skips + else /* early skips */ { - // show test + /* show test */ mlog("%-46s ", test); - - // skip - rstr = TEST_SKIP; + + /* skip */ + rstr= TEST_SKIP; ++total_skip; } - // result + /* result */ mlog("%-14s\n", rstr); } /****************************************************************************** vlog() - + Log the message. ******************************************************************************/ + void vlog(const char *format, va_list ap) { vfprintf(stdout, format, ap); fflush(stdout); - + if (log_fd) { vfprintf(log_fd, format, ap); @@ -1117,10 +1142,11 @@ void vlog(const char *format, va_list ap) /****************************************************************************** log() - + Log the message. ******************************************************************************/ + void mlog(const char *format, ...) { va_list ap; @@ -1128,21 +1154,22 @@ void mlog(const char *format, ...) va_start(ap, format); vlog(format, ap); - + va_end(ap); } /****************************************************************************** log_info() - + Log the given information. ******************************************************************************/ + void log_info(const char *format, ...) { va_list ap; - + va_start(ap, format); mlog("-- INFO : "); @@ -1155,14 +1182,15 @@ void log_info(const char *format, ...) /****************************************************************************** log_error() - + Log the given error. ******************************************************************************/ + void log_error(const char *format, ...) { va_list ap; - + va_start(ap, format); mlog("-- ERROR: "); @@ -1175,14 +1203,15 @@ void log_error(const char *format, ...) /****************************************************************************** log_errno() - + Log the given error and errno. ******************************************************************************/ + void log_errno(const char *format, ...) { va_list ap; - + va_start(ap, format); mlog("-- ERROR: (%003u) ", errno); @@ -1195,10 +1224,11 @@ void log_errno(const char *format, ...) /****************************************************************************** die() - + Exit the application. ******************************************************************************/ + void die(const char *msg) { log_error(msg); @@ -1211,48 +1241,49 @@ void die(const char *msg) /****************************************************************************** setup() - + Setup the mysql test enviornment. ******************************************************************************/ -void setup(char *file) + +void setup(char *file __attribute__((unused))) { char temp[PATH_MAX]; char file_path[PATH_MAX*2]; char *p; int position; - // set the timezone for the timestamp test + /* set the timezone for the timestamp test */ #ifdef __WIN__ _putenv( "TZ=GMT-3" ); #else setenv("TZ", "GMT-3", TRUE); #endif - // find base dir -#ifdef __NETWARE__ + /* find base dir */ +#ifdef __NETWARE__ strcpy(temp, strlwr(file)); - while((p = strchr(temp, '\\')) != NULL) *p = '/'; -#else + while ((p= strchr(temp, '\\')) != NULL) *p= '/'; +#else getcwd(temp, PATH_MAX); - position = strlen(temp); - temp[position] = '/'; - temp[position+1] = 0; + position= strlen(temp); + temp[position]= '/'; + temp[position+1]= 0; #ifdef __WIN__ - while((p = strchr(temp, '\\')) != NULL) *p = '/'; + while ((p= strchr(temp, '\\')) != NULL) *p= '/'; +#endif #endif -#endif - if ((position = strinstr(temp, "/mysql-test/")) != 0) + if ((position= strinstr(temp, "/mysql-test/")) != 0) { - p = temp + position - 1; - *p = 0; + p= temp + position - 1; + *p= 0; strcpy(base_dir, temp); - } + } log_info("Currect directory: %s",base_dir); #ifdef __NETWARE__ - // setup paths + /* setup paths */ snprintf(bin_dir, PATH_MAX, "%s/bin", base_dir); snprintf(mysql_test_dir, PATH_MAX, "%s/mysql-test", base_dir); snprintf(test_dir, PATH_MAX, "%s/t", mysql_test_dir); @@ -1264,24 +1295,24 @@ void setup(char *file) snprintf(char_dir, PATH_MAX, "%s/share/charsets", base_dir); #ifdef HAVE_OPENSSL - use_openssl = TRUE; -#endif // HAVE_OPENSSL + use_openssl= TRUE; +#endif /* HAVE_OPENSSL */ - // OpenSSL paths + /* OpenSSL paths */ snprintf(ca_cert, PATH_MAX, "%s/SSL/cacert.pem", base_dir); snprintf(server_cert, PATH_MAX, "%s/SSL/server-cert.pem", base_dir); snprintf(server_key, PATH_MAX, "%s/SSL/server-key.pem", base_dir); snprintf(client_cert, PATH_MAX, "%s/SSL/client-cert.pem", base_dir); snprintf(client_key, PATH_MAX, "%s/SSL/client-key.pem", base_dir); - // setup files + /* setup files */ snprintf(mysqld_file, PATH_MAX, "%s/mysqld", bin_dir); snprintf(mysqltest_file, PATH_MAX, "%s/mysqltest", bin_dir); snprintf(mysqladmin_file, PATH_MAX, "%s/mysqladmin", bin_dir); snprintf(master_pid, PATH_MAX, "%s/var/run/master.pid", mysql_test_dir); snprintf(slave_pid, PATH_MAX, "%s/var/run/slave.pid", mysql_test_dir); #elif __WIN__ - // setup paths + /* setup paths */ #ifdef _DEBUG snprintf(bin_dir, PATH_MAX, "%s/client_debug", base_dir); #else @@ -1297,22 +1328,22 @@ void setup(char *file) snprintf(char_dir, PATH_MAX, "%s/share/charsets", base_dir); #ifdef HAVE_OPENSSL - use_openssl = TRUE; -#endif // HAVE_OPENSSL + use_openssl= TRUE; +#endif /* HAVE_OPENSSL */ - // OpenSSL paths + /* OpenSSL paths */ snprintf(ca_cert, PATH_MAX, "%s/SSL/cacert.pem", base_dir); snprintf(server_cert, PATH_MAX, "%s/SSL/server-cert.pem", base_dir); snprintf(server_key, PATH_MAX, "%s/SSL/server-key.pem", base_dir); snprintf(client_cert, PATH_MAX, "%s/SSL/client-cert.pem", base_dir); snprintf(client_key, PATH_MAX, "%s/SSL/client-key.pem", base_dir); - // setup files + /* setup files */ snprintf(mysqld_file, PATH_MAX, "%s/mysqld.exe", bin_dir); snprintf(mysqltest_file, PATH_MAX, "%s/mysqltest.exe", bin_dir); snprintf(mysqladmin_file, PATH_MAX, "%s/mysqladmin.exe", bin_dir); -#else - // setup paths +#else + /* setup paths */ snprintf(bin_dir, PATH_MAX, "%s/client", base_dir); snprintf(mysql_test_dir, PATH_MAX, "%s/mysql-test", base_dir); snprintf(test_dir, PATH_MAX, "%s/t", mysql_test_dir); @@ -1324,60 +1355,72 @@ void setup(char *file) snprintf(char_dir, PATH_MAX, "%s/sql/share/charsets", base_dir); #ifdef HAVE_OPENSSL - use_openssl = TRUE; -#endif // HAVE_OPENSSL + use_openssl= TRUE; +#endif /* HAVE_OPENSSL */ - // OpenSSL paths + /* OpenSSL paths */ snprintf(ca_cert, PATH_MAX, "%s/SSL/cacert.pem", base_dir); snprintf(server_cert, PATH_MAX, "%s/SSL/server-cert.pem", base_dir); snprintf(server_key, PATH_MAX, "%s/SSL/server-key.pem", base_dir); snprintf(client_cert, PATH_MAX, "%s/SSL/client-cert.pem", base_dir); snprintf(client_key, PATH_MAX, "%s/SSL/client-key.pem", base_dir); - // setup files + /* setup files */ snprintf(mysqld_file, PATH_MAX, "%s/sql/mysqld", base_dir); snprintf(mysqltest_file, PATH_MAX, "%s/mysqltest", bin_dir); snprintf(mysqladmin_file, PATH_MAX, "%s/mysqladmin", bin_dir); snprintf(master_pid, PATH_MAX, "%s/var/run/master.pid", mysql_test_dir); snprintf(slave_pid, PATH_MAX, "%s/var/run/slave.pid", mysql_test_dir); - + snprintf(master_socket,PATH_MAX, "%s/var/tmp/master.sock", mysql_test_dir); snprintf(slave_socket,PATH_MAX, "%s/var/tmp/slave.sock", mysql_test_dir); #endif - // create log file + /* create log file */ snprintf(temp, PATH_MAX, "%s/mysql-test-run.log", mysql_test_dir); - if ((log_fd = fopen(temp, "w+")) == NULL) + if ((log_fd= fopen(temp, "w+")) == NULL) { log_errno("Unable to create log file."); } - // prepare skip test list - while((p = strchr(skip_test, ',')) != NULL) *p = ' '; + /* prepare skip test list */ + while ((p= strchr(skip_test, ',')) != NULL) *p= ' '; strcpy(temp, strlwr(skip_test)); snprintf(skip_test, PATH_MAX, " %s ", temp); - // environment -#ifdef __NETWARE__ + /* environment */ +#ifdef __NETWARE__ setenv("MYSQL_TEST_DIR", mysql_test_dir, 1); - snprintf(file_path, PATH_MAX*2, "%s/client/mysqldump --no-defaults -u root --port=%u", bin_dir, master_port); + snprintf(file_path, PATH_MAX*2, + "%s/client/mysqldump --no-defaults -u root --port=%u", + bin_dir, master_port); setenv("MYSQL_DUMP", file_path, 1); - snprintf(file_path, PATH_MAX*2, "%s/client/mysqlbinlog --no-defaults --local-load=%s", bin_dir, mysql_tmp_dir); + snprintf(file_path, PATH_MAX*2, + "%s/client/mysqlbinlog --no-defaults --local-load=%s", + bin_dir, mysql_tmp_dir); setenv("MYSQL_BINLOG", file_path, 1); #elif __WIN__ snprintf(file_path,MAX_PATH,"MYSQL_TEST_DIR=%s",mysql_test_dir); _putenv(file_path); - snprintf(file_path, PATH_MAX*2, "MYSQL_DUMP=%s/mysqldump.exe --no-defaults -u root --port=%u", bin_dir, master_port); + snprintf(file_path, PATH_MAX*2, + "MYSQL_DUMP=%s/mysqldump.exe --no-defaults -u root --port=%u", + bin_dir, master_port); _putenv(file_path); - snprintf(file_path, PATH_MAX*2, "MYSQL_BINLOG=%s/mysqlbinlog.exe --no-defaults --local-load=%s", bin_dir, mysql_tmp_dir); + snprintf(file_path, PATH_MAX*2, + "MYSQL_BINLOG=%s/mysqlbinlog.exe --no-defaults --local-load=%s", + bin_dir, mysql_tmp_dir); _putenv(file_path); #else setenv("MYSQL_TEST_DIR", mysql_test_dir, 1); - snprintf(file_path, PATH_MAX*2, "%s/mysqldump --no-defaults -u root --port=%u --socket=%s", bin_dir, master_port, master_socket); + snprintf(file_path, PATH_MAX*2, + "%s/mysqldump --no-defaults -u root --port=%u --socket=%s", + bin_dir, master_port, master_socket); setenv("MYSQL_DUMP", file_path, 1); - snprintf(file_path, PATH_MAX*2, "%s/mysqlbinlog --no-defaults --local-load=%s", bin_dir, mysql_tmp_dir); + snprintf(file_path, PATH_MAX*2, + "%s/mysqlbinlog --no-defaults --local-load=%s", + bin_dir, mysql_tmp_dir); setenv("MYSQL_BINLOG", file_path, 1); -#endif +#endif #ifndef __WIN__ setenv("MASTER_MYPORT", "9306", 1); @@ -1394,21 +1437,23 @@ void setup(char *file) /****************************************************************************** main() - + ******************************************************************************/ + int main(int argc, char **argv) { - int is_ignore_list = 0; - // setup + int is_ignore_list= 0; + /* setup */ setup(argv[0]); - - /* The --ignore option is comma saperated list of test cases to skip and - should be very first command line option to the test suite. - The usage is now: - mysql_test_run --ignore=test1,test2 test3 test4 - where test1 and test2 are test cases to ignore - and test3 and test4 are test cases to run. + /* + The --ignore option is comma saperated list of test cases to skip and + should be very first command line option to the test suite. + + The usage is now: + mysql_test_run --ignore=test1,test2 test3 test4 + where test1 and test2 are test cases to ignore + and test3 and test4 are test cases to run. */ if (argc >= 2 && !strnicmp(argv[1], "--ignore=", sizeof("--ignore=")-1)) { @@ -1425,22 +1470,22 @@ int main(int argc, char **argv) } } free(temp); - is_ignore_list = 1; + is_ignore_list= 1; } - // header + /* header */ #ifndef __WIN__ mlog("MySQL Server %s, for %s (%s)\n\n", VERSION, SYSTEM_TYPE, MACHINE_TYPE); #else mlog("MySQL Server ---, for %s (%s)\n\n", SYSTEM_TYPE, MACHINE_TYPE); #endif - + mlog("Initializing Tests...\n"); - - // install test databases + + /* install test databases */ mysql_install_db(); - + mlog("Starting Tests...\n"); - + mlog("\n"); mlog(HEADER); mlog(DASH); @@ -1449,46 +1494,46 @@ int main(int argc, char **argv) { int i; - // single test - single_test = TRUE; + /* single test */ + single_test= TRUE; - for (i = 1 + is_ignore_list; i < argc; i++) + for (i= 1 + is_ignore_list; i < argc; i++) { - // run given test + /* run given test */ run_test(argv[i]); } } else { - // run all tests + /* run all tests */ #ifndef __WIN__ struct dirent **namelist; int i,n; char test[NAME_MAX]; char *p; int position; - - n = scandir(test_dir, &namelist, 0, alphasort); + + n= scandir(test_dir, &namelist, 0, alphasort); if (n < 0) die("Unable to open tests directory."); - else + else { - for (i = 0; i < n; i++) + for (i= 0; i < n; i++) { - strcpy(test, strlwr(namelist[i]->d_name)); - // find the test suffix - if ((position = strinstr(test, TEST_SUFFIX)) != 0) + strcpy(test, strlwr(namelist[i]->d_name)); + /* find the test suffix */ + if ((position= strinstr(test, TEST_SUFFIX)) != 0) { - p = test + position - 1; - // null terminate at the suffix - *p = 0; - // run test + p= test + position - 1; + /* null terminate at the suffix */ + *p= 0; + /* run test */ run_test(test); } free(namelist[n]); - } + } free(namelist); - } + } #else struct _finddata_t dir; intptr_t handle; @@ -1496,52 +1541,52 @@ int main(int argc, char **argv) char mask[PATH_MAX]; char *p; int position; - char **names = 0; - char **testes = 0; + char **names= 0; + char **testes= 0; int name_index; int index; - - // single test - single_test = FALSE; + + /* single test */ + single_test= FALSE; snprintf(mask,MAX_PATH,"%s/*.test",test_dir); - + if ((handle=_findfirst(mask,&dir)) == -1L) { die("Unable to open tests directory."); } - names = malloc(MAX_COUNT_TESTES*4); - testes = names; - name_index = 0; + names= malloc(MAX_COUNT_TESTES*4); + testes= names; + name_index= 0; do { - if (!(dir.attrib & _A_SUBDIR)) + if (!(dir.attrib & _A_SUBDIR)) { strcpy(test, strlwr(dir.name)); - - // find the test suffix - if ((position = strinstr(test, TEST_SUFFIX)) != 0) - { - p = test + position - 1; - // null terminate at the suffix - *p = 0; - // insert test - *names = malloc(PATH_MAX); + /* find the test suffix */ + if ((position= strinstr(test, TEST_SUFFIX)) != 0) + { + p= test + position - 1; + /* null terminate at the suffix */ + *p= 0; + + /* insert test */ + *names= malloc(PATH_MAX); strcpy(*names,test); names++; name_index++; } - } + } }while (_findnext(handle,&dir) == 0); _findclose(handle); qsort( (void *)testes, name_index, sizeof( char * ), compare ); - for (index = 0; index <= name_index; index++) + for (index= 0; index <= name_index; index++) { run_test(testes[index]); free(testes[index]); @@ -1551,7 +1596,7 @@ int main(int argc, char **argv) #endif } - // stop server + /* stop server */ mysql_stop(); mlog(DASH); @@ -1559,14 +1604,14 @@ int main(int argc, char **argv) mlog("Ending Tests...\n"); - // report stats + /* report stats */ report_stats(); - // close log + /* close log */ if (log_fd) fclose(log_fd); - // keep results up -#ifdef __NETWARE__ + /* keep results up */ +#ifdef __NETWARE__ pressanykey(); #endif return 0; @@ -1577,12 +1622,12 @@ int main(int argc, char **argv) Synopsis: This function breaks the string into a sequence of tokens. The difference between this function and strtok is that it respects the quoted string i.e. - it skips any delimiter character within the quoted part of the string. + it skips any delimiter character within the quoted part of the string. It return tokens by eliminating quote character. It modifies the input string passed. It will work with whitespace delimeter but may not work properly with other delimeter. If the delimeter will contain any quote character, then function will not tokenize and will return null string. - e.g. if input string is + e.g. if input string is --init-slave="set global max_connections=500" --skip-external-locking then the output will two string i.e. --init-slave=set global max_connections=500 @@ -1595,7 +1640,6 @@ Output: return the null terminated token of NULL. */ - char *str_tok(char *string, const char *delim) { char *token; /* current token received from strtok */ @@ -1607,40 +1651,38 @@ char *str_tok(char *string, const char *delim) char *ptr_token=NULL; /* pointer to the quote character in the token from strtok */ char *ptr_quote=NULL; - + /* See if the delimeter contains any quote character */ if (strchr(delim,'\'') || strchr(delim,'\"')) return NULL; /* repeate till we are getting some token from strtok */ - while ((token = (char*)strtok(string, delim) ) != NULL) + while ((token= (char*)strtok(string, delim) ) != NULL) { /* make the input string NULL so that next time onward strtok can be called with NULL input string. */ - string = NULL; - /* - We don't need to remove any quote character for Windows version - */ + string= NULL; + /* We don't need to remove any quote character for Windows version */ #ifndef __WIN__ /* check if the current token contain double quote character*/ - if ((ptr_quote = (char*)strchr(token,'\"')) != NULL) + if ((ptr_quote= (char*)strchr(token,'\"')) != NULL) { /* get the matching the matching double quote in the remaining input string */ - qt_token = (char*)strtok(NULL,"\""); + qt_token= (char*)strtok(NULL,"\""); } /* check if the current token contain single quote character*/ - else if ((ptr_quote = (char*)strchr(token,'\'')) != NULL) + else if ((ptr_quote= (char*)strchr(token,'\'')) != NULL) { /* get the matching the matching single quote in the remaining input string */ - qt_token = (char*)strtok(NULL,"\'"); + qt_token= (char*)strtok(NULL,"\'"); } #endif /* @@ -1663,7 +1705,7 @@ char *str_tok(char *string, const char *delim) and hence quote will be removed */ *ptr_quote= 0; - + /* check if ptr_token has been initialized or not */ if (ptr_token == NULL) { @@ -1678,18 +1720,18 @@ char *str_tok(char *string, const char *delim) copy the current token and entire string between matching pair of quote */ - if (qt_token == NULL) - { - sprintf(ptr_token+strlen(ptr_token),"%s%s", token, ptr_quote+1); - } - else - { - sprintf(ptr_token+strlen(ptr_token),"%s%s %s", token, ptr_quote+1, - qt_token ); - } + if (qt_token == NULL) + { + sprintf(ptr_token+strlen(ptr_token),"%s%s", token, ptr_quote+1); + } + else + { + sprintf(ptr_token+strlen(ptr_token),"%s%s %s", token, ptr_quote+1, + qt_token ); + } } } - + /* return the concatenated token */ return ptr_token; } @@ -1706,23 +1748,24 @@ Arguments: Output: nothing */ + void run_init_script(const char *script_name) { arg_list_t al; int err; - - // args + + /* args */ init_args(&al); add_arg(&al, sh_file); add_arg(&al, script_name); - - // spawn - if ((err = spawn(sh_file, &al, TRUE, NULL, NULL, NULL, NULL)) != 0) + + /* spawn */ + if ((err= spawn(sh_file, &al, TRUE, NULL, NULL, NULL, NULL)) != 0) { die("Unable to run script."); } - - // free args + + /* free args */ free_args(&al); } #endif From 28986c7f92ab164e73f969581a7653d65958673e Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 7 Nov 2004 09:42:27 +0000 Subject: [PATCH 27/28] wrong copyright --- ndb/src/common/editline/complete.c | 16 ---------------- ndb/src/common/editline/editline.c | 16 ---------------- ndb/src/common/editline/editline_internal.h | 16 ---------------- ndb/src/common/editline/sysunix.c | 16 ---------------- ndb/src/common/editline/unix.h | 16 ---------------- 5 files changed, 80 deletions(-) diff --git a/ndb/src/common/editline/complete.c b/ndb/src/common/editline/complete.c index d1f8b1d3ff4..c524a88c678 100644 --- a/ndb/src/common/editline/complete.c +++ b/ndb/src/common/editline/complete.c @@ -1,19 +1,3 @@ -/* Copyright (C) 2003 MySQL AB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* -*- c-basic-offset: 4; -*- ** $Revision: 1.8 $ ** diff --git a/ndb/src/common/editline/editline.c b/ndb/src/common/editline/editline.c index 1e4c1ecba76..886dac2793b 100644 --- a/ndb/src/common/editline/editline.c +++ b/ndb/src/common/editline/editline.c @@ -1,19 +1,3 @@ -/* Copyright (C) 2003 MySQL AB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* -*- c-basic-offset: 4; -*- ** $Revision: 1.6 $ ** diff --git a/ndb/src/common/editline/editline_internal.h b/ndb/src/common/editline/editline_internal.h index 5ed2b32a873..d82fa91c44b 100644 --- a/ndb/src/common/editline/editline_internal.h +++ b/ndb/src/common/editline/editline_internal.h @@ -1,19 +1,3 @@ -/* Copyright (C) 2003 MySQL AB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* $Revision: 1.2 $ ** ** Internal header file for editline library. diff --git a/ndb/src/common/editline/sysunix.c b/ndb/src/common/editline/sysunix.c index d7437f6a9c7..b0242fb99ce 100644 --- a/ndb/src/common/editline/sysunix.c +++ b/ndb/src/common/editline/sysunix.c @@ -1,19 +1,3 @@ -/* Copyright (C) 2003 MySQL AB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* $Revision: 1.4 $ ** ** Unix system-dependant routines for editline library. diff --git a/ndb/src/common/editline/unix.h b/ndb/src/common/editline/unix.h index 37f461b471d..c2fde7547b3 100644 --- a/ndb/src/common/editline/unix.h +++ b/ndb/src/common/editline/unix.h @@ -1,19 +1,3 @@ -/* Copyright (C) 2003 MySQL AB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* $Revision: 1.3 $ ** ** Editline system header file for Unix. From 435b20aa6897b142f90267ea3ed7a7cef1cc385a Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 8 Nov 2004 01:13:54 +0200 Subject: [PATCH 28/28] Simpler arena swapping code Now thd->mem_root is a pointer to thd->main_mem_root and THR_MALLOC is a pointer to thd->mem_root. This gives us the following benefits: - Allow us to easily detect if arena has already been swapped before (this fixes a bug in setup_conds() where arena was swaped twice in some cases) - Faster swaps of arenas (as we don't have to copy the whole MEM_ROOT) - We don't anymore have to call my_pthread_setspecific_ptr(THR_MALLOC,...) to change where memory is alloced. Now it's enough to set thd->mem_root client/mysqltest.c: Remove some not needed defines (Things like this should be done in config-win.h) include/config-win.h: Added popen() and pclose() compatibility macros mysql-test/t/rpl_failed_optimize-master.opt: Portability fix sql/ha_berkeley.cc: New thd->memroot handling sql/item_cmpfunc.cc: Simpler arena swapping code sql/item_func.cc: Simpler arena swapping code sql/item_subselect.cc: Simpler arena swapping code New thd->mem_root handling sql/item_sum.cc: New thd->mem_root handling sql/item_timefunc.cc: Fixed not-initalized usage errors found by valgrind sql/log_event.cc: New thd->mem_root handling sql/mysql_priv.h: New thd->mem_root handling sql/mysqld.cc: New thd->mem_root handling sql/opt_range.cc: New thd->mem_root handling sql/repl_failsafe.cc: New thd->mem_root handling sql/set_var.cc: New thd->mem_root handling sql/sql_acl.cc: New thd->mem_root handling sql/sql_base.cc: Simpler arena swapping code New thd->mem_root handling sql/sql_class.cc: New thd->mem_root handling sql/sql_class.h: Simpler arena swapping code New thd->mem_root handling sql/sql_db.cc: New thd->mem_root handling sql/sql_error.cc: New thd->mem_root handling sql/sql_help.cc: New thd->mem_root handling sql/sql_insert.cc: New thd->mem_root handling sql/sql_parse.cc: New thd->mem_root handling Added some extra checking of return value of new sql/sql_prepare.cc: New thd->mem_root handling sql/sql_select.cc: New thd->mem_root handling sql/sql_select.h: New thd->mem_root handling sql/sql_union.cc: Simpler arena swapping code sql/sql_yacc.yy: New thd->mem_root handling sql/table.cc: New thd->mem_root handling sql/thr_malloc.cc: New thd->mem_root handling tests/client_test.c: Added drop table to some tests Changed some table names to 't1' --- client/mysqltest.c | 8 -- include/config-win.h | 2 + mysql-test/t/rpl_failed_optimize-master.opt | 2 +- sql/ha_berkeley.cc | 10 ++- sql/item_cmpfunc.cc | 8 +- sql/item_func.cc | 7 +- sql/item_subselect.cc | 44 +++++------ sql/item_sum.cc | 30 +++---- sql/item_timefunc.cc | 6 +- sql/log_event.cc | 8 +- sql/mysql_priv.h | 2 +- sql/mysqld.cc | 2 +- sql/opt_range.cc | 15 ++-- sql/repl_failsafe.cc | 2 +- sql/set_var.cc | 2 +- sql/sql_acl.cc | 10 ++- sql/sql_base.cc | 49 ++++++------ sql/sql_class.cc | 22 +++--- sql/sql_class.h | 32 ++++++-- sql/sql_db.cc | 2 +- sql/sql_error.cc | 6 +- sql/sql_help.cc | 14 ++-- sql/sql_insert.cc | 4 +- sql/sql_parse.cc | 24 +++--- sql/sql_prepare.cc | 6 +- sql/sql_select.cc | 8 +- sql/sql_select.h | 2 +- sql/sql_union.cc | 14 ++-- sql/sql_yacc.yy | 16 ++-- sql/table.cc | 14 ++-- sql/thr_malloc.cc | 2 +- tests/client_test.c | 86 ++++++++++++--------- 32 files changed, 243 insertions(+), 216 deletions(-) diff --git a/client/mysqltest.c b/client/mysqltest.c index df80fc7bb66..a207da21af5 100644 --- a/client/mysqltest.c +++ b/client/mysqltest.c @@ -949,11 +949,7 @@ static void do_exec(struct st_query* q) while (fgets(buf, sizeof(buf), res_file)) replace_dynstr_append_mem(ds, buf, strlen(buf)); } -#ifndef __WIN__ error= pclose(res_file); -#else - error= _pclose(res_file); -#endif if (error != 0) die("command \"%s\" failed", cmd); @@ -4610,11 +4606,7 @@ FILE *my_popen(const char *cmd, const char *mode __attribute__((unused))) FILE *res_file; subst_cmd= subst_env_var(cmd); -#ifndef __WIN__ res_file= popen(subst_cmd, "r0"); -#else - res_file= _popen(subst_cmd, "r0"); -#endif my_free(subst_cmd, MYF(0)); return res_file; } diff --git a/include/config-win.h b/include/config-win.h index d28bb25cd09..946a91d7d42 100644 --- a/include/config-win.h +++ b/include/config-win.h @@ -175,6 +175,8 @@ typedef uint rf_SetTimer; #define sigset(A,B) signal((A),(B)) #define finite(A) _finite(A) #define sleep(A) Sleep((A)*1000) +#define popen(A) popen(A,B) _popen((A),(B)) +#define pclose(A) _pclose(A) #ifndef __BORLANDC__ #define access(A,B) _access(A,B) diff --git a/mysql-test/t/rpl_failed_optimize-master.opt b/mysql-test/t/rpl_failed_optimize-master.opt index a6ef074a120..3f82baff598 100644 --- a/mysql-test/t/rpl_failed_optimize-master.opt +++ b/mysql-test/t/rpl_failed_optimize-master.opt @@ -1 +1 @@ ---innodb-lock-wait-timeout=1 +--loose-innodb-lock-wait-timeout=1 diff --git a/sql/ha_berkeley.cc b/sql/ha_berkeley.cc index 09b3e340d1f..2c7cce4bcd0 100644 --- a/sql/ha_berkeley.cc +++ b/sql/ha_berkeley.cc @@ -234,13 +234,13 @@ int berkeley_show_logs(Protocol *protocol) { char **all_logs, **free_logs, **a, **f; int error=1; - MEM_ROOT show_logs_root; - MEM_ROOT *old_root=my_pthread_getspecific_ptr(MEM_ROOT*,THR_MALLOC); + MEM_ROOT **root_ptr= my_pthread_getspecific_ptr(MEM_ROOT**,THR_MALLOC); + MEM_ROOT show_logs_root, *old_mem_root= *root_ptr; DBUG_ENTER("berkeley_show_logs"); init_sql_alloc(&show_logs_root, BDB_LOG_ALLOC_BLOCK_SIZE, BDB_LOG_ALLOC_BLOCK_SIZE); - my_pthread_setspecific_ptr(THR_MALLOC,&show_logs_root); + *root_ptr= &show_logs_root; if ((error= db_env->log_archive(db_env, &all_logs, DB_ARCH_ABS | DB_ARCH_LOG)) || @@ -277,15 +277,17 @@ int berkeley_show_logs(Protocol *protocol) } err: free_root(&show_logs_root,MYF(0)); - my_pthread_setspecific_ptr(THR_MALLOC,old_root); + *root_ptr= old_mem_root; DBUG_RETURN(error); } + static void berkeley_print_error(const char *db_errpfx, char *buffer) { sql_print_error("%s: %s",db_errpfx,buffer); /* purecov: tested */ } + static void berkeley_noticecall(DB_ENV *db_env, db_notices notice) { switch (notice) diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index a28f0f5d4a9..c36f2d191c7 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -1744,9 +1744,9 @@ void Item_func_in::fix_length_and_dec() Conversion is possible: All IN arguments are constants. */ - Item_arena *arena= thd->current_arena, backup; - if (arena->is_stmt_prepare()) - thd->set_n_backup_item_arena(arena, &backup); + Item_arena *arena, backup; + arena= thd->change_arena_if_needed(&backup); + for (arg= args+1, arg_end= args+arg_count; arg < arg_end; arg++) { if (!arg[0]->null_value && @@ -1764,7 +1764,7 @@ void Item_func_in::fix_length_and_dec() arg[0]= conv; } } - if (arena->is_stmt_prepare()) + if (arena) thd->restore_backup_item_arena(arena, &backup); } } diff --git a/sql/item_func.cc b/sql/item_func.cc index b382dbf7bf9..bf85e5b378a 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -160,14 +160,13 @@ bool Item_func::agg_arg_charsets(DTCollation &coll, } THD *thd= current_thd; - Item_arena *arena= thd->current_arena, backup; + Item_arena *arena, backup; bool res= FALSE; /* In case we're in statement prepare, create conversion item in its memory: it will be reused on each execute. */ - if (arena->is_stmt_prepare()) - thd->set_n_backup_item_arena(arena, &backup); + arena= thd->change_arena_if_needed(&backup); for (arg= args, last= args + nargs; arg < last; arg++) { @@ -193,7 +192,7 @@ bool Item_func::agg_arg_charsets(DTCollation &coll, conv->fix_fields(thd, 0, &conv); *arg= conv; } - if (arena->is_stmt_prepare()) + if (arena) thd->restore_backup_item_arena(arena, &backup); return res; } diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc index 401d4dee20f..62cd016b0df 100644 --- a/sql/item_subselect.cc +++ b/sql/item_subselect.cc @@ -190,15 +190,16 @@ bool Item_subselect::fix_fields(THD *thd_param, TABLE_LIST *tables, Item **ref) bool Item_subselect::exec() { int res; - MEM_ROOT *old_root= my_pthread_getspecific_ptr(MEM_ROOT*, THR_MALLOC); - if (&thd->mem_root != old_root) - { - my_pthread_setspecific_ptr(THR_MALLOC, &thd->mem_root); - res= engine->exec(); - my_pthread_setspecific_ptr(THR_MALLOC, old_root); - } - else - res= engine->exec(); + MEM_ROOT *old_root= thd->mem_root; + + /* + As this is execution, all objects should be allocated through the main + mem root + */ + thd->mem_root= &thd->main_mem_root; + res= engine->exec(); + thd->mem_root= old_root; + if (engine_changed) { engine_changed= 0; @@ -312,7 +313,6 @@ Item_singlerow_subselect::select_transformer(JOIN *join) /* Juggle with current arena only if we're in prepared statement prepare */ Item_arena *arena= join->thd->current_arena; - Item_arena backup; if (!select_lex->master_unit()->first_select()->next_select() && !select_lex->table_list.elements && @@ -655,11 +655,9 @@ Item_in_subselect::single_value_transformer(JOIN *join, } SELECT_LEX *select_lex= join->select_lex; - Item_arena *arena= join->thd->current_arena, backup; - + Item_arena *arena, backup; + arena= thd->change_arena_if_needed(&backup); thd->where= "scalar IN/ALL/ANY subquery"; - if (arena->is_stmt_prepare()) - thd->set_n_backup_item_arena(arena, &backup); /* Check that the right part of the subselect contains no more than one @@ -892,7 +890,7 @@ Item_in_subselect::single_value_transformer(JOIN *join, push_warning(thd, MYSQL_ERROR::WARN_LEVEL_NOTE, ER_SELECT_REDUCED, warn_buff); } - if (arena->is_stmt_prepare()) + if (arena) thd->restore_backup_item_arena(arena, &backup); DBUG_RETURN(RES_REDUCE); } @@ -900,13 +898,13 @@ Item_in_subselect::single_value_transformer(JOIN *join, } ok: - if (arena->is_stmt_prepare()) + if (arena) thd->restore_backup_item_arena(arena, &backup); thd->where= save_where; DBUG_RETURN(RES_OK); err: - if (arena->is_stmt_prepare()) + if (arena) thd->restore_backup_item_arena(arena, &backup); DBUG_RETURN(RES_ERROR); } @@ -922,14 +920,12 @@ Item_in_subselect::row_value_transformer(JOIN *join) { DBUG_RETURN(RES_OK); } - Item_arena *arena= join->thd->current_arena, backup; + Item_arena *arena, backup; Item *item= 0; + SELECT_LEX *select_lex= join->select_lex; thd->where= "row IN/ALL/ANY subquery"; - if (arena->is_stmt_prepare()) - thd->set_n_backup_item_arena(arena, &backup); - - SELECT_LEX *select_lex= join->select_lex; + arena= thd->change_arena_if_needed(&backup); if (select_lex->item_list.elements != left_expr->cols()) { @@ -1006,13 +1002,13 @@ Item_in_subselect::row_value_transformer(JOIN *join) if (join->conds->fix_fields(thd, join->tables_list, 0)) goto err; } - if (arena->is_stmt_prepare()) + if (arena) thd->restore_backup_item_arena(arena, &backup); thd->where= save_where; DBUG_RETURN(RES_OK); err: - if (arena->is_stmt_prepare()) + if (arena) thd->restore_backup_item_arena(arena, &backup); DBUG_RETURN(RES_ERROR); } diff --git a/sql/item_sum.cc b/sql/item_sum.cc index e6c96dd6a9a..3b3a6083725 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -254,7 +254,7 @@ Item_sum_hybrid::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref) Item *Item_sum_sum::copy_or_same(THD* thd) { - return new (&thd->mem_root) Item_sum_sum(thd, this); + return new (thd->mem_root) Item_sum_sum(thd, this); } @@ -282,7 +282,7 @@ double Item_sum_sum::val() Item *Item_sum_count::copy_or_same(THD* thd) { - return new (&thd->mem_root) Item_sum_count(thd, this); + return new (thd->mem_root) Item_sum_count(thd, this); } @@ -327,7 +327,7 @@ void Item_sum_count::cleanup() Item *Item_sum_avg::copy_or_same(THD* thd) { - return new (&thd->mem_root) Item_sum_avg(thd, this); + return new (thd->mem_root) Item_sum_avg(thd, this); } @@ -374,7 +374,7 @@ double Item_sum_std::val() Item *Item_sum_std::copy_or_same(THD* thd) { - return new (&thd->mem_root) Item_sum_std(thd, this); + return new (thd->mem_root) Item_sum_std(thd, this); } @@ -384,7 +384,7 @@ Item *Item_sum_std::copy_or_same(THD* thd) Item *Item_sum_variance::copy_or_same(THD* thd) { - return new (&thd->mem_root) Item_sum_variance(thd, this); + return new (thd->mem_root) Item_sum_variance(thd, this); } @@ -546,7 +546,7 @@ void Item_sum_hybrid::cleanup() Item *Item_sum_min::copy_or_same(THD* thd) { - return new (&thd->mem_root) Item_sum_min(thd, this); + return new (thd->mem_root) Item_sum_min(thd, this); } @@ -599,7 +599,7 @@ bool Item_sum_min::add() Item *Item_sum_max::copy_or_same(THD* thd) { - return new (&thd->mem_root) Item_sum_max(thd, this); + return new (thd->mem_root) Item_sum_max(thd, this); } @@ -666,7 +666,7 @@ void Item_sum_bit::clear() Item *Item_sum_or::copy_or_same(THD* thd) { - return new (&thd->mem_root) Item_sum_or(thd, this); + return new (thd->mem_root) Item_sum_or(thd, this); } @@ -680,7 +680,7 @@ bool Item_sum_or::add() Item *Item_sum_xor::copy_or_same(THD* thd) { - return new (&thd->mem_root) Item_sum_xor(thd, this); + return new (thd->mem_root) Item_sum_xor(thd, this); } @@ -694,7 +694,7 @@ bool Item_sum_xor::add() Item *Item_sum_and::copy_or_same(THD* thd) { - return new (&thd->mem_root) Item_sum_and(thd, this); + return new (thd->mem_root) Item_sum_and(thd, this); } @@ -1337,7 +1337,7 @@ int Item_sum_count_distinct::tree_to_myisam() Item *Item_sum_count_distinct::copy_or_same(THD* thd) { - return new (&thd->mem_root) Item_sum_count_distinct(thd, this); + return new (thd->mem_root) Item_sum_count_distinct(thd, this); } @@ -1438,7 +1438,7 @@ bool Item_udf_sum::add() Item *Item_sum_udf_float::copy_or_same(THD* thd) { - return new (&thd->mem_root) Item_sum_udf_float(thd, this); + return new (thd->mem_root) Item_sum_udf_float(thd, this); } double Item_sum_udf_float::val() @@ -1463,7 +1463,7 @@ String *Item_sum_udf_float::val_str(String *str) Item *Item_sum_udf_int::copy_or_same(THD* thd) { - return new (&thd->mem_root) Item_sum_udf_int(thd, this); + return new (thd->mem_root) Item_sum_udf_int(thd, this); } @@ -1501,7 +1501,7 @@ void Item_sum_udf_str::fix_length_and_dec() Item *Item_sum_udf_str::copy_or_same(THD* thd) { - return new (&thd->mem_root) Item_sum_udf_str(thd, this); + return new (thd->mem_root) Item_sum_udf_str(thd, this); } @@ -1815,7 +1815,7 @@ Item_func_group_concat::~Item_func_group_concat() Item *Item_func_group_concat::copy_or_same(THD* thd) { - return new (&thd->mem_root) Item_func_group_concat(thd, this); + return new (thd->mem_root) Item_func_group_concat(thd, this); } diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index f621953a5bc..41418c0094d 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -164,10 +164,10 @@ static bool extract_date_time(DATE_TIME_FORMAT *format, CHARSET_INFO *cs= &my_charset_bin; int error= 0; bool usa_time= 0; - bool sunday_first_n_first_week_non_iso; + bool sunday_first_n_first_week_non_iso= -2; bool strict_week_number; int strict_week_number_year= -1; - bool strict_week_number_year_type; + bool strict_week_number_year_type= -1; int frac_part; const char *val_begin= val; const char *val_end= val + length; @@ -175,9 +175,7 @@ static bool extract_date_time(DATE_TIME_FORMAT *format, const char *end= ptr + format->format.length; DBUG_ENTER("extract_date_time"); - LINT_INIT(sunday_first_n_first_week_non_iso); LINT_INIT(strict_week_number); - LINT_INIT(strict_week_number_year_type); if (!sub_pattern_end) bzero((char*) l_time, sizeof(*l_time)); diff --git a/sql/log_event.cc b/sql/log_event.cc index 326f2fc5c59..8e7f8062014 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -1090,7 +1090,7 @@ end: thd->query_length= thd->db_length =0; VOID(pthread_mutex_unlock(&LOCK_thread_count)); close_thread_tables(thd); - free_root(&thd->mem_root,MYF(MY_KEEP_PREALLOC)); + free_root(thd->mem_root,MYF(MY_KEEP_PREALLOC)); /* If there was an error we stop. Otherwise we increment positions. Note that we will not increment group* positions if we are just after a SET @@ -1888,10 +1888,10 @@ Slave: load data infile on table '%s' at log position %s in log \ slave_print_error(rli,sql_errno,"\ Error '%s' running LOAD DATA INFILE on table '%s'. Default database: '%s'", err, (char*)table_name, print_slave_db_safe(db)); - free_root(&thd->mem_root,MYF(MY_KEEP_PREALLOC)); + free_root(thd->mem_root,MYF(MY_KEEP_PREALLOC)); return 1; } - free_root(&thd->mem_root,MYF(MY_KEEP_PREALLOC)); + free_root(thd->mem_root,MYF(MY_KEEP_PREALLOC)); if (thd->is_fatal_error) { @@ -2505,7 +2505,7 @@ int User_var_log_event::exec_event(struct st_relay_log_info* rli) */ e.fix_fields(thd, 0, 0); e.update_hash(val, val_len, type, charset, DERIVATION_NONE); - free_root(&thd->mem_root,0); + free_root(thd->mem_root,0); rli->inc_event_relay_log_pos(get_event_len()); return 0; diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index 770b7057661..3f55a88b262 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -910,7 +910,7 @@ extern char *default_tz_name; extern MYSQL_LOG mysql_log,mysql_update_log,mysql_slow_log,mysql_bin_log; extern FILE *bootstrap_file; -extern pthread_key(MEM_ROOT*,THR_MALLOC); +extern pthread_key(MEM_ROOT**,THR_MALLOC); extern pthread_mutex_t LOCK_mysql_create_db,LOCK_Acl,LOCK_open, LOCK_thread_count,LOCK_mapped_file,LOCK_user_locks, LOCK_status, LOCK_error_log, LOCK_delayed_insert, LOCK_uuid_generator, diff --git a/sql/mysqld.cc b/sql/mysqld.cc index af6f25c1400..078ee19fe6a 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -374,7 +374,7 @@ SHOW_COMP_OPTION have_crypt, have_compress; /* Thread specific variables */ -pthread_key(MEM_ROOT*,THR_MALLOC); +pthread_key(MEM_ROOT**,THR_MALLOC); pthread_key(THD*, THR_THD); pthread_mutex_t LOCK_mysql_create_db, LOCK_Acl, LOCK_open, LOCK_thread_count, LOCK_mapped_file, LOCK_status, diff --git a/sql/opt_range.cc b/sql/opt_range.cc index c9528af7d98..d25901e56b1 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -400,7 +400,7 @@ QUICK_SELECT::QUICK_SELECT(THD *thd, TABLE *table, uint key_nr, bool no_alloc) { // Allocates everything through the internal memroot init_sql_alloc(&alloc, thd->variables.range_alloc_block_size, 0); - my_pthread_setspecific_ptr(THR_MALLOC,&alloc); + thd->mem_root= &alloc; } else bzero((char*) &alloc,sizeof(alloc)); @@ -668,8 +668,8 @@ int SQL_SELECT::test_quick_select(THD *thd, key_map keys_to_use, DBUG_RETURN(0); // Can't use range } key_parts= param.key_parts; - old_root=my_pthread_getspecific_ptr(MEM_ROOT*,THR_MALLOC); - my_pthread_setspecific_ptr(THR_MALLOC,&alloc); + old_root= thd->mem_root; + thd->mem_root= &alloc; key_info= head->key_info; for (idx=0 ; idx < head->keys ; idx++, key_info++) @@ -769,7 +769,7 @@ int SQL_SELECT::test_quick_select(THD *thd, key_map keys_to_use, } } free_root(&alloc,MYF(0)); // Return memory & allocator - my_pthread_setspecific_ptr(THR_MALLOC,old_root); + thd->mem_root= old_root; thd->no_errors=0; } DBUG_EXECUTE("info",print_quick(quick,&needed_reg);); @@ -2563,7 +2563,8 @@ static bool null_part_in_key(KEY_PART *key_part, const char *key, uint length) QUICK_SELECT *get_quick_select_for_ref(THD *thd, TABLE *table, TABLE_REF *ref) { - MEM_ROOT *old_root= my_pthread_getspecific_ptr(MEM_ROOT*, THR_MALLOC); + MEM_ROOT *old_root= thd->mem_root; + /* The following call may change thd->mem_root */ QUICK_SELECT *quick= new QUICK_SELECT(thd, table, ref->key); KEY *key_info = &table->key_info[ref->key]; KEY_PART *key_part; @@ -2624,11 +2625,11 @@ QUICK_SELECT *get_quick_select_for_ref(THD *thd, TABLE *table, TABLE_REF *ref) } ok: - my_pthread_setspecific_ptr(THR_MALLOC, old_root); + thd->mem_root= old_root; return quick; err: - my_pthread_setspecific_ptr(THR_MALLOC, old_root); + thd->mem_root= old_root; delete quick; return 0; } diff --git a/sql/repl_failsafe.cc b/sql/repl_failsafe.cc index 83fceca80ef..720e82f414e 100644 --- a/sql/repl_failsafe.cc +++ b/sql/repl_failsafe.cc @@ -92,7 +92,7 @@ static int init_failsafe_rpl_thread(THD* thd) VOID(pthread_sigmask(SIG_UNBLOCK,&set,&thd->block_signals)); #endif - thd->mem_root.free=thd->mem_root.used=0; + thd->mem_root->free= thd->mem_root->used= 0; if (thd->variables.max_join_size == HA_POS_ERROR) thd->options|= OPTION_BIG_SELECTS; diff --git a/sql/set_var.cc b/sql/set_var.cc index 905bffac29a..a97506ad07c 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -1165,7 +1165,7 @@ static void fix_max_connections(THD *thd, enum_var_type type) static void fix_thd_mem_root(THD *thd, enum_var_type type) { if (type != OPT_GLOBAL) - reset_root_defaults(&thd->mem_root, + reset_root_defaults(thd->mem_root, thd->variables.query_alloc_block_size, thd->variables.query_prealloc_size); } diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index ff2dfedc30b..98dde1071c3 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -2309,8 +2309,8 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list, create_new_users= test_if_create_new_users(thd); int result=0; rw_wrlock(&LOCK_grant); - MEM_ROOT *old_root=my_pthread_getspecific_ptr(MEM_ROOT*,THR_MALLOC); - my_pthread_setspecific_ptr(THR_MALLOC,&memex); + MEM_ROOT *old_root= thd->mem_root; + thd->mem_root= &memex; while ((Str = str_list++)) { @@ -2415,7 +2415,7 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list, } } grant_option=TRUE; - my_pthread_setspecific_ptr(THR_MALLOC,old_root); + thd->mem_root= old_root; rw_unlock(&LOCK_grant); if (!result) send_ok(thd); @@ -2549,6 +2549,7 @@ my_bool grant_init(THD *org_thd) THD *thd; TABLE_LIST tables[2]; MYSQL_LOCK *lock; + MEM_ROOT *memex_ptr; my_bool return_val= 1; TABLE *t_table, *c_table; bool check_no_resolve= specialflag & SPECIAL_NO_RESOLVE; @@ -2596,7 +2597,8 @@ my_bool grant_init(THD *org_thd) grant_option= TRUE; /* Will be restored by org_thd->store_globals() */ - my_pthread_setspecific_ptr(THR_MALLOC,&memex); + memex_ptr= &memex; + my_pthread_setspecific_ptr(THR_MALLOC, &memex_ptr); do { GRANT_TABLE *mem_check; diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 839b92e7e7f..a5db02478ac 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -499,7 +499,7 @@ void close_temporary_tables(THD *thd) */ query_buf_size+= table->key_length+1; - if ((query = alloc_root(&thd->mem_root, query_buf_size))) + if ((query = alloc_root(thd->mem_root, query_buf_size))) // Better add "if exists", in case a RESET MASTER has been done end=strmov(query, "DROP /*!40005 TEMPORARY */ TABLE IF EXISTS "); @@ -2311,18 +2311,16 @@ int setup_wild(THD *thd, TABLE_LIST *tables, List &fields, if (!wild_num) DBUG_RETURN(0); - Item_arena *arena= thd->current_arena, backup; - + reg2 Item *item; + List_iterator it(fields); + Item_arena *arena, backup; /* If we are in preparing prepared statement phase then we have change temporary mem_root to statement mem root to save changes of SELECT list */ - if ((is_stmt_prepare= arena->is_stmt_prepare())) - thd->set_n_backup_item_arena(arena, &backup); + arena= thd->change_arena_if_needed(&backup); - reg2 Item *item; - List_iterator it(fields); - while ( wild_num && (item= it++)) + while (wild_num && (item= it++)) { if (item->type() == Item::FIELD_ITEM && ((Item_field*) item)->field_name && @@ -2344,7 +2342,7 @@ int setup_wild(THD *thd, TABLE_LIST *tables, List &fields, else if (insert_fields(thd,tables,((Item_field*) item)->db_name, ((Item_field*) item)->table_name, &it)) { - if (is_stmt_prepare) + if (arena) thd->restore_backup_item_arena(arena, &backup); DBUG_RETURN(-1); } @@ -2360,7 +2358,7 @@ int setup_wild(THD *thd, TABLE_LIST *tables, List &fields, wild_num--; } } - if (is_stmt_prepare) + if (arena) thd->restore_backup_item_arena(arena, &backup); DBUG_RETURN(0); } @@ -2589,11 +2587,10 @@ insert_fields(THD *thd,TABLE_LIST *tables, const char *db_name, int setup_conds(THD *thd,TABLE_LIST *tables,COND **conds) { table_map not_null_tables= 0; - Item_arena *arena= thd->current_arena, backup; - bool is_stmt_prepare= arena->is_stmt_prepare(); + Item_arena *arena= 0, backup; DBUG_ENTER("setup_conds"); + thd->set_query_id=1; - thd->lex->current_select->cond_count= 0; if (*conds) { @@ -2628,12 +2625,14 @@ int setup_conds(THD *thd,TABLE_LIST *tables,COND **conds) !(specialflag & SPECIAL_NO_NEW_FUNC))) { table->outer_join= 0; - if (is_stmt_prepare) - thd->set_n_backup_item_arena(arena, &backup); + arena= thd->change_arena_if_needed(&backup); *conds= and_conds(*conds, table->on_expr); table->on_expr=0; - if (is_stmt_prepare) + if (arena) + { thd->restore_backup_item_arena(arena, &backup); + arena= 0; // Safety if goto err + } if ((*conds) && !(*conds)->fixed && (*conds)->fix_fields(thd, tables, conds)) DBUG_RETURN(1); @@ -2641,8 +2640,7 @@ int setup_conds(THD *thd,TABLE_LIST *tables,COND **conds) } if (table->natural_join) { - if (is_stmt_prepare) - thd->set_n_backup_item_arena(arena, &backup); + arena= thd->change_arena_if_needed(&backup); /* Make a join of all fields with have the same name */ TABLE *t1= table->table; TABLE *t2= table->natural_join->table; @@ -2683,7 +2681,7 @@ int setup_conds(THD *thd,TABLE_LIST *tables,COND **conds) { *conds= and_conds(*conds, cond_and); // fix_fields() should be made with temporary memory pool - if (is_stmt_prepare) + if (arena) thd->restore_backup_item_arena(arena, &backup); if (*conds && !(*conds)->fixed) { @@ -2695,7 +2693,7 @@ int setup_conds(THD *thd,TABLE_LIST *tables,COND **conds) { table->on_expr= and_conds(table->on_expr, cond_and); // fix_fields() should be made with temporary memory pool - if (is_stmt_prepare) + if (arena) thd->restore_backup_item_arena(arena, &backup); if (table->on_expr && !table->on_expr->fixed) { @@ -2704,12 +2702,15 @@ int setup_conds(THD *thd,TABLE_LIST *tables,COND **conds) } } } - else if (is_stmt_prepare) + else if (arena) + { thd->restore_backup_item_arena(arena, &backup); + arena= 0; // Safety if goto err + } } } - if (is_stmt_prepare) + if (thd->current_arena->is_stmt_prepare()) { /* We are in prepared statement preparation code => we should store @@ -2722,8 +2723,8 @@ int setup_conds(THD *thd,TABLE_LIST *tables,COND **conds) DBUG_RETURN(test(thd->net.report_error)); err: - if (is_stmt_prepare) - thd->restore_backup_item_arena(arena, &backup); + if (arena) + thd->restore_backup_item_arena(arena, &backup); DBUG_RETURN(1); } diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 7ad20967de0..eda60b5cfdb 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -305,7 +305,7 @@ void THD::init_for_queries() { ha_enable_transaction(this,TRUE); - reset_root_defaults(&mem_root, variables.query_alloc_block_size, + reset_root_defaults(mem_root, variables.query_alloc_block_size, variables.query_prealloc_size); reset_root_defaults(&transaction.mem_root, variables.trans_alloc_block_size, @@ -411,7 +411,7 @@ THD::~THD() dbug_sentry = THD_SENTRY_GONE; #endif /* Reset stmt_backup.mem_root to not double-free memory from thd.mem_root */ - clear_alloc_root(&stmt_backup.mem_root); + clear_alloc_root(&stmt_backup.main_mem_root); DBUG_VOID_RETURN; } @@ -1394,10 +1394,10 @@ void select_dumpvar::cleanup() for memory root initialization. */ Item_arena::Item_arena(THD* thd) - :free_list(0), - state(INITIALIZED) + :free_list(0), mem_root(&main_mem_root), + state(INITIALIZED) { - init_sql_alloc(&mem_root, + init_sql_alloc(&main_mem_root, thd->variables.query_alloc_block_size, thd->variables.query_prealloc_size); } @@ -1420,11 +1420,11 @@ Item_arena::Item_arena(THD* thd) statements. */ Item_arena::Item_arena(bool init_mem_root) - :free_list(0), + :free_list(0), mem_root(&main_mem_root), state(CONVENTIONAL_EXECUTION) { if (init_mem_root) - init_sql_alloc(&mem_root, ALLOC_ROOT_MIN_BLOCK_SIZE, 0); + init_sql_alloc(&main_mem_root, ALLOC_ROOT_MIN_BLOCK_SIZE, 0); } @@ -1518,13 +1518,16 @@ void THD::end_statement() void Item_arena::set_n_backup_item_arena(Item_arena *set, Item_arena *backup) { + DBUG_ENTER("Item_arena::set_n_backup_item_arena"); backup->set_item_arena(this); set_item_arena(set); + DBUG_VOID_RETURN; } void Item_arena::restore_backup_item_arena(Item_arena *set, Item_arena *backup) { + DBUG_ENTER("Item_arena::restore_backup_item_arena"); set->set_item_arena(this); set_item_arena(backup); #ifdef NOT_NEEDED_NOW @@ -1537,18 +1540,19 @@ void Item_arena::restore_backup_item_arena(Item_arena *set, Item_arena *backup) */ clear_alloc_root(&backup->mem_root); #endif + DBUG_VOID_RETURN; } void Item_arena::set_item_arena(Item_arena *set) { - mem_root= set->mem_root; + mem_root= set->mem_root; free_list= set->free_list; state= set->state; } Statement::~Statement() { - free_root(&mem_root, MYF(0)); + free_root(&main_mem_root, MYF(0)); } C_MODE_START diff --git a/sql/sql_class.h b/sql/sql_class.h index e73b35966a9..df6be559df2 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -429,7 +429,8 @@ public: itself to the list on creation (see Item::Item() for details)) */ Item *free_list; - MEM_ROOT mem_root; + MEM_ROOT main_mem_root; + MEM_ROOT *mem_root; // Pointer to current memroot enum enum_state { INITIALIZED= 0, PREPARED= 1, EXECUTED= 3, CONVENTIONAL_EXECUTION= 2, @@ -468,24 +469,24 @@ public: { return state == PREPARED || state == EXECUTED; } inline bool is_conventional_execution() const { return state == CONVENTIONAL_EXECUTION; } - inline gptr alloc(unsigned int size) { return alloc_root(&mem_root,size); } + inline gptr alloc(unsigned int size) { return alloc_root(mem_root,size); } inline gptr calloc(unsigned int size) { gptr ptr; - if ((ptr=alloc_root(&mem_root,size))) + if ((ptr=alloc_root(mem_root,size))) bzero((char*) ptr,size); return ptr; } inline char *strdup(const char *str) - { return strdup_root(&mem_root,str); } + { return strdup_root(mem_root,str); } inline char *strmake(const char *str, uint size) - { return strmake_root(&mem_root,str,size); } + { return strmake_root(mem_root,str,size); } inline char *memdup(const char *str, uint size) - { return memdup_root(&mem_root,str,size); } + { return memdup_root(mem_root,str,size); } inline char *memdup_w_gap(const char *str, uint size, uint gap) { gptr ptr; - if ((ptr=alloc_root(&mem_root,size+gap))) + if ((ptr=alloc_root(mem_root,size+gap))) memcpy(ptr,str,size); return ptr; } @@ -1052,11 +1053,26 @@ public: inline CHARSET_INFO *charset() { return variables.character_set_client; } void update_charset(); + inline Item_arena *change_arena_if_needed(Item_arena *backup) + { + /* + use new arena if we are in a prepared statements and we have not + already changed to use this arena. + */ + if (current_arena->is_stmt_prepare() && + mem_root != ¤t_arena->main_mem_root) + { + set_n_backup_item_arena(current_arena, backup); + return current_arena; + } + return 0; + } + void change_item_tree(Item **place, Item *new_value) { /* TODO: check for OOM condition here */ if (!current_arena->is_conventional_execution()) - nocheck_register_item_tree_change(place, *place, &mem_root); + nocheck_register_item_tree_change(place, *place, mem_root); *place= new_value; } void nocheck_register_item_tree_change(Item **place, Item *old_value, diff --git a/sql/sql_db.cc b/sql/sql_db.cc index eb851e79d2e..e50796f2a33 100644 --- a/sql/sql_db.cc +++ b/sql/sql_db.cc @@ -725,7 +725,7 @@ static long mysql_rm_known_files(THD *thd, MY_DIR *dirp, const char *db, if ((mysql_rm_known_files(thd, new_dirp, NullS, newpath,1)) < 0) goto err; if (!(copy_of_path= thd->memdup(newpath, length+1)) || - !(dir= new (&thd->mem_root) String(copy_of_path, length, + !(dir= new (thd->mem_root) String(copy_of_path, length, &my_charset_bin)) || raid_dirs.push_back(dir)) goto err; diff --git a/sql/sql_error.cc b/sql/sql_error.cc index 87644300535..eab5ec890df 100644 --- a/sql/sql_error.cc +++ b/sql/sql_error.cc @@ -113,12 +113,12 @@ MYSQL_ERROR *push_warning(THD *thd, MYSQL_ERROR::enum_warning_level level, The following code is here to change the allocation to not use the thd->mem_root, which is freed after each query */ - MEM_ROOT *old_root=my_pthread_getspecific_ptr(MEM_ROOT*,THR_MALLOC); - my_pthread_setspecific_ptr(THR_MALLOC, &thd->warn_root); + MEM_ROOT *old_root= thd->mem_root; + thd->mem_root= &thd->warn_root; err= new MYSQL_ERROR(thd, code, level, msg); if (err) thd->warn_list.push_back(err); - my_pthread_setspecific_ptr(THR_MALLOC, old_root); + thd->mem_root= old_root; } thd->warn_count[(uint) level]++; thd->total_warn_count++; diff --git a/sql/sql_help.cc b/sql/sql_help.cc index ffaaafc26e6..04ecbbd43b9 100644 --- a/sql/sql_help.cc +++ b/sql/sql_help.cc @@ -127,7 +127,7 @@ void memorize_variant_topic(THD *thd, TABLE *topics, int count, String *name, String *description, String *example) { DBUG_ENTER("memorize_variant_topic"); - MEM_ROOT *mem_root= &thd->mem_root; + MEM_ROOT *mem_root= thd->mem_root; if (count==0) { get_field(mem_root,find_fields[help_topic_name].field, name); @@ -138,7 +138,7 @@ void memorize_variant_topic(THD *thd, TABLE *topics, int count, { if (count == 1) names->push_back(name); - String *new_name= new (&thd->mem_root) String; + String *new_name= new (thd->mem_root) String; get_field(mem_root,find_fields[help_topic_name].field,new_name); names->push_back(new_name); } @@ -351,8 +351,8 @@ int search_categories(THD *thd, TABLE *categories, { if (select && !select->cond->val_int()) continue; - String *lname= new (&thd->mem_root) String; - get_field(&thd->mem_root,pfname,lname); + String *lname= new (thd->mem_root) String; + get_field(thd->mem_root,pfname,lname); if (++count == 1 && res_id) *res_id= (int16) pcat_id->val_int(); names->push_back(lname); @@ -385,8 +385,8 @@ void get_all_items_for_category(THD *thd, TABLE *items, Field *pfname, { if (!select->cond->val_int()) continue; - String *name= new (&thd->mem_root) String(); - get_field(&thd->mem_root,pfname,name); + String *name= new (thd->mem_root) String(); + get_field(thd->mem_root,pfname,name); res->push_back(name); } end_read_record(&read_record_info); @@ -638,7 +638,7 @@ int mysqld_help(THD *thd, const char *mask) String name, description, example; int res, count_topics, count_categories, error; uint mlen= strlen(mask); - MEM_ROOT *mem_root= &thd->mem_root; + MEM_ROOT *mem_root= thd->mem_root; if (open_and_lock_tables(thd, tables)) { diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 648549ca3ac..822ce622b1b 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -202,7 +202,7 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list, { /* it should be allocated before Item::fix_fields() */ table->insert_values= - (byte *)alloc_root(&thd->mem_root, table->rec_buff_length); + (byte *)alloc_root(thd->mem_root, table->rec_buff_length); if (!table->insert_values) goto abort; } @@ -924,7 +924,7 @@ TABLE *delayed_insert::get_local_table(THD* client_thd) found_next_number_field=table->found_next_number_field; for (org_field=table->field ; *org_field ; org_field++,field++) { - if (!(*field= (*org_field)->new_field(&client_thd->mem_root,copy))) + if (!(*field= (*org_field)->new_field(client_thd->mem_root,copy))) return 0; (*field)->orig_table= copy; // Remove connection (*field)->move_field(adjust_ptrs); // Point at copy->record[0] diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index f5b9bc0638f..2bf977804af 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -1026,7 +1026,7 @@ pthread_handler_decl(handle_one_connection,arg) } if (thd->user_connect) decrease_user_connections(thd->user_connect); - free_root(&thd->mem_root,MYF(0)); + free_root(thd->mem_root,MYF(0)); if (net->error && net->vio != 0 && net->report_error) { if (!thd->killed && thd->variables.log_warnings > 1) @@ -1121,14 +1121,14 @@ extern "C" pthread_handler_decl(handle_bootstrap,arg) { thd->net.error = 0; close_thread_tables(thd); // Free tables - free_root(&thd->mem_root,MYF(MY_KEEP_PREALLOC)); + free_root(thd->mem_root,MYF(MY_KEEP_PREALLOC)); break; } mysql_parse(thd,thd->query,length); close_thread_tables(thd); // Free tables if (thd->is_fatal_error) break; - free_root(&thd->mem_root,MYF(MY_KEEP_PREALLOC)); + free_root(thd->mem_root,MYF(MY_KEEP_PREALLOC)); free_root(&thd->transaction.mem_root,MYF(MY_KEEP_PREALLOC)); } @@ -1681,7 +1681,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd, #endif close_connection(thd, 0, 1); close_thread_tables(thd); // Free before kill - free_root(&thd->mem_root,MYF(0)); + free_root(thd->mem_root,MYF(0)); free_root(&thd->transaction.mem_root,MYF(0)); kill_mysql(); error=TRUE; @@ -1808,7 +1808,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd, thread_running--; VOID(pthread_mutex_unlock(&LOCK_thread_count)); thd->packet.shrink(thd->variables.net_buffer_length); // Reclaim some memory - free_root(&thd->mem_root,MYF(MY_KEEP_PREALLOC)); + free_root(thd->mem_root,MYF(MY_KEEP_PREALLOC)); DBUG_RETURN(error); } @@ -2062,7 +2062,7 @@ mysql_execute_command(THD *thd) query_len= need_conversion? (pstr->length() * to_cs->mbmaxlen) : pstr->length(); - if (!(query_str= alloc_root(&thd->mem_root, query_len+1))) + if (!(query_str= alloc_root(thd->mem_root, query_len+1))) { res= -1; break; // EOM (error should be reported by allocator) @@ -3937,8 +3937,8 @@ mysql_init_select(LEX *lex) bool mysql_new_select(LEX *lex, bool move_down) { - SELECT_LEX *select_lex = new(&lex->thd->mem_root) SELECT_LEX(); - if (!select_lex) + SELECT_LEX *select_lex; + if (!(select_lex= new(lex->thd->mem_root) SELECT_LEX())) return 1; select_lex->select_number= ++lex->thd->select_number; select_lex->init_query(); @@ -3946,9 +3946,10 @@ mysql_new_select(LEX *lex, bool move_down) if (move_down) { /* first select_lex of subselect or derived table */ - SELECT_LEX_UNIT *unit= new(&lex->thd->mem_root) SELECT_LEX_UNIT(); - if (!unit) + SELECT_LEX_UNIT *unit; + if (!(unit= new(lex->thd->mem_root) SELECT_LEX_UNIT())) return 1; + unit->init_query(); unit->init_select(); unit->thd= lex->thd; @@ -3970,7 +3971,8 @@ mysql_new_select(LEX *lex, bool move_down) as far as we included SELECT_LEX for UNION unit should have fake SELECT_LEX for UNION processing */ - fake= unit->fake_select_lex= new(&lex->thd->mem_root) SELECT_LEX(); + if (!(fake= unit->fake_select_lex= new(lex->thd->mem_root) SELECT_LEX())) + return 1; fake->include_standalone(unit, (SELECT_LEX_NODE**)&unit->fake_select_lex); fake->select_number= INT_MAX; diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index 4ae69e40342..d81ed2cd014 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -1065,7 +1065,7 @@ static int mysql_test_select(Prepared_statement *stmt, DBUG_RETURN(1); #endif - if (!lex->result && !(lex->result= new (&stmt->mem_root) select_send)) + if (!lex->result && !(lex->result= new (stmt->mem_root) select_send)) { send_error(thd); goto err; @@ -1503,7 +1503,7 @@ static bool init_param_array(Prepared_statement *stmt) List_iterator param_iterator(lex->param_list); /* Use thd->mem_root as it points at statement mem_root */ stmt->param_array= (Item_param **) - alloc_root(&stmt->thd->mem_root, + alloc_root(stmt->thd->mem_root, sizeof(Item_param*) * stmt->param_count); if (!stmt->param_array) { @@ -1569,7 +1569,7 @@ int mysql_stmt_prepare(THD *thd, char *packet, uint packet_length, if (name) { stmt->name.length= name->length; - if (!(stmt->name.str= memdup_root(&stmt->mem_root, (char*)name->str, + if (!(stmt->name.str= memdup_root(stmt->mem_root, (char*)name->str, name->length))) { delete stmt; diff --git a/sql/sql_select.cc b/sql/sql_select.cc index df74a946b5c..089bb150bbd 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -4603,7 +4603,7 @@ static Field* create_tmp_field_from_field(THD *thd, Field* org_field, org_field->field_name, table, org_field->charset()); else - new_field= org_field->new_field(&thd->mem_root, table); + new_field= org_field->new_field(thd->mem_root, table); if (new_field) { if (modify_item) @@ -5206,7 +5206,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List &fields, if (!using_unique_constraint) { group->buff=(char*) group_buff; - if (!(group->field=field->new_field(&thd->mem_root,table))) + if (!(group->field=field->new_field(thd->mem_root,table))) goto err; /* purecov: inspected */ if (maybe_null) { @@ -8499,7 +8499,7 @@ setup_copy_fields(THD *thd, TMP_TABLE_PARAM *param, saved value */ Field *field= item->field; - item->result_field=field->new_field(&thd->mem_root,field->table); + item->result_field=field->new_field(thd->mem_root,field->table); char *tmp=(char*) sql_alloc(field->pack_length()+1); if (!tmp) goto err; @@ -8942,7 +8942,7 @@ bool JOIN::rollup_init() return 1; rollup.ref_pointer_arrays= (Item***) (rollup.fields + send_group_parts); ref_array= (Item**) (rollup.ref_pointer_arrays+send_group_parts); - rollup.item_null= new (&thd->mem_root) Item_null(); + rollup.item_null= new (thd->mem_root) Item_null(); /* Prepare space for field list for the different levels diff --git a/sql/sql_select.h b/sql/sql_select.h index 34eaa7e272d..bbd169d1850 100644 --- a/sql/sql_select.h +++ b/sql/sql_select.h @@ -354,7 +354,7 @@ class store_key :public Sql_alloc field_arg->table, field_arg->charset()); else { - to_field=field_arg->new_field(&thd->mem_root,field_arg->table); + to_field=field_arg->new_field(thd->mem_root,field_arg->table); if (to_field) to_field->move_field(ptr, (uchar*) null, 1); } diff --git a/sql/sql_union.cc b/sql/sql_union.cc index 0be554f58a2..e0e8f8d42c5 100644 --- a/sql/sql_union.cc +++ b/sql/sql_union.cc @@ -313,24 +313,24 @@ int st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result, We're in statement prepare or in execution of a conventional statement. */ - Item_arena backup; - if (arena->is_stmt_prepare()) - thd->set_n_backup_item_arena(arena, &backup); + Item_arena *tmp_arena,backup; + tmp_arena= thd->change_arena_if_needed(&backup); + Field **field; for (field= table->field; *field; field++) { Item_field *item= new Item_field(*field); if (!item || item_list.push_back(item)) { - if (arena->is_stmt_prepare()) - thd->restore_backup_item_arena(arena, &backup); + if (tmp_arena) + thd->restore_backup_item_arena(tmp_arena, &backup); DBUG_RETURN(-1); } } + if (tmp_arena) + thd->restore_backup_item_arena(tmp_arena, &backup); if (arena->is_stmt_prepare()) { - thd->restore_backup_item_arena(arena, &backup); - /* prepare fake select to initialize it correctly */ ulong options_tmp= init_prepare_fake_select_lex(thd); if (!(fake_select_lex->join= new JOIN(thd, item_list, thd->options, diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 4538cb6e6ac..94c0fe3cf0c 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -3297,7 +3297,7 @@ opt_distinct: |DISTINCT { $$ = 1; }; opt_gconcat_separator: - /* empty */ { $$ = new (&YYTHD->mem_root) String(",",1,default_charset_info); } + /* empty */ { $$ = new (YYTHD->mem_root) String(",",1,default_charset_info); } |SEPARATOR_SYM text_string { $$ = $2; }; @@ -3551,15 +3551,15 @@ key_list_or_empty: key_usage_list2: key_usage_list2 ',' ident { Select-> - interval_list.push_back(new (&YYTHD->mem_root) String((const char*) $3.str, $3.length, + interval_list.push_back(new (YYTHD->mem_root) String((const char*) $3.str, $3.length, system_charset_info)); } | ident { Select-> - interval_list.push_back(new (&YYTHD->mem_root) String((const char*) $1.str, $1.length, + interval_list.push_back(new (YYTHD->mem_root) String((const char*) $1.str, $1.length, system_charset_info)); } | PRIMARY_SYM { Select-> - interval_list.push_back(new (&YYTHD->mem_root) String("PRIMARY", 7, + interval_list.push_back(new (YYTHD->mem_root) String("PRIMARY", 7, system_charset_info)); }; using_list: @@ -4507,7 +4507,7 @@ opt_db: wild: /* empty */ | LIKE TEXT_STRING_sys - { Lex->wild= new (&YYTHD->mem_root) String($2.str, $2.length, + { Lex->wild= new (YYTHD->mem_root) String($2.str, $2.length, system_charset_info); }; opt_full: @@ -4561,7 +4561,7 @@ opt_describe_column: /* empty */ {} | text_string { Lex->wild= $1; } | ident - { Lex->wild= new (&YYTHD->mem_root) String((const char*) $1.str,$1.length,system_charset_info); }; + { Lex->wild= new (YYTHD->mem_root) String((const char*) $1.str,$1.length,system_charset_info); }; /* flush things */ @@ -4802,7 +4802,7 @@ text_literal: text_string: TEXT_STRING_literal - { $$= new (&YYTHD->mem_root) String($1.str,$1.length,YYTHD->variables.collation_connection); } + { $$= new (YYTHD->mem_root) String($1.str,$1.length,YYTHD->variables.collation_connection); } | HEX_NUM { Item *tmp = new Item_varbinary($1.str,$1.length); @@ -5821,7 +5821,7 @@ column_list: column_list_id: ident { - String *new_str = new (&YYTHD->mem_root) String((const char*) $1.str,$1.length,system_charset_info); + String *new_str = new (YYTHD->mem_root) String((const char*) $1.str,$1.length,system_charset_info); List_iterator iter(Lex->columns); class LEX_COLUMN *point; LEX *lex=Lex; diff --git a/sql/table.cc b/sql/table.cc index 3ae3d668407..20ac714020d 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -81,6 +81,7 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag, uchar *null_pos; uint null_bit, new_frm_ver, field_pack_length; SQL_CRYPT *crypted=0; + MEM_ROOT **root_ptr, *old_root; DBUG_ENTER("openfrm"); DBUG_PRINT("enter",("name: '%s' form: %lx",name,outparam)); @@ -91,8 +92,9 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag, error=1; init_sql_alloc(&outparam->mem_root, TABLE_ALLOC_BLOCK_SIZE, 0); - MEM_ROOT *old_root=my_pthread_getspecific_ptr(MEM_ROOT*,THR_MALLOC); - my_pthread_setspecific_ptr(THR_MALLOC,&outparam->mem_root); + root_ptr= my_pthread_getspecific_ptr(MEM_ROOT**, THR_MALLOC); + old_root= *root_ptr; + *root_ptr= &outparam->mem_root; outparam->real_name=strdup_root(&outparam->mem_root, name+dirname_length(name)); @@ -251,9 +253,9 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag, #ifdef HAVE_CRYPTED_FRM else if (*(head+26) == 2) { - my_pthread_setspecific_ptr(THR_MALLOC,old_root); + *root_ptr= old_root crypted=get_crypt_for_frm(); - my_pthread_setspecific_ptr(THR_MALLOC,&outparam->mem_root); + *root_ptr= &outparam->mem_root; outparam->crypted=1; } #endif @@ -736,7 +738,7 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag, } outparam->db_low_byte_first=outparam->file->low_byte_first(); - my_pthread_setspecific_ptr(THR_MALLOC,old_root); + *root_ptr= old_root; opened_tables++; #ifndef DBUG_OFF if (use_hash) @@ -751,7 +753,7 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag, err_end: /* Here when no file */ delete crypted; - my_pthread_setspecific_ptr(THR_MALLOC,old_root); + *root_ptr= old_root; frm_error(error,outparam,name,ME_ERROR+ME_WAITTANG); delete outparam->file; outparam->file=0; // For easyer errorchecking diff --git a/sql/thr_malloc.cc b/sql/thr_malloc.cc index 0df60858bcb..3a9ca397bba 100644 --- a/sql/thr_malloc.cc +++ b/sql/thr_malloc.cc @@ -38,7 +38,7 @@ void init_sql_alloc(MEM_ROOT *mem_root, uint block_size, uint pre_alloc) gptr sql_alloc(uint Size) { - MEM_ROOT *root=my_pthread_getspecific_ptr(MEM_ROOT*,THR_MALLOC); + MEM_ROOT *root= *my_pthread_getspecific_ptr(MEM_ROOT**,THR_MALLOC); char *ptr= (char*) alloc_root(root,Size); return ptr; } diff --git a/tests/client_test.c b/tests/client_test.c index 004f076c6df..1578f8c7d95 100644 --- a/tests/client_test.c +++ b/tests/client_test.c @@ -97,11 +97,12 @@ void die(const char *file, int line, const char *expr) #define myerror(msg) print_error(msg) #define mysterror(stmt, msg) print_st_error(stmt, msg) -#define myquery(r) \ +#define myquery(RES) \ { \ -if (r) \ - myerror(NULL); \ - DIE_UNLESS(r == 0); \ + int r= (RES); \ + if (r) \ + myerror(NULL); \ + DIE_UNLESS(r == 0); \ } #define myquery_r(r) \ @@ -282,38 +283,40 @@ static void client_query() myheader("client_query"); - rc= mysql_query(mysql, "DROP TABLE IF EXISTS myclient_test"); + rc= mysql_query(mysql, "DROP TABLE IF EXISTS t1"); myquery(rc); - rc= mysql_query(mysql, "CREATE TABLE myclient_test(" + rc= mysql_query(mysql, "CREATE TABLE t1(" "id int primary key auto_increment, " "name varchar(20))"); myquery(rc); - rc= mysql_query(mysql, "CREATE TABLE myclient_test(id int, name varchar(20))"); + rc= mysql_query(mysql, "CREATE TABLE t1(id int, name varchar(20))"); myquery_r(rc); - rc= mysql_query(mysql, "INSERT INTO myclient_test(name) VALUES('mysql')"); + rc= mysql_query(mysql, "INSERT INTO t1(name) VALUES('mysql')"); myquery(rc); - rc= mysql_query(mysql, "INSERT INTO myclient_test(name) VALUES('monty')"); + rc= mysql_query(mysql, "INSERT INTO t1(name) VALUES('monty')"); myquery(rc); - rc= mysql_query(mysql, "INSERT INTO myclient_test(name) VALUES('venu')"); + rc= mysql_query(mysql, "INSERT INTO t1(name) VALUES('venu')"); myquery(rc); - rc= mysql_query(mysql, "INSERT INTO myclient_test(name) VALUES('deleted')"); + rc= mysql_query(mysql, "INSERT INTO t1(name) VALUES('deleted')"); myquery(rc); - rc= mysql_query(mysql, "INSERT INTO myclient_test(name) VALUES('deleted')"); + rc= mysql_query(mysql, "INSERT INTO t1(name) VALUES('deleted')"); myquery(rc); - rc= mysql_query(mysql, "UPDATE myclient_test SET name= 'updated' " + rc= mysql_query(mysql, "UPDATE t1 SET name= 'updated' " "WHERE name= 'deleted'"); myquery(rc); - rc= mysql_query(mysql, "UPDATE myclient_test SET id= 3 WHERE name= 'updated'"); + rc= mysql_query(mysql, "UPDATE t1 SET id= 3 WHERE name= 'updated'"); myquery_r(rc); + + myquery(mysql_query(mysql, "drop table t1")); } @@ -743,7 +746,7 @@ static void client_store_result() myheader("client_store_result"); - rc= mysql_query(mysql, "SELECT * FROM myclient_test"); + rc= mysql_query(mysql, "SELECT * FROM t1"); myquery(rc); /* get the result */ @@ -763,7 +766,7 @@ static void client_use_result() int rc; myheader("client_use_result"); - rc= mysql_query(mysql, "SELECT * FROM myclient_test"); + rc= mysql_query(mysql, "SELECT * FROM t1"); myquery(rc); /* get the result */ @@ -7537,17 +7540,17 @@ static void test_fetch_seek() char c2[11], c3[20]; myheader("test_fetch_seek"); + rc= mysql_query(mysql, "drop table if exists t1"); - rc= mysql_query(mysql, "drop table if exists test_seek"); myquery(rc); - rc= mysql_query(mysql, "create table test_seek(c1 int primary key auto_increment, c2 char(10), c3 timestamp(14))"); + rc= mysql_query(mysql, "create table t1(c1 int primary key auto_increment, c2 char(10), c3 timestamp(14))"); myquery(rc); - rc= mysql_query(mysql, "insert into test_seek(c2) values('venu'), ('mysql'), ('open'), ('source')"); + rc= mysql_query(mysql, "insert into t1(c2) values('venu'), ('mysql'), ('open'), ('source')"); myquery(rc); - stmt= mysql_simple_prepare(mysql, "select * from test_seek"); + stmt= mysql_simple_prepare(mysql, "select * from t1"); check_stmt(stmt); bind[0].buffer_type= MYSQL_TYPE_LONG; @@ -7620,6 +7623,7 @@ static void test_fetch_seek() DIE_UNLESS(rc == MYSQL_NO_DATA); mysql_stmt_close(stmt); + myquery(mysql_query(mysql, "drop table t1")); } @@ -7637,16 +7641,16 @@ static void test_fetch_offset() myheader("test_fetch_offset"); - rc= mysql_query(mysql, "drop table if exists test_column"); + rc= mysql_query(mysql, "drop table if exists t1"); myquery(rc); - rc= mysql_query(mysql, "create table test_column(a char(10))"); + rc= mysql_query(mysql, "create table t1(a char(10))"); myquery(rc); - rc= mysql_query(mysql, "insert into test_column values('abcdefghij'), (null)"); + rc= mysql_query(mysql, "insert into t1 values('abcdefghij'), (null)"); myquery(rc); - stmt= mysql_simple_prepare(mysql, "select * from test_column"); + stmt= mysql_simple_prepare(mysql, "select * from t1"); check_stmt(stmt); bind[0].buffer_type= MYSQL_TYPE_STRING; @@ -7706,6 +7710,8 @@ static void test_fetch_offset() check_execute_r(stmt, rc); mysql_stmt_close(stmt); + + myquery(mysql_query(mysql, "drop table t1")); } @@ -7721,16 +7727,16 @@ static void test_fetch_column() myheader("test_fetch_column"); - rc= mysql_query(mysql, "drop table if exists test_column"); + rc= mysql_query(mysql, "drop table if exists t1"); myquery(rc); - rc= mysql_query(mysql, "create table test_column(c1 int primary key auto_increment, c2 char(10))"); + rc= mysql_query(mysql, "create table t1(c1 int primary key auto_increment, c2 char(10))"); myquery(rc); - rc= mysql_query(mysql, "insert into test_column(c2) values('venu'), ('mysql')"); + rc= mysql_query(mysql, "insert into t1(c2) values('venu'), ('mysql')"); myquery(rc); - stmt= mysql_simple_prepare(mysql, "select * from test_column order by c2 desc"); + stmt= mysql_simple_prepare(mysql, "select * from t1 order by c2 desc"); check_stmt(stmt); bind[0].buffer_type= MYSQL_TYPE_LONG; @@ -7841,6 +7847,7 @@ static void test_fetch_column() check_execute_r(stmt, rc); mysql_stmt_close(stmt); + myquery(mysql_query(mysql, "drop table t1")); } @@ -7852,27 +7859,28 @@ static void test_list_fields() int rc; myheader("test_list_fields"); - rc= mysql_query(mysql, "drop table if exists test_list_fields"); + rc= mysql_query(mysql, "drop table if exists t1"); myquery(rc); - rc= mysql_query(mysql, "create table test_list_fields(c1 int primary key auto_increment, c2 char(10) default 'mysql')"); + rc= mysql_query(mysql, "create table t1(c1 int primary key auto_increment, c2 char(10) default 'mysql')"); myquery(rc); - result= mysql_list_fields(mysql, "test_list_fields", NULL); + result= mysql_list_fields(mysql, "t1", NULL); mytest(result); rc= my_process_result_set(result); DIE_UNLESS(rc == 0); verify_prepare_field(result, 0, "c1", "c1", MYSQL_TYPE_LONG, - "test_list_fields", "test_list_fields", + "t1", "t1", current_db, 11, "0"); verify_prepare_field(result, 1, "c2", "c2", MYSQL_TYPE_STRING, - "test_list_fields", "test_list_fields", + "t1", "t1", current_db, 10, "mysql"); mysql_free_result(result); + myquery(mysql_query(mysql, "drop table t1")); } @@ -11140,11 +11148,13 @@ static void test_bug4172() res= mysql_store_result(mysql); row= mysql_fetch_row(res); - printf("Binary protocol: float=%s, double=%s, decimal(10,4)=%s\n", - f, d, e); - printf("Text protocol: float=%s, double=%s, decimal(10,4)=%s\n", - row[0], row[1], row[2]); - + if (!opt_silent) + { + printf("Binary protocol: float=%s, double=%s, decimal(10,4)=%s\n", + f, d, e); + printf("Text protocol: float=%s, double=%s, decimal(10,4)=%s\n", + row[0], row[1], row[2]); + } DIE_UNLESS(!strcmp(f, row[0]) && !strcmp(d, row[1]) && !strcmp(e, row[2])); mysql_free_result(res);