2 * Sherlock Library -- Large File Support
4 * (c) 1999--2002 Martin Mares <mj@ucw.cz>
6 * This software may be freely distributed and used according to the terms
7 * of the GNU Lesser General Public License.
10 #ifndef _SHERLOCK_LFS_H
11 #define _SHERLOCK_LFS_H
18 #define sh_open open64
19 #define sh_seek lseek64
20 #define sh_pread pread64
21 #define sh_pwrite pwrite64
22 #define sh_ftruncate ftruncate64
23 #define sh_mmap(a,l,p,f,d,o) mmap64(a,l,p,f,d,o)
24 #define sh_pread pread64
25 #define sh_pwrite pwrite64
27 #else /* !CONFIG_LFS */
30 #define sh_seek(f,o,w) lseek(f,o,w)
31 #define sh_ftruncate(f,o) ftruncate(f,o)
32 #define sh_mmap(a,l,p,f,d,o) mmap(a,l,p,f,d,o)
33 #define sh_pread pread
34 #define sh_pwrite pwrite
36 #endif /* !CONFIG_LFS */
38 #define SHERLOCK_HAVE_PREAD
40 static inline sh_off_t
41 sh_file_size(byte *name)
43 int fd = sh_open(name, O_RDONLY);
45 die("Cannot open %s: %m", name);
46 sh_off_t len = sh_seek(fd, 0, SEEK_END);
51 #endif /* !_SHERLOCK_LFS_H */