~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/archive/azio.cc

  • Committer: Brian Aker
  • Date: 2010-01-22 00:53:13 UTC
  • Revision ID: brian@gaz-20100122005313-jmizcbcdi1lt4tcx
Revert db patch.

Show diffs side-by-side

added added

removed removed

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