Don't allocate objects of 0 length
[openafs.git] / src / budb / budb_internal.h
1 /*
2  * Copyright 2000, International Business Machines Corporation and others.
3  * All Rights Reserved.
4  *
5  * This software has been released under the terms of the IBM Public
6  * License.  For details, see the LICENSE file in the top-level source
7  * directory or online at http://www.openafs.org/dl/license10.html
8  */
9
10 #ifndef _BUDB_PROTOTYPES_H
11 #define _BUDB_PROTOTYPES_H
12
13 /* db_alloc.c */
14 afs_int32 InitDBalloc(void);
15 afs_int32 AllocStructure(struct ubik_trans *ut, char type, dbadr related,
16                          dbadr *saP, void *s);
17 afs_int32 FreeStructure(struct ubik_trans *ut, char type, dbadr sa);
18 afs_int32 AllocBlock(struct ubik_trans *, struct block *, dbadr *);
19 afs_int32 FreeBlock(struct ubik_trans *, struct blockHeader *, dbadr);
20
21 /* db_dump.c */
22 afs_int32 writeDatabase(struct ubik_trans *, int);
23
24 /* db_hash.c */
25
26 afs_int32 InitDBhash(void);
27 void ht_DBInit(void);
28 afs_int32 ht_HashOut(struct ubik_trans *ut, struct memoryHashTable *mht,
29                      dbadr ea, void *e);
30 afs_int32 RemoveFromList(struct ubik_trans *ut, dbadr ea, void *e,
31                          dbadr *head, dbadr ta, void *t, dbadr *thread);
32 afs_int32 ht_LookupEntry(struct ubik_trans *ut, struct memoryHashTable *mht,
33                           void *key, dbadr *eaP, void *e);
34 afs_int32 ht_HashIn(struct ubik_trans *ut, struct memoryHashTable *mht,
35                     dbadr ea, void *e);
36 afs_int32 scanHashTable(struct ubik_trans *ut, struct memoryHashTable *mhtPtr,
37                         int (*selectFn) (dbadr, void *, void *),
38                         int (*operationFn) (dbadr, void *, void *),
39                         void *rockPtr);
40
41 /* db_lock.c */
42 int checkLockHandle(struct ubik_trans *, afs_uint32);
43
44 /* dbs_dump.c */
45 afs_int32 badEntry(afs_uint32 dbAddr);
46
47 /* ol_verify.c */
48 afs_int32 checkDiskAddress(unsigned long, int, int *, int *);
49
50 /* procs.c */
51 afs_int32 InitProcs(void);
52 int callPermitted(struct rx_call *);
53 afs_int32 InitRPC(struct ubik_trans **, int lock, int this_op);
54
55 /* server.c */
56
57 void Log(char *fmt, ... )
58     AFS_ATTRIBUTE_FORMAT(__printf__, 1, 2);
59 void LogError(long code, char *fmt, ... )
60     AFS_ATTRIBUTE_FORMAT(__printf__, 2, 3);
61 void LogDebug(int level, char *fmt, ... )
62     AFS_ATTRIBUTE_FORMAT(__printf__, 2, 3);
63
64 /* struct_ops.c */
65
66 void tape_ntoh(struct tape *, struct tape *);
67 void principal_hton(struct budb_principal *, struct budb_principal *);
68 void principal_ntoh(struct budb_principal *, struct budb_principal *);
69 void structDumpHeader_hton(struct structDumpHeader *,
70                            struct structDumpHeader *);
71 int tapeSet_ntoh(struct budb_tapeSet *, struct budb_tapeSet *);
72 int tapeSet_hton(struct budb_tapeSet *, struct budb_tapeSet *);
73 void volInfo_ntoh(struct volInfo *, struct volInfo *);
74 void volFragment_ntoh(struct volFragment *, struct volFragment *);
75 void dump_ntoh(struct dump *, struct dump *);
76 int dumpToBudbDump(dbDumpP, struct budb_dumpEntry *);
77 int tapeToBudbTape(struct tape *r, struct budb_tapeEntry *);
78 int volsToBudbVol(struct volFragment *, struct volInfo *,
79                   struct budb_volumeEntry *);
80 void printDump(FILE *, struct dump *);
81 int printPrincipal(struct budb_principal *ptr);
82 int printTape(FILE *, struct tape *);
83 int printTapeSet(struct budb_tapeSet *, afs_int32);
84 int printVolInfo(FILE *, struct volInfo *);
85 int printVolFragment(FILE *, struct volFragment *);
86 int printMemoryHashTable(FILE *, struct memoryHashTable *);
87
88 /* database.c */
89 afs_int32 CheckInit(struct ubik_trans *, int (*db_init) (struct ubik_trans *));
90 afs_int32 InitDB(void);
91
92 #endif