~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/myisam/mi_open.c

  • Committer: Stewart Smith
  • Date: 2008-11-07 22:58:15 UTC
  • mto: This revision was merged to the branch mainline in revision 587.
  • Revision ID: stewart@flamingspork.com-20081107225815-ie2kwpxnytpstovl
remove trailing whitespace in serialize/table

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 
18
18
#include "myisamdef.h"
19
19
#include <mystrings/m_ctype.h>
 
20
#include <drizzled/util/test.h>
20
21
 
21
22
static void setup_key_functions(MI_KEYDEF *keyinfo);
22
 
#define get_next_element(to,pos,size) \
23
 
  do {                                \
24
 
    memcpy(to, pos, size);            \
25
 
    pos+=size;                        \
26
 
  } while (0)
27
 
 
28
23
 
29
24
#define disk_pos_assert(pos, end_pos) \
30
25
if (pos > end_pos)             \
96
91
    share_buff.key_cache= multi_key_cache_search((unsigned char*) name_buff,
97
92
                                                 strlen(name_buff));
98
93
 
99
 
    if ((kfile=my_open(name_buff,(open_mode=O_RDWR) | O_SHARE,MYF(0))) < 0)
 
94
    if ((kfile=my_open(name_buff,(open_mode=O_RDWR),MYF(0))) < 0)
100
95
    {
101
96
      if ((errno != EROFS && errno != EACCES) ||
102
97
          mode != O_RDONLY ||
103
 
          (kfile=my_open(name_buff,(open_mode=O_RDONLY) | O_SHARE,MYF(0))) < 0)
 
98
          (kfile=my_open(name_buff,(open_mode=O_RDONLY),MYF(0))) < 0)
104
99
        goto err;
105
100
    }
106
101
    share->mode=open_mode;
860
855
  mi_int2store(ptr,base->max_key_length);               ptr +=2;
861
856
  mi_int2store(ptr,base->extra_alloc_bytes);            ptr +=2;
862
857
  *ptr++= base->extra_alloc_procent;
863
 
  *ptr++= base->raid_type;
864
 
  mi_int2store(ptr,base->raid_chunks);                  ptr +=2;
865
 
  mi_int4store(ptr,base->raid_chunksize);               ptr +=4;
 
858
  /* old raid info  slots */
 
859
  *ptr++= 0;
 
860
  mi_int2store(ptr,UINT16_C(0));                        ptr +=2;
 
861
  mi_int4store(ptr,UINT32_C(0));                        ptr +=4;
 
862
 
866
863
  memset(ptr, 0, 6);                                    ptr +=6; /* extra */
867
864
  return my_write(file, buff, (size_t) (ptr-buff), MYF(MY_NABP)) != 0;
868
865
}
894
891
  base->max_key_length = mi_uint2korr(ptr);             ptr +=2;
895
892
  base->extra_alloc_bytes = mi_uint2korr(ptr);          ptr +=2;
896
893
  base->extra_alloc_procent = *ptr++;
897
 
  base->raid_type= *ptr++;
898
 
  base->raid_chunks= mi_uint2korr(ptr);                 ptr +=2;
899
 
  base->raid_chunksize= mi_uint4korr(ptr);              ptr +=4;
900
 
  /* TO BE REMOVED: Fix for old RAID files */
901
 
  if (base->raid_type == 0)
902
 
  {
903
 
    base->raid_chunks=0;
904
 
    base->raid_chunksize=0;
905
 
  }
 
894
 
 
895
  /* advance past raid_type (1) raid_chunks (2) and raid_chunksize (4) */
 
896
  ptr+= 7; 
906
897
 
907
898
  ptr+=6;
908
899
  return ptr;
1043
1034
}
1044
1035
 
1045
1036
/**************************************************************************
1046
 
Open data file with or without RAID
 
1037
Open data file
1047
1038
We can't use dup() here as the data file descriptors need to have different
1048
1039
active seek-positions.
1049
1040
 
1054
1045
int mi_open_datafile(MI_INFO *info, MYISAM_SHARE *share,
1055
1046
                     File file_to_dup __attribute__((unused)))
1056
1047
{
1057
 
    info->dfile=my_open(share->data_file_name, share->mode | O_SHARE,
 
1048
    info->dfile=my_open(share->data_file_name, share->mode,
1058
1049
                        MYF(MY_WME));
1059
1050
  return info->dfile >= 0 ? 0 : 1;
1060
1051
}
1062
1053
 
1063
1054
int mi_open_keyfile(MYISAM_SHARE *share)
1064
1055
{
1065
 
  if ((share->kfile=my_open(share->unique_file_name, share->mode | O_SHARE,
 
1056
  if ((share->kfile=my_open(share->unique_file_name, share->mode,
1066
1057
                            MYF(MY_WME))) < 0)
1067
1058
    return 1;
1068
1059
  return 0;