ptserver: move IDToName, NameToID to ptprocs.c and make static 19/13319/3
authorBenjamin Kaduk <kaduk@mit.edu>
Sun, 2 Sep 2018 22:03:38 +0000 (17:03 -0500)
committerBenjamin Kaduk <kaduk@mit.edu>
Fri, 6 Nov 2020 03:29:07 +0000 (22:29 -0500)
These two helpers are only used in implementing server-side RPC handlers,
and having to track the codeflow across files is unhelpful.  Move them
into the file where they're used, make them static, and remove the
prototypes from ptrototypes.h (which is not an installed header, so
there is no API/ABI breakage).

Change-Id: I236d17865a296933f41aaee206535d341c3a955d
Reviewed-on: https://gerrit.openafs.org/13319
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

src/ptserver/ptprocs.c
src/ptserver/ptprototypes.h
src/ptserver/utils.c

index 90416ab..88af82d 100644 (file)
@@ -91,6 +91,10 @@ static afs_int32 addToGroup(struct rx_call *call, afs_int32 aid, afs_int32 gid,
                            afs_int32 *cid);
 static afs_int32 nameToID(struct rx_call *call, namelist *aname, idlist *aid);
 static afs_int32 idToName(struct rx_call *call, idlist *aid, namelist *aname, afs_int32 *cid);
+static afs_int32 IDToName(struct ubik_trans *at, afs_int32 aid,
+                         char aname[PR_MAXNAMELEN]);
+static afs_int32 NameToID(struct ubik_trans *at, char aname[PR_MAXNAMELEN],
+                         afs_int32 *aid);
 static afs_int32 Delete(struct rx_call *call, afs_int32 aid, afs_int32 *cid);
 static afs_int32 UpdateEntry(struct rx_call *call, afs_int32 aid, char *name,
                             struct PrUpdateEntry *uentry, afs_int32 *cid);
@@ -685,6 +689,36 @@ idToName(struct rx_call *call, idlist *aid, namelist *aname, afs_int32 *cid)
     return PRSUCCESS;
 }
 
+static afs_int32
+IDToName(struct ubik_trans *at, afs_int32 aid, char aname[PR_MAXNAMELEN])
+{
+    afs_int32 temp;
+    struct prentry tentry;
+    afs_int32 code;
+
+    temp = FindByID(at, aid);
+    if (temp == 0)
+       return PRNOENT;
+    code = pr_Read(at, 0, temp, (char *)&tentry, sizeof(tentry));
+    if (code)
+       return code;
+    strncpy(aname, tentry.name, PR_MAXNAMELEN);
+    return PRSUCCESS;
+}
+
+static afs_int32
+NameToID(struct ubik_trans *at, char aname[PR_MAXNAMELEN], afs_int32 *aid)
+{
+    afs_int32 temp;
+    struct prentry tentry;
+
+    temp = FindByName(at, aname, &tentry);
+    if (!temp)
+       return PRNOENT;
+    *aid = tentry.id;
+    return PRSUCCESS;
+}
+
 afs_int32
 SPR_Delete(struct rx_call *call, afs_int32 aid)
 {
index bc4c8d6..c6a9dab 100644 (file)
@@ -47,10 +47,6 @@ extern afs_int32 FindByName(struct ubik_trans *at,
                            char aname[PR_MAXNAMELEN], struct prentry *tentryp);
 extern afs_int32 AllocID(struct ubik_trans *at, afs_int32 flag,
                         afs_int32 *aid);
-extern afs_int32 IDToName(struct ubik_trans *at, afs_int32 aid,
-                         char aname[PR_MAXNAMELEN]);
-extern afs_int32 NameToID(struct ubik_trans *at,
-                         char aname[PR_MAXNAMELEN], afs_int32 *aid);
 extern int IDCmp(const void *a, const void *b);
 extern afs_int32 RemoveFromIDHash(struct ubik_trans *tt, afs_int32 aid,
                                  afs_int32 *loc);
index abc37c1..d0f6ac2 100644 (file)
@@ -390,36 +390,6 @@ AllocID(struct ubik_trans *at, afs_int32 flag, afs_int32 *aid)
     }
 }
 
-afs_int32
-IDToName(struct ubik_trans *at, afs_int32 aid, char aname[PR_MAXNAMELEN])
-{
-    afs_int32 temp;
-    struct prentry tentry;
-    afs_int32 code;
-
-    temp = FindByID(at, aid);
-    if (temp == 0)
-       return PRNOENT;
-    code = pr_Read(at, 0, temp, (char *)&tentry, sizeof(tentry));
-    if (code)
-       return code;
-    strncpy(aname, tentry.name, PR_MAXNAMELEN);
-    return PRSUCCESS;
-}
-
-afs_int32
-NameToID(struct ubik_trans *at, char aname[PR_MAXNAMELEN], afs_int32 *aid)
-{
-    afs_int32 temp;
-    struct prentry tentry;
-
-    temp = FindByName(at, aname, &tentry);
-    if (!temp)
-       return PRNOENT;
-    *aid = tentry.id;
-    return PRSUCCESS;
-}
-
 int
 IDCmp(const void *a, const void *b)
 {