]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
Further code cleanup for the backup suite
authorSimon Wilkinson <sxw@inf.ed.ac.uk>
Tue, 21 Jul 2009 19:53:57 +0000 (20:53 +0100)
committerDerrick Brashear <shadow@dementia.org>
Thu, 23 Jul 2009 19:01:04 +0000 (12:01 -0700)
Protect butm.h against multiple inclusion
Prototype more functions for internal use in bucoord
Remove some unused variables
Include additional headers as required
Prototype exported functions in budb
Make SendReturnList helper function generic, by using a void * rock

Reviewed-on: http://gerrit.openafs.org/http://gerrit.openafs.org/168
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
13 files changed:
src/bubasics/butm.p.h
src/bucoord/bucoord_internal.h
src/bucoord/commands.c
src/bucoord/dump.c
src/bucoord/dump_sched.c
src/bucoord/main.c
src/bucoord/tape_hosts.c
src/bucoord/vol_sets.c
src/budb/budb_prototypes.h
src/budb/db_hash.c
src/budb/procs.c
src/butc/lwps.c
src/butm/file_tm.c

index 6827dbea515c1e52adaab0c3cb061988f042fe3a..b84287b00a296c06a40b1198d605428c76d8bbe6 100644 (file)
@@ -7,6 +7,9 @@
  * directory or online at http://www.openafs.org/dl/license10.html
  */
 
+#ifndef AFS_SRC_BUBASICS_BUTM_H
+#define AFS_SRC_BUBASICS_BUTM_H
+
 #include <afs/auth.h>
 #include <afs/bubasics.h>
 
