diff --git a/README.md b/README.md index a779a07..c9c1435 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,5 @@ # libatasmart +A small and lightweight parser library for ATA S.M.A.R.T. hard disk +health monitoring. + diff --git a/glibc-scsi_h.patch b/glibc-scsi_h.patch new file mode 100644 index 0000000..ceee55f --- /dev/null +++ b/glibc-scsi_h.patch @@ -0,0 +1,17 @@ +--- /usr/include/scsi/scsi.h 2009-07-15 11:00:17.897425654 +0200 ++++ /usr/include/scsi/scsi.h.patched 2009-07-15 11:00:08.305425688 +0200 +@@ -142,10 +142,10 @@ + + /* defined in T10 SCSI Primary Commands-2 (SPC2) */ + struct scsi_varlen_cdb_hdr { +- u8 opcode; /* opcode always == VARIABLE_LENGTH_CMD */ +- u8 control; +- u8 misc[5]; +- u8 additional_cdb_length; /* total cdb length - 8 */ ++ __u8 opcode; /* opcode always == VARIABLE_LENGTH_CMD */ ++ __u8 control; ++ __u8 misc[5]; ++ __u8 additional_cdb_length; /* total cdb length - 8 */ + __be16 service_action; + /* service specific data follows */ + }; diff --git a/libatasmart-uninitialized-var.patch b/libatasmart-uninitialized-var.patch new file mode 100644 index 0000000..e88e22a --- /dev/null +++ b/libatasmart-uninitialized-var.patch @@ -0,0 +1,52 @@ +From 26f0cc57fcf346753f17e75fb1378f053dcba92c Mon Sep 17 00:00:00 2001 +From: David Zeuthen +Date: Wed, 9 Dec 2009 17:14:36 -0500 +Subject: [PATCH] fix return of uninitialized variable +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + + atasmart.c: In function ‘init_smart’: + atasmart.c:2556: warning: ‘ret’ may be used uninitialized in this function + +We apparently don't initialize the ret variable in init_smart() - +unfortunately + + o this warning is never reported with using -O0 (thanks gcc - + see http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings though) + + o we never run into this bug with just skdump(1) + +The bug does show up in the udisks (aka DeviceKit-disks) use of +libatasmart and this patch fixes it. + +Signed-off-by: David Zeuthen +--- + atasmart.c | 4 ++++ + 1 files changed, 4 insertions(+), 0 deletions(-) + +diff --git a/atasmart.c b/atasmart.c +index 3ff0334..cf93819 100644 +--- a/atasmart.c ++++ b/atasmart.c +@@ -2564,6 +2564,8 @@ static int init_smart(SkDisk *d) { + if (!disk_smart_is_available(d)) + return 0; + ++ ret = -1; ++ + if (!disk_smart_is_enabled(d)) { + if ((ret = disk_smart_enable(d, TRUE)) < 0) + goto fail; +@@ -2580,6 +2582,8 @@ static int init_smart(SkDisk *d) { + + disk_smart_read_thresholds(d); + ++ ret = 0; ++ + fail: + return ret; + } +-- +1.6.5.5 + diff --git a/libatasmart.spec b/libatasmart.spec new file mode 100644 index 0000000..69f6e0c --- /dev/null +++ b/libatasmart.spec @@ -0,0 +1,104 @@ +Name: libatasmart +Version: 0.19 +Release: 1mamba +Summary: ATA S.M.A.R.T. Disk Health Monitoring Library +Group: System/Libraries +Vendor: openmamba +Distribution: openmamba +Packager: Automatic Build System +URL: http://git.0pointer.de/?p=libatasmart.git;a=summary +Source: http://0pointer.de/public/libatasmart-%{version}.tar.xz +# FIXME rebuild glibc and apply this patch +# see http://www.mail-archive.com/debian-kernel@lists.debian.org/msg48804.html +Source1: glibc-scsi_h.patch +# https://bugs.freedesktop.org/show_bug.cgi?id=25543 +Patch0: libatasmart-uninitialized-var.patch +License: LGPL +## AUTOBUILDREQ-BEGIN +BuildRequires: glibc-devel +BuildRequires: udev-devel +## AUTOBUILDREQ-END +BuildRoot: %{_tmppath}/%{name}-%{version}-root + +%description +A small and lightweight parser library for ATA S.M.A.R.T. hard disk +health monitoring. + +%package devel +Group: Development/Libraries +Summary: Libraries and headers for %{name} +Requires: %{name} = %{?epoch:%epoch:}%{version}-%{release} +Requires: vala + +%description devel +ATA S.M.A.R.T. Disk Health Monitoring Library. + +This package contains libraries and header files need for development. + +%package static +Group: Development/Libraries +Summary: Static libraries for %{name} +Requires: %{name}-devel = %{?epoch:%epoch:}%{version}-%{release} + +%description static +ATA S.M.A.R.T. Disk Health Monitoring Library. + +This package contains static libraries need for development. + +%prep +%setup -q +%patch0 -p1 -b .uninitialized-var.patch + +%build +%configure +%make + +%install +[ "%{buildroot}" != / ] && rm -rf "%{buildroot}" +%makeinstall +rm -rf %{buildroot}%{_docdir}/libatasmart/README + +%clean +[ "%{buildroot}" != / ] && rm -rf "%{buildroot}" + +%post -p /sbin/ldconfig +%postun -p /sbin/ldconfig + +%files +%defattr(-,root,root) +%{_sbindir}/skdump +%{_sbindir}/sktest +%{_libdir}/libatasmart.so.* +%doc LGPL README + +%files devel +%defattr(-,root,root) +%{_includedir}/atasmart.h +%{_libdir}/libatasmart.so +%{_libdir}/pkgconfig/libatasmart.pc +%{_datadir}/vala/vapi/atasmart.vapi +%doc blob-examples/FUJITSU* +%doc blob-examples/INTEL* +%doc blob-examples/MCC* +%doc blob-examples/Maxtor* +%doc blob-examples/SAMSUNG* +%doc blob-examples/ST* +%doc blob-examples/TOSHIBA* +%doc blob-examples/WDC* + +%files static +%defattr(-,root,root) +%{_libdir}/libatasmart.*a + +%changelog +* Wed Aug 08 2012 Automatic Build System 0.19-1mamba +- update to 0.19 + +* Sun Oct 16 2011 Automatic Build System 0.18-1mamba +- automatic version update by autodist + +* Sat Feb 05 2011 Silvan Calarco 0.17-2mamba +- automatic port from devel-gil + +* Wed Oct 27 2010 gil 0.17-1mamba +- package created by autospec