~drizzle-trunk/drizzle/development

481.2.1 by Monty Taylor
Split iocache definitions into their own header.
1
/* - mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
 *
4
 *  Copyright (C) 2008 MySQL
5
 *
6
 *  This program is free software; you can redistribute it and/or modify
7
 *  it under the terms of the GNU General Public License as published by
8
 *  the Free Software Foundation; either version 2 of the License, or
9
 *  (at your option) any later version.
10
 *
11
 *  This program is distributed in the hope that it will be useful,
12
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 *  GNU General Public License for more details.
15
 *
16
 *  You should have received a copy of the GNU General Public License
17
 *  along with this program; if not, write to the Free Software
18
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19
 */
1 by brian
clean slate
20
2234 by Brian Aker
Mass removal of ifdef/endif in favor of pragma once.
21
#pragma once
1 by brian
clean slate
22
1241.9.1 by Monty Taylor
Removed global.h. Fixed all the headers.
23
#ifdef __cplusplus
24
# include <cstdio>
25
#else
26
# include <stdio.h>
27
#endif
28
12.4.2 by Stewart Smith
my_errno => errno
29
#include <errno.h>
2241.4.18 by Stewart Smith
add include of sys/types.h to my_sys.h as it uses uint which is in sys/types.h on OSX
30
#include <sys/types.h>
12.4.2 by Stewart Smith
my_errno => errno
31
2241.4.14 by Stewart Smith
remove some includes from my_sys.h and instead only include where needed. This helps reduce the number of files that have to be rebuilt when you change some of the more widely included header files (such as the drizzled::identifier ones)
32
#include <drizzled/definitions.h>
2173.2.1 by Monty Taylor
Fixes incorrect usage of include
33
#include <drizzled/internal/my_pthread.h>
1 by brian
clean slate
34
2281.5.1 by Muhammad Umair
Merged charset declarations of global_charset_info.h and charset_info.h into charset.h header file.
35
#include <drizzled/charset.h>                    /* for charset_info_st */
1 by brian
clean slate
36
#include <stdarg.h>
492.1.1 by Monty Taylor
Moved MEM_ROOT functions into my_alloc.h.
37
1241.9.1 by Monty Taylor
Removed global.h. Fixed all the headers.
38
#ifndef errno				/* did we already get it? */
39
#ifdef HAVE_ERRNO_AS_DEFINE
40
#include <errno.h>			/* errno is a define */
41
#else
42
extern int errno;			/* declare errno */
43
#endif
44
#endif					/* #ifndef errno */
45
1702.1.1 by jobin
Support for cross platform compilation
46
#ifdef HAVE_SYS_MMAN_H 
1241.9.1 by Monty Taylor
Removed global.h. Fixed all the headers.
47
#include <sys/mman.h>
1702.1.1 by jobin
Support for cross platform compilation
48
#endif
1241.9.1 by Monty Taylor
Removed global.h. Fixed all the headers.
49
2173.2.1 by Monty Taylor
Fixes incorrect usage of include
50
#include <drizzled/qsort_cmp.h>
1241.9.45 by Monty Taylor
Added a header for qsort_cmp.
51
2173.2.1 by Monty Taylor
Fixes incorrect usage of include
52
#include <drizzled/visibility.h>
2119.4.1 by Monty Taylor
Turns on -fvisibility=hidden by default. Symbols intended to be used by
53
2385.3.10 by Olaf van der Spek
Refactor iocache
54
namespace drizzled {
55
namespace internal {
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
56
1241.9.1 by Monty Taylor
Removed global.h. Fixed all the headers.
57
#ifndef MAP_NOSYNC
58
#define MAP_NOSYNC      0
59
#endif
60
#ifndef MAP_NORESERVE
61
#define MAP_NORESERVE 0         /* For irix and AIX */
62
#endif
63
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
64
/*
65
  EDQUOT is used only in 3 C files only in mysys/. If it does not exist on
66
  system, we set it to some value which can never happen.
67
*/
68
#ifndef EDQUOT
69
#define EDQUOT (-1)
70
#endif
1241.9.1 by Monty Taylor
Removed global.h. Fixed all the headers.
71
1 by brian
clean slate
72
	/* General bitmaps for my_func's */
73
#define MY_FFNF		1	/* Fatal if file not found */
74
#define MY_FNABP	2	/* Fatal if not all bytes read/writen */
75
#define MY_NABP		4	/* Error if not all bytes read/writen */
76
#define MY_FAE		8	/* Fatal if any error */
77
#define MY_WME		16	/* Write message on error */
78
#define MY_WAIT_IF_FULL 32	/* Wait and try again if disk full error */
79
#define MY_IGNORE_BADFD 32      /* my_sync: ignore 'bad descriptor' errors */
80
#define MY_SYNC_DIR     1024    /* my_create/delete/rename: sync directory */
81
#define MY_FULL_IO     512      /* For my_read - loop intil I/O is complete */
82
#define MY_DONT_CHECK_FILESIZE 128 /* Option to init_io_cache() */
83
#define MY_LINK_WARNING 32	/* my_redel() gives warning if links */
84
#define MY_COPYTIME	64	/* my_redel() copys time */
85
#define MY_DELETE_OLD	256	/* my_create_with_symlink() */
86
#define MY_HOLD_ORIGINAL_MODES 128  /* my_copy() holds to file modes */
87
#define MY_DONT_WAIT	64	/* my_lock() don't wait if can't lock */
88
#define MY_DONT_OVERWRITE_FILE 1024	/* my_copy: Don't overwrite file */
89
#define MY_THREADSAFE 2048      /* my_seek(): lock fd mutex */
90
91
#define ME_OLDWIN	2	/* Use old window */
92
#define ME_BELL		4	/* Ring bell then printing message */
93
#define ME_WAITTANG	32	/* Wait for a user action  */
94
#define ME_NOREFRESH	64	/* Dont refresh screen */
95
#define ME_NOINPUT	128	/* Dont use the input libary */
96
97
	/* Bits in last argument to fn_format */
98
#define MY_REPLACE_DIR		1	/* replace dir in name with 'dir' */
99
#define MY_REPLACE_EXT		2	/* replace extension with 'ext' */
100
#define MY_UNPACK_FILENAME	4	/* Unpack name (~ -> home) */
101
#define MY_RESOLVE_SYMLINKS	16	/* Resolve all symbolic links */
102
#define MY_RETURN_REAL_PATH	32	/* return full path for file */
103
#define MY_SAFE_PATH		64	/* Return NULL if too long path */
104
#define MY_RELATIVE_PATH	128	/* name is relative to 'dir' */
105
#define MY_APPEND_EXT           256     /* add 'ext' as additional extension*/
106
1241.13.1 by Monty Taylor
Put my_off_t back... but this time localized only to myisam and mysys.
107
typedef uint64_t my_off_t;
108
1 by brian
clean slate
109
extern char *home_dir;			/* Home directory for user */
110
extern const char *my_progname;		/* program-name (printed in errors) */
111
2119.4.3 by Monty Taylor
We want to add visibility markers into the headers... not take them away
112
extern DRIZZLED_API int my_umask,		/* Default creation mask  */
2318.9.7 by Olaf van der Spek
Prune unused code
113
	   my_umask_dir;
2241.4.26 by Stewart Smith
remove mysys_uses_curses - unused
114
extern bool my_use_symdir;
1 by brian
clean slate
115
298 by Brian Aker
ulong conversion.
116
extern uint32_t	my_default_record_cache_size;
2318.9.7 by Olaf van der Spek
Prune unused code
117
extern bool my_disable_symlinks;
118
extern const char wild_many, wild_one, wild_prefix;
1 by brian
clean slate
119
extern const char *charsets_dir;
120
146 by Brian Aker
my_bool cleanup.
121
extern bool timed_mutexes;
1 by brian
clean slate
122
123
enum cache_type
124
{
1578.4.4 by Brian Aker
Remove pthread mutex that is no longer used (since IO_CACHE is single
125
  TYPE_NOT_SET= 0,
126
  READ_CACHE,
127
  WRITE_CACHE,
128
  READ_FIFO,
129
  READ_NET,
130
  WRITE_NET
131
};
1 by brian
clean slate
132
1848.4.1 by tdavies
File:drizzled/internal/my_sys.h; converted struct wild_file_pack to c++ class, and added constructor. Coverted struct 'st_record_cache' to c++ class, changed name to 'record_cache' and added constructor.
133
typedef struct record_cache	/* Used when cacheing records */
1 by brian
clean slate
134
{
1848.4.1 by tdavies
File:drizzled/internal/my_sys.h; converted struct wild_file_pack to c++ class, and added constructor. Coverted struct 'st_record_cache' to c++ class, changed name to 'record_cache' and added constructor.
135
public:
1241.9.1 by Monty Taylor
Removed global.h. Fixed all the headers.
136
  int file;
1 by brian
clean slate
137
  int	rc_seek,error,inited;
138
  uint	rc_length,read_length,reclength;
1241.13.1 by Monty Taylor
Put my_off_t back... but this time localized only to myisam and mysys.
139
  my_off_t rc_record_pos,end_of_file;
481 by Brian Aker
Remove all of uchar.
140
  unsigned char *rc_buff,*rc_buff2,*rc_pos,*rc_end,*rc_request_pos;
1 by brian
clean slate
141
  enum cache_type type;
1848.4.1 by tdavies
File:drizzled/internal/my_sys.h; converted struct wild_file_pack to c++ class, and added constructor. Coverted struct 'st_record_cache' to c++ class, changed name to 'record_cache' and added constructor.
142
143
  record_cache():
144
    file(0),
145
    rc_seek(0),
146
    error(0),
147
    inited(0),
148
    rc_length(0),
149
    read_length(0),
150
    reclength(0),
151
    rc_record_pos(0),
152
    end_of_file(0),
153
    rc_buff(NULL),
154
    rc_buff2(NULL),
155
    rc_pos(NULL),
156
    rc_end(NULL),
157
    rc_request_pos(NULL)
158
  {}
159
1 by brian
clean slate
160
} RECORD_CACHE;
161
2190.1.6 by Brian Aker
Remove duplicate symbols.
162
/* Prototypes for mysys and my_func functions */
1 by brian
clean slate
163
164
extern int my_copy(const char *from,const char *to,myf MyFlags);
2119.4.1 by Monty Taylor
Turns on -fvisibility=hidden by default. Symbols intended to be used by
165
DRIZZLED_API int my_delete(const char *name,myf MyFlags);
166
DRIZZLED_API int my_open(const char *FileName,int Flags,myf MyFlags);
2385.3.10 by Olaf van der Spek
Refactor iocache
167
extern int my_register_filename(int fd, const char *FileName, uint32_t error_message_number, myf MyFlags);
168
DRIZZLED_API int my_create(const char *FileName,int CreateFlags, int AccessFlags, myf MyFlags);
2119.4.1 by Monty Taylor
Turns on -fvisibility=hidden by default. Symbols intended to be used by
169
DRIZZLED_API int my_close(int Filedes,myf MyFlags);
1 by brian
clean slate
170
extern int my_mkdir(const char *dir, int Flags, myf MyFlags);
171
extern int my_realpath(char *to, const char *filename, myf MyFlags);
1241.9.1 by Monty Taylor
Removed global.h. Fixed all the headers.
172
extern int my_create_with_symlink(const char *linkname, const char *filename,
2385.3.10 by Olaf van der Spek
Refactor iocache
173
                                  int createflags, int access_flags, myf MyFlags);
2119.4.1 by Monty Taylor
Turns on -fvisibility=hidden by default. Symbols intended to be used by
174
DRIZZLED_API int my_delete_with_symlink(const char *name, myf MyFlags);
1 by brian
clean slate
175
extern int my_rename_with_symlink(const char *from,const char *to,myf MyFlags);
2119.4.1 by Monty Taylor
Turns on -fvisibility=hidden by default. Symbols intended to be used by
176
DRIZZLED_API size_t my_read(int Filedes,unsigned char *Buffer,size_t Count,myf MyFlags);
177
DRIZZLED_API int my_rename(const char *from, const char *to,myf MyFlags);
2385.3.10 by Olaf van der Spek
Refactor iocache
178
DRIZZLED_API size_t my_write(int Filedes, const unsigned char *Buffer, size_t Count, myf MyFlags);
1 by brian
clean slate
179
180
extern int check_if_legal_tablename(const char *path);
181
2119.4.1 by Monty Taylor
Turns on -fvisibility=hidden by default. Symbols intended to be used by
182
DRIZZLED_API int my_sync(int fd, myf my_flags);
1 by brian
clean slate
183
extern int my_sync_dir(const char *dir_name, myf my_flags);
184
extern int my_sync_dir_by_file(const char *file_name, myf my_flags);
2281.4.5 by Olaf van der Spek
Prune & refactor
185
extern void my_init();
186
extern void my_end();
1 by brian
clean slate
187
extern int my_redel(const char *from, const char *to, int MyFlags);
188
extern int my_copystat(const char *from, const char *to, int MyFlags);
189
779.2.11 by Monty Taylor
General build cleanup - removed cruft, removed depreated checks.
190
extern void my_remember_signal(int signal_number,void (*func)(int));
1 by brian
clean slate
191
extern size_t dirname_part(char * to,const char *name, size_t *to_res_length);
192
extern size_t dirname_length(const char *name);
193
#define base_name(A) (A+dirname_length(A))
1022.2.29 by Monty Taylor
Fixed some no-inline warnings.
194
bool test_if_hard_path(const char *dir_name);
779.1.19 by Monty Taylor
Removed stuff that gcov showed we weren't using.
195
1 by brian
clean slate
196
extern char *convert_dirname(char *to, const char *from, const char *from_end);
197
extern char * fn_ext(const char *name);
198
extern char * fn_same(char * toname,const char *name,int flag);
2318.9.8 by Olaf van der Spek
Refactor tablename_to_filename()
199
DRIZZLED_API char * fn_format(char * to,const char *name,const char *dir, const char *form, uint32_t flag);
1 by brian
clean slate
200
extern size_t unpack_dirname(char * to,const char *from);
201
extern size_t unpack_filename(char * to,const char *from);
202
extern char * intern_filename(char * to,const char *from);
203
extern int pack_filename(char * to, const char *name, size_t max_length);
2318.9.7 by Olaf van der Spek
Prune unused code
204
extern char * my_load_path(char * to, const char *path, const char *own_path_prefix);
482 by Brian Aker
Remove uint.
205
extern void my_string_ptr_sort(unsigned char *base,uint32_t items,size_t size);
2385.3.10 by Olaf van der Spek
Refactor iocache
206
extern void radixsort_for_str_ptr(unsigned char* base[], uint32_t number_of_elements, size_t size_of_element,unsigned char *buffer[]);
207
extern void my_qsort(void *base_ptr, size_t total_elems, size_t size, qsort_cmp cmp);
208
extern void my_qsort2(void *base_ptr, size_t total_elems, size_t size, qsort2_cmp cmp, void *cmp_argument);
1 by brian
clean slate
209
extern qsort2_cmp get_ptr_compare(size_t);
2119.4.1 by Monty Taylor
Turns on -fvisibility=hidden by default. Symbols intended to be used by
210
DRIZZLED_API void my_store_ptr(unsigned char *buff, size_t pack_length, my_off_t pos);
211
DRIZZLED_API my_off_t my_get_ptr(unsigned char *ptr, size_t pack_length);
1241.9.1 by Monty Taylor
Removed global.h. Fixed all the headers.
212
int create_temp_file(char *to, const char *dir, const char *pfx, myf MyFlags);
1 by brian
clean slate
213
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
214
} /* namespace internal */
215
} /* namespace drizzled */