From 47878de7d12c7e438fcc584183b44893e91b4a28 Mon Sep 17 00:00:00 2001 From: bowgotsai Date: Mon, 23 Jan 2017 14:04:34 +0800 Subject: fs_mgr: Switch to LOG()/PLOG() defined in This is the minimal change just to replace KLOG_{INFO, WARNING, ERROR} defined in to LOG()/PLOG() defined in . The logging.h uses program invocation name as the tag when logging. e.g., init logs will have "init: ..." at the beginning in each line. To facilitate debugging, this commit adds [libfs_mgr] after the tag, and the resulting output will like this: [ 11.278002] init: [libfs_mgr]Enabling dm-verity for system (mode 2) [ 11.283309] init: [libfs_mgr]loading verity table: '1 /dev/block/platform/soc.0/f9824900.sdhci/by-name/system ...' [ 11.337884] init: [libfs_mgr]Not running /system/bin/tune2fs on /dev/block/dm-0 (executable not in system image) [ 11.362281] init: [libfs_mgr]__mount(source=/dev/block/dm-0,target=/system,type=ext4)=0 [ 11.376331] init: [libfs_mgr]Requested quota status is match on /dev/block/platform/soc.0/f9824900.sdhci/by-name/vendor [ 11.398237] init: [libfs_mgr]__mount(source=/dev/block/platform/soc.0/f9824900.sdhci/by-name/vendor,target=/vendor,type=ext4)=0 [ 11.410735] init: [libfs_mgr]Requested quota status is match on /dev/block/platform/soc.0/f9824900.sdhci/by-name/userdata [ 11.426783] init: [libfs_mgr]check_fs(): mount(/dev/block/platform/soc.0/f9824900.sdhci/by-name/userdata,/data,ext4)=-1: Invalid argument [ 11.439154] init: [libfs_mgr]Running /system/bin/e2fsck on /dev/block/platform/soc.0/f9824900.sdhci/by-name/userdata Bug: 34336098 Test: check device can boot Change-Id: Idcbaca1050e2d8eabe1e4510a0af03aa0312d03a --- fs_mgr/fs_mgr_fstab.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'fs_mgr/fs_mgr_fstab.cpp') diff --git a/fs_mgr/fs_mgr_fstab.cpp b/fs_mgr/fs_mgr_fstab.cpp index 23059dff3..48ddf29e8 100644 --- a/fs_mgr/fs_mgr_fstab.cpp +++ b/fs_mgr/fs_mgr_fstab.cpp @@ -196,7 +196,7 @@ static int parse_flags(char *flags, struct flag_list *fl, } } if (flag_vals->file_encryption_mode == 0) { - ERROR("Unknown file encryption mode: %s\n", mode); + LERROR << "Unknown file encryption mode: " << mode; } } else if ((fl[i].flag == MF_LENGTH) && flag_vals) { /* The length flag is followed by an = and the @@ -226,7 +226,7 @@ static int parse_flags(char *flags, struct flag_list *fl, flag_vals->partnum = strtol(part_start, NULL, 0); } } else { - ERROR("Warning: voldmanaged= flag malformed\n"); + LERROR << "Warning: voldmanaged= flag malformed"; } } else if ((fl[i].flag == MF_SWAPPRIO) && flag_vals) { flag_vals->swap_prio = strtoll(strchr(p, '=') + 1, NULL, 0); @@ -276,7 +276,7 @@ static int parse_flags(char *flags, struct flag_list *fl, /* fs_options was not passed in, so if the flag is unknown * it's an error. */ - ERROR("Warning: unknown flag %s\n", p); + LERROR << "Warning: unknown flag " << p; } } p = strtok_r(NULL, ",", &savep); @@ -321,7 +321,7 @@ struct fstab *fs_mgr_read_fstab_file(FILE *fstab_file) } if (!entries) { - ERROR("No entries found in fstab\n"); + LERROR << "No entries found in fstab"; goto err; } @@ -354,30 +354,30 @@ struct fstab *fs_mgr_read_fstab_file(FILE *fstab_file) * between the two reads. */ if (cnt >= entries) { - ERROR("Tried to process more entries than counted\n"); + LERROR << "Tried to process more entries than counted"; break; } if (!(p = strtok_r(line, delim, &save_ptr))) { - ERROR("Error parsing mount source\n"); + LERROR << "Error parsing mount source"; goto err; } fstab->recs[cnt].blk_device = strdup(p); if (!(p = strtok_r(NULL, delim, &save_ptr))) { - ERROR("Error parsing mount_point\n"); + LERROR << "Error parsing mount_point"; goto err; } fstab->recs[cnt].mount_point = strdup(p); if (!(p = strtok_r(NULL, delim, &save_ptr))) { - ERROR("Error parsing fs_type\n"); + LERROR << "Error parsing fs_type"; goto err; } fstab->recs[cnt].fs_type = strdup(p); if (!(p = strtok_r(NULL, delim, &save_ptr))) { - ERROR("Error parsing mount_flags\n"); + LERROR << "Error parsing mount_flags"; goto err; } tmp_fs_options[0] = '\0'; @@ -392,7 +392,7 @@ struct fstab *fs_mgr_read_fstab_file(FILE *fstab_file) } if (!(p = strtok_r(NULL, delim, &save_ptr))) { - ERROR("Error parsing fs_mgr_options\n"); + LERROR << "Error parsing fs_mgr_options"; goto err; } fstab->recs[cnt].fs_mgr_flags = parse_flags(p, fs_mgr_flags, @@ -413,7 +413,7 @@ struct fstab *fs_mgr_read_fstab_file(FILE *fstab_file) } /* If an A/B partition, modify block device to be the real block device */ if (fs_mgr_update_for_slotselect(fstab) != 0) { - ERROR("Error updating for slotselect\n"); + LERROR << "Error updating for slotselect"; goto err; } free(line); @@ -433,7 +433,7 @@ struct fstab *fs_mgr_read_fstab(const char *fstab_path) fstab_file = fopen(fstab_path, "r"); if (!fstab_file) { - ERROR("Cannot open file %s\n", fstab_path); + LERROR << "Cannot open file " << fstab_path; return NULL; } fstab = fs_mgr_read_fstab_file(fstab_file); -- cgit v1.2.3