summaryrefslogtreecommitdiff
path: root/lib/backupstore
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2012-01-22 16:35:37 +0000
committerChris Wilson <chris+github@qwirx.com>2012-01-22 16:35:37 +0000
commit24f341ac16373577c9737042306f930f484e1802 (patch)
treed315fa8176d16966ec6c66c85d6bd01fd98572c4 /lib/backupstore
parent7b41fa400370560b0e7978164648cbf4cc6e6165 (diff)
Allow constructing a BackupClientFileAttributes from a struct EMU_STAT.
Diffstat (limited to 'lib/backupstore')
-rw-r--r--lib/backupstore/BackupClientFileAttributes.cpp37
-rw-r--r--lib/backupstore/BackupClientFileAttributes.h3
2 files changed, 35 insertions, 5 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
//
diff --git a/lib/backupstore/BackupClientFileAttributes.h b/lib/backupstore/BackupClientFileAttributes.h
index f9a0d883..8ae7ffc2 100644
--- a/lib/backupstore/BackupClientFileAttributes.h
+++ b/lib/backupstore/BackupClientFileAttributes.h
@@ -29,6 +29,7 @@ class BackupClientFileAttributes : public StreamableMemBlock
{
public:
BackupClientFileAttributes();
+ BackupClientFileAttributes(const EMU_STRUCT_STAT &st);
BackupClientFileAttributes(const BackupClientFileAttributes &rToCopy);
BackupClientFileAttributes(const StreamableMemBlock &rToCopy);
~BackupClientFileAttributes();
@@ -60,7 +61,7 @@ public:
private:
static void FillAttributes(StreamableMemBlock &outputBlock,
- const char *Filename, EMU_STRUCT_STAT &st,
+ const char *Filename, const EMU_STRUCT_STAT &st,
bool ZeroModificationTimes);
static void FillAttributesLink(StreamableMemBlock &outputBlock, const char *Filename, struct stat &st);
void WriteExtendedAttr(const char *Filename, int xattrOffset) const;