Create a FuseDataProvider base class

The fuse data provider for adb/sdcard shares common code and structures.
This cl creates a FuseDataProvider base class and provides
implementations for adb and sdcard.

In the follow cls, we can kill the provider_vtab struct; and also add
another implementation to parse a block map file and provides data.

Test: unit tests pass, sideload a package, apply a package from sdcard
Change-Id: If8311666a52a2e3c0fbae0ee9688fa6d01e4ad09
This commit is contained in:
xunchang
2019-03-17 16:45:12 -07:00
parent 698dc08561
commit ea2912f187
16 changed files with 250 additions and 136 deletions
+3 -2
View File
@@ -244,8 +244,9 @@ static int fetch_block(fuse_data* fd, uint32_t block) {
memset(fd->block_data + fetch_size, 0, fd->block_size - fetch_size);
}
int result = fd->vtab.read_block(block, fd->block_data, fetch_size);
if (result < 0) return result;
if (!fd->vtab.read_block(block, fd->block_data, fetch_size)) {
return -EIO;
}
fd->curr_block = block;