update_engine: Add MtdFileDescriptor and UbiFileDescriptor
We send a pure file descriptor to ExtentWriter. This CL changes that to
use FileDescriptor. At the same time, the CL adds two other
FileDescriptor classes MtdFileDescriptor and UbiFileDescriptor to work
with raw NAND and UBI devices. Both of these classes support either read
only or sequential write, but not both at the same time. Seek operation
is possible in read only mode.
These classes are conditionally included if USE_mtd is not '0'.
BUG=chromium:426742
TEST=unittest
TEST=USE=mtd emerge update_engine, make sure there is MtdFileDescriptor
in /usr/sbin/update_engine
TEST=emerge --unmerge android_mtdutils; USE=-mtd emerge update_engine
make sure there is no UbiFileDescriptor in that same file
Change-Id: If3ba43677d93dc4f3cea037f19866c8b546b2cae
Reviewed-on: https://chromium-review.googlesource.com/229004
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
Reviewed-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Nam Nguyen <namnguyen@chromium.org>
Tested-by: Nam Nguyen <namnguyen@chromium.org>
diff --git a/bzip_extent_writer.cc b/bzip_extent_writer.cc
index 008e64a..7cde7ba 100644
--- a/bzip_extent_writer.cc
+++ b/bzip_extent_writer.cc
@@ -12,7 +12,7 @@
const vector<char>::size_type kOutputBufferLength = 16 * 1024;
}
-bool BzipExtentWriter::Init(int fd,
+bool BzipExtentWriter::Init(FileDescriptorPtr fd,
const vector<Extent>& extents,
uint32_t block_size) {
// Init bzip2 stream