diff mbox

[7/7] libjunction: Remove <ttl> tag from <location>

Message ID 20121120202726.47389.91089.stgit@seurat.1015granger.net
State Accepted
Headers show

Commit Message

Chuck Lever Nov. 20, 2012, 8:27 p.m. UTC
Recent changes to the NSDB schema moved the cache TTL from location
records to their parent FSN record.  The same change is needed for
NFS basic junctions.

Start by removing the existing <ttl> tag from NFS basic junctions.
The default cache expiry for junctions should then be 300 seconds.

I'm not sure anyone will ever need to alter this value.  There is
no interface to change it in today's fedfs-utils or nfs-utils.

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

 src/include/junction.h |    2 --
 src/libjunction/nfs.c  |   62 ++----------------------------------------------
 src/nfsref/add.c       |    1 -
 src/nfsref/lookup.c    |    1 -
 4 files changed, 2 insertions(+), 64 deletions(-)
diff mbox

Patch

diff --git a/src/include/junction.h b/src/include/junction.h
index acd3e8b..f15d200 100644
--- a/src/include/junction.h
+++ b/src/include/junction.h
@@ -69,8 +69,6 @@  struct nfs_fsloc {
 		uint8_t		  nfl_readrank, nfl_writerank;
 		uint8_t		  nfl_readorder, nfl_writeorder;
 	} nfl_info;
-
-	int32_t			  nfl_ttl;
 };
 
 
diff --git a/src/libjunction/nfs.c b/src/libjunction/nfs.c
index d2534c6..b6bac49 100644
--- a/src/libjunction/nfs.c
+++ b/src/libjunction/nfs.c
@@ -233,11 +233,6 @@ 
 #define NFS_XML_VALIDFOR_TAG		(const xmlChar *)"validfor"
 
 /**
- * Tag name of a ttl child element of an NFS location element
- */
-#define NFS_XML_TTL_TAG			(const xmlChar *)"ttl"
-
-/**
  * XPath path to NFS location elements in a junction document
  */
 #define NFS_XML_LOCATION_XPATH		(const xmlChar *)	\
@@ -556,24 +551,6 @@  nfs_location_validfor_xml(__attribute__((unused)) const char *pathname,
 }
 
 /**
- * Add a "validfor" child to a "location" element
- *
- * @param pathname NUL-terminated C string containing pathname of a junction
- * @param parent parent element to which to add "host" child
- * @param fsloc NFS location containing host information to add
- * @return a FedFsStatus code
- */
-static FedFsStatus
-nfs_location_ttl_xml(__attribute__((unused)) const char *pathname,
-		xmlNodePtr parent, struct nfs_fsloc *fsloc)
-{
-	if (junction_xml_set_int_content(parent, NFS_XML_TTL_TAG,
-						fsloc->nfl_ttl) == NULL)
-		return FEDFS_ERR_SVRFAULT;
-	return FEDFS_OK;
-}
-
-/**
  * Construct and add one "location" element to a "fileset"
  *
  * @param pathname NUL-terminated C string containing pathname of a junction
@@ -622,10 +599,7 @@  nfs_location_xml(const char *pathname, xmlNodePtr fileset,
 	retval = nfs_location_flags_xml(pathname, new, fsloc);
 	if (retval != FEDFS_OK)
 		return retval;
-	retval = nfs_location_validfor_xml(pathname, new, fsloc);
-	if (retval != FEDFS_OK)
-		return retval;
-	return nfs_location_ttl_xml(pathname, new, fsloc);
+	return nfs_location_validfor_xml(pathname, new, fsloc);
 }
 
 /**
@@ -1241,35 +1215,6 @@  out_err:
 }
 
 /**
- * Parse the first "ttl" child of "location"
- *
- * @param pathname NUL-terminated C string containing pathname of a junction
- * @param location XML parse tree containing fileset location element
- * @param fsloc a blank nfs_fsloc to fill in
- * @return a FedFsStatus code
- */
-static FedFsStatus
-nfs_parse_location_ttl(const char *pathname, xmlNodePtr location,
-		struct nfs_fsloc *fsloc)
-{
-	xmlNodePtr node;
-
-	node = junction_xml_find_child_by_name(location, NFS_XML_TTL_TAG);
-	if (node == NULL)
-		goto out_err;
-
-	if (!junction_xml_get_int_content(node, &fsloc->nfl_ttl))
-		goto out_err;
-
-	return FEDFS_OK;
-
-out_err:
-	xlog(D_GENERAL, "%s: Missing or invalid ttl element in %s",
-		__func__, pathname);
-	return FEDFS_ERR_NOTJUNCT;
-}
-
-/**
  * Parse children of NFS location element in an NFS junction
  *
  * @param pathname NUL-terminated C string containing pathname of a junction
@@ -1313,10 +1258,7 @@  nfs_parse_location_children(const char *pathname, xmlNodePtr location,
 	retval = nfs_parse_location_flags(pathname, location, fsloc);
 	if (retval != FEDFS_OK)
 		return retval;
-	retval = nfs_parse_location_validfor(pathname, location, fsloc);
-	if (retval != FEDFS_OK)
-		return retval;
-	return nfs_parse_location_ttl(pathname, location, fsloc);
+	return nfs_parse_location_validfor(pathname, location, fsloc);
 }
 
 /**
diff --git a/src/nfsref/add.c b/src/nfsref/add.c
index 9c4fded..eefee51 100644
--- a/src/nfsref/add.c
+++ b/src/nfsref/add.c
@@ -74,7 +74,6 @@  nfsref_add_fsloc_defaults(struct nfs_fsloc *new)
 	new->nfl_info.nfl_readorder = 0;
 	new->nfl_info.nfl_writerank = 0;
 	new->nfl_info.nfl_writeorder = 0;
-	new->nfl_ttl = 300;
 }
 
 /**
diff --git a/src/nfsref/lookup.c b/src/nfsref/lookup.c
index acd3769..80f3dfa 100644
--- a/src/nfsref/lookup.c
+++ b/src/nfsref/lookup.c
@@ -65,7 +65,6 @@  nfsref_lookup_display_nfs_location(struct nfs_fsloc *fsloc)
 
 	printf("\tNFS port:\t%u\n", fsloc->nfl_hostport);
 	printf("\tValid for:\t%d\n", fsloc->nfl_validfor);
-	printf("\tCache TTL:\t%d\n", fsloc->nfl_ttl);
 	printf("\tCurrency:\t%d\n", fsloc->nfl_currency);
 	printf("\tFlags:\t\tvarsub(%s)\n",
 		nfsref_lookup_display_boolean(fsloc->nfl_flags.nfl_varsub));