Changeset 2127


Ignore:
Timestamp:
04/04/2008 23:11:45 (4 years ago)
Author:
chris
Message:

Undo mangling by tailor

Location:
box/trunk
Files:
64 edited

Legend:

Unmodified
Added
Removed
  • box/trunk/bin/bbackupd/BackupClientContext.cpp

    r2124 r2127  
    4545        TLSContext &rTLSContext,  
    4646        const std::string &rHostname, 
     47        int Port, 
    4748        int32_t AccountNumber,  
    4849        bool ExtendedLogging, 
     
    5354          mrTLSContext(rTLSContext), 
    5455          mHostname(rHostname), 
     56          mPort(Port), 
    5557          mAccountNumber(AccountNumber), 
    5658          mpSocket(0), 
     
    130132 
    131133                // Connect! 
    132                 mpSocket->Open(mrTLSContext, Socket::TypeINET, mHostname.c_str(), BOX_PORT_BBSTORED); 
     134                mpSocket->Open(mrTLSContext, Socket::TypeINET, 
     135                        mHostname.c_str(), mPort); 
    133136                 
    134137                // And create a procotol object 
     
    147150                        if (!mpExtendedLogFileHandle) 
    148151                        { 
    149                                 BOX_ERROR("Failed to open extended log " 
    150                                         "file: " << strerror(errno)); 
     152                                BOX_LOG_SYS_ERROR("Failed to open extended " 
     153                                        "log file: " << mExtendedLogFile); 
    151154                        } 
    152155                        else 
  • box/trunk/bin/bbackupd/BackupClientContext.h

    r2124 r2127  
    4242                TLSContext &rTLSContext,  
    4343                const std::string &rHostname, 
     44                int32_t Port, 
    4445                int32_t AccountNumber,  
    4546                bool ExtendedLogging, 
     
    202203        TLSContext &mrTLSContext; 
    203204        std::string mHostname; 
     205        int mPort; 
    204206        int32_t mAccountNumber; 
    205207        SocketStreamTLS *mpSocket; 
  • box/trunk/bin/bbackupd/BackupClientDirectoryRecord.cpp

    r2124 r2127  
    10151015        if(mpPendingEntries != 0 && mpPendingEntries->size() == 0) 
    10161016        { 
    1017                 TRACE1("Deleting mpPendingEntries from dir ID %lld\n", mObjectID); 
     1017                BOX_TRACE("Deleting mpPendingEntries from dir ID " << 
     1018                        BOX_FORMAT_OBJECTID(mObjectID)); 
    10181019                delete mpPendingEntries; 
    10191020                mpPendingEntries = 0; 
     
    12501251                                                dirname.GetClearFilename()); 
    12511252 
    1252                                         TRACE1("Deleted directory record for " 
    1253                                                 "%s\n", name.c_str()); 
     1253                                        BOX_TRACE("Deleted directory record " 
     1254                                                "for " << name); 
    12541255                                }                                
    12551256                        } 
  • box/trunk/bin/bbackupd/BackupDaemon.cpp

    r2124 r2127  
    959959                                        tlsContext,  
    960960                                        conf.GetKeyValue("StoreHostname"), 
     961                                        conf.GetKeyValueInt("StorePort"), 
    961962                                        conf.GetKeyValueInt("AccountNumber"),  
    962963                                        conf.GetKeyValueBool("ExtendedLogging"), 
     
    18131814#endif // HAVE_STRUCT_STATVFS_F_MNTONNAME 
    18141815                                { 
    1815                                         BOX_WARNING("Failed to stat location " 
     1816                                        BOX_LOG_SYS_WARNING("Failed to stat location " 
    18161817                                                "path '" << apLoc->mPath << 
    1817                                                 "' (" << strerror(errno) << 
    1818                                                 "), skipping location '" << 
     1818                                                "', skipping location '" << 
    18191819                                                apLoc->mName << "'"); 
    18201820                                        continue; 
     
    21902190                if(::rename(newmap.c_str(), target.c_str()) != 0) 
    21912191                { 
    2192                         BOX_ERROR("failed to rename ID map: " << newmap 
    2193                                 << " to " << target << ": "  
    2194                                 << strerror(errno)); 
     2192                        BOX_LOG_SYS_ERROR("Failed to rename ID map: " << 
     2193                                newmap << " to " << target); 
    21952194                        THROW_EXCEPTION(CommonException, OSFileError) 
    21962195                } 
     
    30563055        if(!FileExists(storeObjectInfoFile.c_str())) 
    30573056        { 
    3058                 // File doesn't exist -- so can't be deleted. But something isn't quite right, so log a message 
    3059                 BOX_WARNING("Store object info file did not exist when it " 
    3060                         "was supposed to. (" << storeObjectInfoFile << ")"); 
     3057                // File doesn't exist -- so can't be deleted. But something 
     3058                // isn't quite right, so log a message 
     3059                BOX_WARNING("StoreObjectInfoFile did not exist when it " 
     3060                        "was supposed to: " << storeObjectInfoFile); 
    30613061 
    30623062                // Return true to stop things going around in a loop 
     
    30673067        if(::unlink(storeObjectInfoFile.c_str()) != 0) 
    30683068        { 
    3069                 BOX_ERROR("Failed to delete the old store object info file: " 
    3070                         << storeObjectInfoFile << ": "<< strerror(errno)); 
     3069                BOX_LOG_SYS_ERROR("Failed to delete the old " 
     3070                        "StoreObjectInfoFile: " << storeObjectInfoFile); 
    30713071                return false; 
    30723072        } 
  • box/trunk/bin/bbackupd/Win32ServiceFunctions.cpp

    r2124 r2127  
    208208                if (emu_stat(pConfigFileName, &st) != 0) 
    209209                { 
    210                         BOX_ERROR("Failed to open configuration file '" << 
    211                                 pConfigFileName << "': " << strerror(errno)); 
     210                        BOX_LOG_SYS_ERROR("Failed to open configuration file " 
     211                                "'" << pConfigFileName << "'"); 
    212212                        return 1; 
    213213                } 
     
    222222        } 
    223223 
    224         SC_HANDLE scm = OpenSCManager(0,0,SC_MANAGER_CREATE_SERVICE); 
     224        SC_HANDLE scm = OpenSCManager(0, 0, SC_MANAGER_CREATE_SERVICE); 
    225225 
    226226        if (!scm)  
  • box/trunk/bin/bbackupd/bbackupd-config.in

    r2124 r2127  
    2727    account-num (hexdecimal) and server-hostname 
    2828                        are supplied by the server administrator 
    29     working-dir         is usually @localstatedir_expanded@ 
     29    working-dir         is usually @localstatedir_expanded@/bbackupd 
    3030    backup directories  is list of directories to back up 
    3131 
  • box/trunk/bin/bbackupquery/BackupQueries.cpp

    r2124 r2127  
    2828#include <set> 
    2929#include <limits> 
     30#include <iostream> 
     31#include <ostream> 
    3032 
    3133#include "BackupQueries.h" 
     
    811813                else 
    812814                { 
    813                         BOX_ERROR("Error changing to directory '" << 
    814                                 args[0] << ": " << strerror(errno)); 
     815                        BOX_LOG_SYS_ERROR("Failed to change to directory " 
     816                                "'" << args[0] << "'"); 
    815817                } 
    816818 
     
    823825        if(::getcwd(wd, PATH_MAX) == 0) 
    824826        { 
    825                 BOX_ERROR("Error getting current directory: " << 
    826                         strerror(errno)); 
     827                BOX_LOG_SYS_ERROR("Error getting current directory"); 
    827828                SetReturnCode(COMMAND_RETURN_ERROR); 
    828829                return; 
     
    14001401                else 
    14011402                { 
    1402                         BOX_WARNING("Failed to access local directory '" << 
    1403                                 localDirDisplay << ": " << strerror(errno) << 
    1404                                 "'."); 
     1403                        BOX_LOG_SYS_WARNING("Failed to access local directory " 
     1404                                "'" << localDirDisplay << "'"); 
    14051405                        rParams.mUncheckedFiles ++; 
    14061406                } 
     
    14501450        if(dirhandle == 0) 
    14511451        { 
    1452                 BOX_WARNING("Failed to open local directory '" <<  
    1453                         localDirDisplay << "': " << strerror(errno)); 
     1452                BOX_LOG_SYS_WARNING("Failed to open local directory '" <<  
     1453                        localDirDisplay << "'"); 
    14541454                rParams.mUncheckedFiles ++; 
    14551455                return; 
     
    15191519                if(::closedir(dirhandle) != 0) 
    15201520                { 
    1521                         BOX_ERROR("Failed to close local directory '" << 
    1522                                 localDirDisplay << "': " << strerror(errno)); 
     1521                        BOX_LOG_SYS_ERROR("Failed to close local directory " 
     1522                                "'" << localDirDisplay << "'"); 
    15231523                } 
    15241524                dirhandle = 0; 
     
    21592159void BackupQueries::CommandUsageDisplayEntry(const char *Name, int64_t Size, int64_t HardLimit, int32_t BlockSize) 
    21602160{ 
    2161         // Calculate size in Mb 
    2162         double mb = (((double)Size) * ((double)BlockSize)) / ((double)(1024*1024)); 
    2163         int64_t percent = (Size * 100) / HardLimit; 
    2164  
    2165         // Bar graph 
    2166         char bar[41]; 
    2167         unsigned int b = (int)((Size * (sizeof(bar)-1)) / HardLimit); 
    2168         if(b > sizeof(bar)-1) {b = sizeof(bar)-1;} 
    2169         for(unsigned int l = 0; l < b; l++) 
    2170         { 
    2171                 bar[l] = '*'; 
    2172         } 
    2173         bar[b] = '\0'; 
    2174  
    2175         // Print the entryj 
    2176         ::printf("%14s %10.1fMb %3d%% %s\n", Name, mb, (int32_t)percent, bar); 
     2161        std::cout << FormatUsageLineStart(Name) << 
     2162                FormatUsageBar(Size, Size * BlockSize, HardLimit * BlockSize) << 
     2163                std::endl; 
    21772164} 
    21782165 
  • box/trunk/bin/bbackupquery/bbackupquery.cpp

    r2124 r2127  
    175175                        if(logFile == 0) 
    176176                        { 
    177                                 BOX_ERROR("Failed to open log file '" << 
    178                                         optarg << "': " << strerror(errno)); 
     177                                BOX_LOG_SYS_ERROR("Failed to open log file " 
     178                                        "'" << optarg << "'"); 
    179179                        } 
    180180                        break; 
     
    261261        if(!quiet) BOX_INFO("Connecting to store..."); 
    262262        SocketStreamTLS socket; 
    263         socket.Open(tlsContext, Socket::TypeINET, conf.GetKeyValue("StoreHostname").c_str(), BOX_PORT_BBSTORED); 
     263        socket.Open(tlsContext, Socket::TypeINET, 
     264                conf.GetKeyValue("StoreHostname").c_str(), 
     265                conf.GetKeyValueInt("StorePort")); 
    264266         
    265267        // 3. Make a protocol, and handshake 
  • box/trunk/bin/bbstoreaccounts/bbstoreaccounts.cpp

    r2126 r2127  
    1414#include <sys/types.h> 
    1515#include <limits.h> 
     16 
     17#include <algorithm> 
     18#include <iostream> 
     19#include <ostream> 
    1620#include <vector> 
    17 #include <algorithm> 
    1821 
    1922#include "BoxPortsAndFiles.h" 
     
    6366} 
    6467 
    65 std::string BlockSizeToString(int64_t Blocks, int DiscSet) 
    66 { 
    67         // Work out size in Mb. 
    68         double mb = (Blocks * BlockSizeOfDiscSet(DiscSet)) / (1024.0*1024.0); 
    69          
    70         // Format string 
    71         std::ostringstream buf; 
    72         buf << Blocks << " blocks " << std::fixed << std::setprecision(2) << 
    73                 std::showpoint << "(" << mb << " MB)"; 
    74         return buf.str(); 
     68std::string BlockSizeToString(int64_t Blocks, int64_t MaxBlocks, int DiscSet) 
     69{ 
     70        return FormatUsageBar(Blocks, Blocks * BlockSizeOfDiscSet(DiscSet), 
     71                MaxBlocks * BlockSizeOfDiscSet(DiscSet)); 
    7572} 
    7673 
     
    224221         
    225222        // Then print out lots of info 
    226         printf("                  Account ID: %08x\n", ID); 
    227         printf("              Last object ID: %lld\n", info->GetLastObjectIDUsed()); 
    228         printf("                 Blocks used: %s\n", BlockSizeToString(info->GetBlocksUsed(), discSet).c_str()); 
    229         printf("    Blocks used by old files: %s\n", BlockSizeToString(info->GetBlocksInOldFiles(), discSet).c_str()); 
    230         printf("Blocks used by deleted files: %s\n", BlockSizeToString(info->GetBlocksInDeletedFiles(), discSet).c_str()); 
    231         printf("  Blocks used by directories: %s\n", BlockSizeToString(info->GetBlocksInDirectories(), discSet).c_str()); 
    232         printf("            Block soft limit: %s\n", BlockSizeToString(info->GetBlocksSoftLimit(), discSet).c_str()); 
    233         printf("            Block hard limit: %s\n", BlockSizeToString(info->GetBlocksHardLimit(), discSet).c_str()); 
    234         printf("         Client store marker: %lld\n", info->GetClientStoreMarker()); 
     223        std::cout << FormatUsageLineStart("Account ID") << 
     224                BOX_FORMAT_ACCOUNT(ID) << std::endl; 
     225        std::cout << FormatUsageLineStart("Last object ID") << 
     226                BOX_FORMAT_OBJECTID(info->GetLastObjectIDUsed()) << std::endl; 
     227        std::cout << FormatUsageLineStart("Used") << 
     228                BlockSizeToString(info->GetBlocksUsed(), 
     229                        info->GetBlocksHardLimit(), discSet) << std::endl; 
     230        std::cout << FormatUsageLineStart("Old files") << 
     231                BlockSizeToString(info->GetBlocksInOldFiles(), 
     232                        info->GetBlocksHardLimit(), discSet) << std::endl; 
     233        std::cout << FormatUsageLineStart("Deleted files") << 
     234                BlockSizeToString(info->GetBlocksInDeletedFiles(), 
     235                        info->GetBlocksHardLimit(), discSet) << std::endl; 
     236        std::cout << FormatUsageLineStart("Directories") << 
     237                BlockSizeToString(info->GetBlocksInDirectories(), 
     238                        info->GetBlocksHardLimit(), discSet) << std::endl; 
     239        std::cout << FormatUsageLineStart("Soft limit") << 
     240                BlockSizeToString(info->GetBlocksSoftLimit(), 
     241                        info->GetBlocksHardLimit(), discSet) << std::endl; 
     242        std::cout << FormatUsageLineStart("Hard limit") << 
     243                BlockSizeToString(info->GetBlocksHardLimit(), 
     244                        info->GetBlocksHardLimit(), discSet) << std::endl; 
     245        std::cout << FormatUsageLineStart("Client store marker") << 
     246                info->GetLastObjectIDUsed() << std::endl; 
    235247         
    236248        return 0; 
  • box/trunk/bin/bbstored/BBStoreDHousekeeping.cpp

    r2124 r2127  
    194194        if(mInterProcessComms.GetLine(line, false /* no pre-processing */, MaximumWaitTime)) 
    195195        { 
    196                 TRACE1("Housekeeping received command '%s' over interprocess comms\n", line.c_str()); 
     196                BOX_TRACE("Housekeeping received command '" << line << 
     197                        "' over interprocess comms"); 
    197198         
    198199                int account = 0; 
  • box/trunk/bin/bbstored/BackupContext.cpp

    r2124 r2127  
    383383                mSaveStoreInfoDelay = 0; 
    384384                 
    385                 TRACE1("When allocating object ID, found that %lld is already in use\n", id); 
     385                BOX_WARNING("When allocating object ID, found that " << 
     386                        BOX_FORMAT_OBJECTID(id) << " is already in use"); 
    386387        } 
    387388         
  • box/trunk/bin/bbstored/bbstored-config.in

    r2124 r2127  
    197197Server 
    198198{ 
    199         PidFile = @localstatedir_expanded@/bbstored.pid 
     199        PidFile = @localstatedir_expanded@/run/bbstored.pid 
    200200        User = $username 
    201201        ListenAddresses = inet:$server 
  • box/trunk/configure.ac

    r2124 r2127  
    66AC_CONFIG_SRCDIR([lib/common/Box.h]) 
    77AC_CONFIG_HEADERS([lib/common/BoxConfig.h]) 
    8  
    9 # override default sysconfdir, for backwards compatibility 
    10 test "$sysconfdir" = NONE && sysconfdir=/etc 
    11 test "$localstatedir" = NONE && localstatedir=/var/run 
    128 
    139touch install-sh 
     
    6359esac 
    6460 
    65 AC_CHECK_HEADER([zlib.h],, [AC_MSG_ERROR([[cannot find zlib.h]])]) 
    6661AC_CHECK_LIB([z], [zlibVersion],, [AC_MSG_ERROR([[cannot find zlib]])]) 
    6762VL_LIB_READLINE([have_libreadline=yes], [have_libreadline=no]) 
     
    274269  LIBS="-Wl,-Bstatic $LIBS -Wl,-Bdynamic" 
    275270fi 
     271 
     272# override default sysconfdir, for backwards compatibility 
     273test "$sysconfdir" = '${prefix}/etc' && sysconfdir=/etc 
     274test "$localstatedir" = '${prefix}/var' && localstatedir=/var 
    276275 
    277276## Kludge to allow makeparcels.pl to use bindir. This is not a good long term 
  • box/trunk/documentation/bbackupctl.xml

    r2124 r2127  
    44    <refentrytitle>bbackupctl</refentrytitle> 
    55 
    6     <manvolnum>1</manvolnum> 
     6    <manvolnum>8</manvolnum> 
    77  </refmeta> 
    88 
     
    2424    <para><literal>bbackupctl</literal> lets the user control the bbackupd 
    2525    daemon on a client machine. The main use is to force a sync with the store 
    26     server. This is especially important if bbackupd(1) is configured to do 
     26    server. This is especially important if bbackupd(8) is configured to do 
    2727    snapshot backups. In that case <literal>bbackupctl</literal> is the only 
    2828    way to effect a backup.</para> 
     
    3232    connecting on this socket has the correct credentials to execute the 
    3333    commands, leaving a rather sizeable security hole open. To avoid this, 
    34     unset the CommandSocket parameter in <literal>bbackupd.conf</literal>(8). 
     34    unset the CommandSocket parameter in <literal>bbackupd.conf</literal>(5). 
    3535    That disables the command socket, so bbackupd is secure. This does, 
    3636    however, render bbackupctl unusable.</para> 
     
    9494    <title>See Also</title> 
    9595 
    96     <para><literal>bbackupd.conf(8)</literal></para> 
     96    <para><literal>bbackupd.conf(5)</literal></para> 
    9797 
    98     <para>bbackupd(1)</para> 
     98    <para><literal>bbackupd(8)</literal></para> 
    9999  </refsection> 
    100100 
  • box/trunk/documentation/bbackupquery.xml

    r2124 r2127  
    44    <refentrytitle>bbackupquery</refentrytitle> 
    55 
    6     <manvolnum>1</manvolnum> 
     6    <manvolnum>8</manvolnum> 
    77  </refmeta> 
    88 
     
    4040 
    4141    <para>Note that commands that contain spaces are enclosed in double 
    42     quotes. If the <literal>quit</literal> command is ommitted, after the 
     42    quotes. If the <literal>quit</literal> command is omitted, after the 
    4343    preceding commands are completed, <literal>bbackupquery</literal> will 
    4444    enter interactive mode.</para> 
     
    329329    <title>See Also</title> 
    330330 
    331     <para>bbackupd.conf(8)</para> 
     331    <para>bbackupd.conf(5)</para> 
    332332  </refsection> 
    333333 
     
    358358 
    359359      <listitem> 
    360         <para>The platform you are running on (Hardware and OS), for both 
     360        <para>The platform you are running on (hardware and OS), for both 
    361361        client and server.</para> 
    362362      </listitem> 
  • box/trunk/documentation/bbstoreaccounts.xml

    r2124 r2127  
    44    <refentrytitle>bbstoreaccounts</refentrytitle> 
    55 
    6     <manvolnum>1</manvolnum> 
     6    <manvolnum>8</manvolnum> 
    77  </refmeta> 
    88 
     
    2929    server. </para> 
    3030 
    31     <para><literal>bbstoreaccounts</literal> alwas takes at least 2 
     31    <para><literal>bbstoreaccounts</literal> always takes at least 2 
    3232    parameters: the command name and the account ID. Some commands require 
    3333    additional parameters, and some commands have optional parameters.</para> 
     
    161161            <listitem> 
    162162              <para>Blocks used by deleted files: The number of blocks used by 
    163               files that have been deleted on the client. Thi s data is at 
     163              files that have been deleted on the client. This data is at 
    164164              risk for being removed during housekeeping.</para> 
    165165            </listitem> 
     
    268268 
    269269      <listitem> 
    270         <para>The platform you are running on (Hardware and OS), for both 
     270        <para>The platform you are running on (hardware and OS), for both 
    271271        client and server.</para> 
    272272      </listitem> 
  • box/trunk/documentation/bbstored-certs.xml

    r2124 r2127  
    44    <refentrytitle>bbstored-certs</refentrytitle> 
    55 
    6     <manvolnum>1</manvolnum> 
     6    <manvolnum>8</manvolnum> 
    77  </refmeta> 
    88 
     
    5252          <para><literal>sign &lt;clientcsrfile&gt;</literal>: Sign a client 
    5353          certificate. The <literal>clientcsrfile</literal> is generated 
    54           during client setup. See <literal>bbackupd-config(1)</literal>. Send 
     54          during client setup. See <literal>bbackupd-config(8)</literal>. Send 
    5555          the signed certificate back to the client, and install according to 
    5656          the instructions given by <literal>bbackupd-config</literal>.</para> 
     
    7373    <title>See Also</title> 
    7474 
    75     <para><literal>bbstored-config(1)</literal></para> 
     75    <para><literal>bbstored-config(8)</literal></para> 
    7676 
    7777    <para><literal>bbstored.conf(5)</literal></para> 
    7878 
    79     <para><literal>bbstoreaccounts(1)</literal></para> 
     79    <para><literal>bbstoreaccounts(8)</literal></para> 
    8080  </refsection> 
    8181 
     
    103103 
    104104      <listitem> 
    105         <para>The platform you are running on (Hardware and OS), for both 
     105        <para>The platform you are running on (hardware and OS), for both 
    106106        client and server.</para> 
    107107      </listitem> 
  • box/trunk/documentation/bbstored-config.xml

    r2124 r2127  
    44    <refentrytitle>bbstored-config</refentrytitle> 
    55 
    6     <manvolnum>1</manvolnum> 
     6    <manvolnum>8</manvolnum> 
    77  </refmeta> 
    88 
     
    8787    <title>See Also</title> 
    8888 
    89     <para><literal>raidfile-config(1)</literal></para> 
     89    <para><literal>raidfile-config(8)</literal></para> 
    9090 
    9191    <para><literal>bbstored.conf(5)</literal></para> 
     
    118118 
    119119      <listitem> 
    120         <para>The platform you are running on (Hardware and OS), for both 
     120        <para>The platform you are running on (hardware and OS), for both 
    121121        client and server.</para> 
    122122      </listitem> 
  • box/trunk/documentation/raidfile-config.xml

    r2124 r2127  
    44    <refentrytitle>raidfile-config</refentrytitle> 
    55 
    6     <manvolnum>1</manvolnum> 
     6    <manvolnum>8</manvolnum> 
    77  </refmeta> 
    88 
     
    4646        <listitem> 
    4747          <para><literal>blocksize</literal>: The block size used for file 
    48           storage in the system, in bytes. Using a multple of the file system 
     48          storage in the system, in bytes. Using a multiple of the file system 
    4949          block size is a good strategy. Depending on the size of the files 
    5050          you will be backing up, this multiple varies. Of course it also 
     
    9191    <title>See Also</title> 
    9292 
    93     <para><literal>bbstored-config(1)</literal></para> 
     93    <para><literal>bbstored-config(8)</literal></para> 
    9494 
    9595    <para><literal>bbstored.conf(5)</literal></para> 
     
    121121 
    122122      <listitem> 
    123         <para>The platform you are running on (Hardware and OS), for both 
     123        <para>The platform you are running on (hardware and OS), for both 
    124124        client and server.</para> 
    125125      </listitem> 
  • box/trunk/lib/backupclient/BackupClientRestore.cpp

    r2124 r2127  
    268268                                if(::unlink(rLocalDirectoryName.c_str()) != 0) 
    269269                                { 
    270                                         BOX_ERROR("Failed to delete file " << 
    271                                                 rLocalDirectoryName << ": " << 
    272                                                 strerror(errno)); 
     270                                        BOX_LOG_SYS_ERROR("Failed to delete " 
     271                                                "file '" <<  
     272                                                rLocalDirectoryName << "'"); 
    273273                                        return Restore_UnknownError; 
    274274                                } 
    275275                                BOX_TRACE("In restore, directory name "  
    276                                         "collision with file " << 
    277                                         rLocalDirectoryName); 
     276                                        "collision with file '" << 
     277                                        rLocalDirectoryName << "'"); 
    278278                        } 
    279279                        break; 
     
    379379                ::mkdir(rLocalDirectoryName.c_str(), S_IRWXU) != 0) 
    380380        { 
    381                 BOX_ERROR("Failed to create directory '" << 
    382                         rLocalDirectoryName << "': " <<  
    383                         strerror(errno)); 
     381                BOX_LOG_SYS_ERROR("Failed to create directory '" << 
     382                        rLocalDirectoryName << "'"); 
    384383                return Restore_UnknownError; 
    385384        } 
     
    452451                                // Local name 
    453452                                BackupStoreFilenameClear nm(en->GetName()); 
    454                                 std::string localFilename(rLocalDirectoryName + DIRECTORY_SEPARATOR_ASCHAR + nm.GetClearFilename()); 
     453                                std::string localFilename(rLocalDirectoryName + 
     454                                        DIRECTORY_SEPARATOR_ASCHAR + 
     455                                        nm.GetClearFilename()); 
    455456                                 
    456457                                // Unlink anything which already exists: 
     
    460461                                        ::unlink(localFilename.c_str()) != 0) 
    461462                                { 
    462                                         BOX_ERROR("Failed to delete file '" << 
    463                                                 localFilename << "': " << 
    464                                                 strerror(errno)); 
     463                                        BOX_LOG_SYS_ERROR("Failed to delete " 
     464                                                "file '" << localFilename <<  
     465                                                "'"); 
    465466                                        return Restore_UnknownError; 
    466467                                } 
    467468                                 
    468469                                // Request it from the store 
    469                                 rConnection.QueryGetFile(DirectoryID, en->GetObjectID()); 
     470                                rConnection.QueryGetFile(DirectoryID, 
     471                                        en->GetObjectID()); 
    470472                 
    471473                                // Stream containing encoded file 
    472                                 std::auto_ptr<IOStream> objectStream(rConnection.ReceiveStream()); 
    473                  
    474                                 // Decode the file -- need to do different things depending on whether  
    475                                 // the directory entry has additional attributes 
     474                                std::auto_ptr<IOStream> objectStream( 
     475                                        rConnection.ReceiveStream()); 
     476                 
     477                                // Decode the file -- need to do different 
     478                                // things depending on whether the directory 
     479                                // entry has additional attributes 
    476480                                try 
    477481                                { 
  • box/trunk/lib/backupclient/BackupDaemonConfigVerify.cpp

    r2124 r2127  
    1818static const ConfigurationVerifyKey backuplocationkeys[] =  
    1919{ 
    20         {"ExcludeFile", 0, ConfigTest_MultiValueAllowed, 0}, 
    21         {"ExcludeFilesRegex", 0, ConfigTest_MultiValueAllowed, 0}, 
    22         {"ExcludeDir", 0, ConfigTest_MultiValueAllowed, 0}, 
    23         {"ExcludeDirsRegex", 0, ConfigTest_MultiValueAllowed, 0}, 
    24         {"AlwaysIncludeFile", 0, ConfigTest_MultiValueAllowed, 0}, 
    25         {"AlwaysIncludeFilesRegex", 0, ConfigTest_MultiValueAllowed, 0}, 
    26         {"AlwaysIncludeDir", 0, ConfigTest_MultiValueAllowed, 0}, 
    27         {"AlwaysIncludeDirsRegex", 0, ConfigTest_MultiValueAllowed, 0}, 
    28         {"Path", 0, ConfigTest_Exists | ConfigTest_LastEntry, 0} 
     20        ConfigurationVerifyKey("ExcludeFile", ConfigTest_MultiValueAllowed), 
     21        ConfigurationVerifyKey("ExcludeFilesRegex", ConfigTest_MultiValueAllowed), 
     22        ConfigurationVerifyKey("ExcludeDir", ConfigTest_MultiValueAllowed), 
     23        ConfigurationVerifyKey("ExcludeDirsRegex", ConfigTest_MultiValueAllowed), 
     24        ConfigurationVerifyKey("AlwaysIncludeFile", ConfigTest_MultiValueAllowed), 
     25        ConfigurationVerifyKey("AlwaysIncludeFilesRegex", ConfigTest_MultiValueAllowed), 
     26        ConfigurationVerifyKey("AlwaysIncludeDir", ConfigTest_MultiValueAllowed), 
     27        ConfigurationVerifyKey("AlwaysIncludeDirsRegex", ConfigTest_MultiValueAllowed), 
     28        ConfigurationVerifyKey("Path", ConfigTest_Exists | ConfigTest_LastEntry) 
    2929}; 
    3030 
     
    6565static const ConfigurationVerifyKey verifyrootkeys[] =  
    6666{ 
    67         {"AccountNumber", 0, ConfigTest_Exists | ConfigTest_IsInt, 0}, 
     67        ConfigurationVerifyKey("AccountNumber", 
     68                ConfigTest_Exists | ConfigTest_IsInt), 
     69        ConfigurationVerifyKey("UpdateStoreInterval", 
     70                ConfigTest_Exists | ConfigTest_IsInt), 
     71        ConfigurationVerifyKey("MinimumFileAge", 
     72                ConfigTest_Exists | ConfigTest_IsInt), 
     73        ConfigurationVerifyKey("MaxUploadWait", 
     74                ConfigTest_Exists | ConfigTest_IsInt), 
     75        ConfigurationVerifyKey("MaxFileTimeInFuture", ConfigTest_IsInt, 172800), 
     76        // file is uploaded if the file is this much in the future 
     77        // (2 days default) 
     78        ConfigurationVerifyKey("AutomaticBackup", ConfigTest_IsBool, true), 
     79         
     80        ConfigurationVerifyKey("SyncAllowScript", 0), 
     81        // script that returns "now" if backup is allowed now, or a number 
     82        // of seconds to wait before trying again if not 
    6883 
    69         {"UpdateStoreInterval", 0, ConfigTest_Exists | ConfigTest_IsInt, 0}, 
    70         {"MinimumFileAge", 0, ConfigTest_Exists | ConfigTest_IsInt, 0}, 
    71         {"MaxUploadWait", 0, ConfigTest_Exists | ConfigTest_IsInt, 0}, 
    72         {"MaxFileTimeInFuture", "172800", ConfigTest_IsInt, 0},         // file is uploaded if the file is this much in the future (2 days default) 
     84        ConfigurationVerifyKey("MaximumDiffingTime", ConfigTest_IsInt), 
     85        ConfigurationVerifyKey("DeleteRedundantLocationsAfter", 
     86                ConfigTest_IsInt, 172800), 
    7387 
    74         {"AutomaticBackup", "yes", ConfigTest_IsBool, 0}, 
     88        ConfigurationVerifyKey("FileTrackingSizeThreshold",  
     89                ConfigTest_Exists | ConfigTest_IsInt), 
     90        ConfigurationVerifyKey("DiffingUploadSizeThreshold", 
     91                ConfigTest_Exists | ConfigTest_IsInt), 
     92        ConfigurationVerifyKey("StoreHostname", ConfigTest_Exists), 
     93        ConfigurationVerifyKey("StorePort", ConfigTest_IsInt, 
     94                BOX_PORT_BBSTORED), 
     95        ConfigurationVerifyKey("ExtendedLogging", ConfigTest_IsBool, false), 
     96        // extended log to syslog 
     97        ConfigurationVerifyKey("ExtendedLogFile", 0), 
     98        // extended log to a file 
     99        ConfigurationVerifyKey("LogAllFileAccess", ConfigTest_IsBool, false), 
     100        ConfigurationVerifyKey("CommandSocket", 0), 
     101        // not compulsory to have this 
     102        ConfigurationVerifyKey("KeepAliveTime", ConfigTest_IsInt), 
     103        ConfigurationVerifyKey("StoreObjectInfoFile", 0), 
     104        // optional 
     105 
     106        ConfigurationVerifyKey("NotifyScript", 0), 
     107        // optional script to run when backup needs attention, eg store full 
    75108         
    76         {"SyncAllowScript", 0, 0, 0},                   // optional script to run to see if the sync should be started now 
    77                                 // return "now" if it's allowed, or a number of seconds if it's not 
    78  
    79         {"MaximumDiffingTime", 0, ConfigTest_IsInt, 0}, 
    80         {"DeleteRedundantLocationsAfter", "172800", ConfigTest_IsInt, 0}, 
    81  
    82         {"FileTrackingSizeThreshold", 0, ConfigTest_Exists | ConfigTest_IsInt, 0}, 
    83         {"DiffingUploadSizeThreshold", 0, ConfigTest_Exists | ConfigTest_IsInt, 0}, 
    84         {"StoreHostname", 0, ConfigTest_Exists, 0}, 
    85         {"ExtendedLogging",     "no", ConfigTest_IsBool, 0}, // extended log to syslog 
    86         {"ExtendedLogFile",     NULL, 0, 0}, // extended log to a file 
    87         {"LogAllFileAccess", "no", ConfigTest_IsBool, 0}, 
    88  
    89         {"CommandSocket", 0, 0, 0},                             // not compulsory to have this 
    90         {"KeepAliveTime", 0, ConfigTest_IsInt, 0},                              // optional 
    91         {"StoreObjectInfoFile", 0, 0, 0},                               // optional 
    92  
    93         {"NotifyScript", 0, 0, 0},                              // optional script to run when backup needs attention, eg store full 
    94          
    95         {"CertificateFile", 0, ConfigTest_Exists, 0}, 
    96         {"PrivateKeyFile", 0, ConfigTest_Exists, 0}, 
    97         {"TrustedCAsFile", 0, ConfigTest_Exists, 0}, 
    98         {"KeysFile", 0, ConfigTest_Exists, 0}, 
    99         {"DataDirectory", 0, ConfigTest_Exists | ConfigTest_LastEntry, 0} 
     109        ConfigurationVerifyKey("CertificateFile", ConfigTest_Exists), 
     110        ConfigurationVerifyKey("PrivateKeyFile", ConfigTest_Exists), 
     111        ConfigurationVerifyKey("TrustedCAsFile", ConfigTest_Exists), 
     112        ConfigurationVerifyKey("KeysFile", ConfigTest_Exists), 
     113        ConfigurationVerifyKey("DataDirectory",  
     114                ConfigTest_Exists | ConfigTest_LastEntry), 
    100115}; 
    101116 
  • box/trunk/lib/backupclient/BackupStoreFileDiff.cpp

    r2124 r2127  
    150150        bool canDiffFromThis = false; 
    151151        LoadIndex(rDiffFromBlockIndex, DiffFromObjectID, &pindex, blocksInIndex, Timeout, canDiffFromThis); 
    152         //TRACE1("Diff: Blocks in index: %lld\n", blocksInIndex); 
     152        // BOX_TRACE("Diff: Blocks in index: " << blocksInIndex); 
    153153         
    154154        if(!canDiffFromThis) 
     
    440440                for(int t = 0; t < BACKUP_FILE_DIFF_MAX_BLOCK_SIZES; ++t) 
    441441                { 
    442                         TRACE3("Diff block size %d: %d (count = %lld)\n", t, Sizes[t], sizeCounts[t]); 
     442                        BOX_TRACE("Diff block size " << t << ": " << 
     443                                Sizes[t] << " (count = " <<  
     444                                sizeCounts[t] << ")"); 
    443445                } 
    444446        } 
     
    775777                        if(pHashTable[hash] != 0) 
    776778                        { 
    777                                 //TRACE1("Another hash entry for %d found\n", hash); 
     779                                //BOX_TRACE("Another hash entry for " << hash << " found"); 
    778780                                // Yes -- need to set the pointer in this entry to the current entry to build the linked list 
    779781                                pIndex[b].mpNextInHashList = pHashTable[hash]; 
     
    841843        // Then go through the entries in the hash list, comparing with the strong digest calculated 
    842844        scan = pFirstInHashList; 
    843         //TRACE0("second stage match\n"); 
     845        //BOX_TRACE("second stage match"); 
    844846        while(scan != 0) 
    845847        { 
    846                 //TRACE3("scan size %d, block size %d, hash %d\n", scan->mSize, BlockSize, Hash); 
     848                //BOX_TRACE("scan size " << scan->mSize << 
     849                //      ", block size " << BlockSize << 
     850                //      ", hash " << Hash); 
    847851                ASSERT(scan->mSize == BlockSize); 
    848852                ASSERT(RollingChecksum::ExtractHashingComponent(scan->mWeakChecksum) == DEBUG_Hash); 
     
    851855                if(strong.DigestMatches(scan->mStrongChecksum)) 
    852856                { 
    853                         //TRACE0("Match!\n"); 
     857                        //BOX_TRACE("Match!\n"); 
    854858                        // Found! Add to list of found blocks... 
    855859                        int64_t fileOffset = (FileBlockNumber * BlockSize) + Offset; 
     
    913917                if(BackupStoreFile::TraceDetailsOfDiffProcess) 
    914918                { 
    915                         TRACE1("Diff: Default recipe generated, %lld bytes of file\n", SizeOfInputFile); 
     919                        BOX_TRACE("Diff: Default recipe generated, " <<  
     920                                SizeOfInputFile << " bytes of file"); 
    916921                } 
    917922                #endif 
     
    10061011        // dump out the recipe 
    10071012#ifndef NDEBUG 
    1008         TRACE2("Diff: %lld new bytes found, %lld old blocks used\n", debug_NewBytesFound, debug_OldBlocksUsed); 
     1013        BOX_TRACE("Diff: " <<  
     1014                debug_NewBytesFound << " new bytes found, " << 
     1015                debug_OldBlocksUsed << " old blocks used"); 
    10091016        if(BackupStoreFile::TraceDetailsOfDiffProcess) 
    10101017        { 
    1011                 TRACE1("Diff: Recipe generated (size %d)\n======== ========= ========\nSpace b4 FirstBlk  NumBlks\n", rRecipe.size()); 
     1018                BOX_TRACE("Diff: Recipe generated (size " << rRecipe.size()); 
     1019                BOX_TRACE("======== ========= ========"); 
     1020                BOX_TRACE("Space b4 FirstBlk  NumBlks"); 
    10121021                { 
    10131022                        for(unsigned int e = 0; e < rRecipe.size(); ++e) 
     
    10191028                                sprintf(b, "%8lld", (int64_t)(rRecipe[e].mpStartBlock - pIndex)); 
    10201029#endif 
    1021                                 TRACE3("%8lld %s %8lld\n", rRecipe[e].mSpaceBefore, (rRecipe[e].mpStartBlock == 0)?"       -":b, (int64_t)rRecipe[e].mBlocks); 
    1022                         } 
    1023                 } 
    1024                 TRACE0("======== ========= ========\n"); 
     1030                                BOX_TRACE(std::setw(8) << 
     1031                                        rRecipe[e].mSpaceBefore << 
     1032                                        " " << 
     1033                                        ((rRecipe[e].mpStartBlock == 0)?"       -":b) << 
     1034                                        " " << std::setw(8) << 
     1035                                        rRecipe[e].mBlocks); 
     1036                        } 
     1037                } 
     1038                BOX_TRACE("======== ========= ========"); 
    10251039        } 
    10261040#endif 
  • box/trunk/lib/backupclient/BackupStoreFilenameClear.cpp

    r2124 r2127  
    168168        { 
    169169        case Encoding_Clear: 
    170                 TRACE0("**** BackupStoreFilename encoded with Clear encoding ****\n"); 
     170                BOX_TRACE("**** BackupStoreFilename encoded with " 
     171                        "Clear encoding ****"); 
    171172                mClearFilename.assign(c_str() + 2, size - 2); 
    172173                break; 
     
    194195        { 
    195196#ifndef WIN32 
    196                 TRACE1("Allocating filename encoding/decoding buffer with size %d\n", BufSize); 
     197                BOX_TRACE("Allocating filename encoding/decoding buffer " 
     198                        "with size " << BufSize); 
    197199#endif 
    198200                spEncDecBuffer = new MemoryBlockGuard<uint8_t *>(BufSize); 
  • box/trunk/lib/backupclient/BackupStoreObjectDump.cpp

    r2124 r2127  
    4848        if(ToTrace) 
    4949        { 
    50                 TRACE1("%s", text); 
     50                BOX_TRACE(text); 
    5151        } 
    5252} 
     
    212212                { 
    213213                        nnew++; 
    214                         TRACE2("%8lld this  s=%8lld\n", b, s); 
     214                        BOX_TRACE(std::setw(8) << b << " this  s=" << 
     215                                std::setw(8) << s); 
    215216                } 
    216217                else 
    217218                { 
    218219                        nold++; 
    219                         TRACE2("%8lld other i=%8lld\n", b, 0 - s);               
    220                 } 
    221         } 
    222         TRACE0("======== ===== ==========\n"); 
     220                        BOX_TRACE(std::setw(8) << b << " other i=" << 
     221                                std::setw(8) << 0 - s); 
     222                } 
     223        } 
     224        BOX_TRACE("======== ===== =========="); 
    223225} 
    224226 
  • box/trunk/lib/backupstore/BackupStoreCheck.cpp

    r2124 r2127  
    269269         
    270270                maxDir = CheckObjectsScanDir(0, 1, mStoreRoot); 
    271                 TRACE1("Max dir starting ID is %llx\n", maxDir); 
     271                BOX_TRACE("Max dir starting ID is " << 
     272                        BOX_FORMAT_OBJECTID(maxDir)); 
    272273        } 
    273274         
  • box/trunk/lib/backupstore/BackupStoreCheck2.cpp

    r2124 r2127  
    595595} 
    596596 
     597#define FMT_OID(x) BOX_FORMAT_OBJECTID(x) 
     598#define FMT_i      BOX_FORMAT_OBJECTID((*i)->GetObjectID()) 
    597599 
    598600// -------------------------------------------------------------------------- 
     
    621623                                { 
    622624                                        // Depends on something, but it isn't there. 
    623                                         TRACE2("Entry id %llx removed because depends on newer version %llx which doesn't exist\n", (*i)->GetObjectID(), dependsNewer); 
     625                                        BOX_TRACE("Entry id " << FMT_i << 
     626                                                " removed because depends " 
     627                                                "on newer version " << 
     628                                                FMT_OID(dependsNewer) << 
     629                                                " which doesn't exist"); 
    624630                                         
    625631                                        // Remove 
     
    639645                                        { 
    640646                                                // Wrong entry 
    641                                                 TRACE3("Entry id %llx, correcting DependsOlder to %llx, was %llx\n", dependsNewer, (*i)->GetObjectID(), newerEn->GetDependsOlder()); 
     647                                                BOX_TRACE("Entry id " << 
     648                                                        FMT_OID(dependsNewer) << 
     649                                                        ", correcting DependsOlder to " << 
     650                                                        FMT_i << 
     651                                                        ", was " << 
     652                                                        FMT_OID(newerEn->GetDependsOlder())); 
    642653                                                newerEn->SetDependsOlder((*i)->GetObjectID()); 
    643654                                                // Mark as changed 
     
    658669                        { 
    659670                                // Has an older version marked, but this doesn't exist. Remove this mark 
    660                                 TRACE2("Entry id %llx was marked that %llx depended on it, which doesn't exist, dependency info cleared\n", (*i)->GetObjectID(), dependsOlder); 
     671                                BOX_TRACE("Entry id " << FMT_i << 
     672                                        " was marked as depended on by " << 
     673                                        FMT_OID(dependsOlder) << ", " 
     674                                        "which doesn't exist, dependency " 
     675                                        "info cleared"); 
    661676 
    662677                                (*i)->SetDependsOlder(0); 
     
    694709                        if((*i) == 0) 
    695710                        { 
    696                                 TRACE0("Remove because null pointer found\n"); 
     711                                BOX_TRACE("Remove because null pointer found"); 
    697712                                removeEntry = true; 
    698713                        } 
     
    705720                                { 
    706721                                        // Bad! Unset the file flag 
    707                                         TRACE1("Entry %llx: File flag set when dir flag set\n", (*i)->GetObjectID()); 
     722                                        BOX_TRACE("Entry " << FMT_i << 
     723                                                ": File flag and dir flag both set"); 
    708724                                        (*i)->RemoveFlags(Entry::Flags_File); 
    709725                                        changed = true; 
     
    714730                                { 
    715731                                        // ID already seen, or type doesn't match 
    716                                         TRACE1("Entry %llx: Remove because ID already seen\n", (*i)->GetObjectID()); 
     732                                        BOX_TRACE("Entry " << FMT_i << 
     733                                                ": Remove because ID already seen"); 
    717734                                        removeEntry = true; 
    718735                                } 
     
    731748                                                { 
    732749                                                        // Not set, set it 
    733                                                         TRACE1("Entry %llx: Set old flag\n", (*i)->GetObjectID()); 
     750                                                        BOX_TRACE("Entry " << FMT_i << 
     751                                                                ": Set old flag"); 
    734752                                                        (*i)->AddFlags(Entry::Flags_OldVersion); 
    735753                                                        changed = true; 
     
    742760                                                { 
    743761                                                        // Set, unset it 
    744                                                         TRACE1("Entry %llx: Old flag unset\n", (*i)->GetObjectID()); 
     762                                                        BOX_TRACE("Entry " << FMT_i << 
     763                                                                ": Old flag unset"); 
    745764                                                        (*i)->RemoveFlags(Entry::Flags_OldVersion); 
    746765                                                        changed = true; 
  • box/trunk/lib/backupstore/BackupStoreCheckData.cpp

    r2124 r2127  
    190190                IDBlock *pblock = i->second; 
    191191                int32_t bentries = (pblock == mpInfoLastBlock)?mInfoLastBlockEntries:BACKUPSTORECHECK_BLOCK_SIZE; 
    192                 TRACE2("BLOCK @ 0x%08x, %d entries\n", pblock, bentries); 
     192                BOX_TRACE("BLOCK @ " << BOX_FORMAT_HEX32(pblock) << 
     193                        ", " << bentries << " entries"); 
    193194                 
    194195                for(int e = 0; e < bentries; ++e) 
    195196                { 
    196197                        uint8_t flags = GetFlags(pblock, e); 
    197                         TRACE4("id %llx, c %llx, %s, %s\n", 
    198                                 pblock->mID[e], pblock->mContainer[e], 
    199                                 (flags & Flags_IsDir)?"dir":"file", 
    200                                 (flags & Flags_IsContained)?"contained":"unattached"); 
     198                        BOX_TRACE(std::hex <<  
     199                                "id "  << pblock->mID[e] << 
     200                                ", c " << pblock->mContainer[e] << 
     201                                ", " << ((flags & Flags_IsDir)?"dir":"file") << 
     202                                ", " << ((flags & Flags_IsContained) ?  
     203                                        "contained":"unattached")); 
    201204                } 
    202205        } 
  • box/trunk/lib/backupstore/BackupStoreConfigVerify.cpp

    r2124 r2127  
    1717static const ConfigurationVerifyKey verifyserverkeys[] =  
    1818{ 
    19         SERVERTLS_VERIFY_SERVER_KEYS(0) // no default listen addresses 
     19        SERVERTLS_VERIFY_SERVER_KEYS(ConfigurationVerifyKey::NoDefaultValue) 
     20        // no default listen addresses 
    2021}; 
    2122 
     
    3334static const ConfigurationVerifyKey verifyrootkeys[] =  
    3435{ 
    35         {"AccountDatabase",     0, ConfigTest_Exists, 0}, 
    36         {"TimeBetweenHousekeeping",     0, ConfigTest_Exists | ConfigTest_IsInt, 0}, 
    37         {"ExtendedLogging",     "no", ConfigTest_IsBool, 0},                    // make value "yes" to enable in config file 
     36        ConfigurationVerifyKey("AccountDatabase", ConfigTest_Exists), 
     37        ConfigurationVerifyKey("TimeBetweenHousekeeping", 
     38                ConfigTest_Exists | ConfigTest_IsInt), 
     39        ConfigurationVerifyKey("ExtendedLogging", ConfigTest_IsBool, false), 
     40        // make value "yes" to enable in config file 
    3841 
    3942        #ifdef WIN32 
    40                 {"RaidFileConf", "", ConfigTest_LastEntry, 0} 
     43                ConfigurationVerifyKey("RaidFileConf", ConfigTest_LastEntry) 
    4144        #else 
    42                 {"RaidFileConf", BOX_FILE_RAIDFILE_DEFAULT_CONFIG, ConfigTest_LastEntry, 0} 
     45                ConfigurationVerifyKey("RaidFileConf", ConfigTest_LastEntry, 
     46                        BOX_FILE_RAIDFILE_DEFAULT_CONFIG) 
    4347        #endif 
    44  
    4548}; 
    4649 
  • box/trunk/lib/common/Box.h

    r2124 r2127  
    5353        int BoxDebug_printf(const char *format, ...); 
    5454        int BoxDebugTrace(const char *format, ...); 
    55         #define TRACE0(msg) {BoxDebugTrace("%s", msg);} 
    56         #define TRACE1(msg, a0) {BoxDebugTrace(msg, a0);} 
    57         #define TRACE2(msg, a0, a1) {BoxDebugTrace(msg, a0, a1);} 
    58         #define TRACE3(msg, a0, a1, a2) {BoxDebugTrace(msg, a0, a1, a2);} 
    59         #define TRACE4(msg, a0, a1, a2, a3) {BoxDebugTrace(msg, a0, a1, a2, a3);} 
    60         #define TRACE5(msg, a0, a1, a2, a3, a4) {BoxDebugTrace(msg, a0, a1, a2, a3, a4);} 
    61         #define TRACE6(msg, a0, a1, a2, a3, a4, a5) {BoxDebugTrace(msg, a0, a1, a2, a3, a4, a5);} 
    62         #define TRACE7(msg, a0, a1, a2, a3, a4, a5, a6) {BoxDebugTrace(msg, a0, a1, a2, a3, a4, a5, a6);} 
    63         #define TRACE8(msg, a0, a1, a2, a3, a4, a5, a6, a7) {BoxDebugTrace(msg, a0, a1, a2, a3, a4, a5, a6, a7);} 
    6455         
    6556        #ifndef PLATFORM_DISABLE_MEM_LEAK_TESTING 
     
    7768        #define TRACE_TO_STDOUT(x) {} 
    7869 
    79         #define TRACE0(msg) 
    80         #define TRACE1(msg, a0) 
    81         #define TRACE2(msg, a0, a1) 
    82         #define TRACE3(msg, a0, a1, a2) 
    83         #define TRACE4(msg, a0, a1, a2, a3) 
    84         #define TRACE5(msg, a0, a1, a2, a3, a4) 
    85         #define TRACE6(msg, a0, a1, a2, a3, a4, a5) 
    86         #define TRACE7(msg, a0, a1, a2, a3, a4, a5, a6) 
    87         #define TRACE8(msg, a0, a1, a2, a3, a4, a5, a6, a7) 
    88          
    8970        // Box Backup builds release get extra information for exception logging 
    9071        #define EXCEPTION_CODENAMES_EXTENDED 
  • box/trunk/lib/common/BoxTime.cpp

    r2124 r2127  
    4040                if (gettimeofday(&tv, NULL) != 0) 
    4141                { 
    42                         BOX_ERROR("Failed to gettimeofday(), dropping " 
    43                                 "precision: " << strerror(errno)); 
     42                        BOX_LOG_SYS_ERROR("Failed to gettimeofday(), " 
     43                                "dropping precision"); 
    4444                } 
    4545                else 
  • box/trunk/lib/common/Configuration.cpp

    r2124 r2127  
    1212#include <stdlib.h> 
    1313#include <limits.h> 
     14 
     15#include <sstream> 
    1416 
    1517#include "Configuration.h" 
     
    3032static const bool sValueBooleanValue[] = {true, true, false, false}; 
    3133 
    32  
     34ConfigurationVerifyKey::ConfigurationVerifyKey 
     35( 
     36        std::string name, 
     37        int flags, 
     38        void *testFunction 
     39) 
     40: mName(name), 
     41  mHasDefaultValue(false), 
     42  mFlags(flags), 
     43  mTestFunction(testFunction) 
     44{ } 
     45 
     46// to allow passing NULL for default ListenAddresses 
     47 
     48ConfigurationVerifyKey::ConfigurationVerifyKey 
     49( 
     50        std::string name, 
     51        int flags, 
     52        NoDefaultValue_t t, 
     53        void *testFunction 
     54) 
     55: mName(name), 
     56  mHasDefaultValue(false), 
     57  mFlags(flags), 
     58  mTestFunction(testFunction) 
     59{ } 
     60 
     61ConfigurationVerifyKey::ConfigurationVerifyKey 
     62( 
     63        std::string name, 
     64        int flags, 
     65        std::string defaultValue, 
     66        void *testFunction 
     67) 
     68: mName(name), 
     69  mDefaultValue(defaultValue), 
     70  mHasDefaultValue(true), 
     71  mFlags(flags), 
     72  mTestFunction(testFunction) 
     73{ } 
     74 
     75ConfigurationVerifyKey::ConfigurationVerifyKey 
     76( 
     77        std::string name, 
     78        int flags, 
     79        const char *defaultValue, 
     80        void *testFunction 
     81) 
     82: mName(name), 
     83  mDefaultValue(defaultValue), 
     84  mHasDefaultValue(true), 
     85  mFlags(flags), 
     86  mTestFunction(testFunction) 
     87{ } 
     88 
     89ConfigurationVerifyKey::ConfigurationVerifyKey 
     90( 
     91        std::string name, 
     92        int flags, 
     93        int defaultValue, 
     94        void *testFunction 
     95) 
     96: mName(name), 
     97  mHasDefaultValue(true), 
     98  mFlags(flags), 
     99  mTestFunction(testFunction) 
     100{ 
     101        ASSERT(flags & ConfigTest_IsInt); 
     102        std::ostringstream val; 
     103        val << defaultValue; 
     104        mDefaultValue = val.str(); 
     105} 
     106 
     107ConfigurationVerifyKey::ConfigurationVerifyKey 
     108( 
     109        std::string name, 
     110        int flags, 
     111        bool defaultValue, 
     112        void *testFunction 
     113) 
     114: mName(name), 
     115  mHasDefaultValue(true), 
     116  mFlags(flags), 
     117  mTestFunction(testFunction) 
     118{ 
     119        ASSERT(flags & ConfigTest_IsBool); 
     120        mDefaultValue = defaultValue ? "yes" : "no"; 
     121} 
     122 
     123ConfigurationVerifyKey::ConfigurationVerifyKey 
     124( 
     125        const ConfigurationVerifyKey& rToCopy 
     126) 
     127: mName(rToCopy.mName), 
     128  mDefaultValue(rToCopy.mDefaultValue), 
     129  mHasDefaultValue(rToCopy.mHasDefaultValue), 
     130  mFlags(rToCopy.mFlags), 
     131  mTestFunction(rToCopy.mTestFunction) 
     132{ } 
    33133 
    34134// -------------------------------------------------------------------------- 
     
    109209                { 
    110210                        // An error occured, return now 
    111                         //TRACE1("Error message from LoadInto: %s", rErrorMsg.c_str()); 
    112                         TRACE0("Error at Configuration::LoadInfo\n"); 
     211                        BOX_ERROR("Error in Configuration::LoadInfo: " <<  
     212                                rErrorMsg); 
    113213                        delete pconfig; 
    114214                        pconfig = 0; 
     
    121221                        if(!Verify(*pconfig, *pVerify, std::string(), rErrorMsg)) 
    122222                        { 
    123                                 //TRACE1("Error message from Verify: %s", rErrorMsg.c_str()); 
    124                                 TRACE0("Error at Configuration::Verify\n"); 
     223                                BOX_ERROR("Error verifying configuration: " << 
     224                                        rErrorMsg); 
    125225                                delete pconfig; 
    126226                                pconfig = 0; 
     
    190290                        else 
    191291                        { 
    192                                 rErrorMsg += "Unexpected start block in " + rConfig.mName + "\n"; 
     292                                rErrorMsg += "Unexpected start block in " + 
     293                                        rConfig.mName + "\n"; 
    193294                        } 
    194295                } 
     
    291392// 
    292393// Function 
    293 //              Name:    Configuration::KeyExists(const char *) 
     394//              Name:    Configuration::KeyExists(const std::string&) 
    294395//              Purpose: Checks to see if a key exists 
    295396//              Created: 2003/07/23 
    296397// 
    297398// -------------------------------------------------------------------------- 
    298 bool Configuration::KeyExists(const char *pKeyName) const 
    299 { 
    300         if(pKeyName == 0) {THROW_EXCEPTION(CommonException, BadArguments)} 
    301  
    302         return mKeys.find(pKeyName) != mKeys.end(); 
    303 } 
    304  
    305  
    306 // -------------------------------------------------------------------------- 
    307 // 
    308 // Function 
    309 //              Name:    Configuration::GetKeyValue(const char *) 
     399bool Configuration::KeyExists(const std::string& rKeyName) const 
     400{ 
     401        return mKeys.find(rKeyName) != mKeys.end(); 
     402} 
     403 
     404 
     405// -------------------------------------------------------------------------- 
     406// 
     407// Function 
     408//              Name:    Configuration::GetKeyValue(const std::string&) 
    310409//              Purpose: Returns the value of a configuration variable 
    311410//              Created: 2003/07/23 
    312411// 
    313412// -------------------------------------------------------------------------- 
    314 const std::string &Configuration::GetKeyValue(const char *pKeyName) const 
    315 { 
    316         if(pKeyName == 0) {THROW_EXCEPTION(CommonException, BadArguments)} 
    317  
    318         std::map<std::string, std::string>::const_iterator i(mKeys.find(pKeyName)); 
     413const std::string &Configuration::GetKeyValue(const std::string& rKeyName) const 
     414{ 
     415        std::map<std::string, std::string>::const_iterator i(mKeys.find(rKeyName)); 
    319416         
    320417        if(i == mKeys.end()) 
    321418        { 
    322                 BOX_ERROR("Missing configuration key: " << pKeyName); 
     419                BOX_ERROR("Missing configuration key: " << rKeyName); 
    323420                THROW_EXCEPTION(CommonException, ConfigNoKey) 
    324421        } 
     
    333430// 
    334431// Function 
    335 //              Name:    Configuration::GetKeyValueInt(const char *) 
     432//              Name:    Configuration::GetKeyValueInt(const std::string& rKeyName) 
    336433//              Purpose: Gets a key value as an integer 
    337434//              Created: 2003/07/23 
    338435// 
    339436// -------------------------------------------------------------------------- 
    340 int Configuration::GetKeyValueInt(const char *pKeyName) const 
    341 { 
    342         if(pKeyName == 0) {THROW_EXCEPTION(CommonException, BadArguments)} 
    343  
    344         std::map<std::string, std::string>::const_iterator i(mKeys.find(pKeyName)); 
     437int Configuration::GetKeyValueInt(const std::string& rKeyName) const 
     438{ 
     439        std::map<std::string, std::string>::const_iterator i(mKeys.find(rKeyName)); 
    345440         
    346441        if(i == mKeys.end()) 
     
    363458// 
    364459// Function 
    365 //              Name:    Configuration::GetKeyValueBool(const char *) const 
     460//              Name:    Configuration::GetKeyValueBool(const std::string&) 
    366461//              Purpose: Gets a key value as a boolean 
    367462//              Created: 17/2/04 
    368463// 
    369464// -------------------------------------------------------------------------- 
    370 bool Configuration::GetKeyValueBool(const char *pKeyName) const 
    371 { 
    372         if(pKeyName == 0) {THROW_EXCEPTION(CommonException, BadArguments)} 
    373  
    374         std::map<std::string, std::string>::const_iterator i(mKeys.find(pKeyName)); 
     465bool Configuration::GetKeyValueBool(const std::string& rKeyName) const 
     466{ 
     467        std::map<std::string, std::string>::const_iterator i(mKeys.find(rKeyName)); 
    375468         
    376469        if(i == mKeys.end()) 
     
    429522// 
    430523// Function 
    431 //              Name:    Configuration::SubConfigurationExists(const char *) 
     524//              Name:    Configuration::SubConfigurationExists(const 
     525//                       std::string&) 
    432526//              Purpose: Checks to see if a sub configuration exists 
    433527//              Created: 2003/07/23 
    434528// 
    435529// -------------------------------------------------------------------------- 
    436 bool Configuration::SubConfigurationExists(const char *pSubName) const 
    437 { 
    438         if(pSubName == 0) {THROW_EXCEPTION(CommonException, BadArguments)} 
    439  
     530bool Configuration::SubConfigurationExists(const std::string& rSubName) const 
     531{ 
    440532        // Attempt to find it... 
    441533        std::list<std::pair<std::string, Configuration> >::const_iterator i(mSubConfigurations.begin()); 
     
    444536        { 
    445537                // This the one? 
    446                 if(i->first == pSubName) 
     538                if(i->first == rSubName) 
    447539                { 
    448540                        // Yes. 
     
    459551// 
    460552// Function 
    461 //              Name:    Configuration::GetSubConfiguration(const char *) 
     553//              Name:    Configuration::GetSubConfiguration(const 
     554//                       std::string&) 
    462555//              Purpose: Gets a sub configuration 
    463556//              Created: 2003/07/23 
    464557// 
    465558// -------------------------------------------------------------------------- 
    466 const Configuration &Configuration::GetSubConfiguration(const char *pSubName) const 
    467 { 
    468         if(pSubName == 0) {THROW_EXCEPTION(CommonException, BadArguments)} 
    469  
     559const Configuration &Configuration::GetSubConfiguration(const std::string& 
     560        rSubName) const 
     561{ 
    470562        // Attempt to find it... 
    471563        std::list<std::pair<std::string, Configuration> >::const_iterator i(mSubConfigurations.begin()); 
     
    474566        { 
    475567                // This the one? 
    476                 if(i->first == pSubName) 
     568                if(i->first == rSubName) 
    477569                { 
    478570                        // Yes. 
     
    529621                { 
    530622                        // Can the key be found? 
    531                         ASSERT(pvkey->mpName); 
    532                         if(rConfig.KeyExists(pvkey->mpName)) 
     623                        if(rConfig.KeyExists(pvkey->Name())) 
    533624                        { 
    534625                                // Get value 
    535                                 const std::string &rval = rConfig.GetKeyValue(pvkey->mpName); 
     626                                const std::string &rval = rConfig.GetKeyValue(pvkey->Name()); 
    536627                                const char *val = rval.c_str(); 
    537628 
    538629                                // Check it's a number? 
    539                                 if((pvkey->Tests & ConfigTest_IsInt) == ConfigTest_IsInt) 
     630                                if((pvkey->Flags() & ConfigTest_IsInt) == ConfigTest_IsInt) 
    540631                                {                                        
    541632                                        // Test it... 
     
    546637                                                // not a good value 
    547638                                                ok = false; 
    548                                                 rErrorMsg += rLevel + rConfig.mName +"." + pvkey->mpName + " (key) is not a valid integer.\n"; 
     639                                                rErrorMsg += rLevel + rConfig.mName + "." + pvkey->Name() + " (key) is not a valid integer.\n"; 
    549640                                        } 
    550641                                } 
    551642                                 
    552643                                // Check it's a bool? 
    553                                 if((pvkey->Tests & ConfigTest_IsBool) == ConfigTest_IsBool) 
     644                                if((pvkey->Flags() & ConfigTest_IsBool) == ConfigTest_IsBool) 
    554645                                {                                
    555646                                        // See if it's one of the allowed strings. 
     
    569660                                        { 
    570661                                                ok = false; 
    571                                                 rErrorMsg += rLevel + rConfig.mName +"." + pvkey->mpName + " (key) is not a valid boolean value.\n"; 
     662                                                rErrorMsg += rLevel + rConfig.mName + "." + pvkey->Name() + " (key) is not a valid boolean value.\n"; 
    572663                                        } 
    573664                                } 
    574665                                 
    575666                                // Check for multi valued statments where they're not allowed 
    576                                 if((pvkey->Tests & ConfigTest_MultiValueAllowed) == 0) 
     667                                if((pvkey->Flags() & ConfigTest_MultiValueAllowed) == 0) 
    577668                                { 
    578669                                        // Check to see if this key is a multi-value -- it shouldn't be 
     
    580671                                        { 
    581672                                                ok = false; 
    582                                                 rErrorMsg += rLevel + rConfig.mName +"." + pvkey->mpName + " (key) multi value not allowed (duplicated key?).\n"; 
     673                                                rErrorMsg += rLevel + rConfig.mName +"." + pvkey->Name() + " (key) multi value not allowed (duplicated key?).\n"; 
    583674                                        } 
    584675                                }                                
     
    587678                        { 
    588679                                // Is it required to exist? 
    589                                 if((pvkey->Tests & ConfigTest_Exists) == ConfigTest_Exists) 
     680                                if((pvkey->Flags() & ConfigTest_Exists) == ConfigTest_Exists) 
    590681                                { 
    591682                                        // Should exist, but doesn't. 
    592683                                        ok = false; 
    593                                         rErrorMsg += rLevel + rConfig.mName + "." + pvkey->mpName + " (key) is missing.\n"; 
    594                                 } 
    595                                 else if(pvkey->mpDefaultValue) 
    596                                 { 
    597                                         rConfig.mKeys[std::string(pvkey->mpName)] = std::string(pvkey->mpDefaultValue); 
     684                                        rErrorMsg += rLevel + rConfig.mName + "." + pvkey->Name() + " (key) is missing.\n"; 
     685                                } 
     686                                else if(pvkey->HasDefaultValue()) 
     687                                { 
     688                                        rConfig.mKeys[pvkey->Name()] = 
     689                                                pvkey->DefaultValue(); 
    598690                                } 
    599691                        } 
    600692                 
    601                         if((pvkey->Tests & ConfigTest_LastEntry) == ConfigTest_LastEntry) 
     693                        if((pvkey->Flags() & ConfigTest_LastEntry) == ConfigTest_LastEntry) 
    602694                        { 
    603695                                // No more! 
     
    619711                        while(scan) 
    620712                        { 
    621                                 if(scan->mpName == i->first) 
     713                                if(scan->Name() == i->first) 
    622714                                { 
    623715                                        found = true; 
     
    626718                                 
    627719                                // Next? 
    628                                 if((scan->Tests & ConfigTest_LastEntry) == ConfigTest_LastEntry) 
     720                                if((scan->Flags() & ConfigTest_LastEntry) == ConfigTest_LastEntry) 
    629721                                { 
    630722                                        break; 
     
    651743                while(scan) 
    652744                { 
    653                         ASSERT(scan->mpName); 
    654                         if(scan->mpName[0] == '*') 
     745                        if(scan->mName.length() > 0 && scan->mName[0] == '*') 
    655746                        { 
    656747                                wildcardverify = scan; 
     
    660751                        if((scan->Tests & ConfigTest_Exists) == ConfigTest_Exists) 
    661752                        { 
    662                                 if(scan->mpName[0] == '*') 
     753                                if(scan->mName.length() > 0 && 
     754                                        scan->mName[0] == '*') 
    663755                                { 
    664756                                        // Check something exists 
     
    673765                                { 
    674766                                        // Check real thing exists 
    675                                         if(!rConfig.SubConfigurationExists(scan->mpName)) 
     767                                        if(!rConfig.SubConfigurationExists(scan->mName)) 
    676768                                        { 
    677769                                                // Should exist, but doesn't. 
    678770                                                ok = false; 
    679                                                 rErrorMsg += rLevel + rConfig.mName + "." + scan->mpName + " (block) is missing.\n"; 
     771                                                rErrorMsg += rLevel + rConfig.mName + "." + scan->mName + " (block) is missing.\n"; 
    680772                                        } 
    681773                                } 
     
    702794                        while(scan) 
    703795                        { 
    704                                 if(strcmp(scan->mpName, name) == 0) 
     796                                if(scan->mName == name) 
    705797                                { 
    706798                                        // found it! 
  • box/trunk/lib/common/Configuration.h

    r2124 r2127  
    3030{ 
    3131public: 
    32         const char *mpName;                     // "*" for all other keys (not implemented yet) 
    33         const char *mpDefaultValue;     // default for when it's not present 
    34         int Tests; 
    35         void *TestFunction;                     // set to zero for now, will implement later 
     32        typedef enum 
     33        { 
     34                NoDefaultValue = 1 
     35        } NoDefaultValue_t; 
     36 
     37        ConfigurationVerifyKey(std::string name, int flags, 
     38                void *testFunction = NULL); 
     39        // to allow passing ConfigurationVerifyKey::NoDefaultValue 
     40        // for default ListenAddresses 
     41        ConfigurationVerifyKey(std::string name, int flags, 
     42                NoDefaultValue_t t, void *testFunction = NULL); 
     43        ConfigurationVerifyKey(std::string name, int flags, 
     44                std::string defaultValue, void *testFunction = NULL); 
     45        ConfigurationVerifyKey(std::string name, int flags, 
     46                const char* defaultValue, void *testFunction = NULL); 
     47        ConfigurationVerifyKey(std::string name, int flags, 
     48                int defaultValue, void *testFunction = NULL); 
     49        ConfigurationVerifyKey(std::string name, int flags, 
     50                bool defaultValue, void *testFunction = NULL); 
     51        const std::string& Name() const { return mName; } 
     52        const std::string& DefaultValue() const { return mDefaultValue; } 
     53        const bool HasDefaultValue() const { return mHasDefaultValue; } 
     54        const int Flags() const { return mFlags; } 
     55        const void* TestFunction() const { return mTestFunction; } 
     56        ConfigurationVerifyKey(const ConfigurationVerifyKey& rToCopy); 
     57 
     58private: 
     59        ConfigurationVerifyKey& operator=(const ConfigurationVerifyKey& 
     60                noAssign); 
     61 
     62        std::string mName;         // "*" for all other keys (not implemented yet) 
     63        std::string mDefaultValue; // default for when it's not present 
     64        bool mHasDefaultValue; 
     65        int mFlags; 
     66        void *mTestFunction; // set to zero for now, will implement later 
    3667}; 
    3768 
     
    3970{ 
    4071public: 
    41         const char *mpName;                     // "*" for all other sub config names 
     72        std::string mName; // "*" for all other sub config names 
    4273        const ConfigurationVerify *mpSubConfigurations; 
    4374        const ConfigurationVerifyKey *mpKeys; 
    4475        int Tests;       
    45         void *TestFunction;                     // set to zero for now, will implement later 
     76        void *TestFunction; // set to zero for now, will implement later 
    4677}; 
    4778 
     
    80111        { return LoadAndVerify(rFilename, 0, rErrorMsg); } 
    81112         
    82         bool KeyExists(const char *pKeyName) const; 
    83         const std::string &GetKeyValue(const char *pKeyName) const; 
    84         int GetKeyValueInt(const char *pKeyName) const; 
    85         bool GetKeyValueBool(const char *pKeyName) const; 
     113        bool KeyExists(const std::string& rKeyName) const; 
     114        const std::string &GetKeyValue(const std::string& rKeyName) const; 
     115        int GetKeyValueInt(const std::string& rKeyName) const; 
     116        bool GetKeyValueBool(const std::string& rKeyName) const; 
    86117        std::vector<std::string> GetKeyNames() const; 
    87118         
    88         bool SubConfigurationExists(const char *pSubName) const; 
    89         const Configuration &GetSubConfiguration(const char *pSubName) const; 
     119        bool SubConfigurationExists(const std::string& rSubName) const; 
     120        const Configuration &GetSubConfiguration(const std::string& rSubName) const; 
    90121        std::vector<std::string> GetSubConfigurationNames() const; 
    91122         
  • box/trunk/lib/common/DebugMemLeakFinder.cpp

    r2124 r2127  
    147147        if(ptr && i == sMallocBlocks.end()) 
    148148        { 
    149                 TRACE1("Block %x realloc(), but not in list. Error? Or allocated in startup static objects?\n", ptr); 
     149                BOX_WARNING("Block " << ptr << " realloc()ated, but not " 
     150                        "in list. Error? Or allocated in startup static " 
     151                        "objects?"); 
    150152        } 
    151153 
     
    194196                else 
    195197                { 
    196                         TRACE1("Block %p freed, but not known. Error? Or allocated in startup static allocation?\n", ptr); 
     198                        BOX_WARNING("Block " << ptr << " freed, but not " 
     199                                "known. Error? Or allocated in startup " 
     200                                "static allocation?"); 
    197201                } 
    198202 
     
    294298                if(i == sMallocBlocks.end()) 
    295299                { 
    296                         TRACE0("Logical error in section block finding\n"); 
     300                        BOX_WARNING("Logical error in section block finding"); 
    297301                } 
    298302                else 
    299303                { 
    300                         TRACE4("Block %p size %d allocated at %s:%d\n", i->first, i->second.size, i->second.file, i->second.line); 
     304                        BOX_TRACE("Block " << i->first << " size " << 
     305                                i->second.size << " allocated at " << 
     306                                i->second.file << ":" << i->second.line); 
    301307                } 
    302308        } 
    303309        for(std::map<void *, ObjectInfo>::const_iterator i(sSectionObjectBlocks.begin()); i != sSectionObjectBlocks.end(); ++i) 
    304310        { 
    305                 TRACE5("Object%s %p size %d allocated at %s:%d\n", i->second.array?" []":"", i->first, i->second.size, i->second.file, i->second.line); 
     311                BOX_TRACE("Object" << (i->second.array?" []":"") << " " << 
     312                        i->first << " size " << i->second.size << 
     313                        " allocated at " << i->second.file <<  
     314                        ":" << i->second.line); 
    306315        } 
    307316} 
  • box/trunk/lib/common/EventWatchFilesystemObject.cpp

    r2124 r2127  
    2727// 
    2828// Function 
    29 //              Name:    EventWatchFilesystemObject::EventWatchFilesystemObject(const char *) 
    30 //              Purpose: Constructor -- opens the file object 
    31 //              Created: 12/3/04 
     29//      Name:    EventWatchFilesystemObject::EventWatchFilesystemObject 
     30//               (const char *) 
     31//      Purpose: Constructor -- opens the file object 
     32//      Created: 12/3/04 
    3233// 
    3334// -------------------------------------------------------------------------- 
     
    4041        if(mDescriptor == -1) 
    4142        { 
    42                 BOX_ERROR("EventWatchFilesystemObject: " 
    43                         "Failed to open file '" << Filename << "': " << 
    44                         strerror(errno)); 
     43                BOX_LOG_SYS_ERROR("EventWatchFilesystemObject: " 
     44                        "Failed to open file '" << Filename << "'"); 
    4545                THROW_EXCEPTION(CommonException, OSFileOpenError) 
    4646        } 
     
    5454// 
    5555// Function 
    56 //              Name:    EventWatchFilesystemObject::~EventWatchFilesystemObject() 
    57 //              Purpose: Destructor 
    58 //              Created: 12/3/04 
     56//      Name:    EventWatchFilesystemObject::~EventWatchFilesystemObject() 
     57//      Purpose: Destructor 
     58//      Created: 12/3/04 
    5959// 
    6060// -------------------------------------------------------------------------- 
     
    7171// 
    7272// Function 
    73 //              Name:    EventWatchFilesystemObject::EventWatchFilesystemObject(const EventWatchFilesystemObject &) 
    74 //              Purpose: Copy constructor 
    75 //              Created: 12/3/04 
     73//      Name:    EventWatchFilesystemObject::EventWatchFilesystemObject 
     74//               (const EventWatchFilesystemObject &) 
     75//      Purpose: Copy constructor 
     76//      Created: 12/3/04 
    7677// 
    7778// -------------------------------------------------------------------------- 
    78 EventWatchFilesystemObject::EventWatchFilesystemObject(const EventWatchFilesystemObject &rToCopy) 
     79EventWatchFilesystemObject::EventWatchFilesystemObject( 
     80        const EventWatchFilesystemObject &rToCopy) 
    7981        : mDescriptor(::dup(rToCopy.mDescriptor)) 
    8082{ 
     
    9092// 
    9193// Function 
    92 //              Name:    EventWatchFilesystemObject::FillInKEvent(struct kevent &, int) 
    93 //              Purpose: For WaitForEvent 
    94 //              Created: 12/3/04 
     94//      Name:    EventWatchFilesystemObject::FillInKEvent(struct kevent &, int) 
     95//      Purpose: For WaitForEvent 
     96//      Created: 12/3/04 
    9597// 
    9698// -------------------------------------------------------------------------- 
    97 void EventWatchFilesystemObject::FillInKEvent(struct kevent &rEvent, int Flags) const 
     99void EventWatchFilesystemObject::FillInKEvent(struct kevent &rEvent, 
     100        int Flags) const 
    98101{ 
    99         EV_SET(&rEvent, mDescriptor, EVFILT_VNODE, EV_CLEAR, NOTE_DELETE | NOTE_WRITE, 0, (void*)this); 
     102        EV_SET(&rEvent, mDescriptor, EVFILT_VNODE, EV_CLEAR, 
     103                NOTE_DELETE | NOTE_WRITE, 0, (void*)this); 
    100104} 
    101105#else 
    102 void EventWatchFilesystemObject::FillInPoll(int &fd, short &events, int Flags) const 
     106void EventWatchFilesystemObject::FillInPoll(int &fd, short &events, 
     107        int Flags) const 
    103108{ 
    104109        THROW_EXCEPTION(CommonException, KQueueNotSupportedOnThisPlatform) 
  • box/trunk/lib/common/FileStream.cpp

    r2124 r2127  
    3131        : mOSFileHandle(::open(Filename, flags, mode)), 
    3232#endif 
    33           mIsEOF(false) 
     33          mIsEOF(false), 
     34          mFileName(Filename) 
    3435{ 
    3536#ifdef WIN32 
     
    5051                } 
    5152        } 
    52 #ifdef WIN32 
    53         this->fileName = Filename; 
    54 #endif 
    5553} 
    5654 
     
    6664FileStream::FileStream(tOSFileHandle FileDescriptor) 
    6765        : mOSFileHandle(FileDescriptor), 
    68           mIsEOF(false) 
     66          mIsEOF(false), 
     67          mFileName("HANDLE") 
    6968{ 
    7069#ifdef WIN32 
     
    7877                THROW_EXCEPTION(CommonException, OSFileOpenError) 
    7978        } 
    80 #ifdef WIN32 
    81         this->fileName = "HANDLE"; 
    82 #endif 
    8379} 
    8480 
     
    151147                ); 
    152148 
    153         if ( valid ) 
     149        if(valid) 
    154150        { 
    155151                r = numBytesRead; 
    156152        } 
    157         else if (GetLastError() == ERROR_BROKEN_PIPE) 
     153        else if(GetLastError() == ERROR_BROKEN_PIPE) 
    158154        { 
    159155                r = 0; 
     
    161157        else 
    162158        { 
    163                 BOX_ERROR("Failed to read from file: " << 
    164                         GetErrorMessage(GetLastError())); 
     159                BOX_LOG_WIN_ERROR("Failed to read from file: " << mFileName); 
    165160                r = -1; 
    166161        } 
    167162#else 
    168163        int r = ::read(mOSFileHandle, pBuffer, NBytes); 
    169 #endif 
    170164        if(r == -1) 
    171165        { 
     166                BOX_LOG_SYS_ERROR("Failed to read from file: " << mFileName); 
     167        } 
     168#endif 
     169 
     170        if(r == -1) 
     171        { 
    172172                THROW_EXCEPTION(CommonException, OSFileReadError) 
    173173        } 
     174 
    174175        if(r == 0) 
    175176        { 
  • box/trunk/lib/common/FileStream.h

    r2124 r2127  
    5858        FileStream(const FileStream &rToCopy) { /* do not call */ } 
    5959 
    60 #ifdef WIN32 
    6160        // for debugging.. 
    62         std::string fileName; 
    63 #endif 
     61        std::string mFileName; 
    6462}; 
    6563 
  • box/trunk/lib/common/Guards.h

    r2124 r2127  
    3838                if(mOSFileHandle < 0) 
    3939                { 
    40                         BOX_ERROR("FileHandleGuard: failed to open file '" << 
    41                                 rFilename << "': " << strerror(errno)); 
     40                        BOX_LOG_SYS_ERROR("FileHandleGuard: failed to open "  
     41                                "file '" << rFilename << "'"); 
    4242                        THROW_EXCEPTION(CommonException, OSFileOpenError) 
    4343                } 
  • box/trunk/lib/common/Logging.h

    r2124 r2127  
    2828#define BOX_LOG(level, stuff) \ 
    2929{ \ 
    30         std::ostringstream line; \ 
    31         line << stuff; \ 
    32         Logging::Log(level, __FILE__, __LINE__, line.str()); \ 
     30        std::ostringstream _box_log_line; \ 
     31        _box_log_line << stuff; \ 
     32        Logging::Log(level, __FILE__, __LINE__, _box_log_line.str()); \ 
    3333} 
    3434 
    3535#define BOX_SYSLOG(level, stuff) \ 
    3636{ \ 
    37         std::ostringstream line; \ 
    38         line << stuff; \ 
    39         Logging::LogToSyslog(level, __FILE__, __LINE__, line.str()); \ 
     37        std::ostringstream _box_log_line; \ 
     38        _box_log_line << stuff; \ 
     39        Logging::LogToSyslog(level, __FILE__, __LINE__, _box_log_line.str()); \ 
    4040} 
    4141 
     
    4949        { BOX_LOG(Log::TRACE, stuff) } 
    5050 
    51 #define BOX_FORMAT_ACCOUNT(accno) \ 
     51#define BOX_LOG_SYS_WARNING(stuff) \ 
     52        BOX_WARNING(stuff << ": " << strerror(errno) << " (" << errno << ")") 
     53#define BOX_LOG_SYS_ERROR(stuff) \ 
     54        BOX_ERROR(stuff << ": " << strerror(errno) << " (" << errno << ")") 
     55#define BOX_LOG_SYS_FATAL(stuff) \ 
     56        BOX_FATAL(stuff << ": " << strerror(errno) << " (" << errno << ")") 
     57 
     58#ifdef WIN32 
     59        #define BOX_LOG_WIN_ERROR(stuff) \ 
     60                BOX_ERROR(stuff << ": " << GetErrorMessage(GetLastError())) 
     61        #define BOX_LOG_WIN_ERROR_NUMBER(stuff, number) \ 
     62                BOX_ERROR(stuff << ": " << GetErrorMessage(number)) 
     63#endif 
     64 
     65#define BOX_FORMAT_HEX32(number) \ 
    5266        std::hex << \ 
    5367        std::showbase << \ 
     
    5569        std::setw(10) << \ 
    5670        std::setfill('0') << \ 
    57         (accno) << \ 
     71        (number) << \ 
    5872        std::dec 
     73 
     74#define BOX_FORMAT_ACCOUNT(accno) \ 
     75        BOX_FORMAT_HEX32(accno) 
    5976 
    6077#define BOX_FORMAT_OBJECTID(objectid) \ 
  • box/trunk/lib/common/PartialReadStream.cpp

    r2124 r2127  
    4545        if(mBytesLeft != 0) 
    4646        { 
    47                 TRACE1("PartialReadStream::~PartialReadStream when mBytesLeft = %d\n", mBytesLeft); 
     47                BOX_TRACE("PartialReadStream destroyed with " << mBytesLeft << 
     48                        " bytes remaining"); 
    4849        } 
    4950} 
  • box/trunk/lib/common/Utils.cpp

    r2124 r2127  
    5454        } 
    5555/*#ifndef NDEBUG 
    56         TRACE2("Splitting string '%s' on %c\n", String.c_str(), SplitOn); 
     56        BOX_TRACE("Splitting string '" << String << " on " << (char)SplitOn); 
    5757        for(unsigned int l = 0; l < rOutput.size(); ++l) 
    5858        { 
    59                 TRACE2("%d = '%s'\n", l, rOutput[l].c_str()); 
     59                BOX_TRACE(l << " = '" << rOutput[l] << "'"); 
    6060        } 
    6161#endif*/ 
     
    160160} 
    161161 
    162  
    163  
    164  
     162std::string HumanReadableSize(int64_t Bytes) 
     163{ 
     164        double readableValue = Bytes; 
     165        std::string units = " B"; 
     166 
     167        if (readableValue > 1024) 
     168        { 
     169                readableValue /= 1024; 
     170                units = "kB"; 
     171        } 
     172   
     173        if (readableValue > 1024) 
     174        { 
     175                readableValue /= 1024; 
     176                units = "MB"; 
     177        } 
     178   
     179        if (readableValue > 1024) 
     180        { 
     181                readableValue /= 1024; 
     182                units = "GB"; 
     183        } 
     184   
     185        std::ostringstream result; 
     186        result << std::fixed << std::setprecision(2) << readableValue << 
     187                " " << units; 
     188        return result.str(); 
     189} 
     190 
     191std::string FormatUsageBar(int64_t Blocks, int64_t Bytes, int64_t Max) 
     192{ 
     193        std::ostringstream result; 
     194         
     195        // Bar graph 
     196        char bar[17]; 
     197        unsigned int b = (int)((Bytes * (sizeof(bar)-1)) / Max); 
     198        if(b > sizeof(bar)-1) {b = sizeof(bar)-1;} 
     199        for(unsigned int l = 0; l < b; l++) 
     200        { 
     201                bar[l] = '*'; 
     202        } 
     203        for(unsigned int l = b; l < sizeof(bar) - 1; l++) 
     204        { 
     205                bar[l] = ' '; 
     206        } 
     207        bar[sizeof(bar)-1] = '\0'; 
     208         
     209        result << std::fixed << 
     210                std::setw(10) << Blocks << " blocks, " << 
     211                std::setw(10) << HumanReadableSize(Bytes) << ", " <<  
     212                std::setw(3) << std::setprecision(0) << 
     213                ((Bytes*100)/Max) << "% |" << bar << "|"; 
     214         
     215        return result.str(); 
     216} 
     217 
     218std::string FormatUsageLineStart(const std::string& rName) 
     219{ 
     220        std::ostringstream result;       
     221        result << std::setw(20) << std::right << rName << ": "; 
     222        return result.str(); 
     223} 
  • box/trunk/lib/common/Utils.h

    r2124 r2127  
    3131}; 
    3232int ObjectExists(const std::string& rFilename); 
     33std::string HumanReadableSize(int64_t Bytes); 
     34std::string FormatUsageBar(int64_t Blocks, int64_t Bytes, int64_t Max); 
     35std::string FormatUsageLineStart(const std::string& rName); 
    3336 
    3437#include "MemLeakFindOff.h" 
  • box/trunk/lib/compress/Compress.h

    r2124 r2127  
    5353                        :(inflateEnd(&mStream)))) != Z_OK) 
    5454                { 
    55                         TRACE1("zlib error code = %d\n", r); 
     55                        BOX_WARNING("zlib error code = " << r); 
    5656                        if(r == Z_DATA_ERROR) 
    5757                        { 
    58                                 TRACE0("WARNING: End of compress/decompress without all input being consumed -- possible corruption?\n"); 
     58                                BOX_WARNING("End of compress/decompress " 
     59                                        "without all input being consumed, " 
     60                                        "possible corruption?"); 
    5961                        } 
    6062                        else 
     
    149151                if(ret < 0) 
    150152                { 
    151                         TRACE1("zlib error code = %d\n", ret);                   
     153                        BOX_WARNING("zlib error code = " << ret);                        
    152154                        THROW_EXCEPTION(CompressException, TransformFailed) 
    153155                } 
  • box/trunk/lib/compress/CompressStream.cpp

    r2124 r2127  
    415415                size *= 2; 
    416416        } 
    417         TRACE1("Allocating CompressStream buffer, size %d\n", size); 
     417        BOX_TRACE("Allocating CompressStream buffer, size " << size); 
    418418        mpBuffer = ::malloc(size); 
    419419        if(mpBuffer == 0) 
  • box/trunk/lib/crypto/CipherContext.cpp

    r2124 r2127  
    167167        if(mWithinTransform) 
    168168        { 
    169                 TRACE0("CipherContext::Begin called when context flagged as within a transform\n"); 
     169                BOX_WARNING("CipherContext::Begin called when context " 
     170                        "flagged as within a transform"); 
    170171        } 
    171172 
     
    424425        if(mWithinTransform) 
    425426        { 
    426                 TRACE0("CipherContext::TransformBlock called when context flagged as within a transform\n"); 
     427                BOX_WARNING("CipherContext::TransformBlock called when " 
     428                        "context flagged as within a transform"); 
    427429        } 
    428430 
     
    522524        if(mWithinTransform) 
    523525        { 
    524                 TRACE0("CipherContext::SetIV called when context flagged as within a transform\n"); 
     526                BOX_WARNING("CipherContext::SetIV called when context " 
     527                        "flagged as within a transform"); 
    525528        } 
    526529 
     
    560563        if(mWithinTransform) 
    561564        { 
    562                 TRACE0("CipherContext::SetRandomIV called when context flagged as within a transform\n"); 
     565                BOX_WARNING("CipherContext::SetRandomIV called when " 
     566                        "context flagged as within a transform"); 
    563567        } 
    564568 
  • box/trunk/lib/intercept/intercept.cpp

    r2124 r2127  
    376376        if (hookfn != NULL) 
    377377        { 
    378                 TRACE2("readdir hooked to %p for %s\n", hookfn, dirname); 
     378                BOX_TRACE("readdir hooked to " << hookfn << " for " << dirname); 
    379379        } 
    380380        else if (intercept_filename != NULL) 
    381381        { 
    382                 TRACE2("readdir unhooked from %p for %s\n", readdir_hook,  
    383                         intercept_filename); 
     382                BOX_TRACE("readdir unhooked from " << readdir_hook <<  
     383                        " for " << intercept_filename); 
    384384        } 
    385385 
     
    393393        if (hookfn != NULL) 
    394394        { 
    395                 TRACE2("lstat hooked to %p for %s\n", hookfn, filename); 
     395                BOX_TRACE("lstat hooked to " << hookfn << " for " << filename); 
    396396        } 
    397397        else 
    398398        { 
    399                 TRACE2("lstat unhooked from %p for %s\n", lstat_hook,  
     399                BOX_TRACE("lstat unhooked from " << lstat_hook << " for " << 
    400400                        lstat_file); 
    401401        } 
  • box/trunk/lib/raidfile/RaidFileController.cpp

    r2124 r2127  
    7171        static const ConfigurationVerifyKey verifykeys[] = 
    7272        { 
    73                 {"SetNumber",   0,      ConfigTest_Exists | ConfigTest_IsInt, 0}, 
    74                 {"BlockSize",   0,      ConfigTest_Exists | ConfigTest_IsInt, 0}, 
    75                 {"Dir0",                0,      ConfigTest_Exists, 0}, 
    76                 {"Dir1",                0,      ConfigTest_Exists, 0}, 
    77                 {"Dir2",                0,      ConfigTest_Exists | ConfigTest_LastEntry, 0} 
     73                ConfigurationVerifyKey("SetNumber", 
     74                        ConfigTest_Exists | ConfigTest_IsInt), 
     75                ConfigurationVerifyKey("BlockSize", 
     76                        ConfigTest_Exists | ConfigTest_IsInt), 
     77                ConfigurationVerifyKey("Dir0", ConfigTest_Exists), 
     78                ConfigurationVerifyKey("Dir1", ConfigTest_Exists), 
     79                ConfigurationVerifyKey("Dir2", 
     80                        ConfigTest_Exists | ConfigTest_LastEntry) 
    7881        }; 
    7982         
  • box/trunk/lib/raidfile/RaidFileWrite.cpp

    r2124 r2127  
    9797                if(existance != RaidFileUtil::NoFile) 
    9898                { 
    99                         TRACE2("Trying to overwrite raidfile %d %s\n", mSetNumber, mFilename.c_str()); 
     99                        BOX_ERROR("Attempted to overwrite raidfile " << 
     100                                mSetNumber << " " << mFilename); 
    100101                        THROW_EXCEPTION(RaidFileException, CannotOverwriteExistingFile) 
    101102                } 
     
    179180        if(written != Length) 
    180181        { 
    181                 TRACE3("RaidFileWrite::Write: Write failure, Length = %d, written = %d, errno = %d\n", Length, written, errno); 
     182                BOX_LOG_SYS_ERROR("RaidFileWrite failed, Length = " << 
     183                        Length << ", written = " << written); 
    182184                THROW_EXCEPTION(RaidFileException, OSError) 
    183185        } 
     
    780782void RaidFileWrite::Close() 
    781783{ 
    782         TRACE0("Warning: RaidFileWrite::Close() called, discarding file\n"); 
     784        BOX_WARNING("RaidFileWrite::Close() called, discarding file"); 
    783785        if(mOSFileHandle != -1) 
    784786        { 
  • box/trunk/lib/server/Daemon.cpp

    r2124 r2127  
    466466                        if(::setsid() == -1) 
    467467                        { 
    468                                 BOX_ERROR("Failed to setsid(): " <<  
    469                                         strerror(errno)); 
     468                                BOX_LOG_SYS_ERROR("Failed to setsid()"); 
    470469                                THROW_EXCEPTION(ServerException, DaemoniseFailed) 
    471470                        } 
     
    476475                        case -1: 
    477476                                // error 
     477                                BOX_LOG_SYS_ERROR("Failed to fork() a child"); 
    478478                                THROW_EXCEPTION(ServerException, DaemoniseFailed) 
    479479                                break; 
     
    498498                sa.sa_handler = SignalHandler; 
    499499                sa.sa_flags = 0; 
    500                 sigemptyset(&sa.sa_mask);               // macro 
    501                 if(::sigaction(SIGHUP, &sa, NULL) != 0 || ::sigaction(SIGTERM, &sa, NULL) != 0) 
    502                 { 
     500                sigemptyset(&sa.sa_mask); // macro 
     501                if(::sigaction(SIGHUP, &sa, NULL) != 0 || 
     502                        ::sigaction(SIGTERM, &sa, NULL) != 0) 
     503                { 
     504                        BOX_LOG_SYS_ERROR("Failed to set signal handlers"); 
    503505                        THROW_EXCEPTION(ServerException, DaemoniseFailed) 
    504506                } 
     
    516518                if(::write(pidFile, pid, pidsize) != pidsize) 
    517519                { 
    518                         BOX_FATAL("can't write pid file"); 
     520                        BOX_LOG_SYS_FATAL("Failed to write PID file: " << 
     521                                pidFileName); 
    519522                        THROW_EXCEPTION(ServerException, DaemoniseFailed) 
    520523                } 
     
    545548                        if(devnull == -1) 
    546549                        { 
     550                                BOX_LOG_SYS_ERROR("Failed to open /dev/null"); 
    547551                                THROW_EXCEPTION(CommonException, OSFileError); 
    548552                        } 
     
    891895                        return 0; 
    892896                } 
     897                BOX_LOG_SYS_ERROR("Failed to stat configuration file: " << 
     898                        GetConfigFileName()); 
    893899                THROW_EXCEPTION(CommonException, OSFileError) 
    894900        } 
  • box/trunk/lib/server/Daemon.h

    r2124 r2127  
    9393}; 
    9494 
    95 #define DAEMON_VERIFY_SERVER_KEYS       {"PidFile", 0, ConfigTest_Exists, 0}, \ 
    96                                                                         {"User", 0, ConfigTest_LastEntry, 0} 
     95#define DAEMON_VERIFY_SERVER_KEYS \ 
     96        ConfigurationVerifyKey("PidFile", ConfigTest_Exists), \ 
     97        ConfigurationVerifyKey("User", ConfigTest_LastEntry) 
    9798 
    9899#endif // DAEMON__H 
  • box/trunk/lib/server/ProtocolUncertainStream.cpp

    r2124 r2127  
    4242        if(!mFinished) 
    4343        { 
    44                 TRACE0("ProtocolUncertainStream::~ProtocolUncertainStream() destroyed when stream not complete\n"); 
     44                BOX_WARNING("ProtocolUncertainStream destroyed before " 
     45                        "stream finished"); 
    4546        } 
    4647} 
  • box/trunk/lib/server/ServerControl.h

    r2124 r2127  
    143143        if (!killed) 
    144144        { 
    145                 BOX_ERROR("Failed to kill process " << pid << ": " << 
    146                         strerror(errno)); 
     145                BOX_LOG_SYS_ERROR("Failed to kill process " << pid); 
    147146        } 
    148147        TEST_THAT(killed); 
  • box/trunk/lib/server/ServerStream.h

    r2124 r2127  
    274274                                                         
    275275                                                        // Log it 
    276                                                         BOX_WARNING("Message from child process " << pid << ": " << logMessage); 
     276                                                        BOX_NOTICE("Message from child process " << pid << ": " << logMessage); 
    277277                                                } 
    278278                                                else 
     
    366366 
    367367#define SERVERSTREAM_VERIFY_SERVER_KEYS(DEFAULT_ADDRESSES) \ 
    368                                                                                         {"ListenAddresses", DEFAULT_ADDRESSES, 0, 0}, \ 
    369                                                                                         DAEMON_VERIFY_SERVER_KEYS  
     368        ConfigurationVerifyKey("ListenAddresses", 0, DEFAULT_ADDRESSES), \ 
     369        DAEMON_VERIFY_SERVER_KEYS  
    370370 
    371371#include "MemLeakFindOff.h" 
  • box/trunk/lib/server/ServerTLS.h

    r2124 r2127  
    7171 
    7272#define SERVERTLS_VERIFY_SERVER_KEYS(DEFAULT_ADDRESSES) \ 
    73                                                                                         {"CertificateFile", 0, ConfigTest_Exists, 0}, \ 
    74                                                                                         {"PrivateKeyFile", 0, ConfigTest_Exists, 0}, \ 
    75                                                                                         {"TrustedCAsFile", 0, ConfigTest_Exists, 0}, \ 
    76                                                                                         SERVERSTREAM_VERIFY_SERVER_KEYS(DEFAULT_ADDRESSES) 
    77  
     73        ConfigurationVerifyKey("CertificateFile", ConfigTest_Exists), \ 
     74        ConfigurationVerifyKey("PrivateKeyFile", ConfigTest_Exists), \ 
     75        ConfigurationVerifyKey("TrustedCAsFile", ConfigTest_Exists), \ 
     76        SERVERSTREAM_VERIFY_SERVER_KEYS(DEFAULT_ADDRESSES) 
    7877 
    7978#endif // SERVERTLS__H 
  • box/trunk/lib/server/SocketListen.h

    r2124 r2127  
    109109#endif 
    110110                        { 
    111                                 THROW_EXCEPTION(ServerException, SocketCloseError) 
     111                                BOX_LOG_SYS_ERROR("Failed to close network " 
     112                                        "socket"); 
     113                                THROW_EXCEPTION(ServerException, 
     114                                        SocketCloseError) 
    112115                        } 
    113116                } 
     
    115118        } 
    116119 
    117         // -------------------------------------------------------------------------- 
     120        // ------------------------------------------------------------------ 
    118121        // 
    119122        // Function 
     
    122125        //              Created: 2003/07/31 
    123126        // 
    124         // -------------------------------------------------------------------------- 
     127        // ------------------------------------------------------------------ 
    125128        void Listen(int Type, const char *Name, int Port = 0) 
    126129        { 
    127                 if(mSocketHandle != -1) {THROW_EXCEPTION(ServerException, SocketAlreadyOpen)} 
     130                if(mSocketHandle != -1) 
     131                { 
     132                        THROW_EXCEPTION(ServerException, SocketAlreadyOpen); 
     133                } 
    128134                 
    129135                // Setup parameters based on type, looking up names if required 
     
    131137                SocketAllAddr addr; 
    132138                int addrLen = 0; 
    133                 Socket::NameLookupToSockAddr(addr, sockDomain, Type, Name, Port, addrLen); 
     139                Socket::NameLookupToSockAddr(addr, sockDomain, Type, Name, 
     140                        Port, addrLen); 
    134141         
    135142                // Create the socket 
    136                 mSocketHandle = ::socket(sockDomain, SOCK_STREAM, 0 /* let OS choose protocol */); 
     143                mSocketHandle = ::socket(sockDomain, SOCK_STREAM, 
     144                        0 /* let OS choose protocol */); 
    137145                if(mSocketHandle == -1) 
    138146                { 
     147                        BOX_LOG_SYS_ERROR("Failed to create a network socket"); 
    139148                        THROW_EXCEPTION(ServerException, SocketOpenError) 
    140149                } 
     
    142151                // Set an option to allow reuse (useful for -HUP situations!) 
    143152#ifdef WIN32 
    144                 if(::setsockopt(mSocketHandle, SOL_SOCKET, SO_REUSEADDR, "", 0) == -1) 
     153                if(::setsockopt(mSocketHandle, SOL_SOCKET, SO_REUSEADDR, "", 
     154                        0) == -1) 
    145155#else 
    146156                int option = true; 
    147                 if(::setsockopt(mSocketHandle, SOL_SOCKET, SO_REUSEADDR, &option, sizeof(option)) == -1) 
    148 #endif 
    149                 { 
     157                if(::setsockopt(mSocketHandle, SOL_SOCKET, SO_REUSEADDR, 
     158                        &option, sizeof(option)) == -1) 
     159#endif 
     160                { 
     161                        BOX_LOG_SYS_ERROR("Failed to set socket options"); 
    150162                        THROW_EXCEPTION(ServerException, SocketOpenError) 
    151163                } 
     
    162174        } 
    163175         
    164         // -------------------------------------------------------------------------- 
     176        // ------------------------------------------------------------------ 
    165177        // 
    166178        // Function 
    167179        //              Name:    SocketListen::Accept(int) 
    168         //              Purpose: Accepts a connection, returning a pointer to a class of 
    169         //                               the specified type. May return a null pointer if a signal happens, 
    170         //                               or there's a timeout. Timeout specified in milliseconds, defaults to infinite time. 
     180        //              Purpose: Accepts a connection, returning a pointer to 
     181        //                       a class of the specified type. May return a 
     182        //                       null pointer if a signal happens, or there's 
     183        //                       a timeout. Timeout specified in 
     184        //                       milliseconds, defaults to infinite time. 
    171185        //              Created: 2003/07/31 
    172186        // 
    173         // -------------------------------------------------------------------------- 
    174         std::auto_ptr<SocketType> Accept(int Timeout = INFTIM, std::string *pLogMsg = 0) 
    175         { 
    176                 if(mSocketHandle == -1) {THROW_EXCEPTION(ServerException, BadSocketHandle)} 
     187        // ------------------------------------------------------------------ 
     188        std::auto_ptr<SocketType> Accept(int Timeout = INFTIM, 
     189                std::string *pLogMsg = 0) 
     190        { 
     191                if(mSocketHandle == -1) 
     192                { 
     193                        THROW_EXCEPTION(ServerException, BadSocketHandle); 
     194                } 
    177195                 
    178196                // Do the accept, using the supplied locking type 
     
    186204                        if(!socklock.HaveLock()) 
    187205                        { 
    188                                 // Didn't get the lock for some reason. Wait a while, then 
    189                                 // return nothing. 
     206                                // Didn't get the lock for some reason. 
     207                                // Wait a while, then return nothing. 
     208                                BOX_ERROR("Failed to get a lock on incoming " 
     209                                        "connection"); 
    190210                                ::sleep(1); 
    191211                                return std::auto_ptr<SocketType>(); 
     
    203223                                if(errno == EINTR) 
    204224                                { 
     225                                        BOX_ERROR("Failed to accept " 
     226                                                "connection: interrupted by " 
     227                                                "signal"); 
    205228                                        // return nothing 
    206229                                        return std::auto_ptr<SocketType>(); 
     
    208231                                else 
    209232                                { 
    210                                         THROW_EXCEPTION(ServerException, SocketPollError) 
     233                                        BOX_LOG_SYS_ERROR("Failed to poll " 
     234                                                "connection"); 
     235                                        THROW_EXCEPTION(ServerException, 
     236                                                SocketPollError) 
    211237                                } 
    212238                                break; 
     
    221247                        sock = ::accept(mSocketHandle, &addr, &addrlen); 
    222248                } 
    223                 // Got socket (or error), unlock (implcit in destruction) 
     249 
     250                // Got socket (or error), unlock (implicit in destruction) 
    224251                if(sock == -1) 
    225252                { 
     253                        BOX_LOG_SYS_ERROR("Failed to accept connection"); 
    226254                        THROW_EXCEPTION(ServerException, SocketAcceptError) 
    227255                } 
     
    230258                if(pLogMsg) 
    231259                { 
    232                         *pLogMsg = Socket::IncomingConnectionLogMessage(&addr, addrlen); 
     260                        *pLogMsg = Socket::IncomingConnectionLogMessage(&addr, 
     261                                addrlen); 
    233262                } 
    234263                else 
     
    244273        // on multiple sockets. 
    245274#ifdef HAVE_KQUEUE 
    246         // -------------------------------------------------------------------------- 
     275        // ------------------------------------------------------------------ 
    247276        // 
    248277        // Function 
     
    251280        //              Created: 9/3/04 
    252281        // 
    253         // -------------------------------------------------------------------------- 
     282        // ------------------------------------------------------------------ 
    254283        void FillInKEvent(struct kevent &rEvent, int Flags = 0) const 
    255284        { 
    256                 EV_SET(&rEvent, mSocketHandle, EVFILT_READ, 0, 0, 0, (void*)this); 
     285                EV_SET(&rEvent, mSocketHandle, EVFILT_READ, 0, 0, 0, 
     286                        (void*)this); 
    257287        } 
    258288#else 
    259         // -------------------------------------------------------------------------- 
     289        // ------------------------------------------------------------------ 
    260290        // 
    261291        // Function 
    262292        //              Name:    SocketListen::FillInPoll 
    263         //              Purpose: Fills in the data necessary for a poll operation 
     293        //              Purpose: Fills in the data necessary for a poll 
     294        //                       operation 
    264295        //              Created: 9/3/04 
    265296        // 
    266         // -------------------------------------------------------------------------- 
     297        // ------------------------------------------------------------------ 
    267298        void FillInPoll(int &fd, short &events, int Flags = 0) const 
    268299        { 
  • box/trunk/lib/server/SocketStream.cpp

    r2124 r2127  
    151151 
    152152        // Create the socket 
    153         mSocketHandle = ::socket(sockDomain, SOCK_STREAM, 0 /* let OS choose protocol */); 
     153        mSocketHandle = ::socket(sockDomain, SOCK_STREAM, 
     154                0 /* let OS choose protocol */); 
    154155        if(mSocketHandle == INVALID_SOCKET_VALUE) 
    155156        { 
     157                BOX_LOG_SYS_ERROR("Failed to create a network socket"); 
    156158                THROW_EXCEPTION(ServerException, SocketOpenError) 
    157159        } 
     
    164166                DWORD err = WSAGetLastError(); 
    165167                ::closesocket(mSocketHandle); 
    166 #else 
    167                 int err = errno; 
     168                BOX_LOG_WIN_ERROR_NUMBER("Failed to connect to socket "  
     169                        "(type " << Type << ", name " << Name << 
     170                        ", port " << Port << ")", err); 
     171#else // !WIN32 
     172                BOX_LOG_SYS_ERROR("Failed to connect to socket (type " << 
     173                        Type << ", name " << Name << ", port " << Port << 
     174                        ")"); 
    168175                ::close(mSocketHandle); 
    169 #endif 
    170  
    171 #ifdef WIN32 
    172                 BOX_ERROR("Failed to connect to socket (type " << Type << 
    173                         ", name " << Name << ", port " << Port << "): " << 
    174                                 GetErrorMessage(err) 
    175                         ); 
    176 #else 
    177                 BOX_ERROR("Failed to connect to socket (type " << Type << 
    178                         ", name " << Name << ", port " << Port << "): " << 
    179                                 strerror(err) << " (" << err << ")" 
    180                         ); 
    181 #endif 
     176#endif // WIN32 
    182177 
    183178                mSocketHandle = INVALID_SOCKET_VALUE; 
     
    221216                        { 
    222217                                // Bad! 
    223                                 THROW_EXCEPTION(ServerException, SocketPollError) 
     218                                BOX_LOG_SYS_ERROR("Failed to poll socket"); 
     219                                THROW_EXCEPTION(ServerException, 
     220                                        SocketPollError) 
    224221                        } 
    225222                        break; 
     
    251248                { 
    252249                        // Other error 
    253                         THROW_EXCEPTION(ConnectionException, Conn_SocketReadError) 
     250                        BOX_LOG_SYS_ERROR("Failed to read from socket"); 
     251                        THROW_EXCEPTION(ConnectionException, 
     252                                Conn_SocketReadError); 
    254253                } 
    255254        } 
     255 
    256256        // Closed for reading? 
    257257        if(r == 0) 
     
    298298                        // Error. 
    299299                        mWriteClosed = true;    // assume can't write again 
    300                         THROW_EXCEPTION(ConnectionException, Conn_SocketWriteError) 
     300                        BOX_LOG_SYS_ERROR("Failed to write to socket"); 
     301                        THROW_EXCEPTION(ConnectionException, 
     302                                Conn_SocketWriteError); 
    301303                } 
    302304                 
     
    311313                if(bytesLeft > 0) 
    312314                { 
    313                         TRACE3("Waiting to send data on socket %d, (%d to send of %d)\n", mSocketHandle, bytesLeft, NBytes); 
     315                        BOX_TRACE("Waiting to send data on socket " <<  
     316                                mSocketHandle << " (" << bytesLeft << 
     317                                " of " << NBytes << " bytes left)"); 
    314318                         
    315319                        // Wait for data to send. 
     
    324328                                if(errno != EINTR) 
    325329                                { 
    326                                         THROW_EXCEPTION(ServerException, SocketPollError) 
     330                                        BOX_LOG_SYS_ERROR("Failed to poll " 
     331                                                "socket"); 
     332                                        THROW_EXCEPTION(ServerException, 
     333                                                SocketPollError) 
    327334                                } 
    328335                        } 
     
    351358#endif 
    352359        { 
     360                BOX_LOG_SYS_ERROR("Failed to close socket"); 
    353361                THROW_EXCEPTION(ServerException, SocketCloseError) 
    354362        } 
     
    381389        if(::shutdown(mSocketHandle, how) == -1) 
    382390        { 
     391                BOX_LOG_SYS_ERROR("Failed to shutdown socket"); 
    383392                THROW_EXCEPTION(ConnectionException, Conn_SocketShutdownError) 
    384393        } 
     
    459468        socklen_t credLen = sizeof(cred); 
    460469 
    461         if(::getsockopt(mSocketHandle, SOL_SOCKET, SO_PEERCRED, &cred, &credLen) == 0) 
     470        if(::getsockopt(mSocketHandle, SOL_SOCKET, SO_PEERCRED, &cred, 
     471                &credLen) == 0) 
    462472        { 
    463473                rUidOut = cred.uid; 
     
    465475                return true; 
    466476        } 
     477 
     478        BOX_LOG_SYS_ERROR("Failed to get peer credentials on socket"); 
    467479#endif 
    468480 
  • box/trunk/test/backupdiff/testbackupdiff.cpp

    r2124 r2127  
    111111        // number of blocks 
    112112        int64_t nblocks = box_ntoh64(hdr.mNumBlocks); 
    113         TRACE2("Reading index from '%s', has %lld blocks\n", filename, nblocks); 
    114         TRACE0("======== ===== ========== ======== ========\n   Index Where  EncSz/Idx     Size  WChcksm\n"); 
     113        BOX_TRACE("Reading index from '" << filename << "', has " << 
     114                nblocks << " blocks"); 
     115        BOX_TRACE("======== ===== ========== ======== ========"); 
     116        BOX_TRACE("   Index Where  EncSz/Idx     Size  WChcksm"); 
    115117        // Read them all in 
    116118        int64_t nnew = 0, nold = 0; 
     
    120122                TEST_THAT(enc.ReadFullBuffer(&en, sizeof(en), 0)); 
    121123                int64_t s = box_ntoh64(en.mEncodedSize); 
    122                 if(s > 0) 
    123                 { 
    124                         nnew++; 
    125                         #ifdef WIN32 
    126                         TRACE2("%8I64d this  s=%8I64d", b, s); 
    127                         #else 
    128                         TRACE2("%8lld this  s=%8lld", b, s); 
    129                         #endif 
    130                 } 
    131                 else 
    132                 { 
    133                         nold++; 
    134                         #ifdef WIN32 
    135                         TRACE2("%8I64d other i=%8I64d", b, 0 - s);               
    136                         #else 
    137                         TRACE2("%8lld other i=%8lld", b, 0 - s);                 
    138                         #endif 
    139                 } 
     124 
    140125                // Decode the rest 
    141126                uint64_t iv = box_ntoh64(hdr.mEntryIVBase); 
    142127                iv += b; 
    143                 sBlowfishDecryptBlockEntry.SetIV(&iv);                   
     128                sBlowfishDecryptBlockEntry.SetIV(&iv); 
    144129                file_BlockIndexEntryEnc entryEnc; 
    145                 sBlowfishDecryptBlockEntry.TransformBlock(&entryEnc, sizeof(entryEnc), 
    146                                 en.mEnEnc, sizeof(en.mEnEnc)); 
    147                 TRACE2(" %8d %08x\n", ntohl(entryEnc.mSize), ntohl(entryEnc.mWeakChecksum)); 
    148                  
    149         } 
    150         TRACE0("======== ===== ========== ======== ========\n"); 
     130                sBlowfishDecryptBlockEntry.TransformBlock(&entryEnc, 
     131                        sizeof(entryEnc), en.mEnEnc, sizeof(en.mEnEnc)); 
     132 
     133 
     134                if(s > 0) 
     135                { 
     136                        nnew++; 
     137                        BOX_TRACE(std::setw(8) << b << " this  s=" <<  
     138                                std::setw(8) << s << " " << 
     139                                std::setw(8) << ntohl(entryEnc.mSize) << " " << 
     140                                std::setw(8) << std::setfill('0') << 
     141                                std::hex << ntohl(entryEnc.mWeakChecksum)); 
     142                } 
     143                else 
     144                { 
     145                        nold++; 
     146                        BOX_TRACE(std::setw(8) << b << " other i=" <<  
     147                                std::setw(8) << (0-s) << " " << 
     148                                std::setw(8) << ntohl(entryEnc.mSize) << " " << 
     149                                std::setw(8) << std::setfill('0') << 
     150                                std::hex << ntohl(entryEnc.mWeakChecksum)); 
     151                } 
     152        } 
     153        BOX_TRACE("======== ===== ========== ======== ========"); 
    151154        TEST_THAT(new_blocks_expected == nnew); 
    152155        TEST_THAT(old_blocks_expected == nold); 
  • box/trunk/test/basicserver/testbasicserver.cpp

    r2124 r2127  
    186186        static ConfigurationVerifyKey verifyserverkeys[] =  
    187187        { 
    188                 SERVERSTREAM_VERIFY_SERVER_KEYS(0)      // no default addresses 
     188                SERVERSTREAM_VERIFY_SERVER_KEYS(ConfigurationVerifyKey::NoDefaultValue) // no default listen addresses 
    189189        }; 
    190190 
     
    259259        static ConfigurationVerifyKey verifyserverkeys[] =  
    260260        { 
    261                 SERVERTLS_VERIFY_SERVER_KEYS(0) // no default listen addresses 
     261                SERVERTLS_VERIFY_SERVER_KEYS(ConfigurationVerifyKey::NoDefaultValue) // no default listen addresses 
    262262        }; 
    263263 
  • box/trunk/test/bbackupd/testbbackupd.cpp

    r2124 r2127  
    515515                        // connect and log in 
    516516                        SocketStreamTLS conn; 
    517                         conn.Open(context, Socket::TypeINET, "localhost", BOX_PORT_BBSTORED); 
     517                        conn.Open(context, Socket::TypeINET, "localhost", 
     518                                22011); 
    518519                        BackupProtocolClient protocol(conn); 
    519520                        protocol.QueryVersion(BACKUP_STORE_SERVER_VERSION); 
     
    608609{ 
    609610        sSocket.Open(rContext, Socket::TypeINET,  
    610                 "localhost", BOX_PORT_BBSTORED); 
     611                "localhost", 22011); 
    611612        std::auto_ptr<BackupProtocolClient> connection; 
    612613        connection.reset(new BackupProtocolClient(sSocket)); 
     
    25602561                                == Restore_TargetExists); 
    25612562                         
    2562                         // Make sure you can't restore to a nonexistant path 
    2563                         printf("Try to restore to a path that doesn't exist\n"); 
    2564                         TEST_THAT(BackupClientRestore(*client, restoredirid,  
    2565                                 "testfiles/no-such-path/subdir",  
    2566                                 true /* print progress dots */)  
    2567                                 == Restore_TargetPathNotFound); 
    2568                          
    25692563                        // Find ID of the deleted directory 
    25702564                        deldirid = GetDirID(*client, "x1", restoredirid); 
     
    25782572                                true /* deleted files */)  
    25792573                                == Restore_Complete); 
     2574 
     2575                        // Make sure you can't restore to a nonexistant path 
     2576                        printf("\n\n==== Try to restore to a path " 
     2577                                "that doesn't exist\n"); 
     2578                        fflush(stdout); 
     2579                        TEST_THAT(BackupClientRestore(*client, restoredirid,  
     2580                                "testfiles/no-such-path/subdir",  
     2581                                true /* print progress dots */)  
     2582                                == Restore_TargetPathNotFound); 
    25802583 
    25812584                        // Log out 
  • box/trunk/test/bbackupd/testfiles/bbackupd-temploc.conf

    r2124 r2127  
    99 
    1010StoreHostname = localhost 
     11StorePort = 22011 
    1112AccountNumber = 0x01234567 
    1213 
  • box/trunk/test/bbackupd/testfiles/bbackupd.conf.in

    r2124 r2127  
    99 
    1010StoreHostname = localhost 
     11StorePort = 22011 
    1112AccountNumber = 0x01234567 
    1213 
  • box/trunk/test/bbackupd/testfiles/bbstored.conf

    r2124 r2127  
    1010{ 
    1111        PidFile = testfiles/bbstored.pid 
    12         ListenAddresses = inet:localhost 
     12        ListenAddresses = inet:localhost:22011 
    1313        CertificateFile = testfiles/serverCerts.pem 
    1414        PrivateKeyFile = testfiles/serverPrivKey.pem 
  • box/trunk/test/common/testcommon.cpp

    r2124 r2127  
    5858ConfigurationVerifyKey verifykeys1_1_1[] = 
    5959{ 
    60         {"bing", 0, ConfigTest_Exists, 0}, 
    61         {"carrots", 0, ConfigTest_Exists | ConfigTest_IsInt, 0}, 
    62         {"terrible", 0, ConfigTest_Exists | ConfigTest_LastEntry, 0} 
     60        ConfigurationVerifyKey("bing", ConfigTest_Exists), 
     61        ConfigurationVerifyKey("carrots", ConfigTest_Exists | ConfigTest_IsInt), 
     62        ConfigurationVerifyKey("terrible", ConfigTest_Exists | ConfigTest_LastEntry) 
    6363}; 
    6464 
    6565ConfigurationVerifyKey verifykeys1_1_2[] = 
    6666{ 
    67         {"fish", 0, ConfigTest_Exists | ConfigTest_IsInt, 0}, 
    68         {"string", 0, ConfigTest_Exists | ConfigTest_LastEntry, 0} 
     67        ConfigurationVerifyKey("fish", ConfigTest_Exists | ConfigTest_IsInt), 
     68        ConfigurationVerifyKey("string", ConfigTest_Exists | ConfigTest_LastEntry) 
    6969}; 
    7070 
     
    9090ConfigurationVerifyKey verifykeys1_1[] = 
    9191{ 
    92         {"value", 0, ConfigTest_Exists | ConfigTest_IsInt, 0}, 
    93         {"string1", 0, ConfigTest_Exists, 0}, 
    94         {"string2", 0, ConfigTest_Exists | ConfigTest_LastEntry, 0} 
     92        ConfigurationVerifyKey("value", ConfigTest_Exists | ConfigTest_IsInt), 
     93        ConfigurationVerifyKey("string1", ConfigTest_Exists), 
     94        ConfigurationVerifyKey("string2", ConfigTest_Exists | ConfigTest_LastEntry) 
    9595}; 
    9696 
    9797ConfigurationVerifyKey verifykeys1_2[] =  
    9898{ 
    99         {"carrots", 0, ConfigTest_Exists | ConfigTest_IsInt, 0}, 
    100         {"string", 0, ConfigTest_Exists | ConfigTest_LastEntry, 0} 
     99        ConfigurationVerifyKey("carrots", ConfigTest_Exists | ConfigTest_IsInt), 
     100        ConfigurationVerifyKey("string", ConfigTest_Exists | ConfigTest_LastEntry) 
    101101}; 
    102102 
     
    121121ConfigurationVerifyKey verifykeys1[] = 
    122122{ 
    123                 {"notExpected", 0, 0, 0}, 
    124                 {"HasDefaultValue", "Lovely default value", 0, 0}, 
    125                 {"MultiValue", 0, ConfigTest_MultiValueAllowed, 0}, 
    126                 {"BoolTrue1", 0, ConfigTest_IsBool, 0}, 
    127                 {"BoolTrue2", 0, ConfigTest_IsBool, 0}, 
    128                 {"BoolFalse1", 0, ConfigTest_IsBool, 0}, 
    129                 {"BoolFalse2", 0, ConfigTest_IsBool, 0}, 
    130                 {"TOPlevel", 0, ConfigTest_LastEntry | ConfigTest_Exists, 0} 
     123                ConfigurationVerifyKey("notExpected", 0), 
     124                ConfigurationVerifyKey("HasDefaultValue", 0, "Lovely default value"), 
     125                ConfigurationVerifyKey("MultiValue", ConfigTest_MultiValueAllowed), 
     126                ConfigurationVerifyKey("BoolTrue1", ConfigTest_IsBool), 
     127                ConfigurationVerifyKey("BoolTrue2", ConfigTest_IsBool), 
     128                ConfigurationVerifyKey("BoolFalse1", ConfigTest_IsBool), 
     129                ConfigurationVerifyKey("BoolFalse2", ConfigTest_IsBool), 
     130                ConfigurationVerifyKey("TOPlevel",  
     131                        ConfigTest_LastEntry | ConfigTest_Exists) 
    131132}; 
    132133 
  • box/trunk/test/compress/testcompress.cpp

    r2124 r2127  
    9191                // Check sizes 
    9292                TEST_THAT(poutput->GetSize() < source.GetSize()); 
    93                 TRACE2("compressed size = %d, source size = %d\n", poutput->GetSize(), source.GetSize()); 
     93                BOX_TRACE("compressed size = " << poutput->GetSize() << 
     94                        ", source size = " << source.GetSize()); 
    9495                 
    9596                // Decompress the data 
  • box/trunk/test/raidfile/testraidfile.cpp

    r2124 r2127  
    623623                TEST_THAT(n1 != n3); 
    624624                TEST_THAT(n1 == n4);            // ie wraps around 
    625                 TRACE3("Gen paths= '%s','%s',%s'\n", n1.c_str(), n2.c_str(), n3.c_str()); 
     625                BOX_TRACE("Gen paths = '" << n1 << "', '" << n2 <<  
     626                        "', '" << n3); 
    626627        } 
    627628 
Note: See TracChangeset for help on using the changeset viewer.