rx: Rework identity copying
authorSimon Wilkinson <sxw@your-file-system.com>
Sun, 21 Nov 2010 10:16:26 +0000 (10:16 +0000)
committerJeffrey Altman <jaltman@openafs.org>
Wed, 24 Nov 2010 05:29:45 +0000 (21:29 -0800)
Change the behaviour of the rx_identity_copy function so that it
copies the whole identity, not just the contents. Add a new function
rx_identity_copyContents which just copies the contents of an identity
into an existing identity structure.

This restores symmetry with the free and freeContents functions.

Change-Id: I692ac8434b1538c283a8ae713956be8ae67cccfd
Reviewed-on: http://gerrit.openafs.org/3352
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>

src/rx/rx_identity.c
src/rx/rx_identity.h
src/shlibafsrpc/libafsrpc.map

index 6391988..5a71486 100644 (file)
@@ -86,10 +86,27 @@ rx_identity_populate(struct rx_identity *identity, rx_identity_kind kind,
     rx_opaque_populate(&identity->exportedName, enameData, enameLength);
 }
 
-
 /*!
  * Copy an identity
  *
+ * Create a new identity as a copy of an existing one.
+ *
+ * @param from
+ *     The identity to copy from
+ * @return
+ *     The new identity
+ */
+struct rx_identity *
+rx_identity_copy(struct rx_identity *from)
+{
+   return rx_identity_new(from->kind, from->displayName,
+                         from->exportedName.val, from->exportedName.len);
+}
+
+
+/*!
+ * Copy an identity's contents
+ *
  * Copy the contents of one identity into another one. This will replace
  * (without freeing) any existing identity contents
  *
@@ -100,7 +117,7 @@ rx_identity_populate(struct rx_identity *identity, rx_identity_kind kind,
  */
 
 void
-rx_identity_copy(struct rx_identity *to, struct rx_identity *from)
+rx_identity_copyContents(struct rx_identity *to, struct rx_identity *from)
 {
     rx_identity_populate(to, from->kind, from->displayName,
                         from->exportedName.val, from->exportedName.len);
index eaadc09..a395e9f 100644 (file)
@@ -43,7 +43,8 @@ struct rx_identity *rx_identity_new(rx_identity_kind, char *, void *,
 int rx_identity_match(struct rx_identity *a, struct rx_identity *b);
 void rx_identity_populate(struct rx_identity *, rx_identity_kind, char *,
                          void *, size_t);
-void rx_identity_copy(struct rx_identity *to, struct rx_identity *from);
+struct rx_identity *rx_identity_copy(struct rx_identity *from);
+void rx_identity_copyContents(struct rx_identity *to, struct rx_identity *from);
 void rx_identity_freeContents(struct rx_identity *identity);
 void rx_identity_free(struct rx_identity **identity);
 
index ac4af97..4619447 100755 (executable)
        rx_identity_match;
        rx_identity_populate;
        rx_identity_copy;
+       rx_identity_copyContents;
        rx_identity_new;
        rx_identity_freeContents;
        rx_identity_free;