]> mj.ucw.cz Git - libucw.git/commitdiff
Moved ucw/lfs.h to ucw/io.h
authorMartin Mares <mj@ucw.cz>
Thu, 9 Feb 2012 22:02:17 +0000 (23:02 +0100)
committerMartin Mares <mj@ucw.cz>
Thu, 9 Feb 2012 22:02:17 +0000 (23:02 +0100)
More I/O functions will follow.

14 files changed:
ucw/Makefile
ucw/doc/index.txt
ucw/fb-atomic.c
ucw/fb-direct.c
ucw/fb-file.c
ucw/fb-mmap.c
ucw/fb-param.c
ucw/io.h [new file with mode: 0644]
ucw/lfs.h [deleted file]
ucw/log-file.c
ucw/partmap.c
ucw/sorter/debug/radix-asio-test.c
ucw/sorter/debug/radix-file-test.c
ucw/tempfile.c

index bf1232683d06d5a072120b253482c0e8307470ad..6c44266beba2ea5b54c9143844f2ec2cf3626d18 100644 (file)
@@ -48,7 +48,7 @@ LIBUCW_MAIN_INCLUDES= \
        prime.h \
        bitops.h \
        conf.h getopt.h ipaccess.h \
-       fastbuf.h lfs.h ff-unicode.h ff-binary.h \
+       fastbuf.h io.h ff-unicode.h ff-binary.h \
        url.h \
        mainloop.h \
        lizard.h \
index 4a14d5214cd9d02f584db905161b1f8103036770..30e3a18257242045540b9b5ae710c79f68c1d2a4 100644 (file)
@@ -65,7 +65,7 @@ Yet undocumented modules
   * `wildmatch.h`
 - File manipulation
   * `asio.h`
-  * `lfs.h`
+  * `io.h`
   * `partmap.h`
 - Address manipulation
   * `url.h`
index 32c9ca9bfe3facd3da41bc29537bd2f321fd9916..8b4544858327da99991c19a19042976c31f9118e 100644 (file)
@@ -9,7 +9,7 @@
 
 #include "ucw/lib.h"
 #include "ucw/fastbuf.h"
-#include "ucw/lfs.h"
+#include "ucw/io.h"
 #include "ucw/conf.h"
 
 #include <string.h>
index 1e2dfd89c53f3f0c6d9806192c8ac614f52b3004..af49f8ced00e0b9e5e9020176add77b40b7632b8 100644 (file)
@@ -27,7 +27,7 @@
 
 #include "ucw/lib.h"
 #include "ucw/fastbuf.h"
-#include "ucw/lfs.h"
+#include "ucw/io.h"
 #include "ucw/asio.h"
 #include "ucw/conf.h"
 #include "ucw/threads.h"
index 3eb2996f52e0303fa4defa5f3d1bee8f157a74cf..77bf03cb8fc255d38be8024544005392238ec77f 100644 (file)
@@ -10,7 +10,7 @@
 
 #include "ucw/lib.h"
 #include "ucw/fastbuf.h"
-#include "ucw/lfs.h"
+#include "ucw/io.h"
 
 #include <stdio.h>
 #include <string.h>
index 747b4286d7757fa037bccbab72a0110d6f3963f8..2a8b53720304a94a75ee21ed75d57c20a3d58aa0 100644 (file)
@@ -11,7 +11,7 @@
 
 #include "ucw/lib.h"
 #include "ucw/fastbuf.h"
-#include "ucw/lfs.h"
+#include "ucw/io.h"
 #include "ucw/conf.h"
 
 #include <string.h>
index 22f988c6d42d3a03effd32c04704893a96d7ba6f..528765cb01ae5950909273cf1687a7561cded4c2 100644 (file)
@@ -10,7 +10,7 @@
 
 #include "ucw/lib.h"
 #include "ucw/conf.h"
-#include "ucw/lfs.h"
+#include "ucw/io.h"
 #include "ucw/fastbuf.h"
 
 #include <fcntl.h>
