1/* Copyright (C) 2007 MySQL AB
2
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; version 2 of the License.
6
7 This program is distributed in the hope that it will be useful,
8 but WITHOUT ANY WARRANTY; without even the implied warranty of
9 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 GNU General Public License for more details.
11
12 You should have received a copy of the GNU General Public License
13 along with this program; if not, write to the Free Software
14 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
15
16#include <my_check_opt.h>
17
18/* almost every standalone maria program will need it */
19void _mi_report_crashed(void *file __attribute__((unused)),
20 const char *message __attribute__((unused)),
21 const char *sfile __attribute__((unused)),
22 uint sline __attribute__((unused)))
23{
24}
25
26static unsigned int no_key(unsigned int not_used __attribute__((unused)))
27{
28 return ENCRYPTION_KEY_VERSION_INVALID;
29}
30
31struct encryption_service_st encryption_handler=
32{
33 no_key, 0, 0, 0, 0, 0, 0
34};
35
36int encryption_scheme_encrypt(const unsigned char* src __attribute__((unused)),
37 unsigned int slen __attribute__((unused)),
38 unsigned char* dst __attribute__((unused)),
39 unsigned int* dlen __attribute__((unused)),
40 struct st_encryption_scheme *scheme __attribute__((unused)),
41 unsigned int key_version __attribute__((unused)),
42 unsigned int i32_1 __attribute__((unused)),
43 unsigned int i32_2 __attribute__((unused)),
44 unsigned long long i64 __attribute__((unused)))
45{
46 return -1;
47}
48
49
50int encryption_scheme_decrypt(const unsigned char* src __attribute__((unused)),
51 unsigned int slen __attribute__((unused)),
52 unsigned char* dst __attribute__((unused)),
53 unsigned int* dlen __attribute__((unused)),
54 struct st_encryption_scheme *scheme __attribute__((unused)),
55 unsigned int key_version __attribute__((unused)),
56 unsigned int i32_1 __attribute__((unused)),
57 unsigned int i32_2 __attribute__((unused)),
58 unsigned long long i64 __attribute__((unused)))
59{
60 return -1;
61}
62
63/* only those that included myisamchk.h may need and can use the below */
64#ifdef _myisamchk_h
65/*
66 All standalone programs which need to use functions from ma_check.c
67 (like maria_repair()) must define their version of _ma_killed_ptr()
68 and _ma_check_print_info|warning|error(). Indeed, linking with ma_check.o
69 brings in the dependencies of ma_check.o which are definitions of the above
70 functions; if the program does not define them then the ones of
71 ha_maria.o are used i.e. ha_maria.o is linked into the program, and this
72 brings dependencies of ha_maria.o on mysqld.o into the program's linking
73 which thus fails, as the program is not linked with mysqld.o.
74 This file contains the versions of these functions used by maria_chk and
75 maria_read_log.
76*/
77
78/*
79 Check if check/repair operation was killed by a signal
80*/
81
82int _ma_killed_ptr(HA_CHECK *param __attribute__((unused)))
83{
84 return 0;
85}
86
87
88void _ma_report_progress(HA_CHECK *param __attribute__((unused)),
89 ulonglong progress __attribute__((unused)),
90 ulonglong max_progress __attribute__((unused)))
91{
92}
93
94 /* print warnings and errors */
95 /* VARARGS */
96
97void _ma_check_print_info(HA_CHECK *param __attribute__((unused)),
98 const char *fmt,...)
99{
100 va_list args;
101 DBUG_ENTER("_ma_check_print_info");
102 DBUG_PRINT("enter", ("format: %s", fmt));
103
104 va_start(args,fmt);
105 vfprintf(stdout, fmt, args);
106 fputc('\n',stdout);
107 va_end(args);
108 DBUG_VOID_RETURN;
109}
110
111/* VARARGS */
112
113void _ma_check_print_warning(HA_CHECK *param, const char *fmt,...)
114{
115 va_list args;
116 DBUG_ENTER("_ma_check_print_warning");
117 DBUG_PRINT("enter", ("format: %s", fmt));
118
119 fflush(stdout);
120 if (!param->warning_printed && !param->error_printed)
121 {
122 if (param->testflag & T_SILENT)
123 fprintf(stderr,"%s: Aria file %s\n",my_progname_short,
124 param->isam_file_name);
125 param->out_flag|= O_DATA_LOST;
126 }
127 param->warning_printed=1;
128 va_start(args,fmt);
129 fprintf(stderr,"%s: warning: ",my_progname_short);
130 vfprintf(stderr, fmt, args);
131 fputc('\n',stderr);
132 fflush(stderr);
133 va_end(args);
134 DBUG_VOID_RETURN;
135}
136
137/* VARARGS */
138
139void _ma_check_print_error(HA_CHECK *param, const char *fmt,...)
140{
141 va_list args;
142 DBUG_ENTER("_ma_check_print_error");
143 DBUG_PRINT("enter", ("format: %s", fmt));
144
145 fflush(stdout);
146 if (!param->warning_printed && !param->error_printed)
147 {
148 if (param->testflag & T_SILENT)
149 fprintf(stderr,"%s: Aria file %s\n",my_progname_short,param->isam_file_name);
150 param->out_flag|= O_DATA_LOST;
151 }
152 param->error_printed|=1;
153 va_start(args,fmt);
154 fprintf(stderr,"%s: error: ",my_progname_short);
155 vfprintf(stderr, fmt, args);
156 fputc('\n',stderr);
157 fflush(stderr);
158 va_end(args);
159 DBUG_VOID_RETURN;
160}
161
162#endif
163
164