Ignore:
Timestamp:
24/02/2010 20:12:00 (2 years ago)
Author:
chris
Message:

Add method to get updated modification time of
BackupClientFileAttributes?.

Add listing of attribute modification time to bbackupquery "list -t"
command.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • box/trunk/lib/backupclient/BackupClientFileAttributes.cpp

    r2633 r2635  
    648648} 
    649649 
     650// -------------------------------------------------------------------------- 
     651// 
     652// Function 
     653//              Name:    BackupClientFileAttributes::GetModificationTime() 
     654//              Purpose: Returns the modification time embedded in the 
     655//                       attributes. 
     656//              Created: 2010/02/24 
     657// 
     658// -------------------------------------------------------------------------- 
     659box_time_t BackupClientFileAttributes::GetModificationTime() const 
     660{ 
     661        // Got something loaded 
     662        if(GetSize() <= 0) 
     663        { 
     664                THROW_EXCEPTION(BackupStoreException, AttributesNotLoaded); 
     665        } 
     666         
     667        // Make sure there are clear attributes to use 
     668        EnsureClearAvailable(); 
     669        ASSERT(mpClearAttributes != 0); 
     670 
     671        // Check if the decrypted attributes are small enough, and the type of attributes stored 
     672        if(mpClearAttributes->GetSize() < (int)sizeof(int32_t)) 
     673        { 
     674                THROW_EXCEPTION(BackupStoreException, AttributesNotUnderstood); 
     675        } 
     676        int32_t *type = (int32_t*)mpClearAttributes->GetBuffer(); 
     677        ASSERT(type != 0); 
     678        if(ntohl(*type) != ATTRIBUTETYPE_GENERIC_UNIX) 
     679        { 
     680                // Don't know what to do with these 
     681                THROW_EXCEPTION(BackupStoreException, AttributesNotUnderstood); 
     682        } 
     683         
     684        // Check there is enough space for an attributes block 
     685        if(mpClearAttributes->GetSize() < (int)sizeof(attr_StreamFormat)) 
     686        { 
     687                // Too small 
     688                THROW_EXCEPTION(BackupStoreException, AttributesNotLoaded); 
     689        } 
     690 
     691        // Get pointer to structure 
     692        attr_StreamFormat *pattr = (attr_StreamFormat*)mpClearAttributes->GetBuffer(); 
     693 
     694        return box_ntoh64(pattr->ModificationTime); 
     695} 
    650696 
    651697// -------------------------------------------------------------------------- 
Note: See TracChangeset for help on using the changeset viewer.