aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuca Stefani <luca.stefani.ge1@gmail.com>2018-08-30 21:06:02 +0200
committerLuca Stefani <luca.stefani.ge1@gmail.com>2018-09-12 11:50:33 +0200
commit50915411a8b04e2ad919414e09ce463792bb3d83 (patch)
tree572207397c5320b78f3c724fd0b6f681070fd426
parent896de5423db1ec3824797e11199a08be20b02d1d (diff)
downloadandroid_bootable_recovery-50915411a8b04e2ad919414e09ce463792bb3d83.tar.gz
android_bootable_recovery-50915411a8b04e2ad919414e09ce463792bb3d83.tar.bz2
android_bootable_recovery-50915411a8b04e2ad919414e09ce463792bb3d83.zip
Revert "f2fs: support f2fs by setting unmovable bit for package file"
* Replaced with upstream aosp/master version * With this change flashing fails if either one of the following cases are met: 1) Kernel f2fs stack doesn't support the ioctl ( errno isn't checked for ENOTSUP ) 2) If the device has multiple userdata entries in fstab ( f2fs and ext4 in this order ) and userdata is formatted as ext4, recovery will attempt to send the ioctl without checking if it's supported ( same as 1, errno isn't checked for ENOTSUP ) 3) The ioctl, when supported, needs an extra argument ( __u32 set ) This reverts commit 848f227eea524a48208bdd4181f90fb63a31ed2b. Change-Id: I5871d3da4594f7da44546a2979e72dd87434f821
-rw-r--r--uncrypt/uncrypt.cpp26
1 files changed, 4 insertions, 22 deletions
diff --git a/uncrypt/uncrypt.cpp b/uncrypt/uncrypt.cpp
index bb43c2c4..645faadb 100644
--- a/uncrypt/uncrypt.cpp
+++ b/uncrypt/uncrypt.cpp
@@ -172,14 +172,10 @@ static struct fstab* read_fstab() {
return fstab;
}
-static const char* find_block_device(const char* path, bool* encryptable, bool* encrypted, bool *f2fs_fs) {
+static const char* find_block_device(const char* path, bool* encryptable, bool* encrypted) {
// Look for a volume whose mount point is the prefix of path and
// return its block device. Set encrypted if it's currently
// encrypted.
-
- // ensure f2fs_fs is set to 0 first.
- if (f2fs_fs)
- *f2fs_fs = false;
for (int i = 0; i < fstab->num_entries; ++i) {
struct fstab_rec* v = &fstab->recs[i];
if (!v->mount_point) {
@@ -196,8 +192,6 @@ static const char* find_block_device(const char* path, bool* encryptable, bool*
*encrypted = true;
}
}
- if (f2fs_fs && strcmp(v->fs_type, "f2fs") == 0)
- *f2fs_fs = true;
return v->blk_device;
}
}
@@ -250,7 +244,7 @@ static int retry_fibmap(const int fd, const char* name, int* block, const int he
}
static int produce_block_map(const char* path, const char* map_file, const char* blk_dev,
- bool encrypted, bool f2fs_fs, int socket) {
+ bool encrypted, int socket) {
std::string err;
if (!android::base::RemoveFileIfExists(map_file, &err)) {
LOG(ERROR) << "failed to remove the existing map file " << map_file << ": " << err;
@@ -313,17 +307,6 @@ static int produce_block_map(const char* path, const char* map_file, const char*
}
}
-#ifndef F2FS_IOC_SET_DONTMOVE
-#ifndef F2FS_IOCTL_MAGIC
-#define F2FS_IOCTL_MAGIC 0xf5
-#endif
-#define F2FS_IOC_SET_DONTMOVE _IO(F2FS_IOCTL_MAGIC, 13)
-#endif
- if (f2fs_fs && ioctl(fd, F2FS_IOC_SET_DONTMOVE) < 0) {
- PLOG(ERROR) << "Failed to set non-movable file for f2fs: " << path << " on " << blk_dev;
- return kUncryptIoctlError;
- }
-
off64_t pos = 0;
int last_progress = 0;
while (pos < sb.st_size) {
@@ -475,8 +458,7 @@ static int uncrypt(const char* input_path, const char* map_file, const int socke
bool encryptable;
bool encrypted;
- bool f2fs_fs;
- const char* blk_dev = find_block_device(path, &encryptable, &encrypted, &f2fs_fs);
+ const char* blk_dev = find_block_device(path, &encryptable, &encrypted);
if (blk_dev == nullptr) {
LOG(ERROR) << "failed to find block device for " << path;
return kUncryptBlockDeviceFindError;
@@ -497,7 +479,7 @@ static int uncrypt(const char* input_path, const char* map_file, const int socke
// and /sdcard we leave the file alone.
if (strncmp(path, "/data/", 6) == 0) {
LOG(INFO) << "writing block map " << map_file;
- return produce_block_map(path, map_file, blk_dev, encrypted, f2fs_fs, socket);
+ return produce_block_map(path, map_file, blk_dev, encrypted, socket);
}
return 0;