Patchwork [11/11] Remove NsdbName and port from fedfs_fsl struct

login
register
mail settings
Submitter Chuck Lever
Date Nov. 6, 2012, 5:34 p.m.
Message ID <20121106173442.26310.92371.stgit@seurat.1015granger.net>
Download mbox | patch
Permalink /patch/197526/
State Accepted
Headers show

Comments

Chuck Lever - Nov. 6, 2012, 5:34 p.m.
The latest NSDB schema no longer stores the NSDB name and port in
a fedfsFsl record.  These values are now assumed from the NSDB the
client is connected to.

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

 doc/man/nsdb-resolve-fsn.8   |    2 --
 src/include/nsdb.h           |    2 --
 src/libnsdb/administrator.c  |    8 --------
 src/libnsdb/fileserver.c     |    9 +--------
 src/nfsref/add.c             |   12 ++++--------
 src/nfsref/lookup.c          |    2 --
 src/nsdbc/nsdb-create-fsl.c  |    2 --
 src/nsdbc/nsdb-resolve-fsn.c |    4 ----
 8 files changed, 5 insertions(+), 36 deletions(-)

Patch

diff --git a/doc/man/nsdb-resolve-fsn.8 b/doc/man/nsdb-resolve-fsn.8
index b3c99e9..d00e7aa 100644
--- a/doc/man/nsdb-resolve-fsn.8
+++ b/doc/man/nsdb-resolve-fsn.8
@@ -258,8 +258,6 @@  dn: fedfsFslUuid=323c5068-7c11-11e0-8d38-000c297fd679,
 .br
  FSL UUID:		323c5068-7c11-11e0-8d38-000c297fd679
 .br
- NSDB:			nsdb.example.net
-.br
  FSL host:		fileserver.example.net
 .br
  TTL:			300
