bucoord: Introduce ubik_Call_SingleServer_BUDB_*

In an effort to avoid the usage of undeclared functions, add wrappers
for ubik_Call_SingleServer() (_BUDB_GetVolumes(), _BUDB_DumpDB()) and
adjust its callers accordingly.

Also, make sure that ubik_Call_SingleServer() uses the same signature as
ubik_Call(). This change helps us to get rid of casting errors.

Change-Id: I431360f7a42a81b1f20005ebaf0c703bab73a963
Reviewed-on: https://gerrit.openafs.org/14886
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
This commit is contained in:
Marcio Barbosa 2022-03-23 17:31:54 -03:00 committed by Benjamin Kaduk
parent aa91806528
commit 981b3d723e
6 changed files with 78 additions and 31 deletions

6
CODING
View File

@ -333,10 +333,8 @@ afs/afs_syscall.c : old-style
afsd/afsd_kernel.c : deprecated : daemon() marked as deprecated on Darwin
auth/ktc.c : all (ukernel) : call_syscall doesn't have a prototype
bozo/bosserver.c : deprecated : daemon() marked as deprecated on Darwin
bucoord/ubik_db_if.c : strict-proto : Ubik_Call
bucoord/commands.c : all : Ubik_Call
: signed vs unsigned for dates
butc/tcudbprocs.c : all : ubik_Call
bucoord/ubik_db_if.c : strict-proto : ubik_Call_SingleServer
bucoord/commands.c : all : signed vs unsigned for dates
external/heimdal/hcrypto/validate.c: all: statement with empty body
external/heimdal/hcrypto/evp.c: cast-function-type
: Linux kernel build uses -Wcast-function-type

View File

@ -58,5 +58,22 @@ extern afs_int32 udbClientInit(int noAuthFlag, int localauth, char *cellName);
struct ktc_token;
extern int vldbClientInit(int noAuthFlag, int localauth, char *cellName,
struct ubik_client **cstruct, time_t *expires);
extern int ubik_Call_SingleServer_BUDB_GetVolumes(struct ubik_client *aclient,
afs_int32 aflags,
afs_int32 majorVersion,
afs_int32 flags,
const char *name,
afs_int32 start,
afs_int32 end,
afs_int32 index,
afs_int32 *nextIndex,
afs_int32 *dbUpdate,
budb_volumeList *volumes);
extern int ubik_Call_SingleServer_BUDB_DumpDB(struct ubik_client *aclient,
afs_int32 aflags,
int firstcall,
afs_int32 maxLength,
charListT *charListPtr,
afs_int32 *flags);
#endif

View File

