diff --git a/Makefile.am b/Makefile.am index 6b70e75..3052f2f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -16,23 +16,29 @@ # License along with libatasmart. If not, If not, see # . +dist_doc_DATA = README + EXTRA_DIST = \ bootstrap.sh \ LGPL \ README \ - atasmart.vapi \ atasmart.c \ blob-examples/README \ blob-examples/FUJITSU_MHY2120BH--0084000D \ blob-examples/FUJITSU_MHY2120BH--0085000B \ + blob-examples/FUJITSU_MHY2120BH--0085000B \ blob-examples/FUJITSU_MHZ2160BH_G1--0084000A \ + blob-examples/INTEL_SSDSA2MH080G1GC--045C8820 \ blob-examples/Maxtor_96147H8--BAC51KJ0 \ + blob-examples/Maxtor_96147H8--BAC51KJ0--2 \ blob-examples/SAMSUNG_HD501LJ--CR100-12 \ blob-examples/ST320410A--3.39 \ blob-examples/ST9160821AS--3.CLH \ + blob-examples/TOSHIBA_MK1651GSY--38IGT0G5T \ blob-examples/WDC_WD2500JB--00REA0-20.00K20 \ blob-examples/WDC_WD2500JS-75NCB3--10.02E04 \ - blob-examples/WDC_WD5000AAKS--00TMA0-12.01C01 + blob-examples/WDC_WD5000AAKS--00TMA0-12.01C01 \ + vala/atasmart.vapi SUBDIRS = @@ -43,6 +49,9 @@ pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = libatasmart.pc + +vapidir = $(datadir)/vala/vapi +vapi_DATA = vala/atasmart.vapi include_HEADERS = \ atasmart.h diff --git a/Makefile.in b/Makefile.in index 25b5546..31d1be0 100644 --- a/Makefile.in +++ b/Makefile.in @@ -58,8 +58,8 @@ sbin_PROGRAMS = skdump$(EXEEXT) sktest$(EXEEXT) noinst_PROGRAMS = strpool$(EXEEXT) subdir = . -DIST_COMMON = README $(am__configure_deps) $(include_HEADERS) \ - $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ +DIST_COMMON = README $(am__configure_deps) $(dist_doc_DATA) \ + $(include_HEADERS) $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(srcdir)/config.h.in $(srcdir)/libatasmart.pc.in \ $(top_srcdir)/configure compile config.guess config.rpath \ config.sub depcomp install-sh ltmain.sh missing @@ -95,7 +95,8 @@ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(sbindir)" \ - "$(DESTDIR)$(pkgconfigdir)" "$(DESTDIR)$(includedir)" + "$(DESTDIR)$(docdir)" "$(DESTDIR)$(pkgconfigdir)" \ + "$(DESTDIR)$(vapidir)" "$(DESTDIR)$(includedir)" LTLIBRARIES = $(lib_LTLIBRARIES) am__DEPENDENCIES_1 = libatasmart_la_DEPENDENCIES = $(am__DEPENDENCIES_1) @@ -155,7 +156,7 @@ install-pdf-recursive install-ps-recursive install-recursive \ installcheck-recursive installdirs-recursive pdf-recursive \ ps-recursive uninstall-recursive -DATA = $(noinst_DATA) $(pkgconfig_DATA) +DATA = $(dist_doc_DATA) $(noinst_DATA) $(pkgconfig_DATA) $(vapi_DATA) HEADERS = $(include_HEADERS) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive @@ -322,23 +323,28 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ +dist_doc_DATA = README EXTRA_DIST = \ bootstrap.sh \ LGPL \ README \ - atasmart.vapi \ atasmart.c \ blob-examples/README \ blob-examples/FUJITSU_MHY2120BH--0084000D \ blob-examples/FUJITSU_MHY2120BH--0085000B \ + blob-examples/FUJITSU_MHY2120BH--0085000B \ blob-examples/FUJITSU_MHZ2160BH_G1--0084000A \ + blob-examples/INTEL_SSDSA2MH080G1GC--045C8820 \ blob-examples/Maxtor_96147H8--BAC51KJ0 \ + blob-examples/Maxtor_96147H8--BAC51KJ0--2 \ blob-examples/SAMSUNG_HD501LJ--CR100-12 \ blob-examples/ST320410A--3.39 \ blob-examples/ST9160821AS--3.CLH \ + blob-examples/TOSHIBA_MK1651GSY--38IGT0G5T \ blob-examples/WDC_WD2500JB--00REA0-20.00K20 \ blob-examples/WDC_WD2500JS-75NCB3--10.02E04 \ - blob-examples/WDC_WD5000AAKS--00TMA0-12.01C01 + blob-examples/WDC_WD5000AAKS--00TMA0-12.01C01 \ + vala/atasmart.vapi SUBDIRS = CLEANFILES = atasmart.strpool.c @@ -346,6 +352,8 @@ noinst_DATA = pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = libatasmart.pc +vapidir = $(datadir)/vala/vapi +vapi_DATA = vala/atasmart.vapi include_HEADERS = \ atasmart.h @@ -587,6 +595,26 @@ distclean-libtool: -rm -f libtool config.lt +install-dist_docDATA: $(dist_doc_DATA) + @$(NORMAL_INSTALL) + test -z "$(docdir)" || $(MKDIR_P) "$(DESTDIR)$(docdir)" + @list='$(dist_doc_DATA)'; test -n "$(docdir)" || list=; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(docdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(docdir)" || exit $$?; \ + done + +uninstall-dist_docDATA: + @$(NORMAL_UNINSTALL) + @list='$(dist_doc_DATA)'; test -n "$(docdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + test -n "$$files" || exit 0; \ + echo " ( cd '$(DESTDIR)$(docdir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(docdir)" && rm -f $$files install-pkgconfigDATA: $(pkgconfig_DATA) @$(NORMAL_INSTALL) test -z "$(pkgconfigdir)" || $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)" @@ -607,6 +635,26 @@ test -n "$$files" || exit 0; \ echo " ( cd '$(DESTDIR)$(pkgconfigdir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(pkgconfigdir)" && rm -f $$files +install-vapiDATA: $(vapi_DATA) + @$(NORMAL_INSTALL) + test -z "$(vapidir)" || $(MKDIR_P) "$(DESTDIR)$(vapidir)" + @list='$(vapi_DATA)'; test -n "$(vapidir)" || list=; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(vapidir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(vapidir)" || exit $$?; \ + done + +uninstall-vapiDATA: + @$(NORMAL_UNINSTALL) + @list='$(vapi_DATA)'; test -n "$(vapidir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + test -n "$$files" || exit 0; \ + echo " ( cd '$(DESTDIR)$(vapidir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(vapidir)" && rm -f $$files install-includeHEADERS: $(include_HEADERS) @$(NORMAL_INSTALL) test -z "$(includedir)" || $(MKDIR_P) "$(DESTDIR)$(includedir)" @@ -944,7 +992,7 @@ config.h installdirs: installdirs-recursive installdirs-am: - for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(pkgconfigdir)" "$(DESTDIR)$(includedir)"; do \ + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(docdir)" "$(DESTDIR)$(pkgconfigdir)" "$(DESTDIR)$(vapidir)" "$(DESTDIR)$(includedir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: $(BUILT_SOURCES) @@ -1000,7 +1048,8 @@ info-am: -install-data-am: install-includeHEADERS install-pkgconfigDATA +install-data-am: install-dist_docDATA install-includeHEADERS \ + install-pkgconfigDATA install-vapiDATA install-dvi: install-dvi-recursive @@ -1048,8 +1097,9 @@ ps-am: -uninstall-am: uninstall-includeHEADERS uninstall-libLTLIBRARIES \ - uninstall-pkgconfigDATA uninstall-sbinPROGRAMS +uninstall-am: uninstall-dist_docDATA uninstall-includeHEADERS \ + uninstall-libLTLIBRARIES uninstall-pkgconfigDATA \ + uninstall-sbinPROGRAMS uninstall-vapiDATA .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all check \ ctags-recursive install install-am install-strip \ @@ -1064,18 +1114,19 @@ distclean-generic distclean-hdr distclean-libtool \ distclean-tags distcleancheck distdir distuninstallcheck dvi \ dvi-am html html-am info info-am install install-am \ - install-data install-data-am install-dvi install-dvi-am \ - install-exec install-exec-am install-html install-html-am \ - install-includeHEADERS install-info install-info-am \ - install-libLTLIBRARIES install-man install-pdf install-pdf-am \ - install-pkgconfigDATA install-ps install-ps-am \ - install-sbinPROGRAMS install-strip installcheck \ - installcheck-am installdirs installdirs-am maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags tags-recursive uninstall uninstall-am \ - uninstall-includeHEADERS uninstall-libLTLIBRARIES \ - uninstall-pkgconfigDATA uninstall-sbinPROGRAMS + install-data install-data-am install-dist_docDATA install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-includeHEADERS install-info \ + install-info-am install-libLTLIBRARIES install-man install-pdf \ + install-pdf-am install-pkgconfigDATA install-ps install-ps-am \ + install-sbinPROGRAMS install-strip install-vapiDATA \ + installcheck installcheck-am installdirs installdirs-am \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \ + uninstall-dist_docDATA uninstall-includeHEADERS \ + uninstall-libLTLIBRARIES uninstall-pkgconfigDATA \ + uninstall-sbinPROGRAMS uninstall-vapiDATA atasmart.strpool.c: atasmart.c strpool diff --git a/aclocal.m4 b/aclocal.m4 index b1d9ba5..75840a0 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -3465,7 +3465,6 @@ eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' cat <<_LT_EOF >> conftest.$ac_ext - /* The mapping between symbol names and symbols. */ const struct { const char *name; diff --git a/atasmart.c b/atasmart.c index bce315b..4faa946 100644 --- a/atasmart.c +++ b/atasmart.c @@ -1183,7 +1183,8 @@ a->pretty_value = (fourtyeight & 0xFFFF)*100 + 273150; else if (!strcmp(a->name, "power-on-minutes")) a->pretty_value = fourtyeight * 60 * 1000; - else if (!strcmp(a->name, "power-on-seconds")) + else if (!strcmp(a->name, "power-on-seconds") || + !strcmp(a->name, "power-on-seconds-2")) a->pretty_value = fourtyeight * 1000; else if (!strcmp(a->name, "power-on-half-minutes")) a->pretty_value = fourtyeight * 30 * 1000; @@ -1309,6 +1310,13 @@ [228] = { "power-off-retract-count-2", SK_SMART_ATTRIBUTE_UNIT_NONE, NULL }, [230] = { "head-amplitude", SK_SMART_ATTRIBUTE_UNIT_UNKNOWN, NULL }, [231] = { "temperature-celsius", SK_SMART_ATTRIBUTE_UNIT_MKELVIN, verify_temperature }, + + /* http://www.adtron.com/pdf/SMART_for_XceedLite_SATA_RevA.pdf */ + [232] = { "endurance-remaining", SK_SMART_ATTRIBUTE_UNIT_UNKNOWN, NULL }, + [233] = { "power-on-seconds-2", SK_SMART_ATTRIBUTE_UNIT_UNKNOWN, NULL }, + [234] = { "uncorrectable-ecc-count", SK_SMART_ATTRIBUTE_UNIT_SECTORS, NULL }, + [235] = { "good-block-rate", SK_SMART_ATTRIBUTE_UNIT_UNKNOWN, NULL }, + [240] = { "head-flying-hours", SK_SMART_ATTRIBUTE_UNIT_MSECONDS, verify_long_time }, [250] = { "read-error-retry-rate", SK_SMART_ATTRIBUTE_UNIT_NONE, NULL } }; @@ -1911,6 +1919,7 @@ if (!strcmp(a->name, "power-on-minutes") || !strcmp(a->name, "power-on-seconds") || + !strcmp(a->name, "power-on-seconds-2") || !strcmp(a->name, "power-on-half-minutes") || !strcmp(a->name, "power-on-hours")) { @@ -2465,12 +2474,18 @@ goto finish; } - if ((vid == 0x0c0b && pid == 0xb159) || + if ((vid == 0x152d && pid == 0x2329)) { + /* Some JMicron bridges seem to choke on SMART + * commands, so let's explicitly black list + * them here. + * + * https://bugzilla.redhat.com/show_bug.cgi?id=515881 */ + d->type = SK_DISK_TYPE_NONE; + } else if ((vid == 0x0c0b && pid == 0xb159) || (vid == 0x04fc && pid == 0x0c25) || (vid == 0x04fc && pid == 0x0c15)) d->type = SK_DISK_TYPE_SUNPLUS; - else if ((vid == 0x152d && pid == 0x2329) || - (vid == 0x152d && pid == 0x2336) || + else if ((vid == 0x152d && pid == 0x2336) || (vid == 0x152d && pid == 0x2338) || (vid == 0x152d && pid == 0x2339)) d->type = SK_DISK_TYPE_JMICRON; diff --git a/atasmart.strpool.c b/atasmart.strpool.c index c71af29..c0b1ac4 100644 --- a/atasmart.strpool.c +++ b/atasmart.strpool.c @@ -1,4 +1,4 @@ -/* Saved 109 relocations, saved 2 strings (19 b) due to suffix compression. */ +/* Saved 113 relocations, saved 2 strings (19 b) due to suffix compression. */ static const char _strpool_[] = "16 Byte SCSI ATA SAT Passthru\0" "12 Byte SCSI ATA SAT Passthru\0" @@ -79,6 +79,10 @@ "head-amplitude\0" /*** Suppressed due to suffix: "temperature-celsius\0" ***/ + "endurance-remaining\0" + "power-on-seconds-2\0" + "uncorrectable-ecc-count\0" + "good-block-rate\0" "head-flying-hours\0" "read-error-retry-rate\0" "9_POWERONMINUTES\0" @@ -1305,7 +1309,8 @@ a->pretty_value = (fourtyeight & 0xFFFF)*100 + 273150; else if (!strcmp(a->name, "power-on-minutes")) a->pretty_value = fourtyeight * 60 * 1000; - else if (!strcmp(a->name, "power-on-seconds")) + else if (!strcmp(a->name, "power-on-seconds") || + !strcmp(a->name, "power-on-seconds-2")) a->pretty_value = fourtyeight * 1000; else if (!strcmp(a->name, "power-on-half-minutes")) a->pretty_value = fourtyeight * 30 * 1000; @@ -1431,8 +1436,15 @@ [228] = { ((const char*) 2321), SK_SMART_ATTRIBUTE_UNIT_NONE, NULL }, [230] = { ((const char*) 2347), SK_SMART_ATTRIBUTE_UNIT_UNKNOWN, NULL }, [231] = { ((const char*) 1795), SK_SMART_ATTRIBUTE_UNIT_MKELVIN, verify_temperature }, - [240] = { ((const char*) 2362), SK_SMART_ATTRIBUTE_UNIT_MSECONDS, verify_long_time }, - [250] = { ((const char*) 2380), SK_SMART_ATTRIBUTE_UNIT_NONE, NULL } + + /* http://www.adtron.com/pdf/SMART_for_XceedLite_SATA_RevA.pdf */ + [232] = { ((const char*) 2362), SK_SMART_ATTRIBUTE_UNIT_UNKNOWN, NULL }, + [233] = { ((const char*) 2382), SK_SMART_ATTRIBUTE_UNIT_UNKNOWN, NULL }, + [234] = { ((const char*) 2401), SK_SMART_ATTRIBUTE_UNIT_SECTORS, NULL }, + [235] = { ((const char*) 2425), SK_SMART_ATTRIBUTE_UNIT_UNKNOWN, NULL }, + + [240] = { ((const char*) 2441), SK_SMART_ATTRIBUTE_UNIT_MSECONDS, verify_long_time }, + [250] = { ((const char*) 2459), SK_SMART_ATTRIBUTE_UNIT_NONE, NULL } }; /* %STRINGPOOLSTOP% */ @@ -1454,19 +1466,19 @@ /* %STRINGPOOLSTART% */ static const char *quirk_name[] = { - ((const char*) 2402), - ((const char*) 2419), - ((const char*) 2436), - ((const char*) 2457), - ((const char*) 2485), - ((const char*) 2500), + ((const char*) 2481), + ((const char*) 2498), ((const char*) 2515), - ((const char*) 2527), - ((const char*) 2547), - ((const char*) 2567), - ((const char*) 2577), - ((const char*) 2587), - ((const char*) 2599), + ((const char*) 2536), + ((const char*) 2564), + ((const char*) 2579), + ((const char*) 2594), + ((const char*) 2606), + ((const char*) 2626), + ((const char*) 2646), + ((const char*) 2656), + ((const char*) 2666), + ((const char*) 2678), NULL }; /* %STRINGPOOLSTOP% */ @@ -1703,19 +1715,19 @@ /* %STRINGPOOLSTART% */ if (quirk & SK_SMART_QUIRK_9_POWERONMINUTES) { static const SkSmartAttributeInfo a = { - ((const char*) 2611), SK_SMART_ATTRIBUTE_UNIT_MSECONDS, verify_long_time + ((const char*) 2690), SK_SMART_ATTRIBUTE_UNIT_MSECONDS, verify_long_time }; return &a; } else if (quirk & SK_SMART_QUIRK_9_POWERONSECONDS) { static const SkSmartAttributeInfo a = { - ((const char*) 2628), SK_SMART_ATTRIBUTE_UNIT_MSECONDS, verify_long_time + ((const char*) 2707), SK_SMART_ATTRIBUTE_UNIT_MSECONDS, verify_long_time }; return &a; } else if (quirk & SK_SMART_QUIRK_9_POWERONHALFMINUTES) { static const SkSmartAttributeInfo a = { - ((const char*) 2645), SK_SMART_ATTRIBUTE_UNIT_MSECONDS, verify_long_time + ((const char*) 2724), SK_SMART_ATTRIBUTE_UNIT_MSECONDS, verify_long_time }; return &a; } else if (quirk & SK_SMART_QUIRK_9_UNKNOWN) @@ -1728,7 +1740,7 @@ /* %STRINGPOOLSTART% */ if (quirk & SK_SMART_QUIRK_192_EMERGENCYRETRACTCYCLECT) { static const SkSmartAttributeInfo a = { - ((const char*) 2667), SK_SMART_ATTRIBUTE_UNIT_NONE, NULL + ((const char*) 2746), SK_SMART_ATTRIBUTE_UNIT_NONE, NULL }; return &a; } @@ -1740,7 +1752,7 @@ /* %STRINGPOOLSTART% */ if (quirk & SK_SMART_QUIRK_194_10XCELSIUS) { static const SkSmartAttributeInfo a = { - ((const char*) 2697), SK_SMART_ATTRIBUTE_UNIT_MKELVIN, verify_temperature + ((const char*) 2776), SK_SMART_ATTRIBUTE_UNIT_MKELVIN, verify_temperature }; return &a; } else if (quirk & SK_SMART_QUIRK_194_UNKNOWN) @@ -1765,7 +1777,7 @@ /* %STRINGPOOLSTART% */ if (quirk & SK_SMART_QUIRK_200_WRITEERRORCOUNT) { static const SkSmartAttributeInfo a = { - ((const char*) 2723), SK_SMART_ATTRIBUTE_UNIT_NONE, NULL + ((const char*) 2802), SK_SMART_ATTRIBUTE_UNIT_NONE, NULL }; return &a; } @@ -1777,7 +1789,7 @@ /* %STRINGPOOLSTART% */ if (quirk & SK_SMART_QUIRK_201_DETECTEDTACOUNT) { static const SkSmartAttributeInfo a = { - ((const char*) 2741), SK_SMART_ATTRIBUTE_UNIT_NONE, NULL + ((const char*) 2820), SK_SMART_ATTRIBUTE_UNIT_NONE, NULL }; return &a; } @@ -1972,9 +1984,9 @@ const char * const map[] = { [SK_SMART_ATTRIBUTE_UNIT_UNKNOWN] = NULL, [SK_SMART_ATTRIBUTE_UNIT_NONE] = ((const char*) 30), - [SK_SMART_ATTRIBUTE_UNIT_MSECONDS] = ((const char*) 2759), - [SK_SMART_ATTRIBUTE_UNIT_SECTORS] = ((const char*) 2762), - [SK_SMART_ATTRIBUTE_UNIT_MKELVIN] = ((const char*) 2770) + [SK_SMART_ATTRIBUTE_UNIT_MSECONDS] = ((const char*) 2838), + [SK_SMART_ATTRIBUTE_UNIT_SECTORS] = ((const char*) 2841), + [SK_SMART_ATTRIBUTE_UNIT_MKELVIN] = ((const char*) 2849) }; /* %STRINGPOOLSTOP% */ @@ -2033,6 +2045,7 @@ if (!strcmp(a->name, "power-on-minutes") || !strcmp(a->name, "power-on-seconds") || + !strcmp(a->name, "power-on-seconds-2") || !strcmp(a->name, "power-on-half-minutes") || !strcmp(a->name, "power-on-hours")) { @@ -2163,12 +2176,12 @@ /* %STRINGPOOLSTART% */ const char * const map[] = { - [SK_SMART_OVERALL_GOOD] = ((const char*) 2773), - [SK_SMART_OVERALL_BAD_ATTRIBUTE_IN_THE_PAST] = ((const char*) 2778), - [SK_SMART_OVERALL_BAD_SECTOR] = ((const char*) 2804), - [SK_SMART_OVERALL_BAD_ATTRIBUTE_NOW] = ((const char*) 2815), - [SK_SMART_OVERALL_BAD_SECTOR_MANY] = ((const char*) 2833), - [SK_SMART_OVERALL_BAD_STATUS] = ((const char*) 2849), + [SK_SMART_OVERALL_GOOD] = ((const char*) 2852), + [SK_SMART_OVERALL_BAD_ATTRIBUTE_IN_THE_PAST] = ((const char*) 2857), + [SK_SMART_OVERALL_BAD_SECTOR] = ((const char*) 2883), + [SK_SMART_OVERALL_BAD_ATTRIBUTE_NOW] = ((const char*) 2894), + [SK_SMART_OVERALL_BAD_SECTOR_MANY] = ((const char*) 2912), + [SK_SMART_OVERALL_BAD_STATUS] = ((const char*) 2928), }; /* %STRINGPOOLSTOP% */ @@ -2587,12 +2600,18 @@ goto finish; } - if ((vid == 0x0c0b && pid == 0xb159) || + if ((vid == 0x152d && pid == 0x2329)) { + /* Some JMicron bridges seem to choke on SMART + * commands, so let's explicitly black list + * them here. + * + * https://bugzilla.redhat.com/show_bug.cgi?id=515881 */ + d->type = SK_DISK_TYPE_NONE; + } else if ((vid == 0x0c0b && pid == 0xb159) || (vid == 0x04fc && pid == 0x0c25) || (vid == 0x04fc && pid == 0x0c15)) d->type = SK_DISK_TYPE_SUNPLUS; - else if ((vid == 0x152d && pid == 0x2329) || - (vid == 0x152d && pid == 0x2336) || + else if ((vid == 0x152d && pid == 0x2336) || (vid == 0x152d && pid == 0x2338) || (vid == 0x152d && pid == 0x2339)) d->type = SK_DISK_TYPE_JMICRON; diff --git a/atasmart.vapi b/atasmart.vapi deleted file mode 100644 index b228a65..0000000 --- a/atasmart.vapi +++ /dev/null @@ -1,140 +0,0 @@ -/*-*- Mode: C; c-basic-offset: 8 -*-*/ - -/*** - This file is part of libatasmart. - - Copyright 2008 Lennart Poettering - - libatasmart is free software; you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as - published by the Free Software Foundation, either version 2.1 of the - License, or (at your option) any later version. - - libatasmart is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with libatasmart. If not, If not, see - . -***/ - -using GLib; - -[CCode (cheader_filename="atasmart.h")] -namespace Smart { - - [CCode (cname="SkSmartSelfTest", cprefix="SK_SMART_SELF_TEST_")] - public enum SmartSelfTest { - SHORT, EXTENDED, CONVEYANCE, ABORT - } - - [Immutable] - [CCode (cname="SkIdentifyParsedData")] - public struct IdentifyParsedData { - public string serial; - public string firmware; - public string model; - } - - [CCode (cname="SkSmartOfflineDataCollectionStatus", cprefix="SK_SMART_OFFLINE_DATA_COLLECTION_STATUS_")] - public enum SmartOfflineDataCollectionStatus { - NEVER, SUCCESS, INPROGRESS, SUSPENDED, ABORTED, FATAL, UNKNOWN - } - - [CCode (cname="sk_smart_offline_data_collection_status_to_string")] - public weak string smart_offline_data_collection_status_to_string(SmartOfflineDataCollectionStatus status); - - - [CCode (cname="SkSmartSelfTestExecutionStatus", cprefix="SK_SMART_SELF_TEST_EXECUTION_STATUS_")] - public enum SmartSelfTestExecutionStatus { - SUCCESS_OR_NEVER, ABORTED, INTERRUPTED, FATAL, ERROR_UNKNOWN, ERROR_ELECTRICAL, ERROR_SERVO, ERROR_READ, ERROR_HANDLING, INPROGRESS - } - - [CCode (cname="sk_smart_self_test_execution_status_to_string")] - public weak string smart_self_test_execution_status_to_string(SmartSelfTestExecutionStatus status); - - [Immutable] - [CCode (cname="SkSmartParsedData")] - public struct SmartParsedData { - public SmartOfflineDataCollectionStatus offline_data_collection_status; - public uint total_offline_data_collection_seconds; - public SmartSelfTestExecutionStatus self_test_execution_status; - public uint self_test_execution_percent_remaining; - - public bool conveyance_test_available; - public bool short_and_extended_test_available; - public bool start_test_available; - public bool abort_test_available; - - public uint short_test_polling_minutes; - public uint extended_test_polling_minutes; - public uint conveyance_test_polling_minutes; - - [CCode (cname="sk_smart_self_test_available")] - public bool self_test_available(SmartSelfTest test); - - [CCode (cname="sk_smart_self_test_polling_minutes")] - public uint self_test_polling_minutes(SmartSelfTest test); - } - - [CCode (cname="SkSmartAttributeUnit", cprefix="SK_SMART_ATTRIBUTE_UNIT_")] - public enum SmartAttributeUnit { - UNKNOWN, NONE, MSECONDS, SECTORS, MKELVIN - } - - [CCode (cname="sk_smart_attribute_unit_to_string")] - public weak string smart_attribute_unit_to_string(SmartAttributeUnit unit); - - [Immutable] - [CCode (cname="SkSmartAttributeParsedData")] - public struct SmartAttributeParsedData { - public uint8 id; - public string name; - public SmartAttributeUnit pretty_unit; - public uint16 flags; - public uint8 threshold; - public bool threshold_valid; - public bool online; - public bool prefailure; - public bool good; - public uint8 current_value; - public uint8 worst_value; - public uint64 pretty_value; - public uint8[6] raw; - } - - [CCode (cname="SkSmartAttributeParseCallback")] - public delegate void SmartAttributeParseCallback(void* disk, SmartAttributeParsedData a); - - [Compact] - [CCode (free_function="sk_disk_free", cname="SkDisk", cprefix="sk_disk_")] - public class Disk { - - public static int open(string name, out Disk disk); - - public int get_size(out uint64 bytes); - - public int check_sleep_mode(out bool awake); - - public int identify_is_available(out bool available); - public int identify_parse(out weak IdentifyParsedData* data); - - public int smart_is_available(out bool available); - public int smart_status(out bool good); - public int smart_read_data(); - public int smart_parse_attributes(SmartAttributeParseCallback cb); - public int smart_parse(out weak SmartParsedData* data); - public int smart_self_test(SmartSelfTest test); - - public int dump(); - } - - /* These two should move to an official vala package */ - [CCode (cname="errno", cheader_filename="errno.h")] - public int errno; - - [CCode (cname="g_strerror", cheader_filename="glib.h")] - public weak string strerror(int err); -} diff --git a/blob-examples/INTEL_SSDSA2MH080G1GC--045C8820 b/blob-examples/INTEL_SSDSA2MH080G1GC--045C8820 new file mode 100644 index 0000000..db9b722 Binary files /dev/null and b/blob-examples/INTEL_SSDSA2MH080G1GC--045C8820 differ diff --git a/blob-examples/Maxtor_96147H8--BAC51KJ0--2 b/blob-examples/Maxtor_96147H8--BAC51KJ0--2 new file mode 100644 index 0000000..8606d22 Binary files /dev/null and b/blob-examples/Maxtor_96147H8--BAC51KJ0--2 differ diff --git a/blob-examples/TOSHIBA_MK1651GSY--38IGT0G5T b/blob-examples/TOSHIBA_MK1651GSY--38IGT0G5T new file mode 100644 index 0000000..0a138f6 Binary files /dev/null and b/blob-examples/TOSHIBA_MK1651GSY--38IGT0G5T differ diff --git a/configure b/configure index 01032cf..3afd1f3 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.63 for libatasmart 0.14. +# Generated by GNU Autoconf 2.63 for libatasmart 0.15. # # Report bugs to . # @@ -745,8 +745,8 @@ # Identity of this package. PACKAGE_NAME='libatasmart' PACKAGE_TARNAME='libatasmart' -PACKAGE_VERSION='0.14' -PACKAGE_STRING='libatasmart 0.14' +PACKAGE_VERSION='0.15' +PACKAGE_STRING='libatasmart 0.15' PACKAGE_BUGREPORT='mzyvongnfzneg (at) 0pointer (dot) net' ac_unique_file="atasmart.c" @@ -1489,7 +1489,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures libatasmart 0.14 to adapt to many kinds of systems. +\`configure' configures libatasmart 0.15 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1559,7 +1559,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of libatasmart 0.14:";; + short | recursive ) echo "Configuration of libatasmart 0.15:";; esac cat <<\_ACEOF @@ -1669,7 +1669,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -libatasmart configure 0.14 +libatasmart configure 0.15 generated by GNU Autoconf 2.63 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -1683,7 +1683,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by libatasmart $as_me 0.14, which was +It was created by libatasmart $as_me 0.15, which was generated by GNU Autoconf 2.63. Invocation command line was $ $0 $@ @@ -2549,7 +2549,7 @@ # Define the identity of the package. PACKAGE='libatasmart' - VERSION='0.14' + VERSION='0.15' cat >>confdefs.h <<_ACEOF @@ -2674,7 +2674,7 @@ PACKAGE_URL=http://git.0pointer.de/?p=libatasmart.git -LIBATASMART_VERSION_INFO=4:0:0 +LIBATASMART_VERSION_INFO=4:1:0 # Make sure we can run config.sub. @@ -2759,6 +2759,19 @@ IFS=$ac_save_IFS case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac + + +# Check whether --enable-silent-rules was given. +if test "${enable_silent_rules+set}" = set; then + enableval=$enable_silent_rules; +fi + +case $enable_silent_rules in +yes) AM_DEFAULT_VERBOSITY=0;; +no) AM_DEFAULT_VERBOSITY=1;; +*) AM_DEFAULT_VERBOSITY=0;; +esac +AM_BACKSLASH='\' if type -p stow > /dev/null && test -d /usr/local/stow ; then @@ -5956,13 +5969,13 @@ else lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext - (eval echo "\"\$as_me:5959: $ac_compile\"" >&5) + (eval echo "\"\$as_me:5972: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 - (eval echo "\"\$as_me:5962: $NM \\\"conftest.$ac_objext\\\"\"" >&5) + (eval echo "\"\$as_me:5975: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 - (eval echo "\"\$as_me:5965: output\"" >&5) + (eval echo "\"\$as_me:5978: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" @@ -7038,7 +7051,6 @@ eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' cat <<_LT_EOF >> conftest.$ac_ext - /* The mapping between symbol names and symbols. */ const struct { const char *name; @@ -7167,7 +7179,7 @@ ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 7170 "configure"' > conftest.$ac_ext + echo '#line 7182 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -9270,11 +9282,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:9273: $lt_compile\"" >&5) + (eval echo "\"\$as_me:9285: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:9277: \$? = $ac_status" >&5 + echo "$as_me:9289: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -9609,11 +9621,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:9612: $lt_compile\"" >&5) + (eval echo "\"\$as_me:9624: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:9616: \$? = $ac_status" >&5 + echo "$as_me:9628: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -9714,11 +9726,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:9717: $lt_compile\"" >&5) + (eval echo "\"\$as_me:9729: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:9721: \$? = $ac_status" >&5 + echo "$as_me:9733: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -9769,11 +9781,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:9772: $lt_compile\"" >&5) + (eval echo "\"\$as_me:9784: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:9776: \$? = $ac_status" >&5 + echo "$as_me:9788: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -12572,7 +12584,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 12575 "configure" +#line 12587 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -12668,7 +12680,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 12671 "configure" +#line 12683 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -14688,11 +14700,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14691: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14703: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:14695: \$? = $ac_status" >&5 + echo "$as_me:14707: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -14787,11 +14799,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14790: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14802: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:14794: \$? = $ac_status" >&5 + echo "$as_me:14806: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -14839,11 +14851,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14842: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14854: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:14846: \$? = $ac_status" >&5 + echo "$as_me:14858: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -18551,7 +18563,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by libatasmart $as_me 0.14, which was +This file was extended by libatasmart $as_me 0.15, which was generated by GNU Autoconf 2.63. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -18614,7 +18626,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_version="\\ -libatasmart config.status 0.14 +libatasmart config.status 0.15 configured by $0, generated by GNU Autoconf 2.63, with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" diff --git a/configure.ac b/configure.ac index f2a2ca4..6adf65a 100644 --- a/configure.ac +++ b/configure.ac @@ -21,7 +21,7 @@ AC_PREREQ(2.63) -AC_INIT([libatasmart], 0.14, [mzyvongnfzneg (at) 0pointer (dot) net]) +AC_INIT([libatasmart], 0.15, [mzyvongnfzneg (at) 0pointer (dot) net]) AC_CONFIG_SRCDIR([atasmart.c]) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_MACRO_DIR(m4) @@ -30,9 +30,11 @@ AC_SUBST(PACKAGE_URL, [http://git.0pointer.de/?p=libatasmart.git]) -AC_SUBST(LIBATASMART_VERSION_INFO, [4:0:0]) +AC_SUBST(LIBATASMART_VERSION_INFO, [4:1:0]) AC_CANONICAL_HOST + +AM_SILENT_RULES([yes]) if type -p stow > /dev/null && test -d /usr/local/stow ; then AC_MSG_NOTICE([*** Found /usr/local/stow: default install prefix set to /usr/local/stow/${PACKAGE_NAME}-${PACKAGE_VERSION} ***]) diff --git a/ltmain.sh b/ltmain.sh index 6939dcc..7d66075 100755 --- a/ltmain.sh +++ b/ltmain.sh @@ -2321,6 +2321,10 @@ #ifdef __cplusplus extern \"C\" { +#endif + +#if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) +#pragma GCC diagnostic ignored \"-Wstrict-prototypes\" #endif /* External symbol declarations for the compiler. */\ diff --git a/vala/atasmart.vapi b/vala/atasmart.vapi new file mode 100644 index 0000000..05b8c37 --- /dev/null +++ b/vala/atasmart.vapi @@ -0,0 +1,156 @@ +/*-*- Mode: C; c-basic-offset: 8 -*-*/ + +/*** + This file is part of libatasmart. + + Copyright 2008 Lennart Poettering + + libatasmart is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation, either version 2.1 of the + License, or (at your option) any later version. + + libatasmart is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with libatasmart. If not, If not, see + . +***/ + +using GLib; + +[CCode (cheader_filename="atasmart.h")] +namespace AtaSmart { + + [CCode (cname="SkSmartSelfTest", cprefix="SK_SMART_SELF_TEST_")] + public enum SmartSelfTest { + SHORT, EXTENDED, CONVEYANCE, ABORT; + + [CCode (cname="sk_smart_self_test_to_string")] + public unowned string? to_string(); + } + + [Immutable] + [CCode (cname="SkIdentifyParsedData")] + public struct IdentifyParsedData { + public string serial; + public string firmware; + public string model; + } + + [CCode (cname="SkSmartOfflineDataCollectionStatus", cprefix="SK_SMART_OFFLINE_DATA_COLLECTION_STATUS_")] + public enum SmartOfflineDataCollectionStatus { + NEVER, SUCCESS, INPROGRESS, SUSPENDED, ABORTED, FATAL, UNKNOWN; + + [CCode (cname="sk_smart_offline_data_collection_status_to_string")] + public unowned string? to_string(); + } + + [CCode (cname="SkSmartSelfTestExecutionStatus", cprefix="SK_SMART_SELF_TEST_EXECUTION_STATUS_")] + public enum SmartSelfTestExecutionStatus { + SUCCESS_OR_NEVER, ABORTED, INTERRUPTED, FATAL, ERROR_UNKNOWN, ERROR_ELECTRICAL, ERROR_SERVO, ERROR_READ, ERROR_HANDLING, INPROGRESS; + + [CCode (cname="sk_smart_self_test_execution_status_to_string")] + public unowned string? to_string(); + } + + [Immutable] + [CCode (cname="SkSmartParsedData")] + public struct SmartParsedData { + public SmartOfflineDataCollectionStatus offline_data_collection_status; + public uint total_offline_data_collection_seconds; + public SmartSelfTestExecutionStatus self_test_execution_status; + public uint self_test_execution_percent_remaining; + + public bool conveyance_test_available; + public bool short_and_extended_test_available; + public bool start_test_available; + public bool abort_test_available; + + public uint short_test_polling_minutes; + public uint extended_test_polling_minutes; + public uint conveyance_test_polling_minutes; + + [CCode (cname="sk_smart_self_test_available")] + public bool self_test_available(SmartSelfTest test); + + [CCode (cname="sk_smart_self_test_polling_minutes")] + public uint self_test_polling_minutes(SmartSelfTest test); + } + + [CCode (cname="SkSmartAttributeUnit", cprefix="SK_SMART_ATTRIBUTE_UNIT_")] + public enum SmartAttributeUnit { + UNKNOWN, NONE, MSECONDS, SECTORS, MKELVIN; + + [CCode (cname="sk_smart_attribute_unit_to_string")] + public unowned string? to_string(); + } + + [Immutable] + [CCode (cname="SkSmartAttributeParsedData")] + public struct SmartAttributeParsedData { + public uint8 id; + public string name; + public SmartAttributeUnit pretty_unit; + public uint16 flags; + public uint8 threshold; + public bool threshold_valid; + public bool online; + public bool prefailure; + public bool good_now; + public bool good_now_valid; + public bool good_in_the_past; + public bool good_in_the_past_valid; + public bool current_value_valid; + public bool worst_value_valid; + public bool warn; + public uint8 current_value; + public uint8 worst_value; + public uint64 pretty_value; + public uint8[] raw; + } + + [CCode (cname="SkSmartOverall", cprefix="SK_SMART_OVERALL_")] + public enum SmartOverall { + GOOD, BAD_ATTRIBUTE_IN_THE_PAST, BAD_SECTOR, BAD_ATTRIBUTE_NOW, BAD_SECTOR_MANY, BAD_STATUS; + + [CCode (cname="sk_smart_overall_to_string")] + public unowned string? to_string(); + } + + [CCode (cname="SkSmartAttributeParseCallback")] + public delegate void SmartAttributeParseCallback(Disk disk, SmartAttributeParsedData a); + + [Compact] + [CCode (free_function="sk_disk_free", cname="SkDisk", cprefix="sk_disk_")] + public class Disk { + + public static int open(string name, out Disk? disk); + + public int get_size(out uint64 bytes); + + public int check_sleep_mode(out bool awake); + + public int identify_is_available(out bool available); + public int identify_parse(out unowned IdentifyParsedData* data); + + public int smart_is_available(out bool available); + public int smart_status(out bool good); + public int smart_read_data(); + public int smart_get_blob(out unowned void* blob, out size_t size); + public int smart_set_blob(void* blob, size_t size); + public int smart_parse_attributes(SmartAttributeParseCallback cb); + public int smart_parse(out unowned SmartParsedData* data); + public int smart_self_test(SmartSelfTest test); + public int smart_get_power_on(out uint64 mseconds); + public int smart_get_power_cycle(out uint64 count); + public int smart_get_bad(out uint64 sectors); + public int smart_get_temperature(out uint64 mkelvin); + public int smart_get_overall(out SmartOverall overall); + + public int dump(); + } +}