Changeset 2717
- Timestamp:
- 28/08/2010 10:01:16 (18 months ago)
- Location:
- box/trunk
- Files:
-
- 1 deleted
- 8 edited
-
bin/bbackupd/BackupClientInodeToIDMap.cpp (modified) (13 diffs)
-
bin/bbackupd/BackupClientInodeToIDMap.h (modified) (2 diffs)
-
bootstrap (modified) (1 diff)
-
configure.ac (modified) (1 diff)
-
infrastructure/makebuildenv.pl.in (modified) (5 diffs)
-
infrastructure/makeparcels.pl.in (modified) (2 diffs)
-
modules.txt (modified) (1 diff)
-
parcels.txt (modified) (2 diffs)
-
qdbm (deleted)
Legend:
- Unmodified
- Added
- Removed
-
box/trunk/bin/bbackupd/BackupClientInodeToIDMap.cpp
r2631 r2717 11 11 12 12 #include <stdlib.h> 13 #include <depot.h> 13 14 #define _PUBLIC_ 15 #include "tdb.h" 14 16 15 17 #define BACKIPCLIENTINODETOIDMAP_IMPLEMENTATION … … 27 29 } IDBRecord; 28 30 29 #define BOX_DBM_MESSAGE(stuff) stuff << " ( qdbm): " << dperrmsg(dpecode)31 #define BOX_DBM_MESSAGE(stuff) stuff << " (tdb): " << tdb_error(mpContext) 30 32 31 33 #define BOX_LOG_DBM_ERROR(stuff) \ … … 37 39 BOX_DBM_MESSAGE(message << ": " << filename)); 38 40 39 #define ASSERT_DBM _OK(operation, message, filename, exception, subtype) \40 if(!( operation)) \41 #define ASSERT_DBM(success, message, exception, subtype) \ 42 if(!(success)) \ 41 43 { \ 42 THROW_DBM_ERROR(message, filename, exception, subtype); \44 THROW_DBM_ERROR(message, mFilename, exception, subtype); \ 43 45 } 44 46 45 47 #define ASSERT_DBM_OPEN() \ 46 if(mp Depot == 0) \48 if(mpContext == 0) \ 47 49 { \ 48 50 THROW_EXCEPTION_MESSAGE(BackupStoreException, InodeMapNotOpen, \ … … 51 53 52 54 #define ASSERT_DBM_CLOSED() \ 53 if(mp Depot != 0) \55 if(mpContext != 0) \ 54 56 { \ 55 57 THROW_EXCEPTION_MESSAGE(CommonException, Internal, \ … … 68 70 : mReadOnly(true), 69 71 mEmpty(false), 70 mp Depot(0)72 mpContext(NULL) 71 73 { 72 74 } … … 82 84 BackupClientInodeToIDMap::~BackupClientInodeToIDMap() 83 85 { 84 if(mp Depot != 0)86 if(mpContext != NULL) 85 87 { 86 88 Close(); … … 109 111 110 112 // Open the database file 111 int mode = ReadOnly ? DP_OREADER : DP_OWRITER;113 int mode = ReadOnly ? O_RDONLY : O_RDWR; 112 114 if(CreateNew) 113 115 { 114 mode |= DP_OCREAT;115 } 116 117 mp Depot = dpopen(Filename, mode,0);118 119 ASSERT_DBM _OK(mpDepot, "Failed to open inode database", mFilename,116 mode |= O_CREAT; 117 } 118 119 mpContext = tdb_open(Filename, 0, 0, mode, 0700); 120 121 ASSERT_DBM(mpContext != NULL, "Failed to open inode database", 120 122 BackupStoreException, BerkelyDBFailure); 121 123 … … 138 140 { 139 141 ASSERT_DBM_CLOSED(); 140 ASSERT(mp Depot == 0);142 ASSERT(mpContext == NULL); 141 143 mEmpty = true; 142 144 mReadOnly = true; … … 154 156 { 155 157 ASSERT_DBM_OPEN(); 156 ASSERT_DBM_OK(dpclose(mpDepot), "Failed to close inode database", 157 mFilename, BackupStoreException, BerkelyDBFailure); 158 mpDepot = 0; 159 } 158 ASSERT_DBM(tdb_close(mpContext) == 0, "Failed to close inode database", 159 BackupStoreException, BerkelyDBFailure); 160 mpContext = NULL; 161 } 162 163 static TDB_DATA GetDatum(void* dptr, size_t dsize) 164 { 165 TDB_DATA datum; 166 datum.dptr = (unsigned char *)dptr; 167 datum.dsize = dsize; 168 return datum; 169 } 170 171 #define GET_STRUCT_DATUM(structure) \ 172 GetDatum(&structure, sizeof(structure)) 160 173 161 174 // -------------------------------------------------------------------------- … … 177 190 } 178 191 179 if(mp Depot == 0)192 if(mpContext == 0) 180 193 { 181 194 THROW_EXCEPTION(BackupStoreException, InodeMapNotOpen); … … 189 202 rec.mInDirectory = InDirectory; 190 203 191 ASSERT_DBM _OK(dpput(mpDepot, (const char *)&InodeRef, sizeof(InodeRef),192 (const char *)&rec, sizeof(rec), DP_DOVER),193 "Failed to add record to inode database", mFilename,204 ASSERT_DBM(tdb_store(mpContext, GET_STRUCT_DATUM(InodeRef), 205 GET_STRUCT_DATUM(rec), 0) == 0, 206 "Failed to add record to inode database", 194 207 BackupStoreException, BerkelyDBFailure); 195 208 } … … 215 228 } 216 229 217 if(mp Depot == 0)230 if(mpContext == 0) 218 231 { 219 232 THROW_EXCEPTION(BackupStoreException, InodeMapNotOpen); … … 222 235 ASSERT_DBM_OPEN(); 223 236 224 IDBRecord rec; 225 226 if(dpgetwb(mpDepot, (const char *)&InodeRef, sizeof(InodeRef), 227 0, sizeof(IDBRecord), (char *)&rec) == -1) 237 TDB_DATA datum = tdb_fetch(mpContext, GET_STRUCT_DATUM(InodeRef)); 238 if(datum.dptr == NULL) 228 239 { 229 240 // key not in file 230 241 return false; 231 242 } 243 244 IDBRecord rec; 245 if(datum.dsize != sizeof(rec)) 246 { 247 THROW_EXCEPTION_MESSAGE(CommonException, Internal, 248 "Failed to get inode database entry: " 249 "record has wrong size: expected " << 250 sizeof(rec) << " but was " << datum.dsize << 251 " in " << mFilename); 252 } 232 253 254 rec = *(IDBRecord *)datum.dptr; 255 free(datum.dptr); 256 233 257 // Return data 234 258 rObjectIDOut = rec.mObjectID; -
box/trunk/bin/bbackupd/BackupClientInodeToIDMap.h
r2631 r2717 18 18 // avoid having to include the DB files when not necessary 19 19 #ifndef BACKIPCLIENTINODETOIDMAP_IMPLEMENTATION 20 class DEPOT; 20 struct TDB_CONTEXT; 21 struct TDB_DATUM; 21 22 #endif 22 23 … … 50 51 bool mEmpty; 51 52 std::string mFilename; 52 DEPOT *mpDepot;53 TDB_CONTEXT *mpContext; 53 54 }; 54 55 -
box/trunk/bootstrap
r217 r2717 1 1 #!/bin/sh 2 3 set -e 2 4 3 5 aclocal -I infrastructure/m4 4 6 autoheader 5 7 autoconf 8 ( cd bundled/tdb; ./autogen.sh; ) -
box/trunk/configure.ac
r2628 r2717 385 385 386 386 cat parcels.txt | sed -e 's/#.*//' | while read cmd subdir configure_args; do 387 if test "$cmd" = " subdir"; then387 if test "$cmd" = "configure"; then 388 388 echo 389 389 export CC CXX CXXFLAGS LDFLAGS LIBS -
box/trunk/infrastructure/makebuildenv.pl.in
r2640 r2717 253 253 # check directory exists 254 254 die "Module $mod can't be found\n" unless -d $mod; 255 256 # skip bundled libraries with their own Makefile process 257 next if ($mod =~ m|^bundled/|); 255 258 256 259 # and put in lists … … 511 514 } 512 515 513 514 516 # make include path 515 my $include_paths = join(' ',map {'-I../../'.$_} @all_deps_for_module); 517 my $include_paths = ""; 518 519 foreach my $mod (@all_deps_for_module) 520 { 521 if ($mod =~ m|^bundled/| and -d "$mod/include") 522 { 523 $include_paths .= "-I../../$mod/include "; 524 } 525 else 526 { 527 $include_paths .= "-I../../$mod "; 528 } 529 } 516 530 517 531 # is target a library? … … 775 789 $dep_target = "\$(OUTBASE)/$dep/$1.a"; 776 790 } 777 elsif ($dep =~ m|^.*/(.*)|) 791 elsif ($dep =~ m|^bundled/(.*)|) 792 { 793 $dep_target = "lib$1.a"; 794 } 795 elsif ($dep =~ m|^bin/(.*)|) 778 796 { 779 797 $dep_target = "\$(OUTBASE)/$dep/$1$platform_exe_ext"; … … 781 799 else 782 800 { 783 $dep_target = "lib$dep.a"; 801 die "Don't know how to add compile-time " . 802 "dependency on $dep"; 784 803 } 785 804 … … 802 821 foreach my $dep (reverse @all_deps_for_module) 803 822 { 804 if ($dep =~ m|^lib \/(.+)$|)823 if ($dep =~ m|^lib/(.+)$|) 805 824 { 806 825 push @lib_files, "\$(OUTBASE)/$dep/$1.a"; 807 826 } 808 elsif ($dep =~ m|^ ([^/]+)$|)827 elsif ($dep =~ m|^bundled/(.+)$|) 809 828 { 810 829 push @lib_files, "../../$dep/lib$1.a"; -
box/trunk/infrastructure/makeparcels.pl.in
r2680 r2717 243 243 push @parcel_deps, "$dir/docs/${name}.html"; 244 244 } 245 elsif ($type eq ' subdir')245 elsif ($type eq 'configure') 246 246 { 247 247 shift @args; … … 255 255 $name-clean: 256 256 cd $name; \$(MAKE) clean 257 257 258 EOF 258 259 push @parcel_deps, "$name-build"; -
box/trunk/modules.txt
r2624 r2717 27 27 28 28 lib/backupclient lib/server lib/crypto lib/compress 29 lib/backupstore lib/server lib/raidfile lib/backupclient 29 lib/backupstore lib/server lib/raidfile lib/backupclient bundled/tdb 30 30 31 31 bin/bbackupobjdump lib/backupclient lib/backupstore 32 bin/bbstored lib/raidfile lib/server lib/backupstore lib/backupclient 32 bin/bbstored lib/raidfile lib/server lib/backupstore lib/backupclient bundled/tdb 33 33 bin/bbstoreaccounts lib/raidfile lib/backupstore 34 bin/bbackupd lib/server lib/backupclient qdbm34 bin/bbackupd lib/server lib/backupclient bundled/tdb 35 35 bin/bbackupquery lib/server lib/backupclient 36 36 bin/bbackupctl lib/server lib/backupclient -
box/trunk/parcels.txt
r2644 r2717 19 19 html bbackupd.conf 20 20 21 subdir qdbm libqdbm.a22 21 23 22 EXCEPT:mingw32,mingw32msvc … … 67 66 html raidfile.conf 68 67 68 configure bundled/tdb 69 69 70 EXCEPT:mingw32,mingw32msvc 70 71 man bbstored.8
Note: See TracChangeset
for help on using the changeset viewer.
