From 51fec467c4b771db8ffc6a10a07dbf781a905482 Mon Sep 17 00:00:00 2001 From: Marcus Brinkmann Date: Tue, 30 Jan 2001 00:38:45 +0000 Subject: 2000-12-26 Neal H Walfield * cache.c: Change cache/hash table size to 509, a prime. Use memcpy/memcmp not bcopy/bcmp. Verify return value from malloc and check the result of rpc transaction _and_ do not act if failed. * main.c: Correct the wording of the help messages. Do not bother initializing global variable to 0. Use memcpy/memcmp not bcopy/bcmp. Verify return value from malloc and check the result of rpc transaction _and_ do not act if failed. * mount.c: Check return values of initialize_rpc. Use memcpy/memcmp not bcopy/bcmp. Verify return value from malloc and strdup. Correct comments. (mount_root): Check result of connect. Handle errors consistently. Reverse loops that are if (! c) {} else when appropriate. * mount.h: Protect header with #ifdef. * name-cache.c: Correct dangerous NPARTIALS macro. Use memcpy/memcmp not bcopy/bcmp. (find_cache): Use PARTIAL_THRESH, not the constant. * nfs-spec.h: Protect header with #ifdef. * nfs.c: Use memcpy/memcmp not bcopy/bcmp. * nfs.h: Likewise. * ops.c (netfs_attempt_mkdir): Check return values of initialize_rpc. Use memcpy/memcmp not bcopy/bcmp. Verify return value from malloc and check the result of rpc transaction _and_ do not act if failed. (netfs_attempt_link): Unlock the directory before the rpc transaction. Check the result of rpc transaction _and_ do not act if failed. * pager.c: Remove, we do not use it. * rpc.c: Use memcpy/memcmp not bcopy/bcmp. Verify return value from malloc and check the result of rpc transaction _and_ do not act if failed. (initialize_rpc): Use AUTH_NONE, not the depreciated AUTH_NULL. Return sane values on failure. (generate_xid): Make inline. (link_rpc): New function. Complements unlink_rpc. (conduct_rpc): Use link_rpc. (rpc_receive_thread): Reroll to a single loop. --- nfs/main.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'nfs/main.c') diff --git a/nfs/main.c b/nfs/main.c index 92a49861..e38f4061 100644 --- a/nfs/main.c +++ b/nfs/main.c @@ -34,13 +34,13 @@ extern char *localhost (); /* Default number of times to retry RPCs when mounted soft. */ -#define DEFAULT_SOFT_RETRIES 3 +#define DEFAULT_SOFT_RETRIES 3 /* Default number of seconds to timeout cached stat information. */ #define DEFAULT_STAT_TIMEOUT 3 /* Default number of seconds to timeout cached file contents. */ -#define DEFAULT_CACHE_TIMEOUT 3 +#define DEFAULT_CACHE_TIMEOUT 3 /* Default number of seconds to timeout cache positive dir hits. */ #define DEFAULT_NAME_CACHE_TIMEOUT 3 @@ -49,10 +49,10 @@ extern char *localhost (); #define DEFAULT_NAME_CACHE_NEG_TIMEOUT 3 /* Default maximum number of bytes to read at once. */ -#define DEFAULT_READ_SIZE 8192 +#define DEFAULT_READ_SIZE 8192 /* Default maximum number of bytes to write at once. */ -#define DEFAULT_WRITE_SIZE 8192 +#define DEFAULT_WRITE_SIZE 8192 /* Number of seconds to timeout cached stat information. */ @@ -114,8 +114,8 @@ static const struct argp_option common_options[] = { {0,0,0,0,0,1}, {"soft", OPT_SOFT, "RETRIES", OPTION_ARG_OPTIONAL, - "File system requests will eventually fail, after RETRIES tries if" - " specified, otherwise " _D(SOFT_RETRIES)}, + "File system requests will eventually fail, after RETRIES tries" + " (default " _D(SOFT_RETRIES) ")" }, {"hard", OPT_HARD, 0, 0, "Retry file systems requests until they succeed"}, @@ -134,10 +134,10 @@ static const struct argp_option common_options[] = "Timeout for cached file data (default " _D(CACHE_TIMEOUT) ")"}, {"name-cache-timeout", OPT_NCACHE_TO, "SEC", 0, "Timeout for positive directory cache entries (default " - _D(NAME_CACHE_TIMEOUT) ")"}, + _D(NAME_CACHE_TIMEOUT) ")"}, {"name-cache-neg-timeout", OPT_NCACHE_NEG_TO, "SEC", 0, "Timeout for negative directory cache entires (default " - _D(NAME_CACHE_NEG_TIMEOUT) ")"}, + _D(NAME_CACHE_NEG_TIMEOUT) ")"}, {"init-transmit-timeout", OPT_INIT_TR_TO,"SEC", 0}, {"max-transmit-timeout", OPT_MAX_TR_TO, "SEC", 0}, @@ -197,7 +197,7 @@ static const struct argp_option startup_options[] = { static char *args_doc = "REMOTE_FS [HOST]"; static char *doc = "Hurd nfs translator" "\vIf HOST is not specified, an attempt is made to extract" -" it from REMOTE_FS, using either the `HOST:FS' or `FS@HOST' notations."; +" it from REMOTE_FS using either the `HOST:FS' or `FS@HOST' notations."; static const struct argp_child runtime_argp_children[] = { {&netfs_std_runtime_argp}, {0} }; @@ -205,12 +205,12 @@ static struct argp runtime_argp = { common_options, parse_common_opt, 0, 0, runtime_argp_children }; -/* Use by netfs_set_options to handle runtime option parsing. */ +/* Used by netfs_set_options to handle runtime option parsing. */ struct argp *netfs_runtime_argp = &runtime_argp; /* Where to find the remote filesystem. */ -static char *remote_fs = 0; -static char *host = 0; +static char *remote_fs; /* = 0; */ +static char *host; /* = 0; */ /* Return an argz string describing the current options. Fill *ARGZ with a pointer to newly malloced storage holding the list and *LEN @@ -272,6 +272,8 @@ extract_nfs_args (char *spec, char **remote_fs, char **host) char *sep; spec = strdup (spec); /* So we can trash it. */ + if (! spec) + return NULL; sep = index (spec, ':'); if (sep) -- cgit v1.2.3