~jaypipes/drizzle/split-xa-resource-manager

« back to all changes in this revision

Viewing changes to plugin/archive/azio.cc

  • Committer: Jay Pipes
  • Date: 2010-02-06 01:51:20 UTC
  • mfrom: (1273.1.10 build)
  • Revision ID: jpipes@serialcoder-20100206015120-as4vb638inbzrb59
Merge trunk changes and resolve conflicts

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
#include <cstdlib>
24
24
#include <cassert>
25
25
 
 
26
using namespace drizzled;
 
27
 
26
28
static int const az_magic[3] = {0xfe, 0x03, 0x01}; /* az magic header */
27
29
 
28
30
static unsigned int azwrite(azio_stream *s, void *buf, unsigned int len);
50
52
  size_t offset;
51
53
  azio_stream *s= (azio_stream *)p;
52
54
 
53
 
  my_thread_init();
 
55
  internal::my_thread_init();
54
56
 
55
57
  while (1)
56
58
  {
75
77
    pthread_mutex_unlock(&s->container.thresh_mutex);
76
78
  }
77
79
 
78
 
  my_thread_end();
 
80
  internal::my_thread_end();
79
81
 
80
82
  return 0;
81
83
}
227
229
  s->stream.avail_out = AZ_BUFSIZE_WRITE;
228
230
 
229
231
  errno = 0;
230
 
  s->file = fd < 0 ? my_open(path, Flags, MYF(0)) : fd;
 
232
  s->file = fd < 0 ? internal::my_open(path, Flags, MYF(0)) : fd;
231
233
#ifdef AZIO_AIO
232
234
  s->container.fd= s->file;
233
235
#endif
439
441
    if (s->mode == 'w')
440
442
    {
441
443
      err = deflateEnd(&(s->stream));
442
 
      my_sync(s->file, MYF(0));
 
444
      internal::my_sync(s->file, MYF(0));
443
445
    }
444
446
    else if (s->mode == 'r')
445
447
      err = inflateEnd(&(s->stream));
447
449
 
448
450
  do_aio_cleanup(s);
449
451
 
450
 
  if (s->file > 0 && my_close(s->file, MYF(0)))
 
452
  if (s->file > 0 && internal::my_close(s->file, MYF(0)))
451
453
      err = Z_ERRNO;
452
454
 
453
455
  s->file= -1;
756
758
    err= do_flush(s, flush);
757
759
 
758
760
    if (err) return err;
759
 
    my_sync(s->file, MYF(0));
 
761
    internal::my_sync(s->file, MYF(0));
760
762
    return  s->z_err == Z_STREAM_END ? Z_OK : s->z_err;
761
763
  }
762
764
}