Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(352)

Unified Diff: src/platform/update_engine/bzip_extent_writer.h

Issue 551132: AU: Extent writer utility classes (Closed)
Patch Set: fixes for review Created 10 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/platform/update_engine/bzip_extent_writer.h
diff --git a/src/platform/update_engine/bzip_extent_writer.h b/src/platform/update_engine/bzip_extent_writer.h
new file mode 100644
index 0000000000000000000000000000000000000000..fac6bad023c99cf303358815819c49f88f96b748
--- /dev/null
+++ b/src/platform/update_engine/bzip_extent_writer.h
@@ -0,0 +1,38 @@
+// Copyright (c) 2009 The Chromium OS Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_BZIP_EXTENT_WRITER_H__
+#define CHROMEOS_PLATFORM_UPDATE_ENGINE_BZIP_EXTENT_WRITER_H__
+
+#include <vector>
+#include <bzlib.h>
+#include "update_engine/extent_writer.h"
+#include "update_engine/utils.h"
+
+// BzipExtentWriter is a concrete ExtentWriter subclass that bzip decompresses
Daniel Erat 2010/02/03 02:12:24 s/bzip decompresses/bzip-decompresses/ (just 'cau
adlr 2010/02/04 22:25:37 Done.
+// what it's given in Write. It passes the decompressed data to an underlying
+// ExtentWriter.
+
+namespace chromeos_update_engine {
+
+class BzipExtentWriter : public ExtentWriter {
+ public:
+ BzipExtentWriter(ExtentWriter* next) : next_(next) {
+ memset(&stream_, 0, sizeof(stream_));
+ }
+ ~BzipExtentWriter() {}
+
+ bool Init(int fd, const std::vector<Extent>& extents, uint32 block_size);
+ bool Write(const void* bytes, size_t count);
+ bool EndImpl();
+
+ private:
+ ExtentWriter* const next_; // The underlying ExtentWriter.
+ bz_stream stream_; // the libbz2 stream
+ std::vector<char> input_buffer_;
+};
+
+} // namespace chromeos_update_engine
+
+#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_BZIP_EXTENT_WRITER_H__

Powered by Google App Engine
This is Rietveld 408576698