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.h b/bzip_extent_writer.h
index 9726253..0187c0b 100644
--- a/bzip_extent_writer.h
+++ b/bzip_extent_writer.h
@@ -23,7 +23,9 @@
}
~BzipExtentWriter() {}
- bool Init(int fd, const std::vector<Extent>& extents, uint32_t block_size);
+ bool Init(FileDescriptorPtr fd,
+ const std::vector<Extent>& extents,
+ uint32_t block_size);
bool Write(const void* bytes, size_t count);
bool EndImpl();