[Box Backup-commit] COMMIT r3067 - box/trunk/lib/backupstore

subversion at boxbackup.org subversion at boxbackup.org
Sun Jan 22 16:35:37 GMT 2012


Author: chris
Date: 2012-01-22 16:35:37 +0000 (Sun, 22 Jan 2012)
New Revision: 3067

Modified:
   box/trunk/lib/backupstore/BackupClientFileAttributes.cpp
   box/trunk/lib/backupstore/BackupClientFileAttributes.h
Log:
Allow constructing a BackupClientFileAttributes from a struct EMU_STAT.


Modified: box/trunk/lib/backupstore/BackupClientFileAttributes.cpp
===================================================================
--- box/trunk/lib/backupstore/BackupClientFileAttributes.cpp	2012-01-22 16:32:07 UTC (rev 3066)
+++ box/trunk/lib/backupstore/BackupClientFileAttributes.cpp	2012-01-22 16:35:37 UTC (rev 3067)
@@ -123,6 +123,30 @@
 // --------------------------------------------------------------------------
 //
 // 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 @@
 // --------------------------------------------------------------------------
 //
 // 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 @@
 // --------------------------------------------------------------------------
 //
 // 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 @@
 // --------------------------------------------------------------------------
 //
 // 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
 //

Modified: box/trunk/lib/backupstore/BackupClientFileAttributes.h
===================================================================
--- box/trunk/lib/backupstore/BackupClientFileAttributes.h	2012-01-22 16:32:07 UTC (rev 3066)
+++ box/trunk/lib/backupstore/BackupClientFileAttributes.h	2012-01-22 16:35:37 UTC (rev 3067)
@@ -29,6 +29,7 @@
 {
 public:
 	BackupClientFileAttributes();
+	BackupClientFileAttributes(const EMU_STRUCT_STAT &st);
 	BackupClientFileAttributes(const BackupClientFileAttributes &rToCopy);
 	BackupClientFileAttributes(const StreamableMemBlock &rToCopy);
 	~BackupClientFileAttributes();
@@ -60,7 +61,7 @@
 
 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;




More information about the Boxbackup-commit mailing list