/
0002-Drop-smartata-dependencies.patch
122 lines (108 loc) · 3.61 KB
/
0002-Drop-smartata-dependencies.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
From a74354efa70a5e5578e581e1e3a6df5d4fa1b2d2 Mon Sep 17 00:00:00 2001
From: Raine Makelainen <raine.makelainen@jolla.com>
Date: Thu, 7 Dec 2017 13:15:34 +0200
Subject: [PATCH 02/10] Drop smartata dependencies
Signed-off-by: Raine Makelainen <raine.makelainen@jolla.com>
---
configure.ac | 4 ----
src/udiskslinuxdriveata.c | 18 ++++++++++++++++++
2 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/configure.ac b/configure.ac
index 61972a62..8bdb5a9f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -166,10 +166,6 @@ PKG_CHECK_MODULES(POLKIT_AGENT_1, [polkit-agent-1 >= 0.102])
AC_SUBST(POLKIT_AGENT_1_CFLAGS)
AC_SUBST(POLKIT_AGENT_1_LIBS)
-PKG_CHECK_MODULES(LIBATASMART, [libatasmart >= 0.17])
-AC_SUBST(LIBATASMART_CFLAGS)
-AC_SUBST(LIBATASMART_LIBS)
-
PKG_CHECK_MODULES(LIBMOUNT, [mount >= 2.30],
[have_libmount=yes],
[have_libmount=no])
diff --git a/src/udiskslinuxdriveata.c b/src/udiskslinuxdriveata.c
index da349cd8..978b57a2 100644
--- a/src/udiskslinuxdriveata.c
+++ b/src/udiskslinuxdriveata.c
@@ -18,6 +18,10 @@
*
*/
+#ifndef HAVE_ATA_SMART
+#define HAVE_ATA_SMART 0
+#endif
+
#include "config.h"
#include <glib/gi18n-lib.h>
@@ -36,7 +40,9 @@
#include <glib/gstdio.h>
#include <errno.h>
+#if HAVE_ATA_SMART
#include <atasmart.h>
+#endif
#include "udiskslogging.h"
#include "udiskslinuxprovider.h"
@@ -353,6 +359,7 @@ typedef struct
gint num_attributes_failed_in_the_past;
} ParseData;
+#if HAVE_ATA_SMART
static void
parse_attr_cb (SkDisk *d,
const SkSmartAttributeParsedData *a,
@@ -433,6 +440,7 @@ selftest_status_to_string (SkSmartSelfTestExecutionStatus status)
}
return ret;
}
+#endif
static gboolean get_pm_state (UDisksLinuxDevice *device, GError **error, guchar *count)
{
@@ -470,6 +478,7 @@ static gboolean get_pm_state (UDisksLinuxDevice *device, GError **error, guchar
return rc;
}
+#if HAVE_ATA_SMART
static gboolean update_io_stats (UDisksLinuxDriveAta *drive, UDisksLinuxDevice *device)
{
const gchar *drivepath = g_udev_device_get_sysfs_path (device->udev_device);
@@ -501,6 +510,7 @@ static gboolean update_io_stats (UDisksLinuxDriveAta *drive, UDisksLinuxDevice *
}
return noio;
}
+#endif
/**
* udisks_linux_drive_ata_refresh_smart_sync:
@@ -531,6 +541,7 @@ udisks_linux_drive_ata_refresh_smart_sync (UDisksLinuxDriveAta *drive,
GCancellable *cancellable,
GError **error)
{
+#if HAVE_ATA_SMART
UDisksLinuxDriveObject *object;
UDisksLinuxDevice *device = NULL;
gboolean ret = FALSE;
@@ -685,6 +696,9 @@ udisks_linux_drive_ata_refresh_smart_sync (UDisksLinuxDriveAta *drive,
sk_disk_free (d);
g_clear_object (&object);
return ret;
+#else
+ return FALSE;
+#endif
}
/* ---------------------------------------------------------------------------------------------------- */
@@ -711,6 +725,7 @@ udisks_linux_drive_ata_smart_selftest_sync (UDisksLinuxDriveAta *drive,
GCancellable *cancellable,
GError **error)
{
+#if HAVE_ATA_SMART
UDisksLinuxDriveObject *object;
UDisksLinuxDevice *device = NULL;
SkDisk *d = NULL;
@@ -767,6 +782,9 @@ udisks_linux_drive_ata_smart_selftest_sync (UDisksLinuxDriveAta *drive,
sk_disk_free (d);
g_clear_object (&object);
return ret;
+#else
+ return FALSE;
+#endif
}
/* ---------------------------------------------------------------------------------------------------- */
--
2.17.1