diff options
author | Chris Wilson <chris+github@qwirx.com> | 2012-01-22 16:35:37 +0000 |
---|---|---|
committer | Chris Wilson <chris+github@qwirx.com> | 2012-01-22 16:35:37 +0000 |
commit | 24f341ac16373577c9737042306f930f484e1802 (patch) | |
tree | d315fa8176d16966ec6c66c85d6bd01fd98572c4 /lib/backupstore/BackupClientFileAttributes.cpp | |
parent | 7b41fa400370560b0e7978164648cbf4cc6e6165 (diff) |
Allow constructing a BackupClientFileAttributes from a struct EMU_STAT.
Diffstat (limited to 'lib/backupstore/BackupClientFileAttributes.cpp')
-rw-r--r-- | lib/backupstore/BackupClientFileAttributes.cpp | 37 |
1 files changed, 33 insertions, 4 deletions
diff --git a/lib/backupstore/BackupClientFileAttributes.cpp b/lib/backupstore/BackupClientFileAttributes.cpp index bc39bd8b..372f9e32 100644 --- a/lib/backupstore/BackupClientFileAttributes.cpp +++ b/lib/backupstore/BackupClientFileAttributes.cpp @@ -123,6 +123,30 @@ BackupClientFileAttributes::BackupClientFileAttributes() // -------------------------------------------------------------------------- // // Function +// Name: BackupClientFileAttributes::BackupClientFileAttributes() +// Purpose: Artifical constructor +// Created: 2011/12/06 +// +// -------------------------------------------------------------------------- +BackupClientFileAttributes::BackupClientFileAttributes(const EMU_STRUCT_STAT &st) +: mpClearAttributes(0) +{ + ASSERT(sizeof(u_int64_t) == sizeof(box_time_t)); + StreamableMemBlock *pnewAttr = new StreamableMemBlock; + FillAttributes(*pnewAttr, (const char *)NULL, st, true); + + // Attributes ready. Encrypt into this block + EncryptAttr(*pnewAttr); + + // Store the new attributes + RemoveClear(); + mpClearAttributes = pnewAttr; + pnewAttr = 0; +} + +// -------------------------------------------------------------------------- +// +// Function // Name: BackupClientFileAttributes::BackupClientFileAttributes(const BackupClientFileAttributes &) // Purpose: Copy constructor // Created: 2003/10/07 @@ -436,12 +460,15 @@ void BackupClientFileAttributes::ReadAttributes(const char *Filename, // -------------------------------------------------------------------------- // // Function -// Name: BackupClientFileAttributes::ReadAttributesLink() +// Name: BackupClientFileAttributes::FillAttributes() // Purpose: Private function, handles standard attributes for all objects // Created: 2003/10/07 // // -------------------------------------------------------------------------- -void BackupClientFileAttributes::FillAttributes(StreamableMemBlock &outputBlock, const char *Filename, EMU_STRUCT_STAT &st, bool ZeroModificationTimes) +void BackupClientFileAttributes::FillAttributes( + StreamableMemBlock &outputBlock, const char *Filename, + const EMU_STRUCT_STAT &st, bool ZeroModificationTimes +) { outputBlock.ResizeBlock(sizeof(attr_StreamFormat)); attr_StreamFormat *pattr = (attr_StreamFormat*)outputBlock.GetBuffer(); @@ -475,7 +502,9 @@ void BackupClientFileAttributes::FillAttributes(StreamableMemBlock &outputBlock, // -------------------------------------------------------------------------- // // Function -// Name: BackupClientFileAttributes::ReadAttributesLink() +// Name: BackupClientFileAttributes::FillAttributesLink( +// StreamableMemBlock &outputBlock, +// const char *Filename, struct stat &st) // Purpose: Private function, handles the case where a symbolic link is needed // Created: 2003/10/07 // @@ -507,7 +536,7 @@ void BackupClientFileAttributes::FillAttributesLink(StreamableMemBlock &outputBl // -------------------------------------------------------------------------- // // Function -// Name: BackupClientFileAttributes::ReadExtendedAttr(const char *, unsigned char**) +// Name: BackupClientFileAttributes::FillExtendedAttr(const char *, unsigned char**) // Purpose: Private function, read the extended attributes of the file into the block // Created: 2005/06/12 // |