Jul
9
Here’s a patch i did to fix httpfs not being able to mount a DVD9 iso. The problem is due to the use of a size_t to hold the file_size , which is simply too small for a DVD9. Ive changed it to a “long long” and that fixes the problem for me.
--- httpfs2.c.org 2010-03-13 21:07:56.000000000 +0100
+++ httpfs2.c 2011-07-09 16:02:41.000000000 +0200
@@ -96,13 +96,13 @@
#endif
char * req_buf;
size_t req_buf_size;
- size_t file_size;
+ long long file_size;
time_t last_modified;
} struct_url;
static struct_url main_url;
-static ssize_t get_stat(struct_url*, struct stat * stbuf);
+static long long get_stat(struct_url*, struct stat * stbuf);
static ssize_t get_data(struct_url*, off_t start, size_t size);
static int open_client_socket(struct_url *url);
static int close_client_socket(struct_url *url);
@@ -185,7 +185,7 @@
* The FUSE operations originally ripped from the hello_ll sample.
*/
-static int httpfs_stat(fuse_ino_t ino, struct stat *stbuf)
+static long long httpfs_stat(fuse_ino_t ino, struct stat *stbuf)
{
stbuf->st_ino = ino;
switch (ino) {
@@ -925,7 +925,7 @@
static ssize_t
parse_header(struct_url *url, const char * buf, ssize_t bytes,
- const char * method, size_t * content_length, int expect)
+ const char * method, long long * content_length, int expect)
{
/* FIXME check the header parser */
int status;
@@ -1040,7 +1040,7 @@
static ssize_t
exchange(struct_url *url, char * buf, const char * method,
- size_t * content_length, off_t start, off_t end, size_t * header_length)
+ long long * content_length, off_t start, off_t end, size_t * header_length)
{
ssize_t res;
ssize_t bytes;
@@ -1117,7 +1117,7 @@
* to determine the file size
*/
-static ssize_t get_stat(struct_url *url, struct stat * stbuf) {
+static long long get_stat(struct_url *url, struct stat * stbuf) {
char buf[HEADER_SIZE];
if( exchange(url, buf, "HEAD", &(url->file_size), 0, 0, 0) < 0 )
@@ -1126,7 +1126,8 @@
close_client_socket(url);
stbuf->st_mtime = url->last_modified;
- return stbuf->st_size = url->file_size;
+ stbuf->st_size = url->file_size;
+ return url->file_size;
}
/*
@@ -1142,7 +1143,8 @@
ssize_t bytes;
off_t end = start + size - 1;
char * destination = url->req_buf;
- size_t content_length, header_length;
+ long long content_length;
+ size_t header_length;
bytes = exchange(url, buf, “GET”, &content_length,
start, end, &header_length);
- Dan