@ -2937,13 +2937,18 @@ dumpInfo(afs_int32 dumpid, afs_int32 detailFlag)
last = next;
/* now get all the volumes in this dump. */
code = ubik_Call_SingleServer(BUDB_GetVolumes, udbHandle.uh_client, UF_SINGLESERVER, BUDB_MAJORVERSION, BUDB_OP_DUMPID | BUDB_OP_TAPENAME, tapeLinkPtr->tapeEntry.name, /* tape name */
dumpid, /* dumpid (not initial dumpid) */
0, /* end */
last, /* last */
&next, /* nextindex */
&dbTime, /* update time */
&vl);
code =
ubik_Call_SingleServer_BUDB_GetVolumes(udbHandle.uh_client,
UF_SINGLESERVER,
BUDB_MAJORVERSION,
BUDB_OP_DUMPID | BUDB_OP_TAPENAME,
tapeLinkPtr->tapeEntry.name, /* tape name */
dumpid, /* dumpid (not initial dumpid) */
0, /* end */
last, /* last */
&next, /* nextindex */
&dbTime, /* update time */
&vl);
if (code) {
if (code == BUDB_ENDOFLIST) { /* 0 volumes on tape */

View File

@ -994,12 +994,12 @@ static struct ubikCallState uServer;
* in the future, we should also put in a protocol to find the sync site
*/
afs_int32
static afs_int32
ubik_Call_SingleServer(int (*aproc) (), struct ubik_client *aclient,
afs_int32 aflags, char *p1, char *p2, char *p3,
char *p4, char *p5, char *p6, char *p7, char *p8,
char *p9, char *p10, char *p11, char *p12, char *p13,
char *p14, char *p15, char *p16)
afs_int32 aflags, long p1, long p2, long p3,
long p4, long p5, long p6, long p7, long p8,
long p9, long p10, long p11, long p12, long p13,
long p14, long p15, long p16)
{
afs_int32 code;
afs_int32 someCode;
@ -1096,6 +1096,33 @@ ubik_Call_SingleServer(int (*aproc) (), struct ubik_client *aclient,
return someCode;
}
int
ubik_Call_SingleServer_BUDB_GetVolumes(struct ubik_client *aclient,
afs_int32 aflags, afs_int32 majorVersion,
afs_int32 flags, const char *name,
afs_int32 start, afs_int32 end,
afs_int32 index, afs_int32 *nextIndex,
afs_int32 *dbUpdate,
budb_volumeList *volumes)
{
return ubik_Call_SingleServer(BUDB_GetVolumes, aclient, aflags,
(long)majorVersion, (long)flags, (long)name,
(long)start, (long)end, (long)index,
(long)nextIndex, (long)dbUpdate,
(long)volumes, 0, 0, 0, 0, 0, 0, 0);
}
int
ubik_Call_SingleServer_BUDB_DumpDB(struct ubik_client *aclient,
afs_int32 aflags, int firstcall,
afs_int32 maxLength, charListT *charListPtr,
afs_int32 *flags)
{
return ubik_Call_SingleServer(BUDB_DumpDB, aclient, aflags, (long)firstcall,
(long)maxLength, (long)charListPtr,
(long)flags, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0);
}
/* -------------------------------------
* debug and test routines

View File

@ -2111,10 +2111,12 @@ DeleteDump(void *param)
/* Query the backup database for list of volumes to delete */
for (index = next = 0; index != -1; index = next) {
rc = ubik_Call_SingleServer(BUDB_GetVolumes, udbHandle.uh_client,
UF_SINGLESERVER, BUDB_MAJORVERSION,
BUDB_OP_DUMPID, tapeName, dumpid, 0,
index, &next, &dbTime, &vl);
rc = ubik_Call_SingleServer_BUDB_GetVolumes(udbHandle.uh_client,
UF_SINGLESERVER,
BUDB_MAJORVERSION,
BUDB_OP_DUMPID,
tapeName, dumpid, 0, index,
&next, &dbTime, &vl);
if (rc) {
if (rc == BUDB_ENDOFLIST)
break;

View File

@ -13,10 +13,6 @@
#include <afs/procmgmt.h>
#include <roken.h>
#ifdef IGNORE_SOME_GCC_WARNINGS
# pragma GCC diagnostic warning "-Wimplicit-function-declaration"
#endif
#include <afs/opr.h>
#include <rx/rx.h>
#include <afs/afsint.h>
@ -456,9 +452,10 @@ writeDbDump(struct butm_tapeInfo *tapeInfoPtr, afs_uint32 taskId,
/* get the data */
code =
ubik_Call_SingleServer(BUDB_DumpDB, udbHandle.uh_client,
UF_SINGLESERVER, firstcall,
maxReadSize, &charList, &done);
ubik_Call_SingleServer_BUDB_DumpDB(udbHandle.uh_client,
UF_SINGLESERVER, firstcall,
maxReadSize, &charList,
&done);
if (code) {
ErrorLog(0, taskId, code, 0, "Can't read database\n");
ERROR_EXIT(code);
@ -611,8 +608,8 @@ writeDbDump(struct butm_tapeInfo *tapeInfoPtr, afs_uint32 taskId,
error_exit:
/* Let the KeepAlive process stop on its own */
code =
ubik_Call_SingleServer(BUDB_DumpDB, udbHandle.uh_client,
UF_END_SINGLESERVER, 0);
ubik_Call_SingleServer_BUDB_DumpDB(udbHandle.uh_client,
UF_END_SINGLESERVER, 0, 0, 0, 0);
if (writeBlock)
free(writeBlock);
@ -1130,8 +1127,9 @@ KeepAlive(void *unused)
charList.charListT_val = 0;
charList.charListT_len = 0;
code =
ubik_Call_SingleServer(BUDB_DumpDB, udbHandle.uh_client,
UF_SINGLESERVER, 0, 0, &charList, &done);
ubik_Call_SingleServer_BUDB_DumpDB(udbHandle.uh_client,
UF_SINGLESERVER, 0, 0, &charList,
&done);
if (code || done)
break;
}