From 981b3d723ec56dad553be570147d1b2aa632f4e1 Mon Sep 17 00:00:00 2001 From: Marcio Barbosa Date: Wed, 23 Mar 2022 17:31:54 -0300 Subject: [PATCH] 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 Reviewed-by: Cheyenne Wills Reviewed-by: Benjamin Kaduk Tested-by: BuildBot --- CODING | 6 ++---- src/bucoord/bucoord_prototypes.h | 17 +++++++++++++++ src/bucoord/commands.c | 19 ++++++++++------ src/bucoord/ubik_db_if.c | 37 +++++++++++++++++++++++++++----- src/butc/dump.c | 10 +++++---- src/butc/tcudbprocs.c | 20 ++++++++--------- 6 files changed, 78 insertions(+), 31 deletions(-) diff --git a/CODING b/CODING index 62c8218208..a4e304f1b9 100644 --- a/CODING +++ b/CODING @@ -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 diff --git a/src/bucoord/bucoord_prototypes.h b/src/bucoord/bucoord_prototypes.h index 80ba654f11..996ed226a4 100644 --- a/src/bucoord/bucoord_prototypes.h +++ b/src/bucoord/bucoord_prototypes.h @@ -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 diff --git a/src/bucoord/commands.c b/src/bucoord/commands.c index ec16ca182b..10f088a478 100644 --- a/src/bucoord/commands.c +++ b/src/bucoord/commands.c @@ -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 */ diff --git a/src/bucoord/ubik_db_if.c b/src/bucoord/ubik_db_if.c index 14d4880f79..fd36fda0c8 100644 --- a/src/bucoord/ubik_db_if.c +++ b/src/bucoord/ubik_db_if.c @@ -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 diff --git a/src/butc/dump.c b/src/butc/dump.c index 3750ef7218..8139d572ce 100644 --- a/src/butc/dump.c +++ b/src/butc/dump.c @@ -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; diff --git a/src/butc/tcudbprocs.c b/src/butc/tcudbprocs.c index 5cd6c321bb..ed953c1965 100644 --- a/src/butc/tcudbprocs.c +++ b/src/butc/tcudbprocs.c @@ -13,10 +13,6 @@ #include #include -#ifdef IGNORE_SOME_GCC_WARNINGS -# pragma GCC diagnostic warning "-Wimplicit-function-declaration" -#endif - #include #include #include @@ -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; }