~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/heap/hp_open.c

Removed SCCS references.

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
#include "hp_static.c"                  /* Stupid vms-linker */
21
21
#endif
22
22
 
23
 
#include <mysys/my_sys.h>
 
23
#include "my_sys.h"
24
24
 
25
25
/*
26
26
  Open heap table based on HP_SHARE structure
32
32
HP_INFO *heap_open_from_share(HP_SHARE *share, int mode)
33
33
{
34
34
  HP_INFO *info;
 
35
  DBUG_ENTER("heap_open_from_share");
35
36
 
36
37
  if (!(info= (HP_INFO*) my_malloc((uint) sizeof(HP_INFO) +
37
38
                                  2 * share->max_key_length,
38
39
                                  MYF(MY_ZEROFILL))))
39
40
  {
40
 
    return(0);
 
41
    DBUG_RETURN(0);
41
42
  }
42
43
  share->open_count++; 
 
44
#ifdef THREAD
43
45
  thr_lock_data_init(&share->lock,&info->lock,NULL);
 
46
#endif
44
47
  info->s= share;
45
 
  info->lastkey= (unsigned char*) (info + 1);
46
 
  info->recbuf= (unsigned char*) (info->lastkey + share->max_key_length);
 
48
  info->lastkey= (uchar*) (info + 1);
 
49
  info->recbuf= (uchar*) (info->lastkey + share->max_key_length);
47
50
  info->mode= mode;
48
 
  info->current_record= UINT32_MAX;             /* No current record */
 
51
  info->current_record= (ulong) ~0L;            /* No current record */
49
52
  info->lastinx= info->errkey= -1;
50
 
  return(info);
 
53
#ifndef DBUG_OFF
 
54
  info->opt_flag= READ_CHECK_USED;              /* Check when changing */
 
55
#endif
 
56
  DBUG_PRINT("exit",("heap: 0x%lx  reclength: %d  records_in_block: %d",
 
57
                     (long) info, share->reclength,
 
58
                     share->block.records_in_block));
 
59
  DBUG_RETURN(info);
51
60
}
52
61
 
53
62
 
58
67
HP_INFO *heap_open_from_share_and_register(HP_SHARE *share, int mode)
59
68
{
60
69
  HP_INFO *info;
 
70
  DBUG_ENTER("heap_open_from_share_and_register");
61
71
 
62
72
  pthread_mutex_lock(&THR_LOCK_heap);
63
73
  if ((info= heap_open_from_share(share, mode)))
66
76
    heap_open_list= list_add(heap_open_list,&info->open_list);
67
77
  }
68
78
  pthread_mutex_unlock(&THR_LOCK_heap);
69
 
  return(info);
 
79
  DBUG_RETURN(info);
70
80
}
71
81
 
72
82
 
82
92
{
83
93
  HP_INFO *info;
84
94
  HP_SHARE *share;
 
95
  DBUG_ENTER("heap_open");
85
96
 
86
97
  pthread_mutex_lock(&THR_LOCK_heap);
87
98
  if (!(share= hp_find_named_heap(name)))
88
99
  {
89
100
    my_errno= ENOENT;
90
101
    pthread_mutex_unlock(&THR_LOCK_heap);
91
 
    return(0);
 
102
    DBUG_RETURN(0);
92
103
  }
93
104
  if ((info= heap_open_from_share(share, mode)))
94
105
  {
96
107
    heap_open_list= list_add(heap_open_list,&info->open_list);
97
108
  }
98
109
  pthread_mutex_unlock(&THR_LOCK_heap);
99
 
  return(info);
 
110
  DBUG_RETURN(info);
100
111
}
101
112
 
102
113
 
106
117
{
107
118
  LIST *pos;
108
119
  HP_SHARE *info;
 
120
  DBUG_ENTER("heap_find");
 
121
  DBUG_PRINT("enter",("name: %s",name));
109
122
 
110
123
  for (pos= heap_share_list; pos; pos= pos->next)
111
124
  {
112
125
    info= (HP_SHARE*) pos->data;
113
126
    if (!strcmp(name, info->name))
114
127
    {
115
 
      return(info);
 
128
      DBUG_PRINT("exit", ("Old heap_database: 0x%lx", (long) info));
 
129
      DBUG_RETURN(info);
116
130
    }
117
131
  }
118
 
  return((HP_SHARE *) 0);
 
132
  DBUG_RETURN((HP_SHARE *) 0);
119
133
}
120
134
 
121
135