ubik-call-sucks-20060704
[openafs.git] / src / ptserver / ptclient.c
index 061a88f..332b8ed 100644 (file)
@@ -41,7 +41,9 @@ char confdir[AFSDIR_PATH_MAX];
 
 char *whoami;
 
+#ifndef AFS_PTHREAD_ENV
 extern struct ubik_client *pruclient;
+#endif
 
 static int ignoreExist = 0;
 static char line[256];
@@ -169,7 +171,7 @@ main(argc, argv)
     register afs_int32 code;
     char op[8];
     char name[PR_MAXNAMELEN];
-    afs_int32 id, oid, gid;
+    afs_int32 id, oid = ANONYMOUSID, gid;
     afs_int32 pos;
     int i;
     struct prentry entry;
@@ -265,7 +267,7 @@ main(argc, argv)
            /* use ubik_Call to do the work, finding an up server and handling
             * the job of finding a sync site, if need be */
            else
-               code = ubik_Call(PR_INewEntry, pruclient, 0, name, id, oid);
+               code = ubik_PR_INewEntry(pruclient, 0, name, id, oid);
            if (CodeOk(code))
                com_err(whoami, code, "on %s %s %d %d", op, name, id, oid);
        } else if (!strcmp(op, "sf")) {
@@ -275,7 +277,7 @@ main(argc, argv)
                code = PRBADARG;
            else
                code =
-                   ubik_Call(PR_SetFieldsEntry, pruclient, 0, id, mask,
+                   ubik_PR_SetFieldsEntry(pruclient, 0, id, mask,
                              access, gq, uq, 0, 0);
            if (CodeOk(code))
                com_err(whoami, code, "on %s %d %x %x %d %d", op, id, mask,
@@ -288,7 +290,7 @@ main(argc, argv)
                code = PRBADARG;
            else
                code =
-                   ubik_Call(PR_ChangeEntry, pruclient, 0, id, newname, oid,
+                   ubik_PR_ChangeEntry(pruclient, 0, id, newname, oid,
                              newid);
            if (CodeOk(code))
                com_err(whoami, code, "on %s %d %s %d %d", op, id, newname,
@@ -298,7 +300,7 @@ main(argc, argv)
            if (GetInt32(&id))
                code = PRBADARG;
            else
-               code = ubik_Call(PR_WhereIsIt, pruclient, 0, id, &pos);
+               code = ubik_PR_WhereIsIt(pruclient, 0, id, &pos);
            if (CodeOk(code))
                printf("%s\n", pr_ErrorMsg(code));
            else
@@ -309,7 +311,7 @@ main(argc, argv)
            if (GetInt32(&pos))
                code = PRBADARG;
            else
-               code = ubik_Call(PR_DumpEntry, pruclient, 0, pos, &entry);
+               code = ubik_PR_DumpEntry(pruclient, 0, pos, &entry);
            if (CodeOk(code))
                printf("%s\n", pr_ErrorMsg(code));
            if (code == PRSUCCESS) {
@@ -330,7 +332,7 @@ main(argc, argv)
            if (GetInt32(&id) || GetInt32(&gid))
                code = PRBADARG;
            else
-               code = ubik_Call(PR_AddToGroup, pruclient, 0, id, gid);
+               code = ubik_PR_AddToGroup(pruclient, 0, id, gid);
            if (CodeOk(code))
                com_err(whoami, code, "on %s %d %d", op, id, gid);
        } else if (!strcmp(op, "iton")) {
@@ -349,7 +351,7 @@ main(argc, argv)
            }
            lnames.namelist_val = 0;
            lnames.namelist_len = 0;
-           code = ubik_Call(PR_IDToName, pruclient, 0, &lid, &lnames);
+           code = ubik_PR_IDToName(pruclient, 0, &lid, &lnames);
            if (CodeOk(code))
                printf("%s\n", pr_ErrorMsg(code));
            if (code == PRSUCCESS) {
@@ -368,10 +370,9 @@ main(argc, argv)
            lnames.namelist_len = 0;
            foo = line;
            skip(&foo);
-           for (i = 0;
-                ((lnames.namelist_len < PR_MAXLIST)
-                 && (sscanf(foo, "%s", lnames.namelist_val[i]) != EOF));
-                i++) {
+           for (i = 0; ((lnames.namelist_len < PR_MAXLIST)
+                        && (sscanf(foo, "%s", lnames.namelist_val[i]) !=
+                            EOF)); i++) {
                lnames.namelist_len++;
                skip(&foo);
            }
@@ -381,7 +382,7 @@ main(argc, argv)
            }
            lid.idlist_val = 0;
            lid.idlist_len = 0;
-           code = ubik_Call(PR_NameToID, pruclient, 0, &lnames, &lid);
+           code = ubik_PR_NameToID(pruclient, 0, &lnames, &lid);
            if (CodeOk(code))
                printf("%s\n", pr_ErrorMsg(code));
            if (code == PRSUCCESS) {
@@ -398,7 +399,7 @@ main(argc, argv)
            if (GetInt32(&id))
                code = PRBADARG;
            else
-               code = ubik_Call(PR_Delete, pruclient, 0, id);
+               code = ubik_PR_Delete(pruclient, 0, id);
            if (CodeOk(code))
                printf("%s\n", pr_ErrorMsg(code));
        } else if (!strcmp(op, "dg")) {
@@ -406,7 +407,7 @@ main(argc, argv)
            if (GetInt32(&id))
                code = PRBADARG;
            else
-               code = ubik_Call(PR_Delete, pruclient, 0, id);
+               code = ubik_PR_Delete(pruclient, 0, id);
            if (CodeOk(code))
                printf("%s\n", pr_ErrorMsg(code));
        } else if (!strcmp(op, "rm")) {
@@ -414,7 +415,7 @@ main(argc, argv)
            if (GetInt32(&id) || GetInt32(&gid))
                code = PRBADARG;
            else
-               code = ubik_Call(PR_RemoveFromGroup, pruclient, 0, id, gid);
+               code = ubik_PR_RemoveFromGroup(pruclient, 0, id, gid);
            if (CodeOk(code))
                printf("%s\n", pr_ErrorMsg(code));
        }
@@ -427,7 +428,7 @@ main(argc, argv)
                code = PRBADARG;
            else
                code =
-                   ubik_Call(PR_ListSuperGroups, pruclient, 0, id, &alist,
+                   ubik_PR_ListSuperGroups(pruclient, 0, id, &alist,
                              &over);
            if (CodeOk(code))
                printf("%s\n", pr_ErrorMsg(code));
@@ -452,7 +453,7 @@ main(argc, argv)
            if (GetInt32(&id))
                code = PRBADARG;
            else
-               code = ubik_Call(PR_GetCPS, pruclient, 0, id, &alist, &over);
+               code = ubik_PR_GetCPS(pruclient, 0, id, &alist, &over);
            if (CodeOk(code))
                printf("%s\n", pr_ErrorMsg(code));
            if (code == PRSUCCESS) {
@@ -479,7 +480,7 @@ main(argc, argv)
                hostaddr = hostinfo->h_addr_list[0];
                id = ntohl(hostaddr->s_addr);
                code =
-                   ubik_Call(PR_GetHostCPS, pruclient, 0, id, &alist, &over);
+                   ubik_PR_GetHostCPS(pruclient, 0, id, &alist, &over);
            }
            if (CodeOk(code))
                printf("%s\n", pr_ErrorMsg(code));
@@ -505,7 +506,7 @@ main(argc, argv)
                code = PRBADARG;
            else
                code =
-                   ubik_Call(PR_ListElements, pruclient, 0, id, &alist,
+                   ubik_PR_ListElements(pruclient, 0, id, &alist,
                              &over);
            if (CodeOk(code))
                printf("%s\n", pr_ErrorMsg(code));
@@ -538,13 +539,13 @@ main(argc, argv)
            if (GetString(name, sizeof(name)))
                code = PRBADARG;
            else
-               code = ubik_Call(PR_NewEntry, pruclient, 0, name, 1, &id);
+               code = ubik_PR_NewEntry(pruclient, 0, name, 1, oid, &id);
            if (CodeOk(code))
                printf("%s\n", pr_ErrorMsg(code));
            if (code == PRSUCCESS)
                printf("Id is %d.\n", id);
        } else if (!strcmp(op, "lm")) {
-           code = ubik_Call(PR_ListMax, pruclient, 0, &id, &gid);
+           code = ubik_PR_ListMax(pruclient, 0, &id, &gid);
            if (CodeOk(code))
                printf("%s\n", pr_ErrorMsg(code));
            if (code == PRSUCCESS)
@@ -555,7 +556,7 @@ main(argc, argv)
            if (GetInt32(&id))
                code = PRBADARG;
            else
-               code = ubik_Call(PR_SetMax, pruclient, 0, id, 0);
+               code = ubik_PR_SetMax(pruclient, 0, id, 0);
            if (CodeOk(code))
                printf("%s\n", pr_ErrorMsg(code));
        } else if (!strcmp(op, "smg")) {
@@ -563,7 +564,7 @@ main(argc, argv)
            if (GetInt32(&id))
                code = PRBADARG;
            else
-               code = ubik_Call(PR_SetMax, pruclient, 0, id, 1);
+               code = ubik_PR_SetMax(pruclient, 0, id, 1);
            if (CodeOk(code))
                printf("%s\n", pr_ErrorMsg(code));
        } else if (!strcmp(op, "sin")) {
@@ -608,7 +609,7 @@ main(argc, argv)
 /*             continue;*/
            }
            uentry.Mask = PRUPDATE_IDHASH;
-           code = ubik_Call(PR_UpdateEntry, pruclient, 0, 0, name, &uentry);
+           code = ubik_PR_UpdateEntry(pruclient, 0, 0, name, &uentry);
            if (code) {
                printf("Failed to update entry %s (err=%d)\n", name, code);
                continue;
@@ -636,7 +637,7 @@ main(argc, argv)
            }
            uentry.Mask = PRUPDATE_NAMEHASH;
            code =
-               ubik_Call(PR_UpdateEntry, pruclient, 0, id, "_foo_", &uentry);
+               ubik_PR_UpdateEntry(pruclient, 0, id, "_foo_", &uentry);
            if (code) {
                printf("Failed to update entry with id %d (err=%d)\n", id,
                       code);
@@ -666,7 +667,7 @@ main(argc, argv)
 /*             continue;*/
            }
            uentry.Mask = PRUPDATE_IDHASH;
-           code = ubik_Call(PR_UpdateEntry, pruclient, 0, 0, name, &uentry);
+           code = ubik_PR_UpdateEntry(pruclient, 0, 0, name, &uentry);
            if (code) {
                printf("Failed to update entry %s (err=%d)\n", name, code);
                continue;
@@ -694,7 +695,7 @@ main(argc, argv)
            }
            uentry.Mask = PRUPDATE_NAMEHASH;
            code =
-               ubik_Call(PR_UpdateEntry, pruclient, 0, id, "_foo_", &uentry);
+               ubik_PR_UpdateEntry(pruclient, 0, id, "_foo_", &uentry);
            if (code) {
                printf("Failed to update entry with id %d (err=%d)\n", id,
                       code);