Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 1 | From e8b3fbfa3d6a11eee25db2dc0f31f439aaf0b65a Mon Sep 17 00:00:00 2001 |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 2 | From: Gustavo Sverzut Barbieri <barbieri@profusion.mobi> |
| 3 | Date: Thu, 26 May 2011 17:30:04 -0300 |
| 4 | Subject: [PATCH] Allow disabling atasmart, lvm2 and devicemapper support. |
| 5 | |
| 6 | https://bugs.freedesktop.org/show_bug.cgi?id=37647 |
| 7 | |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 8 | --- |
| 9 | configure.ac | 53 +++++++++++++++++++++++++++++++++++++++---------- |
| 10 | src/adapter-private.h | 1 - |
| 11 | src/adapter.c | 1 - |
| 12 | src/daemon.c | 4 ++++ |
| 13 | src/device-private.c | 2 +- |
| 14 | src/device-private.h | 5 ++--- |
| 15 | src/device.c | 23 +++++++++++++++++---- |
| 16 | src/expander-private.h | 1 - |
| 17 | src/expander.c | 1 - |
| 18 | src/helpers/Makefile.am | 20 +++++++++++++------ |
| 19 | src/helpers/partutil.c | 3 ++- |
| 20 | src/port-private.h | 1 - |
| 21 | src/probers/Makefile.am | 8 ++++++-- |
| 22 | tools/udisks.c | 10 ++++++++-- |
| 23 | 14 files changed, 99 insertions(+), 34 deletions(-) |
| 24 | |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 25 | diff --git a/configure.ac b/configure.ac |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 26 | index 9454423..8c4e4c2 100644 |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 27 | --- a/configure.ac |
| 28 | +++ b/configure.ac |
| 29 | @@ -155,13 +155,33 @@ PKG_CHECK_MODULES(POLKIT_GOBJECT_1, [polkit-gobject-1 >= 0.97]) |
| 30 | AC_SUBST(POLKIT_GOBJECT_1_CFLAGS) |
| 31 | AC_SUBST(POLKIT_GOBJECT_1_LIBS) |
| 32 | |
| 33 | -PKG_CHECK_MODULES(LIBPARTED, [libparted >= 1.8.8]) |
| 34 | -AC_SUBST(LIBPARTED_CFLAGS) |
| 35 | -AC_SUBST(LIBPARTED_LIBS) |
| 36 | - |
| 37 | -PKG_CHECK_MODULES(DEVMAPPER, [devmapper >= 1.02]) |
| 38 | -AC_SUBST(DEVMAPPER_CFLAGS) |
| 39 | -AC_SUBST(DEVMAPPER_LIBS) |
| 40 | +have_parted=no |
| 41 | +AC_ARG_ENABLE(parted, AS_HELP_STRING([--disable-parted], [disable disk partitioning])) |
| 42 | +if test "x$enable_parted" != "xno"; then |
| 43 | + PKG_CHECK_MODULES(LIBPARTED, [libparted >= 1.8.8], |
| 44 | + [AC_DEFINE(USE_PARTED, 1, [Define if parted should be used]) have_parted=yes], |
| 45 | + have_parted=no) |
| 46 | + AC_SUBST(LIBPARTED_CFLAGS) |
| 47 | + AC_SUBST(LIBPARTED_LIBS) |
| 48 | + if test "x$have_parted" = xno -a "x$enable_parted" = xyes; then |
| 49 | + AC_MSG_ERROR([parted support requested but libraries not found]) |
| 50 | + fi |
| 51 | +fi |
| 52 | +AM_CONDITIONAL(HAVE_PARTED, [test "$have_parted" = "yes"]) |
| 53 | + |
| 54 | +have_devmapper=no |
| 55 | +AC_ARG_ENABLE(devmapper, AS_HELP_STRING([--disable-devmapper], [disable device mapper support])) |
| 56 | +if test "x$enable_devmapper" != "xno"; then |
| 57 | + PKG_CHECK_MODULES(DEVMAPPER, [devmapper >= 1.02], |
| 58 | + [AC_DEFINE(HAVE_DEVMAPPER, 1, [Define if device mapper is available]) have_devmapper=yes], |
| 59 | + have_devmapper=no) |
| 60 | + AC_SUBST(DEVMAPPER_CFLAGS) |
| 61 | + AC_SUBST(DEVMAPPER_LIBS) |
| 62 | + if test "x$have_devmapper" = xno -a "x$enable_devmapper" = xyes; then |
| 63 | + AC_MSG_ERROR([devmapper support requested but libraries not found]) |
| 64 | + fi |
| 65 | +fi |
| 66 | +AM_CONDITIONAL(HAVE_DEVMAPPER, [test "$have_devmapper" = "yes"]) |
| 67 | |
| 68 | have_lvm2=no |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 69 | AC_ARG_ENABLE(lvm2, AS_HELP_STRING([--enable-lvm2], [enable LVM2 support])) |
| 70 | @@ -185,9 +205,19 @@ if test "x$enable_dmmp" = "xyes"; then |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 71 | fi |
| 72 | AM_CONDITIONAL(HAVE_DMMP, [test "$have_dmmp" = "yes"]) |
| 73 | |
| 74 | -PKG_CHECK_MODULES(LIBATASMART, [libatasmart >= 0.14]) |
| 75 | -AC_SUBST(LIBATASMART_CFLAGS) |
| 76 | -AC_SUBST(LIBATASMART_LIBS) |
| 77 | +have_libatasmart=no |
| 78 | +AC_ARG_ENABLE(libatasmart, AS_HELP_STRING([--disable-libatasmart], [disable libatasmart support])) |
| 79 | +if test "x$enable_libatasmart" != "xno"; then |
| 80 | + PKG_CHECK_MODULES(LIBATASMART, [libatasmart >= 0.14], |
| 81 | + [AC_DEFINE(HAVE_LIBATASMART, 1, [Define if libatasmart is available]) have_libatasmart=yes], |
| 82 | + have_libatasmart=no) |
| 83 | + AC_SUBST(LIBATASMART_CFLAGS) |
| 84 | + AC_SUBST(LIBATASMART_LIBS) |
| 85 | + if test "x$have_libatasmart" = xno -a "x$enable_libatasmart" = xyes; then |
| 86 | + AC_MSG_ERROR([libatasmart support requested but libraries not found]) |
| 87 | + fi |
| 88 | +fi |
| 89 | +AM_CONDITIONAL(HAVE_LIBATASMART, [test "$have_libatasmart" = "yes"]) |
| 90 | |
| 91 | PKG_CHECK_MODULES(LIBUDEV, [libudev >= 143]) |
| 92 | AC_SUBST(LIBUDEV_CFLAGS) |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 93 | @@ -278,9 +308,12 @@ echo " |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 94 | cppflags: ${CPPFLAGS} |
| 95 | xsltproc: ${XSLTPROC} |
| 96 | |
| 97 | + Parted support: ${have_parted} |
| 98 | + Device Mapper support: ${have_devmapper} |
| 99 | LVM2 support: ${have_lvm2} |
| 100 | dm-multipath: ${have_dmmp} |
| 101 | Remote Access: ${remote_access} |
| 102 | + libatasmart support: ${have_libatasmart} |
| 103 | |
| 104 | Maintainer mode: ${USE_MAINTAINER_MODE} |
| 105 | Profiling: ${enable_profiling} |
| 106 | diff --git a/src/adapter-private.h b/src/adapter-private.h |
| 107 | index 3409e21..ef584e3 100644 |
| 108 | --- a/src/adapter-private.h |
| 109 | +++ b/src/adapter-private.h |
| 110 | @@ -23,7 +23,6 @@ |
| 111 | |
| 112 | #include <dbus/dbus-glib.h> |
| 113 | #include <gudev/gudev.h> |
| 114 | -#include <atasmart.h> |
| 115 | |
| 116 | #include "types.h" |
| 117 | |
| 118 | diff --git a/src/adapter.c b/src/adapter.c |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 119 | index 65e05b0..45db8c8 100644 |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 120 | --- a/src/adapter.c |
| 121 | +++ b/src/adapter.c |
| 122 | @@ -30,7 +30,6 @@ |
| 123 | #include <dbus/dbus-glib.h> |
| 124 | #include <dbus/dbus-glib-lowlevel.h> |
| 125 | #include <gudev/gudev.h> |
| 126 | -#include <atasmart.h> |
| 127 | |
| 128 | #include "daemon.h" |
| 129 | #include "adapter.h" |
| 130 | diff --git a/src/daemon.c b/src/daemon.c |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 131 | index fafcf9a..14e952f 100644 |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 132 | --- a/src/daemon.c |
| 133 | +++ b/src/daemon.c |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 134 | @@ -1748,6 +1748,7 @@ mdstat_changed_event (GIOChannel *channel, |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 135 | return TRUE; |
| 136 | } |
| 137 | |
| 138 | +#ifdef HAVE_LIBATASMART |
| 139 | static gboolean |
| 140 | refresh_ata_smart_data (Daemon *daemon) |
| 141 | { |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 142 | @@ -1776,6 +1777,7 @@ refresh_ata_smart_data (Daemon *daemon) |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 143 | |
| 144 | return FALSE; |
| 145 | } |
| 146 | +#endif |
| 147 | |
| 148 | static gboolean |
| 149 | register_disks_daemon (Daemon *daemon) |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 150 | @@ -1987,12 +1989,14 @@ daemon_new (void) |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 151 | mount_file_clean_stale (l); |
| 152 | g_list_free (l); |
| 153 | |
| 154 | +#ifdef HAVE_LIBATASMART |
| 155 | /* set up timer for refreshing ATA SMART data - we don't want to refresh immediately because |
| 156 | * when adding a device we also do this... |
| 157 | */ |
| 158 | daemon->priv->ata_smart_refresh_timer_id = g_timeout_add_seconds (ATA_SMART_REFRESH_INTERVAL_SECONDS, |
| 159 | (GSourceFunc) refresh_ata_smart_data, |
| 160 | daemon); |
| 161 | +#endif |
| 162 | |
| 163 | PROFILE ("daemon_new(): end"); |
| 164 | return daemon; |
| 165 | diff --git a/src/device-private.c b/src/device-private.c |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 166 | index 45418ce..fb1d959 100644 |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 167 | --- a/src/device-private.c |
| 168 | +++ b/src/device-private.c |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 169 | @@ -1390,7 +1390,7 @@ device_set_drive_ata_smart_time_collected (Device *device, |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 170 | |
| 171 | void |
| 172 | device_set_drive_ata_smart_status (Device *device, |
| 173 | - SkSmartOverall value) |
| 174 | + guint value) |
| 175 | { |
| 176 | if (G_UNLIKELY (device->priv->drive_ata_smart_status != value)) |
| 177 | { |
| 178 | diff --git a/src/device-private.h b/src/device-private.h |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 179 | index 32a9bd0..8c57c13 100644 |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 180 | --- a/src/device-private.h |
| 181 | +++ b/src/device-private.h |
| 182 | @@ -23,7 +23,6 @@ |
| 183 | |
| 184 | #include <dbus/dbus-glib.h> |
| 185 | #include <gudev/gudev.h> |
| 186 | -#include <atasmart.h> |
| 187 | |
| 188 | #include "types.h" |
| 189 | |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 190 | @@ -228,7 +227,7 @@ struct DevicePrivate |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 191 | |
| 192 | gboolean drive_ata_smart_is_available; |
| 193 | guint64 drive_ata_smart_time_collected; |
| 194 | - SkSmartOverall drive_ata_smart_status; |
| 195 | + guint drive_ata_smart_status; |
| 196 | void *drive_ata_smart_blob; |
| 197 | gsize drive_ata_smart_blob_size; |
| 198 | |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 199 | @@ -396,7 +395,7 @@ void device_set_holders_objpath (Device *device, GStrv value); |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 200 | |
| 201 | void device_set_drive_ata_smart_is_available (Device *device, gboolean value); |
| 202 | void device_set_drive_ata_smart_time_collected (Device *device, guint64 value); |
| 203 | -void device_set_drive_ata_smart_status (Device *device, SkSmartOverall value); |
| 204 | +void device_set_drive_ata_smart_status (Device *device, guint value); |
| 205 | void device_set_drive_ata_smart_blob_steal (Device *device, gchar *blob, gsize blob_size); |
| 206 | |
| 207 | G_END_DECLS |
| 208 | diff --git a/src/device.c b/src/device.c |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 209 | index 2ae7f38..d73f9d6 100644 |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 210 | --- a/src/device.c |
| 211 | +++ b/src/device.c |
| 212 | @@ -50,7 +50,9 @@ |
| 213 | #include <dbus/dbus-glib.h> |
| 214 | #include <dbus/dbus-glib-lowlevel.h> |
| 215 | #include <gudev/gudev.h> |
| 216 | +#ifdef HAVE_LIBATASMART |
| 217 | #include <atasmart.h> |
| 218 | +#endif |
| 219 | |
| 220 | #include "daemon.h" |
| 221 | #include "device.h" |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 222 | @@ -664,10 +666,14 @@ get_property (GObject *object, |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 223 | case PROP_DRIVE_ATA_SMART_STATUS: |
| 224 | { |
| 225 | const gchar *status; |
| 226 | - if (device->priv->drive_ata_smart_status == (SkSmartOverall) - 1) |
| 227 | +#ifdef HAVE_LIBATASMART |
| 228 | + if (device->priv->drive_ata_smart_status == (guint) - 1) |
| 229 | status = ""; |
| 230 | else |
| 231 | status = sk_smart_overall_to_string (device->priv->drive_ata_smart_status); |
| 232 | +#else |
| 233 | + status = ""; |
| 234 | +#endif |
| 235 | g_value_set_string (value, status); |
| 236 | } |
| 237 | break; |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 238 | @@ -5144,6 +5150,7 @@ device_new (Daemon *daemon, |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 239 | goto out; |
| 240 | } |
| 241 | |
| 242 | +#ifdef HAVE_LIBATASMART |
| 243 | /* if just added, update the smart data if applicable */ |
| 244 | if (device->priv->drive_ata_smart_is_available) |
| 245 | { |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 246 | @@ -5151,6 +5158,7 @@ device_new (Daemon *daemon, |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 247 | gchar *ata_smart_refresh_data_options[] = { NULL }; |
| 248 | device_drive_ata_smart_refresh_data (device, ata_smart_refresh_data_options, NULL); |
| 249 | } |
| 250 | +#endif |
| 251 | |
| 252 | PROFILE ("device_new(native_path=%s): end", native_path); |
| 253 | out: |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 254 | @@ -9840,16 +9848,18 @@ drive_ata_smart_refresh_data_completed_cb (DBusGMethodInvocation *context, |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 255 | const char *stdout, |
| 256 | gpointer user_data) |
| 257 | { |
| 258 | +#ifdef HAVE_LIBATASMART |
| 259 | gint rc; |
| 260 | - SkDisk *d; |
| 261 | + SkDisk *d = NULL; |
| 262 | + SkSmartOverall overall; |
| 263 | gchar *blob; |
| 264 | gsize blob_size; |
| 265 | time_t time_collected; |
| 266 | - SkSmartOverall overall; |
| 267 | +#endif |
| 268 | |
| 269 | PROFILE ("drive_ata_smart_refresh_data_completed_cb(device=%s) start", device->priv->native_path); |
| 270 | |
| 271 | - d = NULL; |
| 272 | +#ifdef HAVE_LIBATASMART |
| 273 | blob = NULL; |
| 274 | |
| 275 | if (job_was_cancelled || stdout == NULL) |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 276 | @@ -9953,6 +9963,11 @@ drive_ata_smart_refresh_data_completed_cb (DBusGMethodInvocation *context, |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 277 | g_free (blob); |
| 278 | if (d != NULL) |
| 279 | sk_disk_free (d); |
| 280 | + |
| 281 | +#else |
| 282 | + throw_error (context, ERROR_FAILED, "libatasmart support disabled"); |
| 283 | +#endif |
| 284 | + |
| 285 | PROFILE ("drive_ata_smart_refresh_data_completed_cb(device=%s) end", device->priv->native_path); |
| 286 | } |
| 287 | |
| 288 | diff --git a/src/expander-private.h b/src/expander-private.h |
| 289 | index ef4f440..98a8300 100644 |
| 290 | --- a/src/expander-private.h |
| 291 | +++ b/src/expander-private.h |
| 292 | @@ -23,7 +23,6 @@ |
| 293 | |
| 294 | #include <dbus/dbus-glib.h> |
| 295 | #include <gudev/gudev.h> |
| 296 | -#include <atasmart.h> |
| 297 | |
| 298 | #include "types.h" |
| 299 | |
| 300 | diff --git a/src/expander.c b/src/expander.c |
| 301 | index 734ec0a..e799f13 100644 |
| 302 | --- a/src/expander.c |
| 303 | +++ b/src/expander.c |
| 304 | @@ -34,7 +34,6 @@ |
| 305 | #include <dbus/dbus-glib.h> |
| 306 | #include <dbus/dbus-glib-lowlevel.h> |
| 307 | #include <gudev/gudev.h> |
| 308 | -#include <atasmart.h> |
| 309 | #include <stdlib.h> |
| 310 | |
| 311 | #include "daemon.h" |
| 312 | diff --git a/src/helpers/Makefile.am b/src/helpers/Makefile.am |
| 313 | index 4b863c0..d3ec4e9 100644 |
| 314 | --- a/src/helpers/Makefile.am |
| 315 | +++ b/src/helpers/Makefile.am |
| 316 | @@ -19,15 +19,9 @@ INCLUDES = \ |
| 317 | |
| 318 | libexec_PROGRAMS = \ |
| 319 | udisks-helper-mkfs \ |
| 320 | - udisks-helper-delete-partition \ |
| 321 | - udisks-helper-create-partition \ |
| 322 | - udisks-helper-modify-partition \ |
| 323 | - udisks-helper-create-partition-table \ |
| 324 | udisks-helper-change-filesystem-label \ |
| 325 | udisks-helper-linux-md-remove-component \ |
| 326 | udisks-helper-fstab-mounter \ |
| 327 | - udisks-helper-ata-smart-collect \ |
| 328 | - udisks-helper-ata-smart-selftest \ |
| 329 | udisks-helper-drive-detach \ |
| 330 | udisks-helper-drive-poll \ |
| 331 | udisks-helper-linux-md-check \ |
| 332 | @@ -48,6 +42,13 @@ udisks_helper_mkfs_SOURCES = job-shared.h job-mkfs.c |
| 333 | udisks_helper_mkfs_CPPFLAGS = $(AM_CPPFLAGS) |
| 334 | udisks_helper_mkfs_LDADD = $(GLIB_LIBS) |
| 335 | |
| 336 | +if HAVE_PARTED |
| 337 | +libexec_PROGRAMS += \ |
| 338 | + udisks-helper-delete-partition \ |
| 339 | + udisks-helper-create-partition \ |
| 340 | + udisks-helper-modify-partition \ |
| 341 | + udisks-helper-create-partition-table |
| 342 | + |
| 343 | udisks_helper_delete_partition_SOURCES = job-shared.h job-delete-partition.c |
| 344 | udisks_helper_delete_partition_CPPFLAGS = $(AM_CPPFLAGS) |
| 345 | udisks_helper_delete_partition_LDADD = $(GLIB_LIBS) libpartutil.la |
| 346 | @@ -63,11 +64,17 @@ udisks_helper_modify_partition_LDADD = $(GLIB_LIBS) libpartutil.la |
| 347 | udisks_helper_create_partition_table_SOURCES = job-shared.h job-create-partition-table.c |
| 348 | udisks_helper_create_partition_table_CPPFLAGS = $(AM_CPPFLAGS) |
| 349 | udisks_helper_create_partition_table_LDADD = $(GLIB_LIBS) libpartutil.la |
| 350 | +endif |
| 351 | |
| 352 | udisks_helper_change_filesystem_label_SOURCES = job-shared.h job-change-filesystem-label.c |
| 353 | udisks_helper_change_filesystem_label_CPPFLAGS = $(AM_CPPFLAGS) |
| 354 | udisks_helper_change_filesystem_label_LDADD = $(GLIB_LIBS) |
| 355 | |
| 356 | +if HAVE_LIBATASMART |
| 357 | +libexec_PROGRAMS += \ |
| 358 | + udisks-helper-ata-smart-collect \ |
| 359 | + udisks-helper-ata-smart-selftest |
| 360 | + |
| 361 | udisks_helper_ata_smart_selftest_SOURCES = job-shared.h job-ata-smart-selftest.c |
| 362 | udisks_helper_ata_smart_selftest_CPPFLAGS = $(AM_CPPFLAGS) $(LIBATASMART_CFLAGS) $(GLIB_CFLAGS) |
| 363 | udisks_helper_ata_smart_selftest_LDADD = $(LIBATASMART_LIBS) $(GLIB_LIBS) |
| 364 | @@ -75,6 +82,7 @@ udisks_helper_ata_smart_selftest_LDADD = $(LIBATASMART_LIBS) $(GLIB_LIBS) |
| 365 | udisks_helper_ata_smart_collect_SOURCES = job-ata-smart-collect.c |
| 366 | udisks_helper_ata_smart_collect_CPPFLAGS = $(AM_CPPFLAGS) $(LIBATASMART_CFLAGS) $(GLIB_CFLAGS) |
| 367 | udisks_helper_ata_smart_collect_LDADD = $(LIBATASMART_LIBS) $(GLIB_LIBS) |
| 368 | +endif |
| 369 | |
| 370 | udisks_helper_linux_md_remove_component_SOURCES = job-shared.h job-linux-md-remove-component.c |
| 371 | udisks_helper_linux_md_remove_component_CPPFLAGS = $(AM_CPPFLAGS) |
| 372 | diff --git a/src/helpers/partutil.c b/src/helpers/partutil.c |
| 373 | index 72a8fe3..8893a39 100644 |
| 374 | --- a/src/helpers/partutil.c |
| 375 | +++ b/src/helpers/partutil.c |
| 376 | @@ -62,7 +62,6 @@ DEBUG (const gchar *format, |
| 377 | # include <config.h> |
| 378 | #endif |
| 379 | |
| 380 | -#define USE_PARTED |
| 381 | #ifdef USE_PARTED |
| 382 | #include <parted/parted.h> |
| 383 | #endif |
| 384 | @@ -928,6 +927,7 @@ part_table_parse_apple (int fd, |
| 385 | return p; |
| 386 | } |
| 387 | |
| 388 | +#ifdef USE_PARTED |
| 389 | static PartitionTable * |
| 390 | part_table_load_from_disk_from_file (char *device_file) |
| 391 | { |
| 392 | @@ -948,6 +948,7 @@ part_table_load_from_disk_from_file (char *device_file) |
| 393 | out: |
| 394 | return ret; |
| 395 | } |
| 396 | +#endif |
| 397 | |
| 398 | PartitionTable * |
| 399 | part_table_load_from_disk (int fd) |
| 400 | diff --git a/src/port-private.h b/src/port-private.h |
| 401 | index cc48376..a91532f 100644 |
| 402 | --- a/src/port-private.h |
| 403 | +++ b/src/port-private.h |
| 404 | @@ -23,7 +23,6 @@ |
| 405 | |
| 406 | #include <dbus/dbus-glib.h> |
| 407 | #include <gudev/gudev.h> |
| 408 | -#include <atasmart.h> |
| 409 | |
| 410 | #include "types.h" |
| 411 | |
| 412 | diff --git a/src/probers/Makefile.am b/src/probers/Makefile.am |
| 413 | index 06bb566..01c693b 100644 |
| 414 | --- a/src/probers/Makefile.am |
| 415 | +++ b/src/probers/Makefile.am |
| 416 | @@ -22,8 +22,6 @@ INCLUDES = \ |
| 417 | |
| 418 | udevhelperdir = $(slashlibdir)/udev |
| 419 | udevhelper_PROGRAMS = udisks-part-id \ |
| 420 | - udisks-dm-export \ |
| 421 | - udisks-probe-ata-smart \ |
| 422 | udisks-probe-sas-expander \ |
| 423 | $(NULL) |
| 424 | |
| 425 | @@ -35,17 +33,23 @@ udisks_part_id_SOURCES = part-id.c |
| 426 | udisks_part_id_CPPFLAGS = $(AM_CPPFLAGS) $(LIBUDEV_CFLAGS) |
| 427 | udisks_part_id_LDADD = $(GLIB_LIBS) $(LIBUDEV_LIBS) $(top_builddir)/src/helpers/libpartutil.la |
| 428 | |
| 429 | +if HAVE_DEVMAPPER |
| 430 | +udevhelper_PROGRAMS += udisks-dm-export |
| 431 | udisks_dm_export_SOURCES = udisks-dm-export.c |
| 432 | udisks_dm_export_CPPFLAGS = $(AM_CPPFLAGS) $(DEVMAPPER_CFLAGS) $(GLIB_CFLAGS) |
| 433 | udisks_dm_export_LDADD = $(DEVMAPPER_LIBS) $(GLIB_LIBS) |
| 434 | +endif |
| 435 | |
| 436 | udisks_lvm_pv_export_SOURCES = udisks-lvm-pv-export.c |
| 437 | udisks_lvm_pv_export_CPPFLAGS = $(AM_CPPFLAGS) $(DEVMAPPER_CFLAGS) $(LVM2_CFLAGS) $(GLIB_CFLAGS) |
| 438 | udisks_lvm_pv_export_LDADD = $(DEVMAPPER_LIBS) $(LVM2_LIBS) $(GLIB_LIBS) |
| 439 | |
| 440 | +if HAVE_LIBATASMART |
| 441 | +udevhelper_PROGRAMS += udisks-probe-ata-smart |
| 442 | udisks_probe_ata_smart_SOURCES = udisks-probe-ata-smart.c |
| 443 | udisks_probe_ata_smart_CPPFLAGS = $(AM_CPPFLAGS) $(LIBATASMART_CFLAGS) |
| 444 | udisks_probe_ata_smart_LDADD = $(LIBATASMART_LIBS) |
| 445 | +endif |
| 446 | |
| 447 | udisks_probe_sas_expander_SOURCES = udisks-probe-sas-expander.c |
| 448 | udisks_probe_sas_expander_CPPFLAGS = $(AM_CPPFLAGS) $(GLIB_CFLAGS) |
| 449 | diff --git a/tools/udisks.c b/tools/udisks.c |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 450 | index 97e80d7..d30159b 100644 |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 451 | --- a/tools/udisks.c |
| 452 | +++ b/tools/udisks.c |
| 453 | @@ -43,7 +43,9 @@ |
| 454 | #include <dbus/dbus-glib.h> |
| 455 | #include <dbus/dbus-glib-lowlevel.h> |
| 456 | |
| 457 | +#ifdef HAVE_LIBATASMART |
| 458 | #include <atasmart.h> |
| 459 | +#endif |
| 460 | |
| 461 | #include "udisks-daemon-glue.h" |
| 462 | #include "udisks-device-glue.h" |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 463 | @@ -983,6 +985,7 @@ end_highlight (void) |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 464 | g_print ("\x1B[0m"); |
| 465 | } |
| 466 | |
| 467 | +#ifdef HAVE_LIBATASMART |
| 468 | static const gchar * |
| 469 | ata_smart_status_to_desc (const gchar *status, |
| 470 | gboolean *out_highlight) |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 471 | @@ -1163,6 +1166,7 @@ print_ata_smart_attr (SkDisk *d, |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 472 | g_free (threshold_str); |
| 473 | g_free (pretty); |
| 474 | } |
| 475 | +#endif |
| 476 | |
| 477 | static void |
| 478 | do_show_info (const char *object_path) |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 479 | @@ -1445,7 +1449,7 @@ do_show_info (const char *object_path) |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 480 | g_print (" if speed: %" G_GINT64_FORMAT " bits/s\n", props->drive_connection_speed); |
| 481 | |
| 482 | /* ------------------------------------------------------------------------------------------------- */ |
| 483 | - |
| 484 | +#ifdef HAVE_LIBATASMART |
| 485 | if (!props->drive_ata_smart_is_available) |
| 486 | { |
| 487 | g_print (" ATA SMART: not available\n"); |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 488 | @@ -1498,7 +1502,9 @@ do_show_info (const char *object_path) |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 489 | } |
| 490 | |
| 491 | } |
| 492 | - |
| 493 | +#else |
| 494 | + g_print (" ATA SMART: not supported\n"); |
| 495 | +#endif |
| 496 | /* ------------------------------------------------------------------------------------------------- */ |
| 497 | |
| 498 | } |