]> mj.ucw.cz Git - libucw.git/blob - ucw/io.h
LibUCW: Added missing includes in <ucw/io.h>
[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 #include <sys/stat.h>
16 #include <sys/types.h>
17
18 #ifdef CONFIG_UCW_CLEAN_ABI
19 #define careful_read ucw_careful_read
20 #define careful_write ucw_careful_write
21 #define mmap_file ucw_mmap_file
22 #define munmap_file ucw_munmap_file
23 #define sync_dir ucw_sync_dir
24 #endif
25
26 #ifdef CONFIG_UCW_LARGE_FILES
27
28 #define ucw_open open64
29 #define ucw_seek lseek64
30 #define ucw_pread pread64
31 #define ucw_pwrite pwrite64
32 #define ucw_ftruncate ftruncate64
33 #define ucw_mmap(a,l,p,f,d,o) mmap64(a,l,p,f,d,o)
34 #define ucw_pread pread64
35 #define ucw_pwrite pwrite64
36 #define ucw_stat stat64
37 #define ucw_fstat fstat64
38 typedef struct stat64 ucw_stat_t;
39
40 #else   /* !CONFIG_UCW_LARGE_FILES */
41
42 #define ucw_open open
43 #define ucw_seek(f,o,w) lseek(f,o,w)
44 #define ucw_ftruncate(f,o) ftruncate(f,o)
45 #define ucw_mmap(a,l,p,f,d,o) mmap(a,l,p,f,d,o)
46 #define ucw_pread pread
47 #define ucw_pwrite pwrite
48 #define ucw_stat stat
49 #define ucw_fstat fstat
50 typedef struct stat ucw_stat_t;
51
52 #endif  /* !CONFIG_UCW_LARGE_FILES */
53
54 #if defined(_POSIX_SYNCHRONIZED_IO) && (_POSIX_SYNCHRONIZED_IO > 0)
55 #define ucw_fdatasync fdatasync
56 #else
57 #define ucw_fdatasync fsync
58 #endif
59
60 #define HAVE_PREAD
61
62 /* io-size.c */
63
64 ucw_off_t ucw_file_size(const char *name);
65
66 /* io-mmap.c */
67
68 void *mmap_file(const char *name, unsigned *len, int writeable);
69 void munmap_file(void *start, unsigned len);
70
71 /* io-careful.c */
72
73 int careful_read(int fd, void *buf, int len);
74 int careful_write(int fd, const void *buf, int len);
75
76 /* io-sync.c */
77
78 void sync_dir(const char *name);
79
80 #endif  /* !_UCW_IO_H */