summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2006-03-01 21:22:57 +0000
committerLennart Poettering <lennart@poettering.net>2006-03-01 21:22:57 +0000
commitd5142ee0947319da9c9eb157457e54d16f777c82 (patch)
treedc9f508de88bdda23e2125cf78fd59c678397a1a
parentd7198b1a406eeeb42ebe667e337a8c95381ba0a3 (diff)
add experimental 64bit off_t workaround
git-svn-id: file:///home/lennart/svn/public/fusedav/trunk@23 e35a362c-bbd6-0310-a59f-a4efcb1729c4
-rw-r--r--src/filecache.c30
1 files changed, 28 insertions, 2 deletions
diff --git a/src/filecache.c b/src/filecache.c
index 5f81f14..f64f69e 100644
--- a/src/filecache.c
+++ b/src/filecache.c
@@ -30,6 +30,8 @@
#include <unistd.h>
#include <assert.h>
#include <pthread.h>
+#include <inttypes.h>
+#include <limits.h>
#include <ne_props.h>
#include <ne_uri.h>
@@ -230,8 +232,24 @@ fail:
return NULL;
}
+#ifdef FIXNEON64
+
+/* We assume that off_t is 64 bit, neon assumes it is 32 bit wide. we
+ * need to work around this somehow */
+
+typedef struct {
+ uint32_t start, end, total;
+} ne_content_range64;
+
+#endif
+
static int load_up_to_unlocked(struct file_info *fi, off_t l) {
+
+#ifdef FIXNEON64
+ ne_content_range64 range;
+#else
ne_content_range range;
+#endif
ne_session *session;
assert(fi);
@@ -247,14 +265,22 @@ static int load_up_to_unlocked(struct file_info *fi, off_t l) {
if (l <= fi->present)
return 0;
- if (lseek(fi->fd, fi->present, SEEK_SET) != fi->present)
+#ifdef FIXNEON64
+ if (l > UINT_MAX) {
+ /* neon doesn't support 64bit ne_get_range right now */
+ errno = EIO;
return -1;
+ }
+#endif
+ if (lseek(fi->fd, fi->present, SEEK_SET) != fi->present)
+ return -1;
+
range.start = fi->present;
range.end = l-1;
range.total = 0;
- if (ne_get_range(session, fi->filename, &range, fi->fd) != NE_OK) {
+ if (ne_get_range(session, fi->filename, (ne_content_range*) &range, fi->fd) != NE_OK) {
fprintf(stderr, "GET failed: %s\n", ne_get_error(session));
errno = ENOENT;
return -1;