Add --impacted-changes option to kmidiff
authorDodji Seketeli <dodji@redhat.com>
Fri, 6 Oct 2017 09:25:48 +0000 (11:25 +0200)
committerDodji Seketeli <dodji@redhat.com>
Sun, 8 Oct 2017 16:51:35 +0000 (18:51 +0200)
kmidiff displays leaf changes by default and and it does so by *not*
showing impacted interfaces.

This patch add a --impacted-changes option to kmidiff so that it shows
the interfaces that are impacted by each leaf change.  Thus, by
default, no impacted interface is shown.

* doc/manuals/kmidiff.rst: Document the new --impacted-changes
option.
* tools/kmidif.cc (options::show_impacted_interfaces): Add new
data member.
(options::options): Initialize the new data member to false.
(display_usage): Add a description string for the new
--impacted-changes option.
(parse_command_line): Parse the new --impacted-changes option.
(set_diff_context): Update the 'show-impacted-interface' property
accordingly.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
doc/manuals/kmidiff.rst
tools/kmidiff.cc

index eafefce2d6728d3b119593991bf57c39d22e5248..f1564f8c56860075c0d173ba23a4df078cd0045e 100644 (file)
@@ -149,6 +149,10 @@ Options
     <abidiff_default_supprs_label>` are loaded .
 
 
+  * ``--full-impact | -f``
+
+    Tell what interfaces got impacted by each individual ABI change.
+
   * ``--full-impact | -f``
 
     Emit a change report that shows the full impact of each change on
index c10d850dc8886cf3264360cbcc7e028e2f13bdbb..142821d4efca761115d233defb80f36a45b06e10 100644 (file)
@@ -73,6 +73,7 @@ struct options
   bool         verbose;
   bool         missing_operand;
   bool         leaf_changes_only;
+  bool         show_impacted_interfaces;
   string       wrong_option;
   string       kernel_dist_root1;
   string       kernel_dist_root2;
@@ -88,7 +89,8 @@ struct options
       display_version(),
       verbose(),
       missing_operand(),
-      leaf_changes_only(true)
+      leaf_changes_only(true),
+      show_impacted_interfaces(false)
   {}
 }; // end struct options.
 
@@ -111,6 +113,7 @@ display_usage(const string& prog_name, ostream& out)
     << " --suppressions|--suppr <path>  specify a suppression file\n"
     << " --kmi-whitelist|-w <path>  path to a kernel module interface "
     "whitelist\n"
+    << " --impacted-interfaces|-i  show interfaces impacted by ABI changes\n"
     << " --full-impact|-f  show the full impact of changes on top-most "
         "interfaces\n";
 }
@@ -209,6 +212,9 @@ parse_command_line(int argc, char* argv[], options& opts)
          opts.suppression_paths.push_back(argv[j]);
          ++i;
        }
+      else if (!strcmp(argv[i], "--impacted-interfaces")
+              || !strcmp(argv[i], "-i"))
+       opts.show_impacted_interfaces = true;
       else if (!strcmp(argv[i], "--full-impact")
               || !strcmp(argv[i], "-f"))
        opts.leaf_changes_only = false;
@@ -264,6 +270,7 @@ set_diff_context(diff_context_sptr ctxt, const options& opts)
   ctxt->show_symbols_unreferenced_by_debug_info
     (true);
   ctxt->show_leaf_changes_only(opts.leaf_changes_only);
+  ctxt->show_impacted_interfaces(opts.show_impacted_interfaces);
 
   ctxt->switch_categories_off(get_default_harmless_categories_bitmap());