@@ -149,3 +152,5 @@ struct butm_tapeLabel {
 #define butm_WriteEOT(i) (*((i)->ops.writeEOT))(i)
 #define butm_SetSize(i,s) (*((i)->ops.setSize))(i,s)
 #define butm_GetSize(i,s) (*((i)->ops.getSize))(i,s)
+
+#endif
index 8fc8f16523b76693821ed0c6fc3758032e6843dd..88a28cd58828454df4d5769eaaa0cf32944d9df0 100644 (file)
@@ -57,6 +57,7 @@ extern int bc_AddTapeHost(struct bc_config *aconfig, char *aname,
                          afs_int32 aport);
 extern int bc_DeleteTapeHost(struct bc_config *aconfig, char *aname,
                             afs_int32 aport);
+extern int bc_InitConfig(char *apath);
 
 /* dsstub.c */
 extern char *tailCompPtr(char *pathNamePtr);
@@ -164,6 +165,13 @@ extern afs_int32 bcdb_LookupVolume(char *volumeName,
 extern int bcdb_FindTape(afs_int32 dumpid, char *tapeName,
                         struct budb_tapeEntry *teptr);
 
+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,
+                          struct ktc_token *ttoken);
+
 /* vol_sets.c */
 extern afs_int32 bc_UpdateVolumeSet(void);
 extern int bc_SaveVolumeSet(void);
index c97a350b4561f2dd9fdf96d1c57a7d4974e42009..d7f2d99d2e8cc8e198b020e89d58fbb644f2394c 100644 (file)
@@ -28,6 +28,7 @@
 #include <afs/com_err.h>
 #include <afs/afsutil.h>
 #include <afs/budb.h>
+#include <afs/budb_prototypes.h>
 #include <afs/butc.h>
 #include <afs/bubasics.h>      /* PA */
 #include <afs/volser.h>
@@ -2426,7 +2427,7 @@ bc_deleteDumpCmd(struct cmd_syndesc *as, void *arock)
     char *timeString;
     budb_dumpsList dumps, flags;
     int i;
-    afs_int32 port = -1, dbonly = 0, force;
+    afs_int32 port = -1, force;
 
     /* Must specify at least one of -dumpid, -from, or -to */
     if (!as->parms[0].items && !as->parms[1].items && !as->parms[2].items
index b8d3a06d01fe0aa69cac3f60685b50eba2d4159d..4a373f154aff3ecf5b3065d0b5be85d553f5d362 100644 (file)
@@ -246,7 +246,7 @@ bc_StartDmpRst(struct bc_config *aconfig, char *adname, char *avname,
 {
     register int i;
     register afs_int32 code;
-    void *junk;
+    void *junk = NULL;
 
     for (i = 0; i < BC_MAXSIMDUMPS; i++)
        if (!(bc_dumpTasks[i].flags & BC_DI_INUSE))
@@ -289,7 +289,7 @@ bc_StartDmpRst(struct bc_config *aconfig, char *adname, char *avname,
 
     code =
        LWP_CreateProcess(bc_DmpRstStart, 20480, LWP_NORMAL_PRIORITY,
-                         (void *)i, "helper", &junk);
+                         (void *)i, "helper", junk);
     if (code) {
        bc_HandleMisc(code);
        afs_com_err(whoami, code, "; Can't start thread");
index 06669be664170985c451116d6f92ffb5d2ab6472..a2a49ab6f03d9e5822cabc9043beb134eab5ffd2 100644 (file)
@@ -34,6 +34,7 @@
 #include "bc.h"
 #include "error_macros.h"
 #include "bucoord_internal.h"
+#include "bucoord_prototypes.h"
 
 /* code to manage dump schedules 
  * specific to the ubik database implementation
index 90e228a683f3a0bea267e1351f3ba2803b6635cd..508d4634a96c6510c0da9fa14ade2ff291cda9fb 100644 (file)
@@ -48,6 +48,7 @@
 #include <afs/vlserver.h>
 #include <afs/butm.h>
 #include <afs/butx.h>
+#include <afs/tcdata.h>
 
 #include "bc.h"                        /*Backup Coordinator structs and defs */
 #include "bucoord_internal.h"
@@ -226,7 +227,7 @@ backupInit(void)
     }
     initd = 1;
 
-    code = bc_InitConfig(DefaultConfDir);
+    code = bc_InitConfig((char *)DefaultConfDir);
     if (code) {
        afs_com_err(whoami, code,
                "Can't initialize from config files in directory '%s'",
index a5d98f81831d4d4599b84c25f2cc14eefdacbaa6..f6315d4108e6234fad4ab99f956e2601fbabb404 100644 (file)
@@ -28,6 +28,7 @@
 #include "error_macros.h"
 #include <errno.h>
 #include "bucoord_internal.h"
+#include "bucoord_prototypes.h"
     
 /* code to manage tape hosts
  * specific to the ubik database implementation
index 70e2cb5f458478a58a42fea03ee2a727e7d118a3..2820c62f8d75a9d8fe0f02282e79cd5aeeb63fad 100644 (file)
@@ -28,6 +28,7 @@
 #include "bc.h"
 #include "error_macros.h"
 #include "bucoord_internal.h"
+#include "bucoord_prototypes.h"
     
 /* code to manage volumesets
  * specific to the ubik database implementation
index 0667e7a1cf6a4fe5c2e55e8ba0d614387b64c75f..5c995871b640d6d56c883f3d11ea927f11d31f03 100644 (file)
@@ -20,4 +20,7 @@ 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 *);
+extern void printDumpEntry(struct budb_dumpEntry *deptr);
+extern void printTapeEntry(struct budb_tapeEntry *teptr);
+extern void printVolumeEntry(struct budb_volumeEntry *veptr);
 #endif
index 102bbd899e9fb7d61af40fd212ebc147116aa844..9a3b62a3bc86f28dd3fd377cda29a2c53ea66223 100644 (file)
@@ -254,7 +254,7 @@ ht_GetTableBlock(struct ubik_trans *ut, struct memoryHashTable *mht,
     int n;
     int i;
     int length;
-    dbadr ta = NULL;
+    dbadr ta = 0;
 
     if ((mht == 0)
        || ((ht = mht->ht) == 0)
index f8d37cc2cab46987d5a4ae6ddb7f34e830dcaee8..34eb55cd0ca5fea32717d2bbc72864a72ce2cc0f 100644 (file)
@@ -395,8 +395,9 @@ AddToReturnList(struct returnList *list, dbadr a, afs_int32 *to_skipP)
 }
 
 afs_int32
-FillVolEntry(struct ubik_trans *ut, dbadr va, struct budb_volumeEntry *vol)
+FillVolEntry(struct ubik_trans *ut, dbadr va, void *rock)
 {
+    struct budb_volumeEntry *vol = (struct budb_volumeEntry *) rock;
     struct dump d;
     struct tape t;
     struct volInfo vi;
@@ -431,8 +432,9 @@ FillVolEntry(struct ubik_trans *ut, dbadr va, struct budb_volumeEntry *vol)
 }
 
 afs_int32
-FillDumpEntry(struct ubik_trans *ut, dbadr da, struct budb_dumpEntry *dump)
+FillDumpEntry(struct ubik_trans *ut, dbadr da, void *rock)
 {
+    struct budb_dumpEntry *dump = (struct budb_dumpEntry *)rock;
     struct dump d, ad;
 
     if (dbread(ut, da, &d, sizeof(d)))
@@ -473,8 +475,9 @@ FillDumpEntry(struct ubik_trans *ut, dbadr da, struct budb_dumpEntry *dump)
 }
 
 afs_int32
-FillTapeEntry(struct ubik_trans *ut, dbadr ta, struct budb_tapeEntry *tape)
+FillTapeEntry(struct ubik_trans *ut, dbadr ta, void *rock)
 {
+    struct budb_tapeEntry *tape=(struct budb_tapeEntry *) rock;
     struct tape t;
     struct dump d;
     afs_int32 code;
@@ -517,7 +520,7 @@ static afs_int32
 SendReturnList(struct ubik_trans *ut,
               struct returnList *list, /* list of elements to return */
               afs_int32(*FillProc) (struct ubik_trans *, dbadr da, 
-                                    budb_dumpEntry *), 
+                                    void *),
                                        /* proc to fill entry */
               int e_size,              /* size of each element */
               afs_int32 index,         /* index from previous call */
index 3127a3abf2dd9d149a30154df343d48d6de0381e..c4fded6cb967b0398cb576ceef0a6dcd4d37d4af 100644 (file)
@@ -46,7 +46,7 @@ extern int tapemounted;
 extern char *opencallout;
 extern char *closecallout;
 extern char *whoami;
-extern char *extractDumpName();
+extern char *extractDumpName(char *);
 extern int BufferSize;         /* Size in B stored for header info */
 FILE *restoretofilefd;
 #ifdef xbsa
index 948fd960dc440ccb6f2469af0e0a17f2555f90f9..c1d0c2db60e53cfe704f138a3ed66c71e6759043 100644 (file)
@@ -672,11 +672,11 @@ incPosition(struct butm_tapeInfo *info, usd_handle_t fid, afs_uint32 dataSize)
  */
 afs_int32 TapeBlockSize;
 afs_int32
-readData(usd_handle_t fid, char *data, afs_int32 totalSize, afs_int32 *errorP)
+readData(usd_handle_t fid, char *data, afs_uint32 totalSize, afs_int32 *errorP)
 {
     afs_int32 toread;          /* Number of bytes to read */
-    afs_int32 rSize;           /* Total bytes read so far */
-    afs_int32 tSize;           /* Temporary size */
+    afs_uint32 rSize;          /* Total bytes read so far */
+    afs_uint32 tSize;          /* Temporary size */
     afs_int32 rc;              /* return code */
 
     toread = totalSize;                /* First, try to read all the data */
@@ -775,7 +775,7 @@ WriteTapeBlock(struct butm_tapeInfo *info,
               afs_int32 blockType)
 {
     afs_int32 code = 0, rc = 0;
-    afs_int32 wsize;
+    afs_uint32 wsize;
     struct tapeLabel *label;
     struct fileMark *fmark;
     struct blockMark *bmark;