~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/archive/azio.cc

pandora-build v0.71. Added check for avahi.

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 <drizzled/global.h>
15
15
 
16
16
#include "azio.h"
17
17
 
18
 
#include <fcntl.h>
 
18
#include <stdio.h>
 
19
#include <string.h>
 
20
#include <stdlib.h>
 
21
#include <assert.h>
19
22
#include <unistd.h>
20
23
 
21
 
#include <cstdio>
22
 
#include <cstring>
23
 
#include <cstdlib>
24
 
#include <cassert>
25
 
 
26
 
using namespace drizzled;
27
 
 
28
24
static int const az_magic[3] = {0xfe, 0x03, 0x01}; /* az magic header */
29
25
 
30
26
static unsigned int azwrite(azio_stream *s, void *buf, unsigned int len);
52
48
  size_t offset;
53
49
  azio_stream *s= (azio_stream *)p;
54
50
 
 
51
  my_thread_init();
 
52
 
55
53
  while (1)
56
54
  {
57
55
    pthread_mutex_lock(&s->container.thresh_mutex);
75
73
    pthread_mutex_unlock(&s->container.thresh_mutex);
76
74
  }
77
75
 
 
76
  my_thread_end();
 
77
 
78
78
  return 0;
79
79
}
80
80
 
159
159
  int err;
160
160
  int level = Z_DEFAULT_COMPRESSION ; /* compression level */
161
161
  int strategy = Z_DEFAULT_STRATEGY; /* compression strategy */
162
 
  int fd= -1;
 
162
  File fd= -1;
163
163
 
164
164
  memset(s, 0, sizeof(azio_stream));
165
165
 
225
225
  s->stream.avail_out = AZ_BUFSIZE_WRITE;
226
226
 
227
227
  errno = 0;
228
 
  s->file = fd < 0 ? internal::my_open(path, Flags, MYF(0)) : fd;
 
228
  s->file = fd < 0 ? my_open(path, Flags, MYF(0)) : fd;
229
229
#ifdef AZIO_AIO
230
230
  s->container.fd= s->file;
231
231
#endif
437
437
    if (s->mode == 'w')
438
438
    {
439
439
      err = deflateEnd(&(s->stream));
440
 
      internal::my_sync(s->file, MYF(0));
 
440
      my_sync(s->file, MYF(0));
441
441
    }
442
442
    else if (s->mode == 'r')
443
443
      err = inflateEnd(&(s->stream));
445
445
 
446
446
  do_aio_cleanup(s);
447
447
 
448
 
  if (s->file > 0 && internal::my_close(s->file, MYF(0)))
 
448
  if (s->file > 0 && my_close(s->file, MYF(0)))
449
449
      err = Z_ERRNO;
450
450
 
451
451
  s->file= -1;
754
754
    err= do_flush(s, flush);
755
755
 
756
756
    if (err) return err;
757
 
    internal::my_sync(s->file, MYF(0));
 
757
    my_sync(s->file, MYF(0));
758
758
    return  s->z_err == Z_STREAM_END ? Z_OK : s->z_err;
759
759
  }
760
760
}
1072
1072
    }
1073
1073
    s->pos+= s->stream.avail_in;
1074
1074
    s->inbuf= (Byte *)s->container.buffer;
1075
 
    /* We only azio_read when we know there is more data to be read */
 
1075
    /* We only aio_read when we know there is more data to be read */
1076
1076
    if (s->pos >= s->check_point)
1077
1077
    {
1078
1078
      s->aio_inited= 0;