aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Szeredi <miklos@szeredi.hu>2006-01-30 09:47:02 +0000
committerMiklos Szeredi <miklos@szeredi.hu>2006-01-30 09:47:02 +0000
commit40393a4b0b1a5c8598743e02144d14a26009c2a1 (patch)
treee7c7b408a5374589911f17d8b549211ed67a8520
parenta6e0d2ddd92f1428bef1c6460a9691a80758b756 (diff)
downloadsshfs-40393a4b0b1a5c8598743e02144d14a26009c2a1.tar
sshfs-40393a4b0b1a5c8598743e02144d14a26009c2a1.tar.gz
sshfs-40393a4b0b1a5c8598743e02144d14a26009c2a1.tar.bz2
sshfs-40393a4b0b1a5c8598743e02144d14a26009c2a1.zip
fix
-rw-r--r--ChangeLog5
-rw-r--r--sshfs.c29
2 files changed, 34 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 39471f1..a7793fa 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2006-01-29 Miklos Szeredi <miklos@szeredi.hu>
+
+ * Add '-olarge_read' option for Linux-2.4.*. This should
+ generally improve download performance
+
2006-01-27 Miklos Szeredi <miklos@szeredi.hu>
* Add workaround (enabled by default) for ssh clients not setting
diff --git a/sshfs.c b/sshfs.c
index afe4311..af9edf4 100644
--- a/sshfs.c
+++ b/sshfs.c
@@ -25,6 +25,7 @@
#include <sys/time.h>
#include <sys/wait.h>
#include <sys/socket.h>
+#include <sys/utsname.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <glib.h>
@@ -2168,6 +2169,33 @@ int parse_workarounds(void)
return res;
}
+#if FUSE_VERSION == 25
+static int fuse_opt_insert_arg(struct fuse_args *args, int pos,
+ const char *arg)
+{
+ assert(pos <= args->argc);
+ if (fuse_opt_add_arg(args, arg) == -1)
+ return -1;
+
+ if (pos != args->argc - 1) {
+ char *newarg = args->argv[args->argc - 1];
+ memmove(&args->argv[pos + 1], &args->argv[pos],
+ sizeof(char *) * (args->argc - pos - 1));
+ args->argv[pos] = newarg;
+ }
+ return 0;
+}
+#endif
+
+void check_large_read(struct fuse_args *args)
+{
+ struct utsname buf;
+ int err = uname(&buf);
+ if (!err && strcmp(buf.sysname, "Linux") == 0 &&
+ strncmp(buf.release, "2.4.", 4) == 0)
+ fuse_opt_insert_arg(args, 1, "-olarge_read");
+}
+
int main(int argc, char *argv[])
{
int res;
@@ -2253,6 +2281,7 @@ int main(int argc, char *argv[])
g_free(tmp);
tmp = g_strdup_printf("-ofsname=sshfs#%s", fsname);
fuse_opt_insert_arg(&args, 1, tmp);
+ check_large_read(&args);
g_free(tmp);
g_free(fsname);
res = fuse_main(args.argc, args.argv, cache_init(&sshfs_oper));