diff mbox

[8/8] mountd: Simplify "no junction support" case

Message ID 20121011151151.4665.80466.stgit@lebasque.1015granger.net (mailing list archive)
State New, archived
Headers show

Commit Message

Chuck Lever III Oct. 11, 2012, 3:11 p.m. UTC
We've added logic in the "not an export" case in nfsd_fh(), so it's
no longer a simple function call.  Clean up this code by splitting
it into a new function, and make plain what happens when junction
support is compiled out.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---

 utils/mountd/cache.c |   32 +++++++++++++++++++-------------
 1 files changed, 19 insertions(+), 13 deletions(-)


--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Chuck Lever III Oct. 11, 2012, 3:14 p.m. UTC | #1
On Oct 11, 2012, at 11:11 AM, Chuck Lever wrote:

> We've added logic in the "not an export" case in nfsd_fh(), so it's

Oops, I meant nfsd_export() .

> no longer a simple function call.  Clean up this code by splitting
> it into a new function, and make plain what happens when junction
> support is compiled out.
> 
> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
> ---
> 
> utils/mountd/cache.c |   32 +++++++++++++++++++-------------
> 1 files changed, 19 insertions(+), 13 deletions(-)
> 
> diff --git a/utils/mountd/cache.c b/utils/mountd/cache.c
> index 457fc9c..8280234 100644
> --- a/utils/mountd/cache.c
> +++ b/utils/mountd/cache.c
> @@ -1109,11 +1109,24 @@ static struct exportent *lookup_junction(char *dom, const char *pathname,
> 	(void)dlclose(handle);
> 	return exp;
> }
> +
> +static void lookup_nonexport(FILE *f, char *dom, char *path,
> +		struct addrinfo *ai)
> +{
> +	struct exportent *eep;
> +
> +	eep = lookup_junction(dom, path, ai);
> +	dump_to_cache(f, dom, path, eep);
> +	if (eep == NULL)
> +		return;
> +	exportent_release(eep);
> +	free(eep);
> +}
> #else	/* !HAVE_NFS_PLUGIN_H */
> -static inline struct exportent *lookup_junction(char *UNUSED(dom),
> -		const char *UNUSED(pathname), struct addrinfo *UNUSED(ai))
> +static void lookup_nonexport(FILE *f, char *dom, char *path,
> +		struct addrinfo *UNUSED(ai))
> {
> -	return NULL;
> +	dump_to_cache(f, dom, path, NULL);
> }
> #endif	/* !HAVE_NFS_PLUGIN_H */
> 
> @@ -1164,16 +1177,9 @@ static void nfsd_export(FILE *f)
> 			     " or fsid= required", path);
> 			dump_to_cache(f, dom, path, NULL);
> 		}
> -	} else {
> -		struct exportent *eep;
> -
> -		eep = lookup_junction(dom, path, ai);
> -		dump_to_cache(f, dom, path, eep);
> -		if (eep != NULL) {
> -			exportent_release(eep);
> -			free(eep);
> -		}
> -	}
> +	} else
> +		lookup_nonexport(f, dom, path, ai);
> +
>  out:
> 	xlog(D_CALL, "nfsd_export: found %p path %s", found, path ? path : NULL);
> 	if (dom) free(dom);
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/utils/mountd/cache.c b/utils/mountd/cache.c
index 457fc9c..8280234 100644
--- a/utils/mountd/cache.c
+++ b/utils/mountd/cache.c
@@ -1109,11 +1109,24 @@  static struct exportent *lookup_junction(char *dom, const char *pathname,
 	(void)dlclose(handle);
 	return exp;
 }
+
+static void lookup_nonexport(FILE *f, char *dom, char *path,
+		struct addrinfo *ai)
+{
+	struct exportent *eep;
+
+	eep = lookup_junction(dom, path, ai);
+	dump_to_cache(f, dom, path, eep);
+	if (eep == NULL)
+		return;
+	exportent_release(eep);
+	free(eep);
+}
 #else	/* !HAVE_NFS_PLUGIN_H */
-static inline struct exportent *lookup_junction(char *UNUSED(dom),
-		const char *UNUSED(pathname), struct addrinfo *UNUSED(ai))
+static void lookup_nonexport(FILE *f, char *dom, char *path,
+		struct addrinfo *UNUSED(ai))
 {
-	return NULL;
+	dump_to_cache(f, dom, path, NULL);
 }
 #endif	/* !HAVE_NFS_PLUGIN_H */
 
@@ -1164,16 +1177,9 @@  static void nfsd_export(FILE *f)
 			     " or fsid= required", path);
 			dump_to_cache(f, dom, path, NULL);
 		}
-	} else {
-		struct exportent *eep;
-
-		eep = lookup_junction(dom, path, ai);
-		dump_to_cache(f, dom, path, eep);
-		if (eep != NULL) {
-			exportent_release(eep);
-			free(eep);
-		}
-	}
+	} else
+		lookup_nonexport(f, dom, path, ai);
+
  out:
 	xlog(D_CALL, "nfsd_export: found %p path %s", found, path ? path : NULL);
 	if (dom) free(dom);