~eday/drizzle/eday-dev

« back to all changes in this revision

Viewing changes to plugin/myisam/mf_keycache.cc

  • Committer: Eric Day
  • Date: 2010-01-07 20:02:38 UTC
  • mfrom: (971.3.291 staging)
  • Revision ID: eday@oddments.org-20100107200238-uqw8v6kv9pl7nny5
Merged trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
101
101
  I/O finished.
102
102
*/
103
103
 
104
 
#include <drizzled/global.h>
105
 
#include <mysys/mysys_err.h>
106
 
#include <mysys/my_sys.h>
 
104
#include "config.h"
 
105
#include "drizzled/my_error.h"
 
106
#include "drizzled/internal/my_sys.h"
107
107
#include "keycache.h"
108
 
#include <mystrings/m_string.h>
109
 
#include <mysys/my_bit.h>
 
108
#include "drizzled/internal/m_string.h"
 
109
#include "drizzled/internal/my_bit.h"
110
110
#include <errno.h>
111
111
#include <stdarg.h>
112
112
 
161
161
{
162
162
  struct st_hash_link *next, **prev; /* to connect links in the same bucket  */
163
163
  struct st_block_link *block;       /* reference to the block for the page: */
164
 
  File file;                         /* from such a file                     */
 
164
  int file;                         /* from such a file                     */
165
165
  my_off_t diskpos;                  /* with such an offset                  */
166
166
  uint32_t requests;                     /* number of requests for the page      */
167
167
};
336
336
      }
337
337
      if (blocks < 8)
338
338
      {
339
 
        my_errno= ENOMEM;
 
339
        errno= ENOMEM;
340
340
        my_error(EE_OUTOFMEMORY, MYF(0), blocks * keycache->key_cache_block_size);
341
341
        goto err;
342
342
      }
395
395
  return((int) keycache->disk_blocks);
396
396
 
397
397
err:
398
 
  error= my_errno;
 
398
  error= errno;
399
399
  keycache->disk_blocks= 0;
400
400
  keycache->blocks=  0;
401
401
  if (keycache->block_mem)
408
408
    free((unsigned char*) keycache->block_root);
409
409
    keycache->block_root= NULL;
410
410
  }
411
 
  my_errno= error;
 
411
  errno= error;
412
412
  keycache->can_be_used= 0;
413
413
  return(0);
414
414
}
1394
1394
*/
1395
1395
 
1396
1396
static BLOCK_LINK *find_key_block(KEY_CACHE *keycache,
1397
 
                                  File file, my_off_t filepos,
 
1397
                                  int file, my_off_t filepos,
1398
1398
                                  int init_hits_left,
1399
1399
                                  int wrmode, int *page_st)
1400
1400
{
2193
2193
*/
2194
2194
 
2195
2195
unsigned char *key_cache_read(KEY_CACHE *keycache,
2196
 
                      File file, my_off_t filepos, int level,
 
2196
                      int file, my_off_t filepos, int level,
2197
2197
                      unsigned char *buff, uint32_t length,
2198
2198
                      uint32_t block_length,
2199
2199
                      int return_buffer)
2296
2296
            this could only happen if we are using a file with
2297
2297
            small key blocks and are trying to read outside the file
2298
2298
          */
2299
 
          my_errno= -1;
 
2299
          errno= -1;
2300
2300
          block->status|= BLOCK_ERROR;
2301
2301
        }
2302
2302
      }
2387
2387
*/
2388
2388
 
2389
2389
int key_cache_insert(KEY_CACHE *keycache,
2390
 
                     File file, my_off_t filepos, int level,
 
2390
                     int file, my_off_t filepos, int level,
2391
2391
                     unsigned char *buff, uint32_t length)
2392
2392
{
2393
2393
  int error= 0;
2621
2621
*/
2622
2622
 
2623
2623
int key_cache_write(KEY_CACHE *keycache,
2624
 
                    File file, my_off_t filepos, int level,
 
2624
                    int file, my_off_t filepos, int level,
2625
2625
                    unsigned char *buff, uint32_t length,
2626
2626
                    uint32_t block_length,
2627
2627
                    int dont_write)
3042
3042
*/
3043
3043
 
3044
3044
static int flush_cached_blocks(KEY_CACHE *keycache,
3045
 
                               File file, BLOCK_LINK **cache,
 
3045
                               int file, BLOCK_LINK **cache,
3046
3046
                               BLOCK_LINK **end,
3047
3047
                               enum flush_type type)
3048
3048
{
3168
3168
*/
3169
3169
 
3170
3170
static int flush_key_blocks_int(KEY_CACHE *keycache,
3171
 
                                File file, enum flush_type type)
 
3171
                                int file, enum flush_type type)
3172
3172
{
3173
3173
  BLOCK_LINK *cache_buff[FLUSH_CACHE],**cache;
3174
3174
  int last_errno= 0;
3467
3467
            {
3468
3468
              struct st_hash_link *next_hash_link= NULL;
3469
3469
              my_off_t            next_diskpos= 0;
3470
 
              File                next_file= 0;
 
3470
              int                next_file= 0;
3471
3471
              uint32_t                next_status= 0;
3472
3472
              uint32_t                hash_requests= 0;
3473
3473
 
3592
3592
*/
3593
3593
 
3594
3594
int flush_key_blocks(KEY_CACHE *keycache,
3595
 
                     File file, enum flush_type type)
 
3595
                     int file, enum flush_type type)
3596
3596
{
3597
3597
  int res= 0;
3598
3598