]> mj.ucw.cz Git - libucw.git/commitdiff
Large File Support.
authorMartin Mares <mj@ucw.cz>
Sun, 24 Oct 1999 19:58:22 +0000 (19:58 +0000)
committerMartin Mares <mj@ucw.cz>
Sun, 24 Oct 1999 19:58:22 +0000 (19:58 +0000)
lib/config.h
lib/lfs.h [new file with mode: 0644]

index 171211c61ab5da058d6057f2c7750ae3a38886d8..50bf986ab0b4137c3db8ac7eaedbb912b397baec 100644 (file)
@@ -9,7 +9,13 @@
 
 /* Version */
 
-#define SHER_VER "1.2"
+#define SHER_VER "1.3"
+
+/* Features */
+
+#define SHERLOCK_CONFIG_REF_WEIGHTS
+#undef SHERLOCK_CONFIG_LARGE_DB
+#undef SHERLOCK_CONFIG_LFS
 
 /* Types */
 
@@ -32,6 +38,20 @@ typedef unsigned long addr_int_t;    /* Both integer and address */
 
 typedef u32 oid_t;                     /* Object ID */
 
+#ifdef SHERLOCK_CONFIG_LFS             /* off_t as passed to file functions */
+typedef s64 sh_off_t;
+#define BYTES_PER_FILE_POINTER 5
+#else
+typedef int sh_off_t;
+#define BYTES_PER_FILE_POINTER 4
+#endif
+
+#ifdef SHERLOCK_CONFIG_LARGE_DB                /* off_t as present in database files */
+typedef s64 sh_foff_t;
+#else
+typedef s32 sh_foff_t;
+#endif
+
 /* CPU characteristics */
 
 #define CPU_LITTLE_ENDIAN
diff --git a/lib/lfs.h b/lib/lfs.h
new file mode 100644 (file)
index 0000000..ab9d8e7
--- /dev/null
+++ b/lib/lfs.h
@@ -0,0 +1,50 @@
+/*
+ *     Sherlock Library -- Large File Support
+ *
+ *     (c) 1999 Martin Mares, <mj@atrey.karlin.mff.cuni.cz>
+ */
+
+#ifndef _SHERLOCK_LFS_H
+#define _SHERLOCK_LFS_H
+
+#ifdef SHERLOCK_CONFIG_LFS
+
+#ifndef O_LARGEFILE
+#if defined(__linux__) && defined(__i386__)
+#define O_LARGEFILE 0100000
+#else
+#error O_LARGEFILE unknown
+#endif
+#endif
+
+#if 0
+
+/* A "do it yourself" solution */
+
+#include <asm/unistd.h>
+#include <errno.h>
+
+_syscall5(int, _llseek, int, fd, int, hi, int, lo, loff_t *, result, int, whence);
+
+extern inline loff_t sh_seek(int fd, sh_off_t pos, int whence)
+{
+  loff_t result;
+  int err;
+
+  err = _llseek(fd, pos >> 32, pos, &result, whence);
+  return (err < 0) ? err : result;
+}
+#else
+
+/* Touching hidden places in glibc */
+extern loff_t llseek(int fd, loff_t pos, int whence);
+#define sh_seek(f,o,w) llseek(f,o,w)
+
+#endif
+
+#else  /* !SHERLOCK_CONFIG_LFS */
+
+#define sh_seek(f,o,w) lseek(f,o,w)
+
+#endif /* !SHERLOCK_CONFIG_LFS */
+#endif /* !_SHERLOCK_LFS_H */