diff --git a/src/include/nsdb.h b/src/include/nsdb.h
index a9d113b..6baa317 100644
--- a/src/include/nsdb.h
+++ b/src/include/nsdb.h
@@ -86,8 +86,6 @@  struct fedfs_fsl {
 
 	char			  fl_fsluuid[FEDFS_UUID_STRLEN];
 	char			  fl_fsnuuid[FEDFS_UUID_STRLEN];
-	char			  fl_nsdbname[NI_MAXHOST + 1];
-	int			  fl_nsdbport;
 	char			  fl_fslhost[NI_MAXHOST + 1];
 	int			  fl_fslport;
 	int			  fl_fslttl;
diff --git a/src/libnsdb/administrator.c b/src/libnsdb/administrator.c
index d8df76a..6c32d0f 100644
--- a/src/libnsdb/administrator.c
+++ b/src/libnsdb/administrator.c
@@ -558,7 +558,6 @@  nsdb_create_nfs_fsl_entry_s(LDAP *ld, const char *nce, struct fedfs_fsl *fsl,
 {
 	struct fedfs_nfs_fsl *nfsfsl = &fsl->fl_u.fl_nfsfsl;
 	char *ocvals[3], *fsluuidvals[2], *fsnuuidvals[2];
-	char *nsdbnamevals[2], *nsdbportvals[2], nsdbportbuf[12];
 	char *servernamevals[2], *serverportvals[2], serverportbuf[12];
 	char *ttyvals[2], ttybuf[12];
 
@@ -599,13 +598,6 @@  nsdb_create_nfs_fsl_entry_s(LDAP *ld, const char *nce, struct fedfs_fsl *fsl,
 				fsluuidvals, fsl->fl_fsluuid);
 	nsdb_init_add_attribute(attrs[i++], "fedfsFsnUuid",
 				fsnuuidvals, fsl->fl_fsnuuid);
-	nsdb_init_add_attribute(attrs[i++], "fedfsNsdbName",
-				nsdbnamevals, fsl->fl_nsdbname);
-	if (fsl->fl_nsdbport != LDAP_PORT) {
-		sprintf(nsdbportbuf, "%d", fsl->fl_nsdbport);
-		nsdb_init_add_attribute(attrs[i++], "fedfsNsdbPort",
-					nsdbportvals, nsdbportbuf);
-	}
 	nsdb_init_add_attribute(attrs[i++], "fedfsFslHost",
 				servernamevals, fsl->fl_fslhost);
 	if (fsl->fl_fslport != 0) {
diff --git a/src/libnsdb/fileserver.c b/src/libnsdb/fileserver.c
index dcda3cc..cba49fb 100644
--- a/src/libnsdb/fileserver.c
+++ b/src/libnsdb/fileserver.c
@@ -160,7 +160,6 @@  nsdb_new_fedfs_fsl(FedFsFslType type)
 		return NULL;
 	}
 
-	new->fl_nsdbport = LDAP_PORT;
 	new->fl_type = type;
 	new->fl_fslttl = 300;
 	return new;
@@ -657,15 +656,9 @@  nsdb_resolve_fsn_parse_attribute(LDAP *ld, LDAPMessage *entry, char *attr,
 	else if (strcasecmp(attr, "fedfsFsnUuid") == 0)
 		retval = nsdb_parse_singlevalue_str(attr, values,
 				fsl->fl_fsnuuid, sizeof(fsl->fl_fsnuuid));
-	else if (strcasecmp(attr, "fedfsNsdbName") == 0)
-		retval = nsdb_parse_singlevalue_str(attr, values,
-				fsl->fl_nsdbname, sizeof(fsl->fl_nsdbname));
-	else if (strcasecmp(attr, "fedfsNsdbPort") == 0)
-		retval = nsdb_parse_singlevalue_int(attr, values,
-				&fsl->fl_nsdbport);
 	else if (strcasecmp(attr, "fedfsFslHost") == 0)
 		retval = nsdb_parse_singlevalue_str(attr, values,
-				fsl->fl_fslhost, sizeof(fsl->fl_nsdbname));
+				fsl->fl_fslhost, sizeof(fsl->fl_fslhost));
 	else if (strcasecmp(attr, "fedfsFslPort") == 0)
 		retval = nsdb_parse_singlevalue_int(attr, values,
 				&fsl->fl_fslport);
diff --git a/src/nfsref/add.c b/src/nfsref/add.c
index a23b1c4..9c4fded 100644
--- a/src/nfsref/add.c
+++ b/src/nfsref/add.c
@@ -307,7 +307,6 @@  nfsref_add_nfs_fsl_defaults(const char *rootpath, struct fedfs_nfs_fsl *new)
  * Convert a pair of command line arguments to one fedfs_fsl structure
  *
  * @param fsn_uuid NUL-terminated C string containing FSN UUID to use
- * @param host an initialized NSDB host object
  * @param server NUL-terminated C string containing file server hostname
  * @param rootpath NUL-terminated C string containing POSIX-style export path
  * @param fsl OUT: fedfs_fsl object
@@ -317,7 +316,7 @@  nfsref_add_nfs_fsl_defaults(const char *rootpath, struct fedfs_nfs_fsl *new)
  * returned fsl with nsdb_free_fedfs_fsl().
  */
 static FedFsStatus
-nfsref_add_build_fsl(const char *fsn_uuid, nsdb_t host, const char *server,
+nfsref_add_build_fsl(const char *fsn_uuid, const char *server,
 		const char *rootpath, struct fedfs_fsl **fsl)
 {
 	struct fedfs_fsl *new;
@@ -336,8 +335,6 @@  nfsref_add_build_fsl(const char *fsn_uuid, nsdb_t host, const char *server,
 	uuid_generate_random(uu);
 	uuid_unparse(uu, new->fl_fsluuid);
 	strncpy(new->fl_fsnuuid, fsn_uuid, sizeof(new->fl_fsnuuid));
-	strncpy(new->fl_nsdbname, nsdb_hostname(host), sizeof(new->fl_nsdbname));
-	new->fl_nsdbport = nsdb_port(host);
 	strncpy(new->fl_fslhost, server, sizeof(new->fl_fslhost));
 	new->fl_fslport = 0;
 
@@ -354,7 +351,6 @@  nfsref_add_build_fsl(const char *fsn_uuid, nsdb_t host, const char *server,
  *
  * @param argv array of pointers to NUL-terminated C strings contains arguments
  * @param optind index of "argv" where "add" subcommand arguments start
- * @param host an initialized NSDB host object
  * @param fsn_uuid NUL-terminated C string containing FSN UUID to use
  * @param fsls OUT a list of fedfs_fsl objects
  * @return a FedFsStatus code
@@ -364,7 +360,7 @@  nfsref_add_build_fsl(const char *fsn_uuid, nsdb_t host, const char *server,
  *
  */
 static FedFsStatus
-nfsref_add_build_fsl_list(char **argv, int optind, nsdb_t host,
+nfsref_add_build_fsl_list(char **argv, int optind,
 		const char *fsn_uuid, struct fedfs_fsl **fsls)
 {
 	struct fedfs_fsl *fsl, *result = NULL;
@@ -372,7 +368,7 @@  nfsref_add_build_fsl_list(char **argv, int optind, nsdb_t host,
 	int i;
 
 	for (i = optind + 2; argv[i] != NULL; i += 2) {
-		retval = nfsref_add_build_fsl(fsn_uuid, host,
+		retval = nfsref_add_build_fsl(fsn_uuid,
 						argv[i], argv[i + 1], &fsl);
 		if (retval != FEDFS_OK) {
 			nsdb_free_fedfs_fsls(result);
@@ -457,7 +453,7 @@  nfsref_add_create_fedfs_junction(const char *junct_path, char **argv, int optind
 	struct fedfs_fsl *fsls;
 	FedFsStatus retval;
 
-	retval = nfsref_add_build_fsl_list(argv, optind, host, fsn_uuid, &fsls);
+	retval = nfsref_add_build_fsl_list(argv, optind, fsn_uuid, &fsls);
 	if (retval != FEDFS_OK)
 		return retval;
 
diff --git a/src/nfsref/lookup.c b/src/nfsref/lookup.c
index fcbce42..ef64b9f 100644
--- a/src/nfsref/lookup.c
+++ b/src/nfsref/lookup.c
@@ -214,8 +214,6 @@  nfsref_lookup_display_fedfs_fsl(struct fedfs_fsl *fsl)
 
 	printf("\tfedfsFslUuid:\t\t\t%s\n", fsl->fl_fsluuid);
 	printf("\tfedfsFsnUuid:\t\t\t%s\n", fsl->fl_fsnuuid);
-	printf("\tfedfsNsdbName:\t\t\t%s\n", fsl->fl_nsdbname);
-	printf("\tfedfsNsdbPort:\t\t\t%u\n", fsl->fl_nsdbport);
 	printf("\tfedfsFslHost:\t\t\t%s\n", fsl->fl_fslhost);
 	printf("\tfedfsFslPort:\t\t\t%u\n", fsl->fl_fslport);
 	printf("\tfedfsFslTTL:\t\t\t%d\n", fsl->fl_fslttl);
diff --git a/src/nsdbc/nsdb-create-fsl.c b/src/nsdbc/nsdb-create-fsl.c
index 392e4b0..bca22df 100644
--- a/src/nsdbc/nsdb-create-fsl.c
+++ b/src/nsdbc/nsdb-create-fsl.c
@@ -208,7 +208,6 @@  main(int argc, char **argv)
 	}
 	strcpy(fsl->fl_fsluuid, fsl_uuid);
 	strcpy(fsl->fl_fsnuuid, fsn_uuid);
-	strcpy(fsl->fl_nsdbname, nsdbname);
 	strcpy(fsl->fl_fslhost, servername);
 	retval = nsdb_posix_to_path_array(serverpath,
 						&fsl->fl_u.fl_nfsfsl.fn_nfspath);
@@ -216,7 +215,6 @@  main(int argc, char **argv)
 		fprintf(stderr, "Failed to encode serverpath\n");
 		goto out;
 	}
-	fsl->fl_nsdbport = nsdbport;
 	fsl->fl_fslport = serverport;
 
 	retval = nsdb_lookup_nsdb(nsdbname, nsdbport, &host, NULL);
diff --git a/src/nsdbc/nsdb-resolve-fsn.c b/src/nsdbc/nsdb-resolve-fsn.c
index f222742..b877298 100644
--- a/src/nsdbc/nsdb-resolve-fsn.c
+++ b/src/nsdbc/nsdb-resolve-fsn.c
@@ -151,10 +151,6 @@  nsdb_resolve_fsn_display_fsl(struct fedfs_fsl *fsl)
 
 	printf(" FSN UUID:\t\t%s\n", fsl->fl_fsnuuid);
 	printf(" FSL UUID:\t\t%s\n", fsl->fl_fsluuid);
-	if (fsl->fl_nsdbport == 0)
-		printf(" NSDB:\t\t\t%s\n", fsl->fl_nsdbname);
-	else
-		printf(" NSDB:\t\t\t%s:%u\n", fsl->fl_nsdbname, fsl->fl_nsdbport);
 	if (fsl->fl_fslport == 0)
 		printf(" FSL host:\t\t%s\n", fsl->fl_fslhost);
 	else