Reverted large read change - pass -o max_read=32768 to fuse instead. (Large wri… | |
git clone git://git.codemadness.org/susmb | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit 5730c4c0e16c059c6d6f0ce40dd5d38a8b7d72e9 | |
parent bc4a367074f26d066d9c5039d14f5c420f6e4fa0 | |
Author: geoff <devnull@localhost> | |
Date: Fri, 19 May 2006 18:25:47 +0000 | |
Reverted large read change - pass -o max_read=32768 to fuse instead. | |
(Large write code is still there.) | |
Version 20060519. | |
Diffstat: | |
M options.c | 5 ++++- | |
M usmb_file.c | 26 +++++--------------------- | |
M version.h | 2 +- | |
3 files changed, 10 insertions(+), 23 deletions(-) | |
--- | |
diff --git a/options.c b/options.c | |
@@ -132,7 +132,7 @@ bool parse_args (int *argc, char ***argv, | |
* -o ... -- if any mount options in the config file | |
* mount point | |
*/ | |
-#define MAXARGS 10 | |
+#define MAXARGS 12 | |
void build_fuse_args (char *options, char *mountpoint, | |
int *out_argc, char ***out_argv) | |
{ | |
@@ -150,6 +150,9 @@ void build_fuse_args (char *options, char *mountpoint, | |
if (nofork) | |
argv[argc++] = "-f"; | |
+ argv[argc++] = "-o"; | |
+ argv[argc++] = "max_read=32768"; | |
+ | |
if ((NULL != options) && ('\0' != options[0])) | |
{ | |
argv[argc++] = "-o"; | |
diff --git a/usmb_file.c b/usmb_file.c | |
@@ -18,6 +18,7 @@ | |
#include <sys/time.h> // struct timeval needed by libsmbclient.h | |
#include <libsmbclient.h> | |
+#include <assert.h> | |
#include <fuse.h> | |
#include <errno.h> | |
#include <stddef.h> | |
@@ -94,6 +95,8 @@ int usmb_read (const char *filename, char *buff, size_t len, … | |
(void)filename; | |
(void)off; | |
+ assert (len <= 32768); | |
+ | |
DEBUG (fprintf (stderr, "read (%p, %u, %lld) ", buff, len, off)); | |
if (smbc_lseek (fi->fh, off, SEEK_SET) < 0) | |
@@ -102,27 +105,8 @@ int usmb_read (const char *filename, char *buff, size_t le… | |
return -errno; | |
} | |
- size_t got = 0; | |
- int bytes = 0; | |
- | |
- // seems that reads of > 32768 bytes don't work with real Windows servers | |
- while (got < len) | |
- { | |
- bytes = smbc_read (fi->fh, buff, (len > 32768) ? 32768 : len); | |
- | |
- if (bytes < 0) | |
- break; | |
- | |
- got += bytes; | |
- buff += bytes; | |
- | |
- // avoids infinite loops | |
- if (0 == bytes) | |
- break; | |
- } | |
- | |
- DEBUG (fprintf (stderr, " = %d\n", (bytes < 0) ? -errno : (int)got)); | |
- return (bytes < 0) ? -errno : (int)got; | |
+ int bytes = smbc_read (fi->fh, buff, len); | |
+ return (bytes < 0) ? -errno : (int)bytes; | |
} | |
diff --git a/version.h b/version.h | |
@@ -21,7 +21,7 @@ | |
#include <stdio.h> | |
- #define USMB_VERSION 0x20060518 | |
+ #define USMB_VERSION 0x20060519 | |
// a - alpha, b - beta, p - pre-release, s - stable | |
#define USMB_VERSION_STATUS 'a' |