-/* OutputStream is an abstract interface for writing data without seeking.
- * Output could be to a file, to an object within a segment, or even to a
- * memory buffer to help serialize data. */
-class OutputStream {
-public:
- OutputStream();
- virtual ~OutputStream() { }
-
- // Write the given data buffer
- void write(const void *data, size_t len);
-
- // Return the total number of bytes written so far
- int64_t get_pos() const { return bytes_written; }
-
- // Convenience functions for writing other data types. Values are always
- // written out in little-endian order.
- void write_u8(uint8_t val);
- void write_u16(uint16_t val);
- void write_u32(uint32_t val);
- void write_u64(uint64_t val);
-
- void write_s32(int32_t val) { write_u32((uint32_t)val); }
- void write_s64(int64_t val) { write_u64((uint64_t)val); }
-
- void write_varint(uint64_t val);
-
- void write_uuid(const struct uuid &u);
- void write_string(const std::string &s);
- void write_dictionary(const dictionary &d);
-
-protected:
- // Function which actually causes a write: must be overridden by
- // implementation.
- virtual void write_internal(const void *data, size_t len) = 0;
-
-private:
- int64_t bytes_written;
+/* Simplified TAR header--we only need to store regular files, don't need to
+ * handle long filenames, etc. */
+static const int TAR_BLOCK_SIZE = 512;
+
+struct tar_header
+{
+ char name[100];
+ char mode[8];
+ char uid[8];
+ char gid[8];
+ char size[12];
+ char mtime[12];
+ char chksum[8];
+ char typeflag;
+ char linkname[100];
+ char magic[8];
+ char uname[32];
+ char gname[32];
+ char devmajor[8];
+ char devminor[8];
+ char prefix[155];
+ char padding[12];