Merge changes I1f9b7b13,I36bc4a44

* changes:
  Deprecate <cutils/log.h> and <utils/Log.h>
  Replace SLOG() with LOG(ERROR)
This commit is contained in:
Logan Chien 2018-06-26 02:04:17 +00:00 committed by Gerrit Code Review
commit 17a93d5001
3 changed files with 20 additions and 27 deletions

View file

@ -36,13 +36,13 @@
#include <android-base/properties.h>
#include <bootloader_message/bootloader_message.h>
#include <cutils/android_reboot.h>
#include <cutils/log.h>
#include <cutils/properties.h>
#include <ext4_utils/ext4.h>
#include <ext4_utils/ext4_utils.h>
#include <f2fs_sparseblock.h>
#include <fs_mgr.h>
#include <hardware_legacy/power.h>
#include <log/log.h>
#include <logwrap/logwrap.h>
#include <openssl/evp.h>
#include <openssl/sha.h>

View file

@ -35,12 +35,9 @@
#include <linux/kdev_t.h>
#define LOG_TAG "Vold"
#include <android-base/logging.h>
#include <android-base/properties.h>
#include <android-base/stringprintf.h>
#include <cutils/log.h>
#include <cutils/properties.h>
#include <logwrap/logwrap.h>
#include <selinux/selinux.h>
@ -101,7 +98,8 @@ status_t Check(const std::string& source, const std::string& target) {
if (result == 0) {
break;
}
ALOGW("%s(): umount(%s)=%d: %s\n", __func__, c_target, result, strerror(errno));
LOG(WARNING) << __func__ << "(): umount(" << c_target << ")=" << result << ": "
<< strerror(errno);
sleep(1);
}
}
@ -111,10 +109,10 @@ status_t Check(const std::string& source, const std::string& target) {
* (e.g. recent SDK system images). Detect these and skip the check.
*/
if (access(kFsckPath, X_OK)) {
ALOGD("Not running %s on %s (executable not in system image)\n",
kFsckPath, c_source);
LOG(DEBUG) << "Not running " << kFsckPath << " on " << c_source
<< " (executable not in system image)";
} else {
ALOGD("Running %s on %s\n", kFsckPath, c_source);
LOG(DEBUG) << "Running " << kFsckPath << " on " << c_source;
std::vector<std::string> cmd;
cmd.push_back(kFsckPath);
@ -145,7 +143,7 @@ status_t Mount(const std::string& source, const std::string& target, bool ro,
rc = mount(c_source, c_target, "ext4", flags, NULL);
if (rc && errno == EROFS) {
SLOGE("%s appears to be a read only filesystem - retrying mount RO", c_source);
LOG(ERROR) << source << " appears to be a read only filesystem - retrying mount RO";
flags |= MS_RDONLY;
rc = mount(c_source, c_target, "ext4", flags, NULL);
}

View file

@ -35,12 +35,8 @@
#include <linux/kdev_t.h>
#define LOG_TAG "Vold"
#include <android-base/logging.h>
#include <android-base/stringprintf.h>
#include <cutils/log.h>
#include <cutils/properties.h>
#include <selinux/selinux.h>
#include <logwrap/logwrap.h>
@ -66,7 +62,7 @@ bool IsSupported() {
status_t Check(const std::string& source) {
if (access(kFsckPath, X_OK)) {
SLOGW("Skipping fs checks\n");
LOG(WARNING) << "Skipping fs checks";
return 0;
}
@ -83,38 +79,37 @@ status_t Check(const std::string& source) {
rc = ForkExecvp(cmd, sFsckUntrustedContext);
if (rc < 0) {
SLOGE("Filesystem check failed due to logwrap error");
LOG(ERROR) << "Filesystem check failed due to logwrap error";
errno = EIO;
return -1;
}
switch(rc) {
case 0:
SLOGI("Filesystem check completed OK");
LOG(INFO) << "Filesystem check completed OK";
return 0;
case 2:
SLOGE("Filesystem check failed (not a FAT filesystem)");
LOG(ERROR) << "Filesystem check failed (not a FAT filesystem)";
errno = ENODATA;
return -1;
case 4:
if (pass++ <= 3) {
SLOGW("Filesystem modified - rechecking (pass %d)",
pass);
LOG(WARNING) << "Filesystem modified - rechecking (pass " << pass << ")";
continue;
}
SLOGE("Failing check after too many rechecks");
LOG(ERROR) << "Failing check after too many rechecks";
errno = EIO;
return -1;
case 8:
SLOGE("Filesystem check failed (no filesystem)");
LOG(ERROR) << "Filesystem check failed (no filesystem)";
errno = ENODATA;
return -1;
default:
SLOGE("Filesystem check failed (unknown exit code %d)", rc);
LOG(ERROR) << "Filesystem check failed (unknown exit code " << rc << ")";
errno = EIO;
return -1;
}
@ -146,7 +141,7 @@ status_t Mount(const std::string& source, const std::string& target, bool ro,
rc = mount(c_source, c_target, "vfat", flags, mountData);
if (rc && errno == EROFS) {
SLOGE("%s appears to be a read only filesystem - retrying mount RO", c_source);
LOG(ERROR) << source << " appears to be a read only filesystem - retrying mount RO";
flags |= MS_RDONLY;
rc = mount(c_source, c_target, "vfat", flags, mountData);
}
@ -160,7 +155,7 @@ status_t Mount(const std::string& source, const std::string& target, bool ro,
* lost cluster chains (fsck_msdos doesn't currently do this)
*/
if (mkdir(lost_path, 0755)) {
SLOGE("Unable to create LOST.DIR (%s)", strerror(errno));
PLOG(ERROR) << "Unable to create LOST.DIR";
}
}
free(lost_path);
@ -185,16 +180,16 @@ status_t Format(const std::string& source, unsigned long numSectors) {
int rc = ForkExecvp(cmd);
if (rc < 0) {
SLOGE("Filesystem format failed due to logwrap error");
LOG(ERROR) << "Filesystem format failed due to logwrap error";
errno = EIO;
return -1;
}
if (rc == 0) {
SLOGI("Filesystem formatted OK");
LOG(INFO) << "Filesystem formatted OK";
return 0;
} else {
SLOGE("Format failed (unknown exit code %d)", rc);
LOG(ERROR) << "Format failed (unknown exit code " << rc << ")";
errno = EIO;
return -1;
}