ECP-VELOC Components
User documentation for all components
shuffile_io.h
Go to the documentation of this file.
1 #ifndef SHUFFILE_IO_H
2 #define SHUFFILE_IO_H
3 
4 #include <config.h>
5 #include <stdarg.h>
6 #include <sys/types.h>
7 #include <sys/stat.h>
8 #include <unistd.h>
9 
10 /* compute crc32 */
11 #include <zlib.h>
12 
13 #ifndef SHUFFILE_MAX_LINE
14 #define SHUFFILE_MAX_LINE (1024)
15 #endif
16 
21 /********************************************************/
23 
26 mode_t shuffile_getmode(int read, int write, int execute);
27 
29 int shuffile_open(const char* file, int flags, ...);
30 
32 int shuffile_close(const char* file, int fd);
33 
35 int shuffile_file_lock_read(const char* file, int fd);
36 int shuffile_file_lock_write(const char* file, int fd);
37 int shuffile_file_unlock(const char* file, int fd);
38 
40 int shuffile_open_with_lock(const char* file, int flags, mode_t mode);
41 
43 int shuffile_close_with_unlock(const char* file, int fd);
44 
46 int shuffile_lseek(const char* file, int fd, off_t pos, int whence);
47 
49 ssize_t shuffile_read(const char* file, int fd, void* buf, size_t size);
50 
52 ssize_t shuffile_write(const char* file, int fd, const void* buf, size_t size);
53 
55 ssize_t shuffile_read_attempt(const char* file, int fd, void* buf, size_t size);
56 
58 ssize_t shuffile_write_attempt(const char* file, int fd, const void* buf, size_t size);
59 
61 ssize_t shuffile_read_line(const char* file, int fd, char* buf, size_t size);
62 
64 ssize_t shuffile_writef(const char* file, int fd, const char* format, ...);
65 
69  int n,
70  const char** files,
71  int* fds,
72  char* buf,
73  unsigned long count,
74  unsigned long offset,
75  unsigned long* filesizes
76 );
77 
80  int n,
81  const char** files,
82  int* fds,
83  char* buf,
84  unsigned long count,
85  unsigned long offset,
86  unsigned long* filesizes
87 );
88 
90 int shuffile_stat(const char* file, struct stat* statbuf);
91 
93 unsigned long shuffile_file_size(const char* file);
94 
96 int shuffile_file_exists(const char* file);
97 
99 int shuffile_file_is_readable(const char* file);
100 
102 int shuffile_file_is_writeable(const char* file);
103 
105 int shuffile_file_unlink(const char* file);
106 
108 int shuffile_crc32(const char* filename, uLong* crc);
110 
111 /********************************************************/
113 
116 int shuffile_mkdir(const char* dir, mode_t mode);
117 
119 int shuffile_rmdir(const char* dir);
120 
122 int shuffile_getcwd(char* buf, size_t size);
124 
125 /********************************************************/
127 
130  const char* src_file,
131  const char* dst_file,
132  unsigned long buf_size,
133  uLong* crc
134 );
136 
137 /********************************************************/
139 
142 int shuffile_compress_in_place(const char* file_src, const char* file_dst, unsigned long block_size, int level);
143 
145 int shuffile_uncompress_in_place(const char* file_src, const char* file_dst);
146 
148 int shuffile_compress(const char* file_src, const char* file_dst, unsigned long block_size, int level);
149 
151 int shuffile_uncompress(const char* file_src, const char* file_dst);
153 
154 #endif
shuffile_read_line
ssize_t shuffile_read_line(const char *file, int fd, char *buf, size_t size)
shuffile_file_size
unsigned long shuffile_file_size(const char *file)
shuffile_write_attempt
ssize_t shuffile_write_attempt(const char *file, int fd, const void *buf, size_t size)
shuffile_close_with_unlock
int shuffile_close_with_unlock(const char *file, int fd)
shuffile_file_unlink
int shuffile_file_unlink(const char *file)
shuffile_file_is_writeable
int shuffile_file_is_writeable(const char *file)
shuffile_rmdir
int shuffile_rmdir(const char *dir)
shuffile_close
int shuffile_close(const char *file, int fd)
shuffile_open
int shuffile_open(const char *file, int flags,...)
shuffile_stat
int shuffile_stat(const char *file, struct stat *statbuf)
shuffile_write
ssize_t shuffile_write(const char *file, int fd, const void *buf, size_t size)
shuffile_getcwd
int shuffile_getcwd(char *buf, size_t size)
shuffile_getmode
mode_t shuffile_getmode(int read, int write, int execute)
shuffile_crc32
int shuffile_crc32(const char *filename, uLong *crc)
shuffile_lseek
int shuffile_lseek(const char *file, int fd, off_t pos, int whence)
shuffile_write_pad_n
int shuffile_write_pad_n(int n, const char **files, int *fds, char *buf, unsigned long count, unsigned long offset, unsigned long *filesizes)
shuffile_mkdir
int shuffile_mkdir(const char *dir, mode_t mode)
shuffile_read
ssize_t shuffile_read(const char *file, int fd, void *buf, size_t size)
shuffile_file_is_readable
int shuffile_file_is_readable(const char *file)
shuffile_file_lock_read
int shuffile_file_lock_read(const char *file, int fd)
shuffile_uncompress_in_place
int shuffile_uncompress_in_place(const char *file_src, const char *file_dst)
shuffile_file_copy
int shuffile_file_copy(const char *src_file, const char *dst_file, unsigned long buf_size, uLong *crc)
shuffile_open_with_lock
int shuffile_open_with_lock(const char *file, int flags, mode_t mode)
shuffile_read_attempt
ssize_t shuffile_read_attempt(const char *file, int fd, void *buf, size_t size)
shuffile_uncompress
int shuffile_uncompress(const char *file_src, const char *file_dst)
shuffile_compress
int shuffile_compress(const char *file_src, const char *file_dst, unsigned long block_size, int level)
shuffile_file_exists
int shuffile_file_exists(const char *file)
shuffile_file_unlock
int shuffile_file_unlock(const char *file, int fd)
shuffile_read_pad_n
int shuffile_read_pad_n(int n, const char **files, int *fds, char *buf, unsigned long count, unsigned long offset, unsigned long *filesizes)
shuffile_compress_in_place
int shuffile_compress_in_place(const char *file_src, const char *file_dst, unsigned long block_size, int level)
shuffile_writef
ssize_t shuffile_writef(const char *file, int fd, const char *format,...)
shuffile_file_lock_write
int shuffile_file_lock_write(const char *file, int fd)