diff --git a/ucw/io.h b/ucw/io.h
new file mode 100644 (file)
index 0000000..593dcf7
--- /dev/null
+++ b/ucw/io.h
@@ -0,0 +1,63 @@
+/*
+ *     UCW Library -- Large File Support
+ *
+ *     (c) 1999--2002 Martin Mares <mj@ucw.cz>
+ *
+ *     This software may be freely distributed and used according to the terms
+ *     of the GNU Lesser General Public License.
+ */
+
+#ifndef _UCW_LFS_H
+#define _UCW_LFS_H
+
+#include <fcntl.h>
+#include <unistd.h>
+
+#ifdef CONFIG_LFS
+
+#define ucw_open open64
+#define ucw_seek lseek64
+#define ucw_pread pread64
+#define ucw_pwrite pwrite64
+#define ucw_ftruncate ftruncate64
+#define ucw_mmap(a,l,p,f,d,o) mmap64(a,l,p,f,d,o)
+#define ucw_pread pread64
+#define ucw_pwrite pwrite64
+#define ucw_stat stat64
+#define ucw_fstat fstat64
+typedef struct stat64 ucw_stat_t;
+
+#else  /* !CONFIG_LFS */
+
+#define ucw_open open
+#define ucw_seek(f,o,w) lseek(f,o,w)
+#define ucw_ftruncate(f,o) ftruncate(f,o)
+#define ucw_mmap(a,l,p,f,d,o) mmap(a,l,p,f,d,o)
+#define ucw_pread pread
+#define ucw_pwrite pwrite
+#define ucw_stat stat
+#define ucw_fstat fstat
+typedef struct stat ucw_stat_t;
+
+#endif /* !CONFIG_LFS */
+
+#if defined(_POSIX_SYNCHRONIZED_IO) && (_POSIX_SYNCHRONIZED_IO > 0)
+#define ucw_fdatasync fdatasync
+#else
+#define ucw_fdatasync fsync
+#endif
+
+#define HAVE_PREAD
+
+static inline ucw_off_t
+ucw_file_size(const char *name)
+{
+  int fd = ucw_open(name, O_RDONLY);
+  if (fd < 0)
+    die("Cannot open %s: %m", name);
+  ucw_off_t len = ucw_seek(fd, 0, SEEK_END);
+  close(fd);
+  return len;
+}
+
+#endif /* !_UCW_LFS_H */
diff --git a/ucw/lfs.h b/ucw/lfs.h
deleted file mode 100644 (file)
index 593dcf7..0000000
--- a/ucw/lfs.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- *     UCW Library -- Large File Support
- *
- *     (c) 1999--2002 Martin Mares <mj@ucw.cz>
- *
- *     This software may be freely distributed and used according to the terms
- *     of the GNU Lesser General Public License.
- */
-
-#ifndef _UCW_LFS_H
-#define _UCW_LFS_H
-
-#include <fcntl.h>
-#include <unistd.h>
-
-#ifdef CONFIG_LFS
-
-#define ucw_open open64
-#define ucw_seek lseek64
-#define ucw_pread pread64
-#define ucw_pwrite pwrite64
-#define ucw_ftruncate ftruncate64
-#define ucw_mmap(a,l,p,f,d,o) mmap64(a,l,p,f,d,o)
-#define ucw_pread pread64
-#define ucw_pwrite pwrite64
-#define ucw_stat stat64
-#define ucw_fstat fstat64
-typedef struct stat64 ucw_stat_t;
-
-#else  /* !CONFIG_LFS */
-
-#define ucw_open open
-#define ucw_seek(f,o,w) lseek(f,o,w)
-#define ucw_ftruncate(f,o) ftruncate(f,o)
-#define ucw_mmap(a,l,p,f,d,o) mmap(a,l,p,f,d,o)
-#define ucw_pread pread
-#define ucw_pwrite pwrite
-#define ucw_stat stat
-#define ucw_fstat fstat
-typedef struct stat ucw_stat_t;
-
-#endif /* !CONFIG_LFS */
-
-#if defined(_POSIX_SYNCHRONIZED_IO) && (_POSIX_SYNCHRONIZED_IO > 0)
-#define ucw_fdatasync fdatasync
-#else
-#define ucw_fdatasync fsync
-#endif
-
-#define HAVE_PREAD
-
-static inline ucw_off_t
-ucw_file_size(const char *name)
-{
-  int fd = ucw_open(name, O_RDONLY);
-  if (fd < 0)
-    die("Cannot open %s: %m", name);
-  ucw_off_t len = ucw_seek(fd, 0, SEEK_END);
-  close(fd);
-  return len;
-}
-
-#endif /* !_UCW_LFS_H */
index 862b94c1570cc06825ed29991cd009acfc1e8cad..231344bd4ef77a713da534e9376603333447e46d 100644 (file)
@@ -11,7 +11,7 @@
 #include "ucw/lib.h"
 #include "ucw/log.h"
 #include "ucw/log-internal.h"
-#include "ucw/lfs.h"
+#include "ucw/io.h"
 #include "ucw/threads.h"
 #include "ucw/simple-lists.h"
 
index a823d3d157fa29d1355db9c68ad5bd040b83f5c6..fd9d91249ea8e715942b1e070ada30a141ecd8d3 100644 (file)
@@ -9,7 +9,7 @@
  */
 
 #include "ucw/lib.h"
-#include "ucw/lfs.h"
+#include "ucw/io.h"
 #include "ucw/partmap.h"
 
 #include <stdio.h>
index 168f6ff6b4f0b982a3cb2ce434ee2c6bd5989aae..8e3368b0962d26287a581ad27591ad47b654c196 100644 (file)
@@ -6,7 +6,7 @@
 
 #include "ucw/lib.h"
 #include "ucw/conf.h"
-#include "ucw/lfs.h"
+#include "ucw/io.h"
 #include "ucw/asio.h"
 
 #include <stdio.h>
index 46d1bb4c94dbfe897a9ef4c9039e54ec6610fee2..11f32dd6fa8437e54cae4d32434e623b24307578 100644 (file)
@@ -6,7 +6,7 @@
 
 #include "ucw/lib.h"
 #include "ucw/conf.h"
-#include "ucw/lfs.h"
+#include "ucw/io.h"
 
 #include <stdio.h>
 #include <stdlib.h>
index 76d9cd388d99fe3933bf7bfff404fc3b968ca30a..f616990aca877c8c8eb0879992d2a14645874c5d 100644 (file)
@@ -11,7 +11,7 @@
 #include "ucw/lib.h"
 #include "ucw/conf.h"
 #include "ucw/threads.h"
-#include "ucw/lfs.h"
+#include "ucw/io.h"
 #include "ucw/fastbuf.h"
 
 #include <stdio.h>