inspect_cow: Add -l option to show all ops
This makes inspect_cow not list all ops by default. Instead you must
pass -l to do this. This allows for viewing other data without being
overwhelmed bt the cow listings.
Test: inspect_cow with no flags, -l, and -lo
Change-Id: I3968ff53acb4e645a16ac5b09c5dee8374946f55
diff --git a/fs_mgr/libsnapshot/inspect_cow.cpp b/fs_mgr/libsnapshot/inspect_cow.cpp
index 0adeb83..3c0ba16 100644
--- a/fs_mgr/libsnapshot/inspect_cow.cpp
+++ b/fs_mgr/libsnapshot/inspect_cow.cpp
@@ -42,6 +42,7 @@
LOG(ERROR) << "\t -s Run Silent";
LOG(ERROR) << "\t -d Attempt to decompress";
LOG(ERROR) << "\t -b Show data for failed decompress";
+ LOG(ERROR) << "\t -l Show ops";
LOG(ERROR) << "\t -m Show ops in reverse merge order";
LOG(ERROR) << "\t -o Shows sequence op block order\n";
}
@@ -51,6 +52,7 @@
struct Options {
bool silent;
bool decompress;
+ bool show_ops;
bool show_bad;
bool show_seq;
OpIter iter_type;
@@ -141,7 +143,7 @@
while (!iter->Done()) {
const CowOperation& op = iter->Get();
- if (!opt.silent) std::cout << op << "\n";
+ if (!opt.silent && opt.show_ops) std::cout << op << "\n";
if (opt.decompress && op.type == kCowReplaceOp && op.compression != kCowCompressNone) {
if (!reader.ReadData(op, &sink)) {
@@ -186,7 +188,7 @@
opt.decompress = false;
opt.show_bad = false;
opt.iter_type = android::snapshot::Normal;
- while ((ch = getopt(argc, argv, "sdbmo")) != -1) {
+ while ((ch = getopt(argc, argv, "sdbmol")) != -1) {
switch (ch) {
case 's':
opt.silent = true;
@@ -203,6 +205,9 @@
case 'o':
opt.show_seq = true;
break;
+ case 'l':
+ opt.show_ops = true;
+ break;
default:
android::snapshot::usage();
}