]> mj.ucw.cz Git - libucw.git/blob - ucw/io.h
Conf: Introduced cf_set_journalling()
[libucw.git] / ucw / io.h
1 /*
2  *      UCW Library -- Large File Support
3  *
4  *      (c) 1999--2002 Martin Mares <mj@ucw.cz>
5  *
6  *      This software may be freely distributed and used according to the terms
7  *      of the GNU Lesser General Public License.
8  */
9
10 #ifndef _UCW_IO_H
11 #define _UCW_IO_H
12
13 #include <fcntl.h>
14 #include <unistd.h>
15
16 #ifdef CONFIG_UCW_LARGE_FILES
17
18 #define ucw_open open64
19 #define ucw_seek lseek64
20 #define ucw_pread pread64
21 #define ucw_pwrite pwrite64
22 #define ucw_ftruncate ftruncate64
23 #define ucw_mmap(a,l,p,f,d,o) mmap64(a,l,p,f,d,o)
24 #define ucw_pread pread64
25 #define ucw_pwrite pwrite64
26 #define ucw_stat stat64
27 #define ucw_fstat fstat64
28 typedef struct stat64 ucw_stat_t;
29
30 #else   /* !CONFIG_UCW_LARGE_FILES */
31
32 #define ucw_open open
33 #define ucw_seek(f,o,w) lseek(f,o,w)
34 #define ucw_ftruncate(f,o) ftruncate(f,o)
35 #define ucw_mmap(a,l,p,f,d,o) mmap(a,l,p,f,d,o)
36 #define ucw_pread pread
37 #define ucw_pwrite pwrite
38 #define ucw_stat stat
39 #define ucw_fstat fstat
40 typedef struct stat ucw_stat_t;
41
42 #endif  /* !CONFIG_UCW_LARGE_FILES */
43
44 #if defined(_POSIX_SYNCHRONIZED_IO) && (_POSIX_SYNCHRONIZED_IO > 0)
45 #define ucw_fdatasync fdatasync
46 #else
47 #define ucw_fdatasync fsync
48 #endif
49
50 #define HAVE_PREAD
51
52 /* io-size.c */
53
54 ucw_off_t ucw_file_size(const char *name);
55
56 /* io-mmap.c */
57
58 void *mmap_file(const char *name, unsigned *len, int writeable);
59 void munmap_file(void *start, unsigned len);
60
61 /* io-careful.c */
62
63 int careful_read(int fd, void *buf, int len);
64 int careful_write(int fd, const void *buf, int len);
65
66 /* io-sync.c */
67
68 void sync_dir(const char *name);
69
70 #endif  /* !_UCW_IO_H */