+ return (0);
+} /* }}} int swap_read_swapctl2 */
+
+/* Configuration: Present when swapctl or both methods are available. */
+static int swap_config (const char *key, const char *value) /* {{{ */
+{
+ if (strcasecmp ("ReportPhysical", key) == 0)
+ {
+ if (strcasecmp ("combined", value) == 0)
+ report_physical = 1;
+ else if (strcasecmp ("separate", value) == 0)
+ report_physical = 2;
+# if HAVE_LIBKSTAT
+ else if (IS_TRUE (value))
+ report_physical = 1;
+ else if (IS_FALSE (value))
+ report_physical = 0;
+# endif
+ else
+ WARNING ("swap plugin: The value \"%s\" is not "
+ "recognized by the ReportPhysical option.",
+ value);
+ }
+# if HAVE_LIBKSTAT
+ else if (strcasecmp ("ReportVirtual", key) == 0)
+ {
+ if (IS_TRUE (value))
+ report_physical = 1;
+ else if (IS_FALSE (value))
+ report_physical = 0;
+ else
+ WARNING ("swap plugin: The value \"%s\" is not "
+ "recognized by the ReportVirtual option.",
+ value);
+ }
+# endif /* HAVE_LIBKSTAT */
+ else
+ {
+ return (-1);
+ }
+
+ return (0);
+} /* }}} int swap_config */
+# endif /* HAVE_SWAPCTL_TWO_ARGS */
+
+/* If both methods are available, check the config variables to decide which
+ * function to call. Otherwise, add aliases for the functions so we can
+ * "swap_read" in "module_register". */
+# if HAVE_LIBKSTAT && HAVE_SWAPCTL && HAVE_SWAPCTL_TWO_ARGS
+static int swap_read (void) /* {{{ */
+{
+ int status;
+
+ if (report_physical)
+ {
+ status = swap_read_swapctl2 ();
+ if (status != 0)
+ return (status);
+ }