From fb51d2796f8d7f1ae4338181a80bb5ceb58e2d3f Mon Sep 17 00:00:00 2001 From: Simon Wilkinson Date: Fri, 10 Jul 2009 22:27:30 +0100 Subject: [PATCH] Export budb_prototypes.h Other modules need prototypes from the budb directory, so we need to export this header. However it contains lots of internal functions. So, split the header into budb_prototypes.h and budb_internal.h, and reference the internal.h header locally. Reviewed-on: http://gerrit.openafs.org/44 Verified-by: Russ Allbery Reviewed-by: Russ Allbery Reviewed-by: Jeffrey Altman --- src/budb/Makefile.in | 5 ++- src/budb/NTMakefile | 3 +- src/budb/budb_internal.h | 92 ++++++++++++++++++++++++++++++++++++++ src/budb/budb_prototypes.h | 90 ++++--------------------------------- src/budb/database.c | 2 +- src/budb/db_alloc.c | 2 +- src/budb/db_dump.c | 2 +- src/budb/db_hash.c | 2 +- src/budb/db_lock.c | 2 +- src/budb/db_text.c | 2 +- src/budb/dbs_dump.c | 2 +- src/budb/ol_verify.c | 2 +- src/budb/procs.c | 2 +- src/budb/server.c | 2 +- src/budb/struct_ops.c | 1 + 15 files changed, 117 insertions(+), 94 deletions(-) create mode 100644 src/budb/budb_internal.h diff --git a/src/budb/Makefile.in b/src/budb/Makefile.in index a0621f202..216d85d2e 100644 --- a/src/budb/Makefile.in +++ b/src/budb/Makefile.in @@ -49,7 +49,7 @@ COMMON_OBJS = database.o db_alloc.o db_dump.o db_hash.o struct_ops.o ol_verify.o SERVER_OBJS = ${COMMON_OBJS} budb.ss.o budb.xdr.o dbs_dump.o db_lock.o db_text.o \ procs.o server.o budb_errs.o -all: ${TOP_LIBDIR}/libbudb.a ${TOP_INCDIR}/afs/budb.h ${TOP_INCDIR}/afs/budb_errs.h ${TOP_INCDIR}/afs/budb_client.h budb_server +all: ${TOP_LIBDIR}/libbudb.a ${TOP_INCDIR}/afs/budb.h ${TOP_INCDIR}/afs/budb_errs.h ${TOP_INCDIR}/afs/budb_client.h ${TOP_INCDIR}/afs/budb_prototypes.h budb_server ${TOP_LIBDIR}/libbudb.a: libbudb.a ${INSTALL_DATA} $? $@ @@ -63,6 +63,9 @@ ${TOP_INCDIR}/afs/budb_errs.h: budb_errs.h ${TOP_INCDIR}/afs/budb_client.h: budb_client.h ${INSTALL_DATA} $? $@ +${TOP_INCDIR}/afs/budb_prototypes.h: budb_prototypes.h + ${INSTALL_DATA} $? $@ + # # budb_errs.o actually depends on neither budb_client.h nor budb_errs.h # but generating either of them will rebuild budb_errs.c diff --git a/src/budb/NTMakefile b/src/budb/NTMakefile index ba93aeb5f..c0ebcb36a 100644 --- a/src/budb/NTMakefile +++ b/src/budb/NTMakefile @@ -17,7 +17,8 @@ INCFILEDIR = $(DESTDIR)\include\afs # header file install directory INCFILES =\ $(INCFILEDIR)\budb.h \ $(INCFILEDIR)\budb_errs.h \ - $(INCFILEDIR)\budb_client.h + $(INCFILEDIR)\budb_client.h \ + $(INCFILEDIR)\budb_prototypes.h diff --git a/src/budb/budb_internal.h b/src/budb/budb_internal.h new file mode 100644 index 000000000..670576652 --- /dev/null +++ b/src/budb/budb_internal.h @@ -0,0 +1,92 @@ +/* + * Copyright 2000, International Business Machines Corporation and others. + * All Rights Reserved. + * + * This software has been released under the terms of the IBM Public + * License. For details, see the LICENSE file in the top-level source + * directory or online at http://www.openafs.org/dl/license10.html + */ + +#ifndef _BUDB_PROTOTYPES_H +#define _BUDB_PROTOTYPES_H + +/* budb.ss.c */ +int BUDB_ExecuteRequest(register struct rx_call *z_call); + +/* db_alloc.c */ +afs_int32 InitDBalloc(void); +afs_int32 AllocStructure(struct ubik_trans *ut, char type, dbadr related, + dbadr *saP, void *s); +afs_int32 FreeStructure(struct ubik_trans *ut, char type, dbadr sa); +afs_int32 AllocBlock(struct ubik_trans *, struct block *, dbadr *); +afs_int32 FreeBlock(struct ubik_trans *, struct blockHeader *, dbadr); + +/* db_dump.c */ +afs_int32 writeDatabase(struct ubik_trans *, int); + +/* db_hash.c */ + +afs_int32 InitDBhash(void); +void ht_DBInit(void); +afs_int32 ht_HashOut(struct ubik_trans *ut, struct memoryHashTable *mht, + dbadr ea, void *e); +afs_int32 RemoveFromList(struct ubik_trans *ut, dbadr ea, void *e, + dbadr *head, dbadr ta, void *t, dbadr *thread); +afs_int32 ht_LookupEntry(struct ubik_trans *ut, struct memoryHashTable *mht, + void *key, dbadr *eaP, void *e); +afs_int32 ht_HashIn(struct ubik_trans *ut, struct memoryHashTable *mht, + dbadr ea, void *e); +afs_int32 scanHashTable(struct ubik_trans *ut, struct memoryHashTable *mhtPtr, + int (*selectFn) (dbadr, void *, void *), + int (*operationFn) (dbadr, void *, void *), + void *rockPtr); + +/* db_lock.c */ +int checkLockHandle(struct ubik_trans *, afs_uint32); + +/* dbs_dump.c */ +afs_int32 badEntry(afs_uint32 dbAddr); + +/* ol_verify.c */ +afs_int32 checkDiskAddress(unsigned long, int, int *, int *); + +/* procs.c */ +afs_int32 InitProcs(void); +int callPermitted(struct rx_call *); +afs_int32 InitRPC(struct ubik_trans **, int lock, int this_op); + +/* server.c */ + +void Log(char *fmt, ... ); +void LogError(long code, char *fmt, ... ); +void LogDebug(int level, char *fmt, ... ); + +/* struct_ops.c */ + +void tape_ntoh(struct tape *, struct tape *); +void principal_hton(struct budb_principal *, struct budb_principal *); +void principal_ntoh(struct budb_principal *, struct budb_principal *); +void structDumpHeader_hton(struct structDumpHeader *, + struct structDumpHeader *); +int tapeSet_ntoh(struct budb_tapeSet *, struct budb_tapeSet *); +int tapeSet_hton(struct budb_tapeSet *, struct budb_tapeSet *); +void volInfo_ntoh(struct volInfo *, struct volInfo *); +void volFragment_ntoh(struct volFragment *, struct volFragment *); +void dump_ntoh(struct dump *, struct dump *); +int dumpToBudbDump(dbDumpP, struct budb_dumpEntry *); +int tapeToBudbTape(struct tape *r, struct budb_tapeEntry *); +int volsToBudbVol(struct volFragment *, struct volInfo *, + struct budb_volumeEntry *); +void printDump(FILE *, struct dump *); +int printPrincipal(struct budb_principal *ptr); +int printTape(FILE *, struct tape *); +int printTapeSet(struct budb_tapeSet *, afs_int32); +int printVolInfo(FILE *, struct volInfo *); +int printVolFragment(FILE *, struct volFragment *); +int printMemoryHashTable(FILE *, struct memoryHashTable *); + +/* database.c */ +afs_int32 CheckInit(struct ubik_trans *, int (*db_init) (struct ubik_trans *)); +afs_int32 InitDB(void); + +#endif diff --git a/src/budb/budb_prototypes.h b/src/budb/budb_prototypes.h index 0953a4944..0667e7a1c 100644 --- a/src/budb/budb_prototypes.h +++ b/src/budb/budb_prototypes.h @@ -10,88 +10,14 @@ #ifndef _BUDB_PROTOTYPES_H #define _BUDB_PROTOTYPES_H -/* budb.ss.c */ -int BUDB_ExecuteRequest(register struct rx_call *z_call); - -/* db_alloc.c */ -afs_int32 InitDBalloc(void); -afs_int32 AllocStructure(struct ubik_trans *ut, char type, dbadr related, - dbadr *saP, void *s); -afs_int32 FreeStructure(struct ubik_trans *ut, char type, dbadr sa); -afs_int32 AllocBlock(struct ubik_trans *, struct block *, dbadr *); -afs_int32 FreeBlock(struct ubik_trans *, struct blockHeader *, dbadr); - -/* db_dump.c */ -afs_int32 writeDatabase(struct ubik_trans *, int); - -/* db_hash.c */ - -afs_int32 InitDBhash(void); -void ht_DBInit(void); -afs_int32 ht_HashOut(struct ubik_trans *ut, struct memoryHashTable *mht, - dbadr ea, void *e); -afs_int32 RemoveFromList(struct ubik_trans *ut, dbadr ea, void *e, - dbadr *head, dbadr ta, void *t, dbadr *thread); -afs_int32 ht_LookupEntry(struct ubik_trans *ut, struct memoryHashTable *mht, - void *key, dbadr *eaP, void *e); -afs_int32 ht_HashIn(struct ubik_trans *ut, struct memoryHashTable *mht, - dbadr ea, void *e); -afs_int32 scanHashTable(struct ubik_trans *ut, struct memoryHashTable *mhtPtr, - int (*selectFn) (dbadr, void *, void *), - int (*operationFn) (dbadr, void *, void *), - void *rockPtr); - -/* db_lock.c */ -int checkLockHandle(struct ubik_trans *, afs_uint32); - -/* dbs_dump.c */ -afs_int32 badEntry(afs_uint32 dbAddr); - -/* ol_verify.c */ -afs_int32 checkDiskAddress(unsigned long, int, int *, int *); - -/* procs.c */ -afs_int32 InitProcs(void); -int callPermitted(struct rx_call *); -afs_int32 InitRPC(struct ubik_trans **, int lock, int this_op); - -/* server.c */ - -void Log(char *fmt, ... ); -void LogError(long code, char *fmt, ... ); -void LogDebug(int level, char *fmt, ... ); - /* struct_ops.c */ -void tape_ntoh(struct tape *, struct tape *); -void principal_hton(struct budb_principal *, struct budb_principal *); -void principal_ntoh(struct budb_principal *, struct budb_principal *); -void structDumpHeader_hton(struct structDumpHeader *, - struct structDumpHeader *); - -int tapeSet_ntoh(struct budb_tapeSet *, struct budb_tapeSet *); -int tapeSet_hton(struct budb_tapeSet *, struct budb_tapeSet *); -void volInfo_ntoh(struct volInfo *, struct volInfo *); -void volFragment_ntoh(struct volFragment *, struct volFragment *); -void dump_ntoh(struct dump *, struct dump *); - -int dumpToBudbDump(dbDumpP, struct budb_dumpEntry *); - -int tapeToBudbTape(struct tape *r, struct budb_tapeEntry *); -int volsToBudbVol(struct volFragment *, struct volInfo *, - struct budb_volumeEntry *); - - -void printDump(FILE *, struct dump *); -int printPrincipal(struct budb_principal *ptr); -int printTape(FILE *, struct tape *); -int printTapeSet(struct budb_tapeSet *, afs_int32); -int printVolInfo(FILE *, struct volInfo *); -int printVolFragment(FILE *, struct volFragment *); -int printMemoryHashTable(FILE *, struct memoryHashTable *); - -/* database.c */ -afs_int32 CheckInit(struct ubik_trans *, int (*db_init) (struct ubik_trans *)); -afs_int32 InitDB(void); - +extern void structDumpHeader_ntoh(struct structDumpHeader *, + struct structDumpHeader *); +extern void DbHeader_ntoh(struct DbHeader *, struct DbHeader *); +extern void dumpEntry_ntoh(struct budb_dumpEntry *, struct budb_dumpEntry *); +extern void tapeEntry_ntoh(struct budb_tapeEntry *, struct budb_tapeEntry *); +extern void volumeEntry_ntoh(struct budb_volumeEntry *, + struct budb_volumeEntry *); +extern int default_tapeset(struct budb_tapeSet *, char *); #endif diff --git a/src/budb/database.c b/src/budb/database.c index 778cee7ca..2445dd41c 100644 --- a/src/budb/database.c +++ b/src/budb/database.c @@ -23,7 +23,7 @@ #include "budb_errs.h" #include "database.h" #include "error_macros.h" -#include "budb_prototypes.h" +#include "budb_internal.h" #include "afs/audit.h" #include diff --git a/src/budb/db_alloc.c b/src/budb/db_alloc.c index e2919cc6a..090df26fa 100644 --- a/src/budb/db_alloc.c +++ b/src/budb/db_alloc.c @@ -23,7 +23,7 @@ #include #include "budb_errs.h" #include "database.h" -#include "budb_prototypes.h" +#include "budb_internal.h" /* block and structure allocation routines */ diff --git a/src/budb/db_dump.c b/src/budb/db_dump.c index 15325c552..80d751391 100644 --- a/src/budb/db_dump.c +++ b/src/budb/db_dump.c @@ -33,7 +33,7 @@ #include "globals.h" #include "error_macros.h" #include "budb_errs.h" -#include "budb_prototypes.h" +#include "budb_internal.h" #include "afs/audit.h" diff --git a/src/budb/db_hash.c b/src/budb/db_hash.c index df63dd7ae..102bbd899 100644 --- a/src/budb/db_hash.c +++ b/src/budb/db_hash.c @@ -23,7 +23,7 @@ #include #include "budb_errs.h" #include "database.h" -#include "budb_prototypes.h" +#include "budb_internal.h" #include "error_macros.h" diff --git a/src/budb/db_lock.c b/src/budb/db_lock.c index 50ad2303b..131153b7b 100644 --- a/src/budb/db_lock.c +++ b/src/budb/db_lock.c @@ -23,7 +23,7 @@ #include #include "budb_errs.h" #include "database.h" -#include "budb_prototypes.h" +#include "budb_internal.h" #include "error_macros.h" #include "afs/audit.h" diff --git a/src/budb/db_text.c b/src/budb/db_text.c index 44176a1d8..a13481601 100644 --- a/src/budb/db_text.c +++ b/src/budb/db_text.c @@ -27,7 +27,7 @@ #include "budb_errs.h" #include "database.h" #include "error_macros.h" -#include "budb_prototypes.h" +#include "budb_internal.h" #include "afs/audit.h" #include diff --git a/src/budb/dbs_dump.c b/src/budb/dbs_dump.c index 0ac925134..fb1634680 100644 --- a/src/budb/dbs_dump.c +++ b/src/budb/dbs_dump.c @@ -38,7 +38,7 @@ #include "budb.h" #include "budb_errs.h" #include "database.h" -#include "budb_prototypes.h" +#include "budb_internal.h" #include "error_macros.h" #include "globals.h" #include "afs/audit.h" diff --git a/src/budb/ol_verify.c b/src/budb/ol_verify.c index 612c108f4..5a57e9e5a 100644 --- a/src/budb/ol_verify.c +++ b/src/budb/ol_verify.c @@ -28,7 +28,7 @@ #include "database.h" #include "error_macros.h" #include "budb_errs.h" -#include "budb_prototypes.h" +#include "budb_internal.h" #include #include "afs/audit.h" diff --git a/src/budb/procs.c b/src/budb/procs.c index 2fe8f3197..7f5f35043 100644 --- a/src/budb/procs.c +++ b/src/budb/procs.c @@ -45,7 +45,7 @@ #include "budb.h" #include "budb_errs.h" #include "database.h" -#include "budb_prototypes.h" +#include "budb_internal.h" #include "error_macros.h" #include "globals.h" #include "afs/audit.h" diff --git a/src/budb/server.c b/src/budb/server.c index cf464a1b9..d63591b2a 100644 --- a/src/budb/server.c +++ b/src/budb/server.c @@ -45,7 +45,7 @@ #include "budb_errs.h" #include "database.h" #include "error_macros.h" -#include "budb_prototypes.h" +#include "budb_internal.h" #include "globals.h" #include "afs/audit.h" diff --git a/src/budb/struct_ops.c b/src/budb/struct_ops.c index 1158602b7..63ef1ffbe 100644 --- a/src/budb/struct_ops.c +++ b/src/budb/struct_ops.c @@ -27,6 +27,7 @@ #include "budb.h" #include "budb_errs.h" #include "database.h" +#include "budb_internal.h" #include "budb_prototypes.h" /* ---------------------------------- -- 2.39.5