summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJoe Onorato <joeo@android.com>2009-06-18 13:11:18 -0700
committerJoe Onorato <joeo@android.com>2009-06-18 18:41:11 -0700
commitda1430be269b2b20920b6cb27616f54e2b83a973 (patch)
treea262f22df1bf4797e25bfe2209416dbcfe465f1b /include
parentfa1cf39b803d71ac22af606ce0dd9dd81d512325 (diff)
downloadframeworks_native-da1430be269b2b20920b6cb27616f54e2b83a973.zip
frameworks_native-da1430be269b2b20920b6cb27616f54e2b83a973.tar.gz
frameworks_native-da1430be269b2b20920b6cb27616f54e2b83a973.tar.bz2
Make RestoreHelper and friends also write out the snapshot state.
Diffstat (limited to 'include')
-rw-r--r--include/utils/BackupHelpers.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/include/utils/BackupHelpers.h b/include/utils/BackupHelpers.h
index fa7f8d5..fc701fd 100644
--- a/include/utils/BackupHelpers.h
+++ b/include/utils/BackupHelpers.h
@@ -19,6 +19,7 @@
#include <utils/Errors.h>
#include <utils/String8.h>
+#include <utils/KeyedVector.h>
namespace android {
@@ -32,6 +33,27 @@ typedef struct {
int dataSize; // size of the data, not including the padding, -1 means delete
} entity_header_v1;
+struct SnapshotHeader {
+ int magic0;
+ int fileCount;
+ int magic1;
+ int totalSize;
+};
+
+struct FileState {
+ int modTime_sec;
+ int modTime_nsec;
+ int size;
+ int crc32;
+ int nameLen;
+};
+
+struct FileRec {
+ String8 file;
+ bool deleted;
+ FileState s;
+};
+
/**
* Writes the data.
@@ -99,6 +121,19 @@ private:
int back_up_files(int oldSnapshotFD, BackupDataWriter* dataStream, int newSnapshotFD,
char const* const* files, char const* const *keys, int fileCount);
+class RestoreHelperBase
+{
+public:
+ RestoreHelperBase();
+ ~RestoreHelperBase();
+
+ status_t WriteFile(const String8& filename, BackupDataReader* in);
+ status_t WriteSnapshot(int fd);
+
+private:
+ void* m_buf;
+ KeyedVector<String8,FileRec> m_files;
+};
#define TEST_BACKUP_HELPERS 1