Ignore:
Timestamp:
24/02/2010 19:23:14 (2 years ago)
Author:
chris
Message:

Add notification about uploading new file attributes.

Add check for changing file creation times on Windows, to cause the
attributes to be uploaded again.

File:
1 edited

Legend:

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

    r2618 r2633  
    7979{ 
    8080        int32_t uid, gid, mode; 
     81        #ifdef WIN32 
     82        int64_t fileCreationTime; 
     83        #endif 
    8184} attributeHashData; 
    8285 
     
    222225// Function 
    223226//              Name:    BackupClientFileAttributes::Compare(const BackupClientFileAttributes &, bool) 
    224 //              Purpose: Compare, optionally ignoring the attribute modification time and/or modification time, and some data which is 
    225 //                               irrelevant in practise (eg file generation number) 
     227//              Purpose: Compare, optionally ignoring the attribute 
     228//                       modification time and/or modification time, and some 
     229//                       data which is irrelevant in practise (eg file 
     230//                       generation number) 
    226231//              Created: 10/12/03 
    227232// 
    228233// -------------------------------------------------------------------------- 
    229 bool BackupClientFileAttributes::Compare(const BackupClientFileAttributes &rAttr, bool IgnoreAttrModTime, bool IgnoreModTime) const 
     234bool BackupClientFileAttributes::Compare(const BackupClientFileAttributes &rAttr, 
     235        bool IgnoreAttrModTime, bool IgnoreModTime) const 
    230236{ 
    231237        EnsureClearAvailable(); 
     
    10711077// 
    10721078// Function 
    1073 //              Name:    BackupClientFileAttributes::GenerateAttributeHash(struct stat &, const std::string &, const std::string &) 
    1074 //              Purpose: Generate a 64 bit hash from the attributes, used to detect changes. 
    1075 //                               Include filename in the hash, so that it changes from one file to another, 
    1076 //                               so don't reveal identical attributes. 
     1079//              Name:    BackupClientFileAttributes::GenerateAttributeHash( 
     1080//                       struct stat &, const std::string &, 
     1081//                       const std::string &) 
     1082//              Purpose: Generate a 64 bit hash from the attributes, used to 
     1083//                       detect changes. Include filename in the hash, so 
     1084//                       that it changes from one file to another, so don't 
     1085//                       reveal identical attributes. 
    10771086//              Created: 25/4/04 
    10781087// 
    10791088// -------------------------------------------------------------------------- 
    1080 uint64_t BackupClientFileAttributes::GenerateAttributeHash(EMU_STRUCT_STAT &st, const std::string &filename, const std::string &leafname) 
     1089uint64_t BackupClientFileAttributes::GenerateAttributeHash(EMU_STRUCT_STAT &st, 
     1090        const std::string &filename, const std::string &leafname) 
    10811091{ 
    10821092        if(sAttributeHashSecretLength == 0) 
     
    10931103        hashData.mode = htonl(st.st_mode); 
    10941104 
     1105        #ifdef WIN32 
     1106        // On Windows, the "file attribute modification time" is the 
     1107        // file creation time, and we want to back this up, restore 
     1108        // it and compare it. 
     1109        // 
     1110        // On other platforms, it's not very important and can't 
     1111        // reliably be set to anything other than the current time. 
     1112        hashData.fileCreationTime = box_hton64(st.st_ctime); 
     1113        #endif 
     1114 
    10951115        StreamableMemBlock xattr; 
    10961116        FillExtendedAttr(xattr, filename.c_str()); 
     
    11011121        digest.Add(xattr.GetBuffer(), xattr.GetSize()); 
    11021122        digest.Add(leafname.c_str(), leafname.size()); 
    1103         digest.Add(sAttributeHashSecret, sAttributeHashSecretLength); 
     1123        digest.Add(sAttributeHashSecret, sAttributeHashSecretLength);    
    11041124        digest.Finish(); 
    11051125         
Note: See TracChangeset for help on using the changeset viewer.