Package list libatasmart / 64dda71
Imported Upstream version 0.14 Martin Pitt 12 years ago
10 changed file(s) with 1771 addition(s) and 811 deletion(s). Raw diff Collapse all Expand all
2323 atasmart.c \
2424 blob-examples/README \
2525 blob-examples/FUJITSU_MHY2120BH--0084000D \
26 blob-examples/FUJITSU_MHY2120BH--0085000B \
2627 blob-examples/FUJITSU_MHZ2160BH_G1--0084000A \
2728 blob-examples/Maxtor_96147H8--BAC51KJ0 \
2829 blob-examples/SAMSUNG_HD501LJ--CR100-12 \
8283
8384 atasmart.strpool.c: atasmart.c strpool
8485 $(top_builddir)/strpool $< $@
86
87 ACLOCAL_AMFLAGS = -I m4
0 # Makefile.in generated by automake 1.10.2 from Makefile.am.
0 # Makefile.in generated by automake 1.11 from Makefile.am.
11 # @configure_input@
22
33 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
4 # 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
4 # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
5 # Inc.
56 # This Makefile.in is free software; the Free Software Foundation
67 # gives unlimited permission to copy and/or distribute it,
78 # with or without modifications, as long as this notice is preserved.
3637
3738 VPATH = @srcdir@
3839 pkgdatadir = $(datadir)/@PACKAGE@
40 pkgincludedir = $(includedir)/@PACKAGE@
3941 pkglibdir = $(libdir)/@PACKAGE@
40 pkgincludedir = $(includedir)/@PACKAGE@
42 pkglibexecdir = $(libexecdir)/@PACKAGE@
4143 am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
4244 install_sh_DATA = $(install_sh) -c -m 644
4345 install_sh_PROGRAM = $(install_sh) -c
6971 mkinstalldirs = $(install_sh) -d
7072 CONFIG_HEADER = config.h
7173 CONFIG_CLEAN_FILES = libatasmart.pc
74 CONFIG_CLEAN_VPATH_FILES =
7275 am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
7376 am__vpath_adj = case $$p in \
7477 $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
7578 *) f=$$p;; \
7679 esac;
77 am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
80 am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
81 am__install_max = 40
82 am__nobase_strip_setup = \
83 srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
84 am__nobase_strip = \
85 for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
86 am__nobase_list = $(am__nobase_strip_setup); \
87 for p in $$list; do echo "$$p $$p"; done | \
88 sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
89 $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
90 if (++n[$$2] == $(am__install_max)) \
91 { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
92 END { for (dir in files) print dir, files[dir] }'
93 am__base_list = \
94 sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
95 sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
7896 am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(sbindir)" \
7997 "$(DESTDIR)$(pkgconfigdir)" "$(DESTDIR)$(includedir)"
80 libLTLIBRARIES_INSTALL = $(INSTALL)
8198 LTLIBRARIES = $(lib_LTLIBRARIES)
8299 am__DEPENDENCIES_1 =
83100 libatasmart_la_DEPENDENCIES = $(am__DEPENDENCIES_1)
84101 am_libatasmart_la_OBJECTS = libatasmart_la-atasmart.strpool.lo
85102 libatasmart_la_OBJECTS = $(am_libatasmart_la_OBJECTS)
86 libatasmart_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
87 $(LIBTOOLFLAGS) --mode=link $(CCLD) $(libatasmart_la_CFLAGS) \
88 $(CFLAGS) $(libatasmart_la_LDFLAGS) $(LDFLAGS) -o $@
89 sbinPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
103 AM_V_lt = $(am__v_lt_$(V))
104 am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
105 am__v_lt_0 = --silent
106 libatasmart_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
107 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
108 $(libatasmart_la_CFLAGS) $(CFLAGS) $(libatasmart_la_LDFLAGS) \
109 $(LDFLAGS) -o $@
90110 PROGRAMS = $(noinst_PROGRAMS) $(sbin_PROGRAMS)
91111 am_skdump_OBJECTS = skdump.$(OBJEXT)
92112 skdump_OBJECTS = $(am_skdump_OBJECTS)
100120 DEFAULT_INCLUDES = -I.@am__isrc@
101121 depcomp = $(SHELL) $(top_srcdir)/depcomp
102122 am__depfiles_maybe = depfiles
123 am__mv = mv -f
103124 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
104125 $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
105 LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
106 --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
107 $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
126 LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
127 $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
128 $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
129 $(AM_CFLAGS) $(CFLAGS)
130 AM_V_CC = $(am__v_CC_$(V))
131 am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY))
132 am__v_CC_0 = @echo " CC " $@;
133 AM_V_at = $(am__v_at_$(V))
134 am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
135 am__v_at_0 = @
108136 CCLD = $(CC)
109 LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
110 --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
111 $(LDFLAGS) -o $@
137 LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
138 $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
139 $(AM_LDFLAGS) $(LDFLAGS) -o $@
140 AM_V_CCLD = $(am__v_CCLD_$(V))
141 am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))
142 am__v_CCLD_0 = @echo " CCLD " $@;
143 AM_V_GEN = $(am__v_GEN_$(V))
144 am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
145 am__v_GEN_0 = @echo " GEN " $@;
112146 SOURCES = $(libatasmart_la_SOURCES) $(skdump_SOURCES) sktest.c \
113147 $(strpool_SOURCES)
114148 DIST_SOURCES = $(libatasmart_la_SOURCES) $(skdump_SOURCES) sktest.c \
120154 install-pdf-recursive install-ps-recursive install-recursive \
121155 installcheck-recursive installdirs-recursive pdf-recursive \
122156 ps-recursive uninstall-recursive
123 pkgconfigDATA_INSTALL = $(INSTALL_DATA)
124157 DATA = $(noinst_DATA) $(pkgconfig_DATA)
125 includeHEADERS_INSTALL = $(INSTALL_HEADER)
126158 HEADERS = $(include_HEADERS)
127159 RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
128160 distclean-recursive maintainer-clean-recursive
161 AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
162 $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
163 distdir dist dist-all distcheck
129164 ETAGS = etags
130165 CTAGS = ctags
131166 DIST_SUBDIRS = $(SUBDIRS)
133168 distdir = $(PACKAGE)-$(VERSION)
134169 top_distdir = $(distdir)
135170 am__remove_distdir = \
136 { test ! -d $(distdir) \
137 || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \
138 && rm -fr $(distdir); }; }
171 { test ! -d "$(distdir)" \
172 || { find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
173 && rm -fr "$(distdir)"; }; }
174 am__relativize = \
175 dir0=`pwd`; \
176 sed_first='s,^\([^/]*\)/.*$$,\1,'; \
177 sed_rest='s,^[^/]*/*,,'; \
178 sed_last='s,^.*/\([^/]*\)$$,\1,'; \
179 sed_butlast='s,/*[^/]*$$,,'; \
180 while test -n "$$dir1"; do \
181 first=`echo "$$dir1" | sed -e "$$sed_first"`; \
182 if test "$$first" != "."; then \
183 if test "$$first" = ".."; then \
184 dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
185 dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
186 else \
187 first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
188 if test "$$first2" = "$$first"; then \
189 dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
190 else \
191 dir2="../$$dir2"; \
192 fi; \
193 dir0="$$dir0"/"$$first"; \
194 fi; \
195 fi; \
196 dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
197 done; \
198 reldir="$$dir2"
139199 DIST_ARCHIVES = $(distdir).tar.gz
140200 GZIP_ENV = --best
141201 distuninstallcheck_listfiles = find . -type f -print
142202 distcleancheck_listfiles = find . -type f -print
143203 ACLOCAL = @ACLOCAL@
144204 AMTAR = @AMTAR@
205 AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
145206 AR = @AR@
146207 AUTOCONF = @AUTOCONF@
147208 AUTOHEADER = @AUTOHEADER@
268329 atasmart.c \
269330 blob-examples/README \
270331 blob-examples/FUJITSU_MHY2120BH--0084000D \
332 blob-examples/FUJITSU_MHY2120BH--0085000B \
271333 blob-examples/FUJITSU_MHZ2160BH_G1--0084000A \
272334 blob-examples/Maxtor_96147H8--BAC51KJ0 \
273335 blob-examples/SAMSUNG_HD501LJ--CR100-12 \
319381 BUILT_SOURCES = \
320382 atasmart.strpool.c
321383
384 ACLOCAL_AMFLAGS = -I m4
322385 all: $(BUILT_SOURCES) config.h
323386 $(MAKE) $(AM_MAKEFLAGS) all-recursive
324387
330393 @for dep in $?; do \
331394 case '$(am__configure_deps)' in \
332395 *$$dep*) \
333 echo ' cd $(srcdir) && $(AUTOMAKE) --foreign '; \
334 cd $(srcdir) && $(AUTOMAKE) --foreign \
396 echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \
397 $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \
335398 && exit 0; \
336399 exit 1;; \
337400 esac; \
338401 done; \
339 echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \
340 cd $(top_srcdir) && \
341 $(AUTOMAKE) --foreign Makefile
402 echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \
403 $(am__cd) $(top_srcdir) && \
404 $(AUTOMAKE) --foreign Makefile
342405 .PRECIOUS: Makefile
343406 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
344407 @case '$?' in \
354417 $(SHELL) ./config.status --recheck
355418
356419 $(top_srcdir)/configure: $(am__configure_deps)
357 cd $(srcdir) && $(AUTOCONF)
420 $(am__cd) $(srcdir) && $(AUTOCONF)
358421 $(ACLOCAL_M4): $(am__aclocal_m4_deps)
359 cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
422 $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
423 $(am__aclocal_m4_deps):
360424
361425 config.h: stamp-h1
362426 @if test ! -f $@; then \
368432 @rm -f stamp-h1
369433 cd $(top_builddir) && $(SHELL) ./config.status config.h
370434 $(srcdir)/config.h.in: $(am__configure_deps)
371 cd $(top_srcdir) && $(AUTOHEADER)
435 ($(am__cd) $(top_srcdir) && $(AUTOHEADER))
372436 rm -f stamp-h1
373437 touch $@
374438
379443 install-libLTLIBRARIES: $(lib_LTLIBRARIES)
380444 @$(NORMAL_INSTALL)
381445 test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
382 @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
446 @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
447 list2=; for p in $$list; do \
383448 if test -f $$p; then \
384 f=$(am__strip_dir) \
385 echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
386 $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
449 list2="$$list2 $$p"; \
387450 else :; fi; \
388 done
451 done; \
452 test -z "$$list2" || { \
453 echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
454 $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
455 }
389456
390457 uninstall-libLTLIBRARIES:
391458 @$(NORMAL_UNINSTALL)
392 @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
393 p=$(am__strip_dir) \
394 echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \
395 $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \
459 @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
460 for p in $$list; do \
461 $(am__strip_dir) \
462 echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
463 $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
396464 done
397465
398466 clean-libLTLIBRARIES:
404472 rm -f "$${dir}/so_locations"; \
405473 done
406474 libatasmart.la: $(libatasmart_la_OBJECTS) $(libatasmart_la_DEPENDENCIES)
407 $(libatasmart_la_LINK) -rpath $(libdir) $(libatasmart_la_OBJECTS) $(libatasmart_la_LIBADD) $(LIBS)
475 $(AM_V_CCLD)$(libatasmart_la_LINK) -rpath $(libdir) $(libatasmart_la_OBJECTS) $(libatasmart_la_LIBADD) $(LIBS)
408476
409477 clean-noinstPROGRAMS:
410 @list='$(noinst_PROGRAMS)'; for p in $$list; do \
411 f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
412 echo " rm -f $$p $$f"; \
413 rm -f $$p $$f ; \
414 done
478 @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \
479 echo " rm -f" $$list; \
480 rm -f $$list || exit $$?; \
481 test -n "$(EXEEXT)" || exit 0; \
482 list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
483 echo " rm -f" $$list; \
484 rm -f $$list
415485 install-sbinPROGRAMS: $(sbin_PROGRAMS)
416486 @$(NORMAL_INSTALL)
417487 test -z "$(sbindir)" || $(MKDIR_P) "$(DESTDIR)$(sbindir)"
418 @list='$(sbin_PROGRAMS)'; for p in $$list; do \
419 p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
420 if test -f $$p \
421 || test -f $$p1 \
422 ; then \
423 f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
424 echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(sbinPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(sbindir)/$$f'"; \
425 $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(sbinPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(sbindir)/$$f" || exit 1; \
426 else :; fi; \
427 done
488 @list='$(sbin_PROGRAMS)'; test -n "$(sbindir)" || list=; \
489 for p in $$list; do echo "$$p $$p"; done | \
490 sed 's/$(EXEEXT)$$//' | \
491 while read p p1; do if test -f $$p || test -f $$p1; \
492 then echo "$$p"; echo "$$p"; else :; fi; \
493 done | \
494 sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
495 -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
496 sed 'N;N;N;s,\n, ,g' | \
497 $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
498 { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
499 if ($$2 == $$4) files[d] = files[d] " " $$1; \
500 else { print "f", $$3 "/" $$4, $$1; } } \
501 END { for (d in files) print "f", d, files[d] }' | \
502 while read type dir files; do \
503 if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
504 test -z "$$files" || { \
505 echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(sbindir)$$dir'"; \
506 $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(sbindir)$$dir" || exit $$?; \
507 } \
508 ; done
428509
429510 uninstall-sbinPROGRAMS:
430511 @$(NORMAL_UNINSTALL)
431 @list='$(sbin_PROGRAMS)'; for p in $$list; do \
432 f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
433 echo " rm -f '$(DESTDIR)$(sbindir)/$$f'"; \
434 rm -f "$(DESTDIR)$(sbindir)/$$f"; \
435 done
512 @list='$(sbin_PROGRAMS)'; test -n "$(sbindir)" || list=; \
513 files=`for p in $$list; do echo "$$p"; done | \
514 sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
515 -e 's/$$/$(EXEEXT)/' `; \
516 test -n "$$list" || exit 0; \
517 echo " ( cd '$(DESTDIR)$(sbindir)' && rm -f" $$files ")"; \
518 cd "$(DESTDIR)$(sbindir)" && rm -f $$files
436519
437520 clean-sbinPROGRAMS:
438 @list='$(sbin_PROGRAMS)'; for p in $$list; do \
439 f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
440 echo " rm -f $$p $$f"; \
441 rm -f $$p $$f ; \
442 done
521 @list='$(sbin_PROGRAMS)'; test -n "$$list" || exit 0; \
522 echo " rm -f" $$list; \
523 rm -f $$list || exit $$?; \
524 test -n "$(EXEEXT)" || exit 0; \
525 list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
526 echo " rm -f" $$list; \
527 rm -f $$list
443528 skdump$(EXEEXT): $(skdump_OBJECTS) $(skdump_DEPENDENCIES)
444529 @rm -f skdump$(EXEEXT)
445 $(LINK) $(skdump_OBJECTS) $(skdump_LDADD) $(LIBS)
530 $(AM_V_CCLD)$(LINK) $(skdump_OBJECTS) $(skdump_LDADD) $(LIBS)
446531 sktest$(EXEEXT): $(sktest_OBJECTS) $(sktest_DEPENDENCIES)
447532 @rm -f sktest$(EXEEXT)
448 $(LINK) $(sktest_OBJECTS) $(sktest_LDADD) $(LIBS)
533 $(AM_V_CCLD)$(LINK) $(sktest_OBJECTS) $(sktest_LDADD) $(LIBS)
449534 strpool$(EXEEXT): $(strpool_OBJECTS) $(strpool_DEPENDENCIES)
450535 @rm -f strpool$(EXEEXT)
451 $(LINK) $(strpool_OBJECTS) $(strpool_LDADD) $(LIBS)
536 $(AM_V_CCLD)$(LINK) $(strpool_OBJECTS) $(strpool_LDADD) $(LIBS)
452537
453538 mostlyclean-compile:
454539 -rm -f *.$(OBJEXT)
462547 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strpool.Po@am__quote@
463548
464549 .c.o:
465 @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
466 @am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
550 @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
551 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
552 @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
467553 @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
468554 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
469555 @am__fastdepCC_FALSE@ $(COMPILE) -c $<
470556
471557 .c.obj:
472 @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
473 @am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
558 @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
559 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
560 @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
474561 @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
475562 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
476563 @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
477564
478565 .c.lo:
479 @am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
480 @am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
566 @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
567 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
568 @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
481569 @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
482570 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
483571 @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
484572
485573 libatasmart_la-atasmart.strpool.lo: atasmart.strpool.c
486 @am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libatasmart_la_CFLAGS) $(CFLAGS) -MT libatasmart_la-atasmart.strpool.lo -MD -MP -MF $(DEPDIR)/libatasmart_la-atasmart.strpool.Tpo -c -o libatasmart_la-atasmart.strpool.lo `test -f 'atasmart.strpool.c' || echo '$(srcdir)/'`atasmart.strpool.c
487 @am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libatasmart_la-atasmart.strpool.Tpo $(DEPDIR)/libatasmart_la-atasmart.strpool.Plo
574 @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libatasmart_la_CFLAGS) $(CFLAGS) -MT libatasmart_la-atasmart.strpool.lo -MD -MP -MF $(DEPDIR)/libatasmart_la-atasmart.strpool.Tpo -c -o libatasmart_la-atasmart.strpool.lo `test -f 'atasmart.strpool.c' || echo '$(srcdir)/'`atasmart.strpool.c
575 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libatasmart_la-atasmart.strpool.Tpo $(DEPDIR)/libatasmart_la-atasmart.strpool.Plo
576 @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
488577 @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='atasmart.strpool.c' object='libatasmart_la-atasmart.strpool.lo' libtool=yes @AMDEPBACKSLASH@
489578 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
490 @am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libatasmart_la_CFLAGS) $(CFLAGS) -c -o libatasmart_la-atasmart.strpool.lo `test -f 'atasmart.strpool.c' || echo '$(srcdir)/'`atasmart.strpool.c
579 @am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libatasmart_la_CFLAGS) $(CFLAGS) -c -o libatasmart_la-atasmart.strpool.lo `test -f 'atasmart.strpool.c' || echo '$(srcdir)/'`atasmart.strpool.c
491580
492581 mostlyclean-libtool:
493582 -rm -f *.lo
500589 install-pkgconfigDATA: $(pkgconfig_DATA)
501590 @$(NORMAL_INSTALL)
502591 test -z "$(pkgconfigdir)" || $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)"
503 @list='$(pkgconfig_DATA)'; for p in $$list; do \
592 @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \
593 for p in $$list; do \
504594 if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
505 f=$(am__strip_dir) \
506 echo " $(pkgconfigDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(pkgconfigdir)/$$f'"; \
507 $(pkgconfigDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(pkgconfigdir)/$$f"; \
595 echo "$$d$$p"; \
596 done | $(am__base_list) | \
597 while read files; do \
598 echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgconfigdir)'"; \
599 $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgconfigdir)" || exit $$?; \
508600 done
509601
510602 uninstall-pkgconfigDATA:
511603 @$(NORMAL_UNINSTALL)
512 @list='$(pkgconfig_DATA)'; for p in $$list; do \
513 f=$(am__strip_dir) \
514 echo " rm -f '$(DESTDIR)$(pkgconfigdir)/$$f'"; \
515 rm -f "$(DESTDIR)$(pkgconfigdir)/$$f"; \
516 done
604 @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \
605 files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
606 test -n "$$files" || exit 0; \
607 echo " ( cd '$(DESTDIR)$(pkgconfigdir)' && rm -f" $$files ")"; \
608 cd "$(DESTDIR)$(pkgconfigdir)" && rm -f $$files
517609 install-includeHEADERS: $(include_HEADERS)
518610 @$(NORMAL_INSTALL)
519611 test -z "$(includedir)" || $(MKDIR_P) "$(DESTDIR)$(includedir)"
520 @list='$(include_HEADERS)'; for p in $$list; do \
612 @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \
613 for p in $$list; do \
521614 if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
522 f=$(am__strip_dir) \
523 echo " $(includeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includedir)/$$f'"; \
524 $(includeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includedir)/$$f"; \
615 echo "$$d$$p"; \
616 done | $(am__base_list) | \
617 while read files; do \
618 echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includedir)'"; \
619 $(INSTALL_HEADER) $$files "$(DESTDIR)$(includedir)" || exit $$?; \
525620 done
526621
527622 uninstall-includeHEADERS:
528623 @$(NORMAL_UNINSTALL)
529 @list='$(include_HEADERS)'; for p in $$list; do \
530 f=$(am__strip_dir) \
531 echo " rm -f '$(DESTDIR)$(includedir)/$$f'"; \
532 rm -f "$(DESTDIR)$(includedir)/$$f"; \
533 done
624 @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \
625 files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
626 test -n "$$files" || exit 0; \
627 echo " ( cd '$(DESTDIR)$(includedir)' && rm -f" $$files ")"; \
628 cd "$(DESTDIR)$(includedir)" && rm -f $$files
534629
535630 # This directory's subdirectories are mostly independent; you can cd
536631 # into them and run `make' without going through this Makefile.
556651 else \
557652 local_target="$$target"; \
558653 fi; \
559 (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
654 ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
560655 || eval $$failcom; \
561656 done; \
562657 if test "$$dot_seen" = "no"; then \
590685 else \
591686 local_target="$$target"; \
592687 fi; \
593 (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
688 ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
594689 || eval $$failcom; \
595690 done && test -z "$$fail"
596691 tags-recursive:
597692 list='$(SUBDIRS)'; for subdir in $$list; do \
598 test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
693 test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
599694 done
600695 ctags-recursive:
601696 list='$(SUBDIRS)'; for subdir in $$list; do \
602 test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
697 test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
603698 done
604699
605700 ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
614709
615710 TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
616711 $(TAGS_FILES) $(LISP)
617 tags=; \
712 set x; \
618713 here=`pwd`; \
619714 if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
620715 include_option=--etags-include; \
626721 list='$(SUBDIRS)'; for subdir in $$list; do \
627722 if test "$$subdir" = .; then :; else \
628723 test ! -f $$subdir/TAGS || \
629 tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
724 set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
630725 fi; \
631726 done; \
632727 list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
635730 done | \
636731 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
637732 END { if (nonempty) { for (i in files) print i; }; }'`; \
638 if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
733 shift; \
734 if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
639735 test -n "$$unique" || unique=$$empty_fix; \
640 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
641 $$tags $$unique; \
736 if test $$# -gt 0; then \
737 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
738 "$$@" $$unique; \
739 else \
740 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
741 $$unique; \
742 fi; \
642743 fi
643744 ctags: CTAGS
644745 CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
645746 $(TAGS_FILES) $(LISP)
646 tags=; \
647747 list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
648748 unique=`for i in $$list; do \
649749 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
650750 done | \
651751 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
652752 END { if (nonempty) { for (i in files) print i; }; }'`; \
653 test -z "$(CTAGS_ARGS)$$tags$$unique" \
753 test -z "$(CTAGS_ARGS)$$unique" \
654754 || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
655 $$tags $$unique
755 $$unique
656756
657757 GTAGS:
658758 here=`$(am__cd) $(top_builddir) && pwd` \
659 && cd $(top_srcdir) \
660 && gtags -i $(GTAGS_ARGS) $$here
759 && $(am__cd) $(top_srcdir) \
760 && gtags -i $(GTAGS_ARGS) "$$here"
661761
662762 distclean-tags:
663763 -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
664764
665765 distdir: $(DISTFILES)
666766 $(am__remove_distdir)
667 test -d $(distdir) || mkdir $(distdir)
767 test -d "$(distdir)" || mkdir "$(distdir)"
668768 @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
669769 topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
670770 list='$(DISTFILES)'; \
680780 if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
681781 if test -d $$d/$$file; then \
682782 dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
783 if test -d "$(distdir)/$$file"; then \
784 find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
785 fi; \
683786 if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
684 cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
787 cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
788 find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
685789 fi; \
686 cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
790 cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
687791 else \
688 test -f $(distdir)/$$file \
689 || cp -p $$d/$$file $(distdir)/$$file \
792 test -f "$(distdir)/$$file" \
793 || cp -p $$d/$$file "$(distdir)/$$file" \
690794 || exit 1; \
691795 fi; \
692796 done
693 list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
797 @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
694798 if test "$$subdir" = .; then :; else \
695799 test -d "$(distdir)/$$subdir" \
696800 || $(MKDIR_P) "$(distdir)/$$subdir" \
697801 || exit 1; \
698 distdir=`$(am__cd) $(distdir) && pwd`; \
699 top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
700 (cd $$subdir && \
802 fi; \
803 done
804 @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
805 if test "$$subdir" = .; then :; else \
806 dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
807 $(am__relativize); \
808 new_distdir=$$reldir; \
809 dir1=$$subdir; dir2="$(top_distdir)"; \
810 $(am__relativize); \
811 new_top_distdir=$$reldir; \
812 echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
813 echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
814 ($(am__cd) $$subdir && \
701815 $(MAKE) $(AM_MAKEFLAGS) \
702 top_distdir="$$top_distdir" \
703 distdir="$$distdir/$$subdir" \
816 top_distdir="$$new_top_distdir" \
817 distdir="$$new_distdir" \
704818 am__remove_distdir=: \
705819 am__skip_length_check=: \
820 am__skip_mode_fix=: \
706821 distdir) \
707822 || exit 1; \
708823 fi; \
709824 done
710 -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
825 -test -n "$(am__skip_mode_fix)" \
826 || find "$(distdir)" -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
711827 ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
712828 ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
713829 ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
714 || chmod -R a+r $(distdir)
830 || chmod -R a+r "$(distdir)"
715831 dist-gzip: distdir
716832 tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
717833 $(am__remove_distdir)
722838
723839 dist-lzma: distdir
724840 tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma
841 $(am__remove_distdir)
842
843 dist-xz: distdir
844 tardir=$(distdir) && $(am__tar) | xz -c >$(distdir).tar.xz
725845 $(am__remove_distdir)
726846
727847 dist-tarZ: distdir
752872 bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\
753873 *.tar.lzma*) \
754874 unlzma -c $(distdir).tar.lzma | $(am__untar) ;;\
875 *.tar.xz*) \
876 xz -dc $(distdir).tar.xz | $(am__untar) ;;\
755877 *.tar.Z*) \
756878 uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
757879 *.shar.gz*) \
763885 mkdir $(distdir)/_build
764886 mkdir $(distdir)/_inst
765887 chmod a-w $(distdir)
888 test -d $(distdir)/_build || exit 0; \
766889 dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
767890 && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
768 && cd $(distdir)/_build \
891 && am__cwd=`pwd` \
892 && $(am__cd) $(distdir)/_build \
769893 && ../configure --srcdir=.. --prefix="$$dc_install_base" \
770894 $(DISTCHECK_CONFIGURE_FLAGS) \
771895 && $(MAKE) $(AM_MAKEFLAGS) \
787911 && rm -rf "$$dc_destdir" \
788912 && $(MAKE) $(AM_MAKEFLAGS) dist \
789913 && rm -rf $(DIST_ARCHIVES) \
790 && $(MAKE) $(AM_MAKEFLAGS) distcleancheck
914 && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \
915 && cd "$$am__cwd" \
916 || exit 1
791917 $(am__remove_distdir)
792918 @(echo "$(distdir) archives ready for distribution: "; \
793919 list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
794920 sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
795921 distuninstallcheck:
796 @cd $(distuninstallcheck_dir) \
922 @$(am__cd) '$(distuninstallcheck_dir)' \
797923 && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
798924 || { echo "ERROR: files left after uninstall:" ; \
799925 if test -n "$(DESTDIR)"; then \
842968
843969 distclean-generic:
844970 -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
971 -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
845972
846973 maintainer-clean-generic:
847974 @echo "This command is intended for maintainers to use"
866993
867994 html: html-recursive
868995
996 html-am:
997
869998 info: info-recursive
870999
8711000 info-am:
8741003
8751004 install-dvi: install-dvi-recursive
8761005
1006 install-dvi-am:
1007
8771008 install-exec-am: install-libLTLIBRARIES install-sbinPROGRAMS
8781009
8791010 install-html: install-html-recursive
8801011
1012 install-html-am:
1013
8811014 install-info: install-info-recursive
8821015
1016 install-info-am:
1017
8831018 install-man:
8841019
8851020 install-pdf: install-pdf-recursive
8861021
1022 install-pdf-am:
1023
8871024 install-ps: install-ps-recursive
1025
1026 install-ps-am:
8881027
8891028 installcheck-am:
8901029
9111050 uninstall-am: uninstall-includeHEADERS uninstall-libLTLIBRARIES \
9121051 uninstall-pkgconfigDATA uninstall-sbinPROGRAMS
9131052
914 .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
915 install-strip
1053 .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all check \
1054 ctags-recursive install install-am install-strip \
1055 tags-recursive
9161056
9171057 .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
9181058 all all-am am--refresh check check-am clean clean-generic \
9191059 clean-libLTLIBRARIES clean-libtool clean-noinstPROGRAMS \
9201060 clean-sbinPROGRAMS ctags ctags-recursive dist dist-all \
921 dist-bzip2 dist-gzip dist-lzma dist-shar dist-tarZ dist-zip \
922 distcheck distclean distclean-compile distclean-generic \
923 distclean-hdr distclean-libtool distclean-tags distcleancheck \
924 distdir distuninstallcheck dvi dvi-am html html-am info \
925 info-am install install-am install-data install-data-am \
926 install-dvi install-dvi-am install-exec install-exec-am \
927 install-html install-html-am install-includeHEADERS \
928 install-info install-info-am install-libLTLIBRARIES \
929 install-man install-pdf install-pdf-am install-pkgconfigDATA \
930 install-ps install-ps-am install-sbinPROGRAMS install-strip \
931 installcheck installcheck-am installdirs installdirs-am \
932 maintainer-clean maintainer-clean-generic mostlyclean \
933 mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
934 pdf pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \
1061 dist-bzip2 dist-gzip dist-lzma dist-shar dist-tarZ dist-xz \
1062 dist-zip distcheck distclean distclean-compile \
1063 distclean-generic distclean-hdr distclean-libtool \
1064 distclean-tags distcleancheck distdir distuninstallcheck dvi \
1065 dvi-am html html-am info info-am install install-am \
1066 install-data install-data-am install-dvi install-dvi-am \
1067 install-exec install-exec-am install-html install-html-am \
1068 install-includeHEADERS install-info install-info-am \
1069 install-libLTLIBRARIES install-man install-pdf install-pdf-am \
1070 install-pkgconfigDATA install-ps install-ps-am \
1071 install-sbinPROGRAMS install-strip installcheck \
1072 installcheck-am installdirs installdirs-am maintainer-clean \
1073 maintainer-clean-generic mostlyclean mostlyclean-compile \
1074 mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
1075 tags tags-recursive uninstall uninstall-am \
9351076 uninstall-includeHEADERS uninstall-libLTLIBRARIES \
9361077 uninstall-pkgconfigDATA uninstall-sbinPROGRAMS
9371078
9381079
9391080 atasmart.strpool.c: atasmart.c strpool
9401081 $(top_builddir)/strpool $< $@
1082
9411083 # Tell versions [3.59,3.63) of GNU make to not export all variables.
9421084 # Otherwise a system limit (for SysV at least) may be exceeded.
9431085 .NOEXPORT:
0 # generated automatically by aclocal 1.10.2 -*- Autoconf -*-
0 # generated automatically by aclocal 1.11 -*- Autoconf -*-
11
22 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
3 # 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
3 # 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
44 # This file is free software; the Free Software Foundation
55 # gives unlimited permission to copy and/or distribute it,
66 # with or without modifications, as long as this notice is preserved.
81358135 # generated from the m4 files accompanying Automake X.Y.
81368136 # (This private macro should not be called outside this file.)
81378137 AC_DEFUN([AM_AUTOMAKE_VERSION],
8138 [am__api_version='1.10'
8138 [am__api_version='1.11'
81398139 dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
81408140 dnl require some minimum version. Point them to the right macro.
8141 m4_if([$1], [1.10.2], [],
8141 m4_if([$1], [1.11], [],
81428142 [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
81438143 ])
81448144
81548154 # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
81558155 # This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
81568156 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
8157 [AM_AUTOMAKE_VERSION([1.10.2])dnl
8157 [AM_AUTOMAKE_VERSION([1.11])dnl
81588158 m4_ifndef([AC_AUTOCONF_VERSION],
81598159 [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
81608160 _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
82148214
82158215 # AM_CONDITIONAL -*- Autoconf -*-
82168216
8217 # Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006
8217 # Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008
82188218 # Free Software Foundation, Inc.
82198219 #
82208220 # This file is free software; the Free Software Foundation
82218221 # gives unlimited permission to copy and/or distribute it,
82228222 # with or without modifications, as long as this notice is preserved.
82238223
8224 # serial 8
8224 # serial 9
82258225
82268226 # AM_CONDITIONAL(NAME, SHELL-CONDITION)
82278227 # -------------------------------------
82348234 AC_SUBST([$1_FALSE])dnl
82358235 _AM_SUBST_NOTMAKE([$1_TRUE])dnl
82368236 _AM_SUBST_NOTMAKE([$1_FALSE])dnl
8237 m4_define([_AM_COND_VALUE_$1], [$2])dnl
82378238 if $2; then
82388239 $1_TRUE=
82398240 $1_FALSE='#'
82478248 Usually this means the macro was only invoked conditionally.]])
82488249 fi])])
82498250
8250 # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
8251 # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009
82518252 # Free Software Foundation, Inc.
82528253 #
82538254 # This file is free software; the Free Software Foundation
82548255 # gives unlimited permission to copy and/or distribute it,
82558256 # with or without modifications, as long as this notice is preserved.
82568257
8257 # serial 9
8258 # serial 10
82588259
82598260 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
82608261 # written in clear, in which case automake, when reading aclocal.m4,
83118312 if test "$am_compiler_list" = ""; then
83128313 am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
83138314 fi
8315 am__universal=false
8316 m4_case([$1], [CC],
8317 [case " $depcc " in #(
8318 *\ -arch\ *\ -arch\ *) am__universal=true ;;
8319 esac],
8320 [CXX],
8321 [case " $depcc " in #(
8322 *\ -arch\ *\ -arch\ *) am__universal=true ;;
8323 esac])
8324
83148325 for depmode in $am_compiler_list; do
83158326 # Setup a source with many dependencies, because some compilers
83168327 # like to wrap large dependency lists on column 80 (with \), and
83288339 done
83298340 echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
83308341
8342 # We check with `-c' and `-o' for the sake of the "dashmstdout"
8343 # mode. It turns out that the SunPro C++ compiler does not properly
8344 # handle `-M -o', and we need to detect this. Also, some Intel
8345 # versions had trouble with output in subdirs
8346 am__obj=sub/conftest.${OBJEXT-o}
8347 am__minus_obj="-o $am__obj"
83318348 case $depmode in
8349 gcc)
8350 # This depmode causes a compiler race in universal mode.
8351 test "$am__universal" = false || continue
8352 ;;
83328353 nosideeffect)
83338354 # after this tag, mechanisms are not by side-effect, so they'll
83348355 # only be used when explicitly requested
83388359 break
83398360 fi
83408361 ;;
8362 msvisualcpp | msvcmsys)
8363 # This compiler won't grok `-c -o', but also, the minuso test has
8364 # not run yet. These depmodes are late enough in the game, and
8365 # so weak that their functioning should not be impacted.
8366 am__obj=conftest.${OBJEXT-o}
8367 am__minus_obj=
8368 ;;
83418369 none) break ;;
83428370 esac
8343 # We check with `-c' and `-o' for the sake of the "dashmstdout"
8344 # mode. It turns out that the SunPro C++ compiler does not properly
8345 # handle `-M -o', and we need to detect this.
83468371 if depmode=$depmode \
8347 source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
8372 source=sub/conftest.c object=$am__obj \
83488373 depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
8349 $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
8374 $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
83508375 >/dev/null 2>conftest.err &&
83518376 grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
83528377 grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
8353 grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
8378 grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
83548379 ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
83558380 # icc doesn't choke on unknown options, it will just issue warnings
83568381 # or remarks (even with -Werror). So we grep stderr for any message
84148439 # gives unlimited permission to copy and/or distribute it,
84158440 # with or without modifications, as long as this notice is preserved.
84168441
8417 #serial 4
8442 #serial 5
84188443
84198444 # _AM_OUTPUT_DEPENDENCY_COMMANDS
84208445 # ------------------------------
84218446 AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
8422 [# Autoconf 2.62 quotes --file arguments for eval, but not when files
8423 # are listed without --file. Let's play safe and only enable the eval
8424 # if we detect the quoting.
8425 case $CONFIG_FILES in
8426 *\'*) eval set x "$CONFIG_FILES" ;;
8427 *) set x $CONFIG_FILES ;;
8428 esac
8429 shift
8430 for mf
8431 do
8432 # Strip MF so we end up with the name of the file.
8433 mf=`echo "$mf" | sed -e 's/:.*$//'`
8434 # Check whether this is an Automake generated Makefile or not.
8435 # We used to match only the files named `Makefile.in', but
8436 # some people rename them; so instead we look at the file content.
8437 # Grep'ing the first line is not enough: some people post-process
8438 # each Makefile.in and add a new line on top of each file to say so.
8439 # Grep'ing the whole file is not good either: AIX grep has a line
8440 # limit of 2048, but all sed's we know have understand at least 4000.
8441 if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
8442 dirpart=`AS_DIRNAME("$mf")`
8443 else
8444 continue
8445 fi
8446 # Extract the definition of DEPDIR, am__include, and am__quote
8447 # from the Makefile without running `make'.
8448 DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
8449 test -z "$DEPDIR" && continue
8450 am__include=`sed -n 's/^am__include = //p' < "$mf"`
8451 test -z "am__include" && continue
8452 am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
8453 # When using ansi2knr, U may be empty or an underscore; expand it
8454 U=`sed -n 's/^U = //p' < "$mf"`
8455 # Find all dependency output files, they are included files with
8456 # $(DEPDIR) in their names. We invoke sed twice because it is the
8457 # simplest approach to changing $(DEPDIR) to its actual value in the
8458 # expansion.
8459 for file in `sed -n "
8460 s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
8461 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
8462 # Make sure the directory exists.
8463 test -f "$dirpart/$file" && continue
8464 fdir=`AS_DIRNAME(["$file"])`
8465 AS_MKDIR_P([$dirpart/$fdir])
8466 # echo "creating $dirpart/$file"
8467 echo '# dummy' > "$dirpart/$file"
8447 [{
8448 # Autoconf 2.62 quotes --file arguments for eval, but not when files
8449 # are listed without --file. Let's play safe and only enable the eval
8450 # if we detect the quoting.
8451 case $CONFIG_FILES in
8452 *\'*) eval set x "$CONFIG_FILES" ;;
8453 *) set x $CONFIG_FILES ;;
8454 esac
8455 shift
8456 for mf
8457 do
8458 # Strip MF so we end up with the name of the file.
8459 mf=`echo "$mf" | sed -e 's/:.*$//'`
8460 # Check whether this is an Automake generated Makefile or not.
8461 # We used to match only the files named `Makefile.in', but
8462 # some people rename them; so instead we look at the file content.
8463 # Grep'ing the first line is not enough: some people post-process
8464 # each Makefile.in and add a new line on top of each file to say so.
8465 # Grep'ing the whole file is not good either: AIX grep has a line
8466 # limit of 2048, but all sed's we know have understand at least 4000.
8467 if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
8468 dirpart=`AS_DIRNAME("$mf")`
8469 else
8470 continue
8471 fi
8472 # Extract the definition of DEPDIR, am__include, and am__quote
8473 # from the Makefile without running `make'.
8474 DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
8475 test -z "$DEPDIR" && continue
8476 am__include=`sed -n 's/^am__include = //p' < "$mf"`
8477 test -z "am__include" && continue
8478 am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
8479 # When using ansi2knr, U may be empty or an underscore; expand it
8480 U=`sed -n 's/^U = //p' < "$mf"`
8481 # Find all dependency output files, they are included files with
8482 # $(DEPDIR) in their names. We invoke sed twice because it is the
8483 # simplest approach to changing $(DEPDIR) to its actual value in the
8484 # expansion.
8485 for file in `sed -n "
8486 s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
8487 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
8488 # Make sure the directory exists.
8489 test -f "$dirpart/$file" && continue
8490 fdir=`AS_DIRNAME(["$file"])`
8491 AS_MKDIR_P([$dirpart/$fdir])
8492 # echo "creating $dirpart/$file"
8493 echo '# dummy' > "$dirpart/$file"
8494 done
84688495 done
8469 done
8496 }
84708497 ])# _AM_OUTPUT_DEPENDENCY_COMMANDS
84718498
84728499
84868513 # Do all the work for Automake. -*- Autoconf -*-
84878514
84888515 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
8489 # 2005, 2006, 2008 Free Software Foundation, Inc.
8516 # 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
84908517 #
84918518 # This file is free software; the Free Software Foundation
84928519 # gives unlimited permission to copy and/or distribute it,
84938520 # with or without modifications, as long as this notice is preserved.
84948521
8495 # serial 13
8522 # serial 16
84968523
84978524 # This macro actually does too much. Some checks are only needed if
84988525 # your package does certain things. But this isn't really a big deal.
85098536 # arguments mandatory, and then we can depend on a new Autoconf
85108537 # release and drop the old call support.
85118538 AC_DEFUN([AM_INIT_AUTOMAKE],
8512 [AC_PREREQ([2.60])dnl
8539 [AC_PREREQ([2.62])dnl
85138540 dnl Autoconf wants to disallow AM_ names. We explicitly allow
85148541 dnl the ones we care about.
85158542 m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
85608587 AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
85618588 AM_MISSING_PROG(AUTOHEADER, autoheader)
85628589 AM_MISSING_PROG(MAKEINFO, makeinfo)
8563 AM_PROG_INSTALL_SH
8564 AM_PROG_INSTALL_STRIP
8590 AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
8591 AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
85658592 AC_REQUIRE([AM_PROG_MKDIR_P])dnl
85668593 # We need awk for the "check" target. The system "awk" is bad on
85678594 # some platforms.
85698596 AC_REQUIRE([AC_PROG_MAKE_SET])dnl
85708597 AC_REQUIRE([AM_SET_LEADING_DOT])dnl
85718598 _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
8572 [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
8573 [_AM_PROG_TAR([v7])])])
8599 [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
8600 [_AM_PROG_TAR([v7])])])
85748601 _AM_IF_OPTION([no-dependencies],,
85758602 [AC_PROVIDE_IFELSE([AC_PROG_CC],
8576 [_AM_DEPENDENCIES(CC)],
8577 [define([AC_PROG_CC],
8578 defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
8603 [_AM_DEPENDENCIES(CC)],
8604 [define([AC_PROG_CC],
8605 defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
85798606 AC_PROVIDE_IFELSE([AC_PROG_CXX],
8580 [_AM_DEPENDENCIES(CXX)],
8581 [define([AC_PROG_CXX],
8582 defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
8607 [_AM_DEPENDENCIES(CXX)],
8608 [define([AC_PROG_CXX],
8609 defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
85838610 AC_PROVIDE_IFELSE([AC_PROG_OBJC],
8584 [_AM_DEPENDENCIES(OBJC)],
8585 [define([AC_PROG_OBJC],
8586 defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
8611 [_AM_DEPENDENCIES(OBJC)],
8612 [define([AC_PROG_OBJC],
8613 defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
85878614 ])
8615 _AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
8616 dnl The `parallel-tests' driver may need to know about EXEEXT, so add the
8617 dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro
8618 dnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
8619 AC_CONFIG_COMMANDS_PRE(dnl
8620 [m4_provide_if([_AM_COMPILER_EXEEXT],
8621 [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
85888622 ])
8623
8624 dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion. Do not
8625 dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
8626 dnl mangled by Autoconf and run in a shell conditional statement.
8627 m4_define([_AC_COMPILER_EXEEXT],
8628 m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
85898629
85908630
85918631 # When config.status generates a header, we must update the stamp-h file.
86098649 done
86108650 echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
86118651
8612 # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
8652 # Copyright (C) 2001, 2003, 2005, 2008 Free Software Foundation, Inc.
86138653 #
86148654 # This file is free software; the Free Software Foundation
86158655 # gives unlimited permission to copy and/or distribute it,
86208660 # Define $install_sh.
86218661 AC_DEFUN([AM_PROG_INSTALL_SH],
86228662 [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
8623 install_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"}
8663 if test x"${install_sh}" != xset; then
8664 case $am_aux_dir in
8665 *\ * | *\ *)
8666 install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
8667 *)
8668 install_sh="\${SHELL} $am_aux_dir/install-sh"
8669 esac
8670 fi
86248671 AC_SUBST(install_sh)])
86258672
86268673 # Copyright (C) 2003, 2005 Free Software Foundation, Inc.
86468693
86478694 # Check to see how 'make' treats includes. -*- Autoconf -*-
86488695
8649 # Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
8696 # Copyright (C) 2001, 2002, 2003, 2005, 2009 Free Software Foundation, Inc.
86508697 #
86518698 # This file is free software; the Free Software Foundation
86528699 # gives unlimited permission to copy and/or distribute it,
86538700 # with or without modifications, as long as this notice is preserved.
86548701
8655 # serial 3
8702 # serial 4
86568703
86578704 # AM_MAKE_INCLUDE()
86588705 # -----------------
86618708 [am_make=${MAKE-make}
86628709 cat > confinc << 'END'
86638710 am__doit:
8664 @echo done
8711 @echo this is the am__doit target
86658712 .PHONY: am__doit
86668713 END
86678714 # If we don't find an include directive, just comment out the code.
86718718 _am_result=none
86728719 # First try GNU make style include.
86738720 echo "include confinc" > confmf
8674 # We grep out `Entering directory' and `Leaving directory'
8675 # messages which can occur if `w' ends up in MAKEFLAGS.
8676 # In particular we don't look at `^make:' because GNU make might
8677 # be invoked under some other name (usually "gmake"), in which
8678 # case it prints its new name instead of `make'.
8679 if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
8680 am__include=include
8681 am__quote=
8682 _am_result=GNU
8683 fi
8721 # Ignore all kinds of additional output from `make'.
8722 case `$am_make -s -f confmf 2> /dev/null` in #(
8723 *the\ am__doit\ target*)
8724 am__include=include
8725 am__quote=
8726 _am_result=GNU
8727 ;;
8728 esac
86848729 # Now try BSD make style include.
86858730 if test "$am__include" = "#"; then
86868731 echo '.include "confinc"' > confmf
8687 if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
8688 am__include=.include
8689 am__quote="\""
8690 _am_result=BSD
8691 fi
8732 case `$am_make -s -f confmf 2> /dev/null` in #(
8733 *the\ am__doit\ target*)
8734 am__include=.include
8735 am__quote="\""
8736 _am_result=BSD
8737 ;;
8738 esac
86928739 fi
86938740 AC_SUBST([am__include])
86948741 AC_SUBST([am__quote])
87338780
87348781 # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
87358782
8736 # Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005
8783 # Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008
87378784 # Free Software Foundation, Inc.
87388785 #
87398786 # This file is free software; the Free Software Foundation
87408787 # gives unlimited permission to copy and/or distribute it,
87418788 # with or without modifications, as long as this notice is preserved.
87428789
8743 # serial 5
8790 # serial 6
87448791
87458792 # AM_MISSING_PROG(NAME, PROGRAM)
87468793 # ------------------------------
87578804 AC_DEFUN([AM_MISSING_HAS_RUN],
87588805 [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
87598806 AC_REQUIRE_AUX_FILE([missing])dnl
8760 test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
8807 if test x"${MISSING+set}" != xset; then
8808 case $am_aux_dir in
8809 *\ * | *\ *)
8810 MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
8811 *)
8812 MISSING="\${SHELL} $am_aux_dir/missing" ;;
8813 esac
8814 fi
87618815 # Use eval to expand $SHELL
87628816 if eval "$MISSING --run true"; then
87638817 am_missing_run="$MISSING --run "
88268880 AC_DEFUN([_AM_IF_OPTION],
88278881 [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
88288882
8883 # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
8884 #
8885 # This file is free software; the Free Software Foundation
8886 # gives unlimited permission to copy and/or distribute it,
8887 # with or without modifications, as long as this notice is preserved.
8888
8889 # AM_RUN_LOG(COMMAND)
8890 # -------------------
8891 # Run COMMAND, save the exit status in ac_status, and log it.
8892 # (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
8893 AC_DEFUN([AM_RUN_LOG],
8894 [{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
8895 ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
8896 ac_status=$?
8897 echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
8898 (exit $ac_status); }])
8899
88298900 # Check to make sure that the build environment is sane. -*- Autoconf -*-
88308901
8831 # Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
8902 # Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008
88328903 # Free Software Foundation, Inc.
88338904 #
88348905 # This file is free software; the Free Software Foundation
88358906 # gives unlimited permission to copy and/or distribute it,
88368907 # with or without modifications, as long as this notice is preserved.
88378908
8838 # serial 4
8909 # serial 5
88398910
88408911 # AM_SANITY_CHECK
88418912 # ---------------
88448915 # Just in case
88458916 sleep 1
88468917 echo timestamp > conftest.file
8918 # Reject unsafe characters in $srcdir or the absolute working directory
8919 # name. Accept space and tab only in the latter.
8920 am_lf='
8921 '
8922 case `pwd` in
8923 *[[\\\"\#\$\&\'\`$am_lf]]*)
8924 AC_MSG_ERROR([unsafe absolute working directory name]);;
8925 esac
8926 case $srcdir in
8927 *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*)
8928 AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);;
8929 esac
8930
88478931 # Do `set' in a subshell so we don't clobber the current shell's
88488932 # arguments. Must try -L first in case configure is actually a
88498933 # symlink; some systems play weird games with the mod time of symlinks
88508934 # (eg FreeBSD returns the mod time of the symlink's containing
88518935 # directory).
88528936 if (
8853 set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
8937 set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
88548938 if test "$[*]" = "X"; then
88558939 # -L didn't work.
8856 set X `ls -t $srcdir/configure conftest.file`
8940 set X `ls -t "$srcdir/configure" conftest.file`
88578941 fi
88588942 rm -f conftest.file
88598943 if test "$[*]" != "X $srcdir/configure conftest.file" \
88778961 Check your system clock])
88788962 fi
88798963 AC_MSG_RESULT(yes)])
8964
8965 # Copyright (C) 2009 Free Software Foundation, Inc.
8966 #
8967 # This file is free software; the Free Software Foundation
8968 # gives unlimited permission to copy and/or distribute it,
8969 # with or without modifications, as long as this notice is preserved.
8970
8971 # serial 1
8972
8973 # AM_SILENT_RULES([DEFAULT])
8974 # --------------------------
8975 # Enable less verbose build rules; with the default set to DEFAULT
8976 # (`yes' being less verbose, `no' or empty being verbose).
8977 AC_DEFUN([AM_SILENT_RULES],
8978 [AC_ARG_ENABLE([silent-rules],
8979 [ --enable-silent-rules less verbose build output (undo: `make V=1')
8980 --disable-silent-rules verbose build output (undo: `make V=0')])
8981 case $enable_silent_rules in
8982 yes) AM_DEFAULT_VERBOSITY=0;;
8983 no) AM_DEFAULT_VERBOSITY=1;;
8984 *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
8985 esac
8986 AC_SUBST([AM_DEFAULT_VERBOSITY])dnl
8987 AM_BACKSLASH='\'
8988 AC_SUBST([AM_BACKSLASH])dnl
8989 _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
8990 ])
88808991
88818992 # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
88828993 #
89069017 INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
89079018 AC_SUBST([INSTALL_STRIP_PROGRAM])])
89089019
8909 # Copyright (C) 2006 Free Software Foundation, Inc.
9020 # Copyright (C) 2006, 2008 Free Software Foundation, Inc.
89109021 #
89119022 # This file is free software; the Free Software Foundation
89129023 # gives unlimited permission to copy and/or distribute it,
89139024 # with or without modifications, as long as this notice is preserved.
9025
9026 # serial 2
89149027
89159028 # _AM_SUBST_NOTMAKE(VARIABLE)
89169029 # ---------------------------
89179030 # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
89189031 # This macro is traced by Automake.
89199032 AC_DEFUN([_AM_SUBST_NOTMAKE])
9033
9034 # AM_SUBST_NOTMAKE(VARIABLE)
9035 # ---------------------------
9036 # Public sister of _AM_SUBST_NOTMAKE.
9037 AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
89209038
89219039 # Check how to create a tarball. -*- Autoconf -*-
89229040
6363 /* These three will be autotested for: */
6464 SK_DISK_TYPE_ATA_PASSTHROUGH_12, /* ATA passthrough over SCSI transport, 12-byte version */
6565 SK_DISK_TYPE_ATA_PASSTHROUGH_16, /* ATA passthrough over SCSI transport, 16-byte version */
66 SK_DISK_TYPE_ATA, /* Classic Linux /dev/hda ioctls */
66 SK_DISK_TYPE_LINUX_IDE, /* Classic Linux /dev/hda ioctls */
6767
6868 /* These three will not be autotested for */
6969 SK_DISK_TYPE_SUNPLUS, /* SunPlus USB/ATA bridges */
7070 SK_DISK_TYPE_JMICRON, /* JMicron USB/ATA bridges */
71 SK_DISK_TYPE_BLOB,
72 SK_DISK_TYPE_UNKNOWN,
71 SK_DISK_TYPE_BLOB, /* From a file */
72 SK_DISK_TYPE_NONE, /* No access method */
73 SK_DISK_TYPE_AUTO, /* We don't know yet */
7374 _SK_DISK_TYPE_MAX,
7475 _SK_DISK_TYPE_TEST_MAX = SK_DISK_TYPE_SUNPLUS /* only auto test until here */
7576 } SkDiskType;
113114 SkBool blob_smart_status:1;
114115 SkBool blob_smart_status_valid:1;
115116
117 SkBool attribute_verification_bad:1;
118
116119 SkIdentifyParsedData identify_parsed_data;
117120 SkSmartParsedData smart_parsed_data;
118121
137140 SK_SMART_COMMAND_RETURN_STATUS = 0xDA
138141 } SkSmartCommand;
139142
140 static const char *disk_type_to_string(SkDiskType type) {
143 /* Hmm, if the data we parse is out of a certain range just consider it misparsed */
144 #define SK_MKELVIN_VALID_MIN ((uint64_t) ((-15LL*1000LL) + 273150LL))
145 #define SK_MKELVIN_VALID_MAX ((uint64_t) ((100LL*1000LL) + 273150LL))
146
147 #define SK_MSECOND_VALID_MIN 1ULL
148 #define SK_MSECOND_VALID_SHORT_MAX (60ULL * 60ULL * 1000ULL)
149 #define SK_MSECOND_VALID_LONG_MAX (30ULL * 365ULL * 24ULL * 60ULL * 60ULL * 1000ULL)
150
151 static const char *disk_type_to_human_string(SkDiskType type) {
141152
142153 /* %STRINGPOOLSTART% */
143154 static const char* const map[_SK_DISK_TYPE_MAX] = {
144155 [SK_DISK_TYPE_ATA_PASSTHROUGH_16] = "16 Byte SCSI ATA SAT Passthru",
145156 [SK_DISK_TYPE_ATA_PASSTHROUGH_12] = "12 Byte SCSI ATA SAT Passthru",
146 [SK_DISK_TYPE_ATA] = "Native Linux ATA",
157 [SK_DISK_TYPE_LINUX_IDE] = "Native Linux IDE",
147158 [SK_DISK_TYPE_SUNPLUS] = "Sunplus SCSI ATA Passthru",
148159 [SK_DISK_TYPE_JMICRON] = "JMicron SCSI ATA Passthru",
149160 [SK_DISK_TYPE_BLOB] = "Blob",
150 [SK_DISK_TYPE_UNKNOWN] = "Unknown"
161 [SK_DISK_TYPE_AUTO] = "Automatic",
162 [SK_DISK_TYPE_NONE] = "None"
151163 };
152164 /* %STRINGPOOLSTOP% */
153165
157169 return _P(map[type]);
158170 }
159171
172 static const char *disk_type_to_prefix_string(SkDiskType type) {
173
174 /* %STRINGPOOLSTART% */
175 static const char* const map[_SK_DISK_TYPE_MAX] = {
176 [SK_DISK_TYPE_ATA_PASSTHROUGH_16] = "sat16",
177 [SK_DISK_TYPE_ATA_PASSTHROUGH_12] = "sat12",
178 [SK_DISK_TYPE_LINUX_IDE] = "linux-ide",
179 [SK_DISK_TYPE_SUNPLUS] = "sunplus",
180 [SK_DISK_TYPE_JMICRON] = "jmicron",
181 [SK_DISK_TYPE_NONE] = "none",
182 [SK_DISK_TYPE_AUTO] = "auto",
183 };
184 /* %STRINGPOOLSTOP% */
185
186 if (type >= _SK_DISK_TYPE_MAX)
187 return NULL;
188
189 return _P(map[type]);
190 }
191
192 static const char *disk_type_from_string(const char *s, SkDiskType *type) {
193 unsigned u;
194
195 assert(s);
196 assert(type);
197
198 for (u = 0; u < _SK_DISK_TYPE_MAX; u++) {
199 const char *t;
200 size_t l;
201
202 if (!(t = disk_type_to_prefix_string(u)))
203 continue;
204
205 l = strlen(t);
206
207 if (strncmp(s, t, l))
208 continue;
209
210 if (s[l] != ':')
211 continue;
212
213 *type = u;
214
215 return s + l + 1;
216 }
217
218 return NULL;
219 }
220
160221 static SkBool disk_smart_is_available(SkDisk *d) {
161222 return d->identify_valid && !!(d->identify[164] & 1);
162223 }
188249 return !!(d->smart_data[367] & 41);
189250 }
190251
191 static int disk_ata_command(SkDisk *d, SkAtaCommand command, SkDirection direction, void* cmd_data, void* data, size_t *len) {
252 static int disk_linux_ide_command(SkDisk *d, SkAtaCommand command, SkDirection direction, void* cmd_data, void* data, size_t *len) {
192253 uint8_t *bytes = cmd_data;
193254 int ret;
194255
195 assert(d->type == SK_DISK_TYPE_ATA);
256 assert(d->type == SK_DISK_TYPE_LINUX_IDE);
196257
197258 switch (direction) {
198259
633694 static int disk_command(SkDisk *d, SkAtaCommand command, SkDirection direction, void* cmd_data, void* data, size_t *len) {
634695
635696 static int (* const disk_command_table[_SK_DISK_TYPE_MAX]) (SkDisk *d, SkAtaCommand command, SkDirection direction, void* cmd_data, void* data, size_t *len) = {
636 [SK_DISK_TYPE_ATA] = disk_ata_command,
697 [SK_DISK_TYPE_LINUX_IDE] = disk_linux_ide_command,
637698 [SK_DISK_TYPE_ATA_PASSTHROUGH_12] = disk_passthrough_12_command,
638699 [SK_DISK_TYPE_ATA_PASSTHROUGH_16] = disk_passthrough_16_command,
639700 [SK_DISK_TYPE_SUNPLUS] = disk_sunplus_command,
640701 [SK_DISK_TYPE_JMICRON] = disk_jmicron_command,
641702 [SK_DISK_TYPE_BLOB] = NULL,
642 [SK_DISK_TYPE_UNKNOWN] = NULL
703 [SK_DISK_TYPE_AUTO] = NULL,
704 [SK_DISK_TYPE_NONE] = NULL
643705 };
644706
645707 assert(d);
11191181 else if (!strcmp(a->name, "temperature-centi-celsius"))
11201182 a->pretty_value = (fourtyeight & 0xFFFF)*100 + 273150;
11211183 else if (!strcmp(a->name, "power-on-minutes"))
1122 a->pretty_value = (((uint64_t) a->raw[0]) | (uint64_t) a->raw[1]) * 60 * 1000;
1184 a->pretty_value = fourtyeight * 60 * 1000;
11231185 else if (!strcmp(a->name, "power-on-seconds"))
11241186 a->pretty_value = fourtyeight * 1000;
11251187 else if (!strcmp(a->name, "power-on-half-minutes"))
11271189 else if (!strcmp(a->name, "power-on-hours") ||
11281190 !strcmp(a->name, "loaded-hours") ||
11291191 !strcmp(a->name, "head-flying-hours"))
1130 a->pretty_value = fourtyeight * 60 * 60 * 1000;
1131 else if (!strcmp(a->name, "reallocated-sector-count"))
1192 a->pretty_value = (fourtyeight & 0xFFFFFFFFU) * 60 * 60 * 1000;
1193 else if (!strcmp(a->name, "reallocated-sector-count") ||
1194 !strcmp(a->name, "current-pending-sector"))
11321195 a->pretty_value = fourtyeight & 0xFFFFFFFFU;
11331196 else
11341197 a->pretty_value = fourtyeight;
11351198 }
11361199
1200 typedef void (*SkSmartAttributeVerify)(SkDisk *d, SkSmartAttributeParsedData *a);
1201
11371202 typedef struct SkSmartAttributeInfo {
11381203 const char *name;
11391204 SkSmartAttributeUnit unit;
1205 SkSmartAttributeVerify verify;
11401206 } SkSmartAttributeInfo;
1207
1208 static void verify_temperature(SkDisk *d, SkSmartAttributeParsedData *a) {
1209 assert(a);
1210 assert(a->pretty_unit == SK_SMART_ATTRIBUTE_UNIT_MKELVIN);
1211
1212 if (a->pretty_value < SK_MKELVIN_VALID_MIN ||
1213 a->pretty_value > SK_MKELVIN_VALID_MAX) {
1214 a->pretty_unit = SK_SMART_ATTRIBUTE_UNIT_UNKNOWN;
1215 d->attribute_verification_bad = TRUE;
1216 }
1217 }
1218
1219 static void verify_short_time(SkDisk *d, SkSmartAttributeParsedData *a) {
1220 assert(a);
1221 assert(a->pretty_unit == SK_SMART_ATTRIBUTE_UNIT_MSECONDS);
1222
1223 if (a->pretty_value < SK_MSECOND_VALID_MIN ||
1224 a->pretty_value > SK_MSECOND_VALID_SHORT_MAX) {
1225 a->pretty_unit = SK_SMART_ATTRIBUTE_UNIT_UNKNOWN;
1226 d->attribute_verification_bad = TRUE;
1227 }
1228 }
1229
1230 static void verify_long_time(SkDisk *d, SkSmartAttributeParsedData *a) {
1231 assert(a);
1232 assert(a->pretty_unit == SK_SMART_ATTRIBUTE_UNIT_MSECONDS);
1233
1234 if (a->pretty_value < SK_MSECOND_VALID_MIN ||
1235 a->pretty_value > SK_MSECOND_VALID_LONG_MAX) {
1236 a->pretty_unit = SK_SMART_ATTRIBUTE_UNIT_UNKNOWN;
1237 d->attribute_verification_bad = TRUE;
1238 }
1239 }
1240
1241 static void verify_sectors(SkDisk *d, SkSmartAttributeParsedData *a) {
1242 uint64_t max_sectors;
1243
1244 assert(d);
1245 assert(a);
1246 assert(a->pretty_unit == SK_SMART_ATTRIBUTE_UNIT_SECTORS);
1247
1248 max_sectors = d->size / 512ULL;
1249
1250 if (max_sectors > 0 && a->pretty_value > max_sectors) {
1251 a->pretty_value = SK_SMART_ATTRIBUTE_UNIT_UNKNOWN;
1252 d->attribute_verification_bad = TRUE;
1253 } else {
1254 if ((!strcmp(a->name, "reallocated-sector-count") ||
1255 !strcmp(a->name, "current-pending-sector")) &&
1256 a->pretty_value > 0)
1257 a->warn = TRUE;
1258 }
1259 }
11411260
11421261 /* This data is stolen from smartmontools */
11431262
11441263 /* %STRINGPOOLSTART% */
11451264 static const SkSmartAttributeInfo const attribute_info[256] = {
1146 [1] = { "raw-read-error-rate", SK_SMART_ATTRIBUTE_UNIT_NONE },
1147 [2] = { "throughput-performance", SK_SMART_ATTRIBUTE_UNIT_UNKNOWN },
1148 [3] = { "spin-up-time", SK_SMART_ATTRIBUTE_UNIT_MSECONDS },
1149 [4] = { "start-stop-count", SK_SMART_ATTRIBUTE_UNIT_NONE },
1150 [5] = { "reallocated-sector-count", SK_SMART_ATTRIBUTE_UNIT_SECTORS },
1151 [6] = { "read-channel-margin", SK_SMART_ATTRIBUTE_UNIT_UNKNOWN },
1152 [7] = { "seek-error-rate", SK_SMART_ATTRIBUTE_UNIT_NONE },
1153 [8] = { "seek-time-performance", SK_SMART_ATTRIBUTE_UNIT_UNKNOWN },
1154 [9] = { "power-on-hours", SK_SMART_ATTRIBUTE_UNIT_MSECONDS },
1155 [10] = { "spin-retry-count", SK_SMART_ATTRIBUTE_UNIT_NONE },
1156 [11] = { "calibration-retry-count", SK_SMART_ATTRIBUTE_UNIT_NONE },
1157 [12] = { "power-cycle-count", SK_SMART_ATTRIBUTE_UNIT_NONE },
1158 [13] = { "read-soft-error-rate", SK_SMART_ATTRIBUTE_UNIT_NONE },
1159 [187] = { "reported-uncorrect", SK_SMART_ATTRIBUTE_UNIT_SECTORS },
1160 [189] = { "high-fly-writes", SK_SMART_ATTRIBUTE_UNIT_NONE },
1161 [190] = { "airflow-temperature-celsius", SK_SMART_ATTRIBUTE_UNIT_MKELVIN },
1162 [191] = { "g-sense-error-rate", SK_SMART_ATTRIBUTE_UNIT_NONE },
1163 [192] = { "power-off-retract-count", SK_SMART_ATTRIBUTE_UNIT_NONE },
1164 [193] = { "load-cycle-count", SK_SMART_ATTRIBUTE_UNIT_NONE },
1165 [194] = { "temperature-celsius-2", SK_SMART_ATTRIBUTE_UNIT_MKELVIN },
1166 [195] = { "hardware-ecc-recovered", SK_SMART_ATTRIBUTE_UNIT_NONE },
1167 [196] = { "reallocated-event-count", SK_SMART_ATTRIBUTE_UNIT_NONE },
1168 [197] = { "current-pending-sector", SK_SMART_ATTRIBUTE_UNIT_SECTORS },
1169 [198] = { "offline-uncorrectable", SK_SMART_ATTRIBUTE_UNIT_SECTORS },
1170 [199] = { "udma-crc-error-count", SK_SMART_ATTRIBUTE_UNIT_NONE },
1171 [200] = { "multi-zone-error-rate", SK_SMART_ATTRIBUTE_UNIT_NONE },
1172 [201] = { "soft-read-error-rate", SK_SMART_ATTRIBUTE_UNIT_NONE },
1173 [202] = { "ta-increase-count", SK_SMART_ATTRIBUTE_UNIT_NONE },
1174 [203] = { "run-out-cancel", SK_SMART_ATTRIBUTE_UNIT_UNKNOWN },
1175 [204] = { "shock-count-write-open", SK_SMART_ATTRIBUTE_UNIT_NONE },
1176 [205] = { "shock-rate-write-open", SK_SMART_ATTRIBUTE_UNIT_NONE },
1177 [206] = { "flying-height", SK_SMART_ATTRIBUTE_UNIT_UNKNOWN },
1178 [207] = { "spin-high-current", SK_SMART_ATTRIBUTE_UNIT_UNKNOWN },
1179 [208] = { "spin-buzz", SK_SMART_ATTRIBUTE_UNIT_UNKNOWN},
1180 [209] = { "offline-seek-performance", SK_SMART_ATTRIBUTE_UNIT_UNKNOWN },
1181 [220] = { "disk-shift", SK_SMART_ATTRIBUTE_UNIT_UNKNOWN },
1182 [221] = { "g-sense-error-rate-2", SK_SMART_ATTRIBUTE_UNIT_NONE },
1183 [222] = { "loaded-hours", SK_SMART_ATTRIBUTE_UNIT_MSECONDS },
1184 [223] = { "load-retry-count", SK_SMART_ATTRIBUTE_UNIT_NONE },
1185 [224] = { "load-friction", SK_SMART_ATTRIBUTE_UNIT_UNKNOWN },
1186 [225] = { "load-cycle-count-2", SK_SMART_ATTRIBUTE_UNIT_NONE },
1187 [226] = { "load-in-time", SK_SMART_ATTRIBUTE_UNIT_MSECONDS },
1188 [227] = { "torq-amp-count", SK_SMART_ATTRIBUTE_UNIT_NONE },
1189 [228] = { "power-off-retract-count-2", SK_SMART_ATTRIBUTE_UNIT_NONE },
1190 [230] = { "head-amplitude", SK_SMART_ATTRIBUTE_UNIT_UNKNOWN },
1191 [231] = { "temperature-celsius", SK_SMART_ATTRIBUTE_UNIT_MKELVIN },
1192 [240] = { "head-flying-hours", SK_SMART_ATTRIBUTE_UNIT_MSECONDS },
1193 [250] = { "read-error-retry-rate", SK_SMART_ATTRIBUTE_UNIT_NONE }
1265 [1] = { "raw-read-error-rate", SK_SMART_ATTRIBUTE_UNIT_NONE, NULL },
1266 [2] = { "throughput-performance", SK_SMART_ATTRIBUTE_UNIT_UNKNOWN, NULL },
1267 [3] = { "spin-up-time", SK_SMART_ATTRIBUTE_UNIT_MSECONDS, verify_short_time },
1268 [4] = { "start-stop-count", SK_SMART_ATTRIBUTE_UNIT_NONE, NULL },
1269 [5] = { "reallocated-sector-count", SK_SMART_ATTRIBUTE_UNIT_SECTORS, verify_sectors },
1270 [6] = { "read-channel-margin", SK_SMART_ATTRIBUTE_UNIT_UNKNOWN, NULL },
1271 [7] = { "seek-error-rate", SK_SMART_ATTRIBUTE_UNIT_NONE, NULL },
1272 [8] = { "seek-time-performance", SK_SMART_ATTRIBUTE_UNIT_UNKNOWN, NULL },
1273 [9] = { "power-on-hours", SK_SMART_ATTRIBUTE_UNIT_MSECONDS, verify_long_time },
1274 [10] = { "spin-retry-count", SK_SMART_ATTRIBUTE_UNIT_NONE, NULL },
1275 [11] = { "calibration-retry-count", SK_SMART_ATTRIBUTE_UNIT_NONE, NULL },
1276 [12] = { "power-cycle-count", SK_SMART_ATTRIBUTE_UNIT_NONE, NULL },
1277 [13] = { "read-soft-error-rate", SK_SMART_ATTRIBUTE_UNIT_NONE, NULL },
1278 [187] = { "reported-uncorrect", SK_SMART_ATTRIBUTE_UNIT_SECTORS, verify_sectors },
1279 [189] = { "high-fly-writes", SK_SMART_ATTRIBUTE_UNIT_NONE, NULL },
1280 [190] = { "airflow-temperature-celsius", SK_SMART_ATTRIBUTE_UNIT_MKELVIN, verify_temperature },
1281 [191] = { "g-sense-error-rate", SK_SMART_ATTRIBUTE_UNIT_NONE, NULL },
1282 [192] = { "power-off-retract-count", SK_SMART_ATTRIBUTE_UNIT_NONE, NULL },
1283 [193] = { "load-cycle-count", SK_SMART_ATTRIBUTE_UNIT_NONE, NULL },
1284 [194] = { "temperature-celsius-2", SK_SMART_ATTRIBUTE_UNIT_MKELVIN, verify_temperature },
1285 [195] = { "hardware-ecc-recovered", SK_SMART_ATTRIBUTE_UNIT_NONE, NULL },
1286 [196] = { "reallocated-event-count", SK_SMART_ATTRIBUTE_UNIT_NONE, NULL },
1287 [197] = { "current-pending-sector", SK_SMART_ATTRIBUTE_UNIT_SECTORS, verify_sectors },
1288 [198] = { "offline-uncorrectable", SK_SMART_ATTRIBUTE_UNIT_SECTORS, verify_sectors },
1289 [199] = { "udma-crc-error-count", SK_SMART_ATTRIBUTE_UNIT_NONE, NULL },
1290 [200] = { "multi-zone-error-rate", SK_SMART_ATTRIBUTE_UNIT_NONE, NULL },
1291 [201] = { "soft-read-error-rate", SK_SMART_ATTRIBUTE_UNIT_NONE, NULL },
1292 [202] = { "ta-increase-count", SK_SMART_ATTRIBUTE_UNIT_NONE, NULL },
1293 [203] = { "run-out-cancel", SK_SMART_ATTRIBUTE_UNIT_UNKNOWN, NULL },
1294 [204] = { "shock-count-write-open", SK_SMART_ATTRIBUTE_UNIT_NONE, NULL },
1295 [205] = { "shock-rate-write-open", SK_SMART_ATTRIBUTE_UNIT_NONE, NULL },
1296 [206] = { "flying-height", SK_SMART_ATTRIBUTE_UNIT_UNKNOWN, NULL },
1297 [207] = { "spin-high-current", SK_SMART_ATTRIBUTE_UNIT_UNKNOWN, NULL },
1298 [208] = { "spin-buzz", SK_SMART_ATTRIBUTE_UNIT_UNKNOWN, NULL },
1299 [209] = { "offline-seek-performance", SK_SMART_ATTRIBUTE_UNIT_UNKNOWN, NULL },
1300 [220] = { "disk-shift", SK_SMART_ATTRIBUTE_UNIT_UNKNOWN, NULL },
1301 [221] = { "g-sense-error-rate-2", SK_SMART_ATTRIBUTE_UNIT_NONE, NULL },
1302 [222] = { "loaded-hours", SK_SMART_ATTRIBUTE_UNIT_MSECONDS, verify_long_time },
1303 [223] = { "load-retry-count", SK_SMART_ATTRIBUTE_UNIT_NONE, NULL },
1304 [224] = { "load-friction", SK_SMART_ATTRIBUTE_UNIT_UNKNOWN, NULL },
1305 [225] = { "load-cycle-count-2", SK_SMART_ATTRIBUTE_UNIT_NONE, NULL },
1306 [226] = { "load-in-time", SK_SMART_ATTRIBUTE_UNIT_MSECONDS, verify_short_time },
1307 [227] = { "torq-amp-count", SK_SMART_ATTRIBUTE_UNIT_NONE, NULL },
1308 [228] = { "power-off-retract-count-2", SK_SMART_ATTRIBUTE_UNIT_NONE, NULL },
1309 [230] = { "head-amplitude", SK_SMART_ATTRIBUTE_UNIT_UNKNOWN, NULL },
1310 [231] = { "temperature-celsius", SK_SMART_ATTRIBUTE_UNIT_MKELVIN, verify_temperature },
1311 [240] = { "head-flying-hours", SK_SMART_ATTRIBUTE_UNIT_MSECONDS, verify_long_time },
1312 [250] = { "read-error-retry-rate", SK_SMART_ATTRIBUTE_UNIT_NONE, NULL }
11941313 };
11951314 /* %STRINGPOOLSTOP% */
11961315
11971316 typedef enum SkSmartQuirk {
1198 SK_SMART_QUIRK_9_POWERONMINUTES = 1,
1199 SK_SMART_QUIRK_9_POWERONSECONDS = 2,
1200 SK_SMART_QUIRK_9_POWERONHALFMINUTES = 4,
1201 SK_SMART_QUIRK_192_EMERGENCYRETRACTCYCLECT = 8,
1202 SK_SMART_QUIRK_193_LOADUNLOAD = 16,
1203 SK_SMART_QUIRK_194_10XCELSIUS = 32,
1204 SK_SMART_QUIRK_194_UNKNOWN = 64,
1205 SK_SMART_QUIRK_200_WRITEERRORCOUNT = 128,
1206 SK_SMART_QUIRK_201_DETECTEDTACOUNT = 256,
1207 SK_SMART_QUIRK_9_UNKNOWN = 512
1317 SK_SMART_QUIRK_9_POWERONMINUTES = 0x0001,
1318 SK_SMART_QUIRK_9_POWERONSECONDS = 0x0002,
1319 SK_SMART_QUIRK_9_POWERONHALFMINUTES = 0x0004,
1320 SK_SMART_QUIRK_192_EMERGENCYRETRACTCYCLECT = 0x0008,
1321 SK_SMART_QUIRK_193_LOADUNLOAD = 0x0010,
1322 SK_SMART_QUIRK_194_10XCELSIUS = 0x0020,
1323 SK_SMART_QUIRK_194_UNKNOWN = 0x0040,
1324 SK_SMART_QUIRK_200_WRITEERRORCOUNT = 0x0080,
1325 SK_SMART_QUIRK_201_DETECTEDTACOUNT = 0x0100,
1326 SK_SMART_QUIRK_5_UNKNOWN = 0x0200,
1327 SK_SMART_QUIRK_9_UNKNOWN = 0x0400,
1328 SK_SMART_QUIRK_197_UNKNOWN = 0x0800,
1329 SK_SMART_QUIRK_198_UNKNOWN = 0x1000,
12081330 } SkSmartQuirk;
12091331
12101332 /* %STRINGPOOLSTART% */
12181340 "194_UNKNOWN",
12191341 "200_WRITEERRORCOUNT",
12201342 "201_DETECTEDTACOUNT",
1343 "5_UNKNOWN",
12211344 "9_UNKNOWN",
1345 "197_UNKNOWN",
1346 "198_UNKNOWN",
12221347 NULL
12231348 };
12241349 /* %STRINGPOOLSTOP% */
12311356
12321357 static const SkSmartQuirkDatabase quirk_database[] = { {
12331358
1234 /*** Seagate */
1235 "^ST9160821AS$",
1236 NULL,
1237 SK_SMART_QUIRK_9_UNKNOWN
1359 /*** Fujitsu */
1360 "^("
1361 "FUJITSU MHY2120BH|"
1362 "FUJITSU MHY2250BH"
1363 ")$",
1364 "^0085000B$", /* seems to be specific to this firmware */
1365 SK_SMART_QUIRK_9_POWERONMINUTES|
1366 SK_SMART_QUIRK_197_UNKNOWN|
1367 SK_SMART_QUIRK_198_UNKNOWN
12381368 }, {
1239
1240 /*** Fujitsu */
12411369 "^FUJITSU MHR2040AT$",
12421370 NULL,
12431371 SK_SMART_QUIRK_9_POWERONSECONDS|
13561484 SK_SMART_QUIRK_9_POWERONMINUTES|
13571485 SK_SMART_QUIRK_193_LOADUNLOAD
13581486 }, {
1359
1487 "^HTS541010G9SA00$",
1488 "^MBZOC60P$",
1489 SK_SMART_QUIRK_5_UNKNOWN
1490 }, {
13601491 NULL,
13611492 NULL,
13621493 0
14391570 if (quirk) {
14401571 switch (id) {
14411572
1573 case 5:
1574 if (quirk & SK_SMART_QUIRK_5_UNKNOWN)
1575 return NULL;
1576
1577 break;
1578
14421579 case 9:
14431580 /* %STRINGPOOLSTART% */
14441581 if (quirk & SK_SMART_QUIRK_9_POWERONMINUTES) {
14451582 static const SkSmartAttributeInfo a = {
1446 "power-on-minutes", SK_SMART_ATTRIBUTE_UNIT_MSECONDS
1583 "power-on-minutes", SK_SMART_ATTRIBUTE_UNIT_MSECONDS, verify_long_time
14471584 };
14481585 return &a;
14491586
14501587 } else if (quirk & SK_SMART_QUIRK_9_POWERONSECONDS) {
14511588 static const SkSmartAttributeInfo a = {
1452 "power-on-seconds", SK_SMART_ATTRIBUTE_UNIT_MSECONDS
1589 "power-on-seconds", SK_SMART_ATTRIBUTE_UNIT_MSECONDS, verify_long_time
14531590 };
14541591 return &a;
14551592
14561593 } else if (quirk & SK_SMART_QUIRK_9_POWERONHALFMINUTES) {
14571594 static const SkSmartAttributeInfo a = {
1458 "power-on-half-minutes", SK_SMART_ATTRIBUTE_UNIT_MSECONDS
1595 "power-on-half-minutes", SK_SMART_ATTRIBUTE_UNIT_MSECONDS, verify_long_time
14591596 };
14601597 return &a;
14611598 } else if (quirk & SK_SMART_QUIRK_9_UNKNOWN)
14681605 /* %STRINGPOOLSTART% */
14691606 if (quirk & SK_SMART_QUIRK_192_EMERGENCYRETRACTCYCLECT) {
14701607 static const SkSmartAttributeInfo a = {
1471 "emergency-retract-cycle-count", SK_SMART_ATTRIBUTE_UNIT_NONE
1608 "emergency-retract-cycle-count", SK_SMART_ATTRIBUTE_UNIT_NONE, NULL
14721609 };
14731610 return &a;
14741611 }
14801617 /* %STRINGPOOLSTART% */
14811618 if (quirk & SK_SMART_QUIRK_194_10XCELSIUS) {
14821619 static const SkSmartAttributeInfo a = {
1483 "temperature-centi-celsius", SK_SMART_ATTRIBUTE_UNIT_MKELVIN
1620 "temperature-centi-celsius", SK_SMART_ATTRIBUTE_UNIT_MKELVIN, verify_temperature
14841621 };
14851622 return &a;
14861623 } else if (quirk & SK_SMART_QUIRK_194_UNKNOWN)
14891626
14901627 break;
14911628
1629 case 197:
1630 if (quirk & SK_SMART_QUIRK_197_UNKNOWN)
1631 return NULL;
1632
1633 break;
1634
1635 case 198:
1636 if (quirk & SK_SMART_QUIRK_198_UNKNOWN)
1637 return NULL;
1638
1639 break;
1640
14921641 case 200:
14931642 /* %STRINGPOOLSTART% */
14941643 if (quirk & SK_SMART_QUIRK_200_WRITEERRORCOUNT) {
14951644 static const SkSmartAttributeInfo a = {
1496 "write-error-count", SK_SMART_ATTRIBUTE_UNIT_NONE
1645 "write-error-count", SK_SMART_ATTRIBUTE_UNIT_NONE, NULL
14971646 };
14981647 return &a;
14991648 }
15051654 /* %STRINGPOOLSTART% */
15061655 if (quirk & SK_SMART_QUIRK_201_DETECTEDTACOUNT) {
15071656 static const SkSmartAttributeInfo a = {
1508 "detected-ta-count", SK_SMART_ATTRIBUTE_UNIT_NONE
1657 "detected-ta-count", SK_SMART_ATTRIBUTE_UNIT_NONE, NULL
15091658 };
15101659 return &a;
15111660 }
15871736 uint8_t *p;
15881737 unsigned n;
15891738
1590 if (!d->smart_thresholds_valid) {
1591 a->threshold_valid = FALSE;
1592 return;
1593 }
1739 if (!d->smart_thresholds_valid)
1740 goto fail;
15941741
15951742 for (n = 0, p = d->smart_thresholds+2; n < 30; n++, p+=12)
15961743 if (p[0] == a->id)
15971744 break;
15981745
1599 if (n >= 30) {
1600 a->threshold_valid = FALSE;
1601 a->good_valid = FALSE;
1602 return;
1603 }
1746 if (n >= 30)
1747 goto fail;
16041748
16051749 a->threshold = p[1];
16061750 a->threshold_valid = p[1] != 0xFE;
16071751
1608 a->good_valid = FALSE;
1609 a->good = TRUE;
1752 a->good_now_valid = FALSE;
1753 a->good_now = TRUE;
1754 a->good_in_the_past_valid = FALSE;
1755 a->good_in_the_past = TRUE;
16101756
16111757 /* Always-Fail and Always-Passing thresholds are not relevant
16121758 * for our assessment. */
16131759 if (p[1] >= 1 && p[1] <= 0xFD) {
16141760
16151761 if (a->worst_value_valid) {
1616 a->good = a->good && (a->worst_value > a->threshold);
1617 a->good_valid = TRUE;
1762 a->good_in_the_past = a->good_in_the_past && (a->worst_value > a->threshold);
1763 a->good_in_the_past_valid = TRUE;
16181764 }
16191765
16201766 if (a->current_value_valid) {
1621 a->good = a->good && (a->current_value > a->threshold);
1622 a->good_valid = TRUE;
1767 a->good_now = a->good_now && (a->current_value > a->threshold);
1768 a->good_now_valid = TRUE;
16231769 }
16241770 }
1771
1772 a->warn =
1773 (a->good_now_valid && !a->good_now) ||
1774 (a->good_in_the_past_valid && !a->good_in_the_past);
1775
1776 return;
1777
1778 fail:
1779 a->threshold_valid = FALSE;
1780 a->good_now_valid = FALSE;
1781 a->good_in_the_past_valid = FALSE;
1782 a->warn = FALSE;
16251783 }
16261784
16271785 int sk_disk_smart_parse_attributes(SkDisk *d, SkSmartAttributeParseCallback cb, void* userdata) {
16711829
16721830 find_threshold(d, &a);
16731831
1674 /* Handle a few fields specially */
1675 if ((!strcmp(a.name, "reallocated-sector-count") ||
1676 !strcmp(a.name, "current-pending-sector")) &&
1677 a.pretty_unit == SK_SMART_ATTRIBUTE_UNIT_SECTORS &&
1678 a.pretty_value > 0) {
1679 a.good = FALSE;
1680 a.good_valid = TRUE;
1681 }
1832 if (i && i->verify)
1833 i->verify(d, &a);
16821834
16831835 cb(d, &a, userdata);
16841836 free(an);
18892041 /* %STRINGPOOLSTART% */
18902042 const char * const map[] = {
18912043 [SK_SMART_OVERALL_GOOD] = "GOOD",
2044 [SK_SMART_OVERALL_BAD_ATTRIBUTE_IN_THE_PAST] = "BAD_ATTRIBUTE_IN_THE_PAST",
2045 [SK_SMART_OVERALL_BAD_SECTOR] = "BAD_SECTOR",
2046 [SK_SMART_OVERALL_BAD_ATTRIBUTE_NOW] = "BAD_ATTRIBUTE_NOW",
2047 [SK_SMART_OVERALL_BAD_SECTOR_MANY] = "BAD_SECTOR_MANY",
18922048 [SK_SMART_OVERALL_BAD_STATUS] = "BAD_STATUS",
1893 [SK_SMART_OVERALL_BAD_ATTRIBUTE] = "BAD_ATTRIBUTE",
1894 [SK_SMART_OVERALL_BAD_SECTOR] = "BAD_SECTOR"
18952049 };
18962050 /* %STRINGPOOLSTOP% */
18972051
19012055 return _P(map[overall]);
19022056 }
19032057
1904 static void bad_attribute_cb(SkDisk *d, const SkSmartAttributeParsedData *a, SkBool *good) {
1905 if (a->prefailure && a->good_valid && !a->good)
2058 static void bad_attribute_now_cb(SkDisk *d, const SkSmartAttributeParsedData *a, SkBool *good) {
2059 if (a->prefailure && a->good_now_valid && !a->good_now)
19062060 *good = FALSE;
2061 }
2062
2063 static void bad_attribute_in_the_past_cb(SkDisk *d, const SkSmartAttributeParsedData *a, SkBool *good) {
2064 if (a->prefailure && a->good_in_the_past_valid && !a->good_in_the_past)
2065 *good = FALSE;
2066 }
2067
2068 static uint64_t u64log2(uint64_t n) {
2069 unsigned r;
2070
2071 if (n <= 1)
2072 return 0;
2073
2074 r = 0;
2075 for (;;) {
2076 n = n >> 1;
2077 if (!n)
2078 return r;
2079 r++;
2080 }
19072081 }
19082082
19092083 int sk_disk_smart_get_overall(SkDisk *d, SkSmartOverall *overall) {
19102084 SkBool good;
1911 uint64_t sectors;
2085 uint64_t sectors, sector_threshold;
19122086
19132087 assert(d);
19142088 assert(overall);
19152089
2090 /* First, check SMART self-assesment */
19162091 if (sk_disk_smart_status(d, &good) < 0)
19172092 return -1;
19182093
19212096 return 0;
19222097 }
19232098
2099 /* Second, check if the number of bad sectors is greater than
2100 * a certain threshold */
19242101 if (sk_disk_smart_get_bad(d, &sectors) < 0) {
19252102 if (errno != ENOENT)
19262103 return -1;
1927 } else if (sectors > 0) {
2104 sectors = 0;
2105 } else {
2106
2107 /* We use log2(n_sectors) as a threshold here. We had to pick
2108 * something, and this makes a bit of sense, or doesn't it? */
2109 sector_threshold = u64log2(d->size/512);
2110
2111 if (sectors >= sector_threshold) {
2112 *overall = SK_SMART_OVERALL_BAD_SECTOR_MANY;
2113 return 0;
2114 }
2115 }
2116
2117 /* Third, check if any of the SMART attributes is bad */
2118 good = TRUE;
2119 if (sk_disk_smart_parse_attributes(d, (SkSmartAttributeParseCallback) bad_attribute_now_cb, &good) < 0)
2120 return -1;
2121
2122 if (!good) {
2123 *overall = SK_SMART_OVERALL_BAD_ATTRIBUTE_NOW;
2124 return 0;
2125 }
2126
2127 /* Fourth, check if there are any bad sectors at all */
2128 if (sectors > 0) {
19282129 *overall = SK_SMART_OVERALL_BAD_SECTOR;
19292130 return 0;
19302131 }
19312132
2133 /* Fifth, check if any of the SMART attributes ever was bad */
19322134 good = TRUE;
1933 if (sk_disk_smart_parse_attributes(d, (SkSmartAttributeParseCallback) bad_attribute_cb, &good) < 0)
2135 if (sk_disk_smart_parse_attributes(d, (SkSmartAttributeParseCallback) bad_attribute_in_the_past_cb, &good) < 0)
19342136 return -1;
19352137
19362138 if (!good) {
1937 *overall = SK_SMART_OVERALL_BAD_ATTRIBUTE;
2139 *overall = SK_SMART_OVERALL_BAD_ATTRIBUTE_IN_THE_PAST;
19382140 return 0;
19392141 }
19402142
2143 /* Sixth, there's really nothing to complain about, so give it a pass */
19412144 *overall = SK_SMART_OVERALL_GOOD;
19422145 return 0;
19432146 }
20172220 snprintf(tc, sizeof(tc), "%3u", a->current_value);
20182221 tc[sizeof(tc)-1] = 0;
20192222
2020 highlight = a->good_valid && !a->good && isatty(1);
2223 highlight = a->warn && isatty(1);
20212224
20222225 if (highlight)
20232226 fprintf(stderr, HIGHLIGHT);
20242227
2025 printf("%3u %-27s %-3s %-3s %-3s %-11s 0x%02x%02x%02x%02x%02x%02x %-7s %-7s %-3s\n",
2228 printf("%3u %-27s %-3s %-3s %-3s %-11s 0x%02x%02x%02x%02x%02x%02x %-7s %-7s %-4s %-4s\n",
20262229 a->id,
20272230 print_name(name, sizeof(name), a->id, a->name),
20282231 a->current_value_valid ? tc : "n/a",
20322235 a->raw[0], a->raw[1], a->raw[2], a->raw[3], a->raw[4], a->raw[5],
20332236 a->prefailure ? "prefail" : "old-age",
20342237 a->online ? "online" : "offline",
2035 a->good_valid ? yes_no(a->good) : "n/a");
2238 a->good_now_valid ? yes_no(a->good_now) : "n/a",
2239 a->good_in_the_past_valid ? yes_no(a->good_in_the_past) : "n/a");
20362240
20372241 if (highlight)
20382242 fprintf(stderr, ENDHIGHLIGHT);
20452249
20462250 assert(d);
20472251
2048 printf("Device: %s\n"
2252 printf("Device: %s%s%s\n"
20492253 "Type: %s\n",
2254 d->name ? disk_type_to_prefix_string(d->type) : "",
2255 d->name ? ":" : "",
20502256 d->name ? d->name : "n/a",
2051 disk_type_to_string(d->type));
2257 disk_type_to_human_string(d->type));
20522258
20532259 ret = sk_disk_get_size(d, &size);
20542260 if (ret >= 0)
20832289 printf(" %s", _P(quirk_name[i]));
20842290
20852291 printf("\n");
2086
20872292 }
20882293
20892294 ret = sk_disk_check_sleep_mode(d, &awake);
20982303 uint64_t value, power_on;
20992304
21002305 ret = sk_disk_smart_status(d, &good);
2101 printf("SMART Disk Health Good: %s\n",
2102 ret >= 0 ? yes_no(good) : strerror(errno));
2103
2306 printf("%sSMART Disk Health Good: %s%s\n",
2307 ret >= 0 && !good ? HIGHLIGHT : "",
2308 ret >= 0 ? yes_no(good) : strerror(errno),
2309 ret >= 0 && !good ? ENDHIGHLIGHT : "");
21042310 if ((ret = sk_disk_smart_read_data(d)) < 0)
21052311 return ret;
21062312
21582364 else
21592365 printf("Temperature: %s\n", print_value(pretty, sizeof(pretty), value, SK_SMART_ATTRIBUTE_UNIT_MKELVIN));
21602366
2367 printf("Attribute Parsing Verification: %s\n",
2368 d->attribute_verification_bad ? "Bad" : "Good");
2369
21612370 if (sk_disk_smart_get_overall(d, &overall) < 0)
21622371 printf("Overall Status: %s\n", strerror(errno));
21632372 else
21662375 sk_smart_overall_to_string(overall),
21672376 overall != SK_SMART_OVERALL_GOOD ? ENDHIGHLIGHT : "");
21682377
2169 printf("%3s %-27s %5s %5s %5s %-11s %-14s %-7s %-7s %-3s\n",
2378 printf("%3s %-27s %5s %5s %5s %-11s %-14s %-7s %-7s %-4s %-4s\n",
21702379 "ID#",
21712380 "Name",
21722381 "Value",
21762385 "Raw",
21772386 "Type",
21782387 "Updates",
2179 "Good");
2388 "Good",
2389 "Good/Past");
21802390
21812391 if ((ret = sk_disk_smart_parse_attributes(d, disk_dump_attributes, NULL)) < 0)
21822392 return ret;
22032413 struct udev *udev;
22042414 struct udev_device *dev = NULL, *usb;
22052415 int r = -1;
2416 const char *a;
22062417
22072418 assert(d);
22082419
22132424
22142425 if (!(dev = udev_device_new_from_devnum(udev, 'b', devnum))) {
22152426 errno = ENODEV;
2427 goto finish;
2428 }
2429
2430 if ((a = udev_device_get_property_value(dev, "ID_ATA_SMART_ACCESS"))) {
2431 unsigned u;
2432
2433 for (u = 0; u < _SK_DISK_TYPE_MAX; u++) {
2434 const char *t;
2435
2436 if (!(t = disk_type_to_prefix_string(u)))
2437 continue;
2438
2439 if (!strcmp(a, t)) {
2440 d->type = u;
2441 r = 0;
2442 goto finish;
2443 }
2444 }
2445
2446 d->type = SK_DISK_TYPE_NONE;
2447 r = 0;
22162448 goto finish;
22172449 }
22182450
22332465 }
22342466
22352467 if ((vid == 0x0c0b && pid == 0xb159) ||
2236 (vid == 0x04fc && pid == 0x0c25))
2468 (vid == 0x04fc && pid == 0x0c25) ||
2469 (vid == 0x04fc && pid == 0x0c15))
22372470 d->type = SK_DISK_TYPE_SUNPLUS;
2238 if ((vid == 0x152d && pid == 0x2329) ||
2471 else if ((vid == 0x152d && pid == 0x2329) ||
22392472 (vid == 0x152d && pid == 0x2336) ||
22402473 (vid == 0x152d && pid == 0x2338) ||
22412474 (vid == 0x152d && pid == 0x2339))
22442477 d->type = SK_DISK_TYPE_ATA_PASSTHROUGH_12;
22452478
22462479 } else if (udev_device_get_parent_with_subsystem_devtype(dev, "ide", NULL))
2247 d->type = SK_DISK_TYPE_ATA;
2480 d->type = SK_DISK_TYPE_LINUX_IDE;
22482481 else if (udev_device_get_parent_with_subsystem_devtype(dev, "scsi", NULL))
22492482 d->type = SK_DISK_TYPE_ATA_PASSTHROUGH_16;
22502483 else
2251 d->type = SK_DISK_TYPE_UNKNOWN;
2484 d->type = SK_DISK_TYPE_AUTO;
22522485
22532486 r = 0;
22542487
22742507 goto fail;
22752508 }
22762509
2277 if (!name) {
2278 d->fd = -1;
2510 d->fd = -1;
2511 d->size = (uint64_t) -1;
2512
2513 if (!name)
22792514 d->type = SK_DISK_TYPE_BLOB;
2280 d->size = (uint64_t) -1;
2281 } else {
2282
2283 if (!(d->name = strdup(name))) {
2515 else {
2516 const char *dn;
2517
2518 d->type = SK_DISK_TYPE_AUTO;
2519
2520 if (!(dn = disk_type_from_string(name, &d->type)))
2521 dn = name;
2522
2523 if (!(d->name = strdup(dn))) {
22842524 errno = ENOMEM;
22852525 goto fail;
22862526 }
22872527
2288 if ((d->fd = open(name,
2528 if ((d->fd = open(d->name,
22892529 O_RDONLY|O_NOCTTY|O_NONBLOCK
22902530 #ifdef O_CLOEXEC
22912531 |O_CLOEXEC
23162556 }
23172557
23182558 /* OK, it's a real block device with a size. Now let's find the suitable API */
2319 if ((ret = disk_find_type(d, st.st_rdev)) < 0)
2320 goto fail;
2321
2322 if (d->type == SK_DISK_TYPE_UNKNOWN) {
2559 if (d->type == SK_DISK_TYPE_AUTO)
2560 if ((ret = disk_find_type(d, st.st_rdev)) < 0)
2561 goto fail;
2562
2563 if (d->type == SK_DISK_TYPE_AUTO) {
23232564 /* We have no clue, so let's autotest for a working API */
23242565 for (d->type = 0; d->type < _SK_DISK_TYPE_TEST_MAX; d->type++)
23252566 if (disk_identify_device(d) >= 0)
23262567 break;
23272568 if (d->type >= _SK_DISK_TYPE_TEST_MAX)
2328 d->type = SK_DISK_TYPE_UNKNOWN;
2569 d->type = SK_DISK_TYPE_NONE;
23292570 } else
23302571 disk_identify_device(d);
23312572
156156 SkBool prefailure:1;
157157
158158 /* Volatile data */
159 SkBool good:1, good_valid:1;
159 SkBool good_now:1, good_now_valid:1;
160 SkBool good_in_the_past:1, good_in_the_past_valid:1;
160161 SkBool current_value_valid:1, worst_value_valid:1;
162 SkBool warn:1;
161163 uint8_t current_value, worst_value;
162164 uint64_t pretty_value;
163165 uint8_t raw[6];
170172
171173 typedef enum SkSmartOverall {
172174 SK_SMART_OVERALL_GOOD,
173 SK_SMART_OVERALL_BAD_STATUS, /* Smart Self Assessment negative */
174 SK_SMART_OVERALL_BAD_SECTOR, /* At least one bad sector */
175 SK_SMART_OVERALL_BAD_ATTRIBUTE, /* At least one pre-fail attribute exceeded its threshold in the past or now */
175 SK_SMART_OVERALL_BAD_ATTRIBUTE_IN_THE_PAST, /* At least one pre-fail attribute exceeded its threshold in the past */
176 SK_SMART_OVERALL_BAD_SECTOR, /* At least one bad sector */
177 SK_SMART_OVERALL_BAD_ATTRIBUTE_NOW, /* At least one pre-fail attribute is exceeding its threshold now */
178 SK_SMART_OVERALL_BAD_SECTOR_MANY, /* Many bad sectors */
179 SK_SMART_OVERALL_BAD_STATUS, /* Smart Self Assessment negative */
176180 _SK_SMART_OVERALL_MAX
177181
178182 /* This enum may be extended at any time without this being
0 /* Saved 96 relocations, saved 2 strings (19 b) due to suffix compression. */
0 /* Saved 109 relocations, saved 2 strings (19 b) due to suffix compression. */
11 static const char _strpool_[] =
22 "16 Byte SCSI ATA SAT Passthru\0"
33 "12 Byte SCSI ATA SAT Passthru\0"
4 "Native Linux ATA\0"
4 "Native Linux IDE\0"
55 "Sunplus SCSI ATA Passthru\0"
66 "JMicron SCSI ATA Passthru\0"
77 "Blob\0"
8 "Unknown\0"
8 "Automatic\0"
9 "None\0"
10 "sat16\0"
11 "sat12\0"
12 "linux-ide\0"
13 "sunplus\0"
14 "jmicron\0"
15 "none\0"
16 "auto\0"
917 "Off-line data collection activity was never started.\0"
1018 "Off-line data collection activity was completed without error.\0"
1119 "Off-line activity in progress.\0"
8189 "194_UNKNOWN\0"
8290 "200_WRITEERRORCOUNT\0"
8391 "201_DETECTEDTACOUNT\0"
92 "5_UNKNOWN\0"
8493 "9_UNKNOWN\0"
94 "197_UNKNOWN\0"
95 "198_UNKNOWN\0"
8596 "power-on-minutes\0"
8697 "power-on-seconds\0"
8798 "power-on-half-minutes\0"
95106 "sectors\0"
96107 "mK\0"
97108 "GOOD\0"
98 "BAD_STATUS\0"
99 "BAD_ATTRIBUTE\0"
100 "BAD_SECTOR\0";
109 "BAD_ATTRIBUTE_IN_THE_PAST\0"
110 "BAD_SECTOR\0"
111 "BAD_ATTRIBUTE_NOW\0"
112 "BAD_SECTOR_MANY\0"
113 "BAD_STATUS\0";
101114 #ifndef STRPOOL
102115 #define STRPOOL
103116 #endif
172185 /* These three will be autotested for: */
173186 SK_DISK_TYPE_ATA_PASSTHROUGH_12, /* ATA passthrough over SCSI transport, 12-byte version */
174187 SK_DISK_TYPE_ATA_PASSTHROUGH_16, /* ATA passthrough over SCSI transport, 16-byte version */
175 SK_DISK_TYPE_ATA, /* Classic Linux /dev/hda ioctls */
188 SK_DISK_TYPE_LINUX_IDE, /* Classic Linux /dev/hda ioctls */
176189
177190 /* These three will not be autotested for */
178191 SK_DISK_TYPE_SUNPLUS, /* SunPlus USB/ATA bridges */
179192 SK_DISK_TYPE_JMICRON, /* JMicron USB/ATA bridges */
180 SK_DISK_TYPE_BLOB,
181 SK_DISK_TYPE_UNKNOWN,
193 SK_DISK_TYPE_BLOB, /* From a file */
194 SK_DISK_TYPE_NONE, /* No access method */
195 SK_DISK_TYPE_AUTO, /* We don't know yet */
182196 _SK_DISK_TYPE_MAX,
183197 _SK_DISK_TYPE_TEST_MAX = SK_DISK_TYPE_SUNPLUS /* only auto test until here */
184198 } SkDiskType;
222236 SkBool blob_smart_status:1;
223237 SkBool blob_smart_status_valid:1;
224238
239 SkBool attribute_verification_bad:1;
240
225241 SkIdentifyParsedData identify_parsed_data;
226242 SkSmartParsedData smart_parsed_data;
227243
246262 SK_SMART_COMMAND_RETURN_STATUS = 0xDA
247263 } SkSmartCommand;
248264
249 static const char *disk_type_to_string(SkDiskType type) {
265 /* Hmm, if the data we parse is out of a certain range just consider it misparsed */
266 #define SK_MKELVIN_VALID_MIN ((uint64_t) ((-15LL*1000LL) + 273150LL))
267 #define SK_MKELVIN_VALID_MAX ((uint64_t) ((100LL*1000LL) + 273150LL))
268
269 #define SK_MSECOND_VALID_MIN 1ULL
270 #define SK_MSECOND_VALID_SHORT_MAX (60ULL * 60ULL * 1000ULL)
271 #define SK_MSECOND_VALID_LONG_MAX (30ULL * 365ULL * 24ULL * 60ULL * 60ULL * 1000ULL)
272
273 static const char *disk_type_to_human_string(SkDiskType type) {
250274
251275 /* %STRINGPOOLSTART% */
252276 static const char* const map[_SK_DISK_TYPE_MAX] = {
253277 [SK_DISK_TYPE_ATA_PASSTHROUGH_16] = ((const char*) 1),
254278 [SK_DISK_TYPE_ATA_PASSTHROUGH_12] = ((const char*) 31),
255 [SK_DISK_TYPE_ATA] = ((const char*) 61),
279 [SK_DISK_TYPE_LINUX_IDE] = ((const char*) 61),
256280 [SK_DISK_TYPE_SUNPLUS] = ((const char*) 78),
257281 [SK_DISK_TYPE_JMICRON] = ((const char*) 104),
258282 [SK_DISK_TYPE_BLOB] = ((const char*) 130),
259 [SK_DISK_TYPE_UNKNOWN] = ((const char*) 135)
283 [SK_DISK_TYPE_AUTO] = ((const char*) 135),
284 [SK_DISK_TYPE_NONE] = ((const char*) 145)
260285 };
261286 /* %STRINGPOOLSTOP% */
262287
266291 return _P(map[type]);
267292 }
268293
294 static const char *disk_type_to_prefix_string(SkDiskType type) {
295
296 /* %STRINGPOOLSTART% */
297 static const char* const map[_SK_DISK_TYPE_MAX] = {
298 [SK_DISK_TYPE_ATA_PASSTHROUGH_16] = ((const char*) 150),
299 [SK_DISK_TYPE_ATA_PASSTHROUGH_12] = ((const char*) 156),
300 [SK_DISK_TYPE_LINUX_IDE] = ((const char*) 162),
301 [SK_DISK_TYPE_SUNPLUS] = ((const char*) 172),
302 [SK_DISK_TYPE_JMICRON] = ((const char*) 180),
303 [SK_DISK_TYPE_NONE] = ((const char*) 188),
304 [SK_DISK_TYPE_AUTO] = ((const char*) 193),
305 };
306 /* %STRINGPOOLSTOP% */
307
308 if (type >= _SK_DISK_TYPE_MAX)
309 return NULL;
310
311 return _P(map[type]);
312 }
313
314 static const char *disk_type_from_string(const char *s, SkDiskType *type) {
315 unsigned u;
316
317 assert(s);
318 assert(type);
319
320 for (u = 0; u < _SK_DISK_TYPE_MAX; u++) {
321 const char *t;
322 size_t l;
323
324 if (!(t = disk_type_to_prefix_string(u)))
325 continue;
326
327 l = strlen(t);
328
329 if (strncmp(s, t, l))
330 continue;
331
332 if (s[l] != ':')
333 continue;
334
335 *type = u;
336
337 return s + l + 1;
338 }
339
340 return NULL;
341 }
342
269343 static SkBool disk_smart_is_available(SkDisk *d) {
270344 return d->identify_valid && !!(d->identify[164] & 1);
271345 }
297371 return !!(d->smart_data[367] & 41);
298372 }
299373
300 static int disk_ata_command(SkDisk *d, SkAtaCommand command, SkDirection direction, void* cmd_data, void* data, size_t *len) {
374 static int disk_linux_ide_command(SkDisk *d, SkAtaCommand command, SkDirection direction, void* cmd_data, void* data, size_t *len) {
301375 uint8_t *bytes = cmd_data;
302376 int ret;
303377
304 assert(d->type == SK_DISK_TYPE_ATA);
378 assert(d->type == SK_DISK_TYPE_LINUX_IDE);
305379
306380 switch (direction) {
307381
742816 static int disk_command(SkDisk *d, SkAtaCommand command, SkDirection direction, void* cmd_data, void* data, size_t *len) {
743817
744818 static int (* const disk_command_table[_SK_DISK_TYPE_MAX]) (SkDisk *d, SkAtaCommand command, SkDirection direction, void* cmd_data, void* data, size_t *len) = {
745 [SK_DISK_TYPE_ATA] = disk_ata_command,
819 [SK_DISK_TYPE_LINUX_IDE] = disk_linux_ide_command,
746820 [SK_DISK_TYPE_ATA_PASSTHROUGH_12] = disk_passthrough_12_command,
747821 [SK_DISK_TYPE_ATA_PASSTHROUGH_16] = disk_passthrough_16_command,
748822 [SK_DISK_TYPE_SUNPLUS] = disk_sunplus_command,
749823 [SK_DISK_TYPE_JMICRON] = disk_jmicron_command,
750824 [SK_DISK_TYPE_BLOB] = NULL,
751 [SK_DISK_TYPE_UNKNOWN] = NULL
825 [SK_DISK_TYPE_AUTO] = NULL,
826 [SK_DISK_TYPE_NONE] = NULL
752827 };
753828
754829 assert(d);
11101185
11111186 /* %STRINGPOOLSTART% */
11121187 static const char* const map[] = {
1113 [SK_SMART_OFFLINE_DATA_COLLECTION_STATUS_NEVER] = ((const char*) 143),
1114 [SK_SMART_OFFLINE_DATA_COLLECTION_STATUS_SUCCESS] = ((const char*) 196),
1115 [SK_SMART_OFFLINE_DATA_COLLECTION_STATUS_INPROGRESS] = ((const char*) 259),
1116 [SK_SMART_OFFLINE_DATA_COLLECTION_STATUS_SUSPENDED] = ((const char*) 290),
1117 [SK_SMART_OFFLINE_DATA_COLLECTION_STATUS_ABORTED] = ((const char*) 376),
1118 [SK_SMART_OFFLINE_DATA_COLLECTION_STATUS_FATAL] = ((const char*) 460),
1119 [SK_SMART_OFFLINE_DATA_COLLECTION_STATUS_UNKNOWN] = ((const char*) 540)
1188 [SK_SMART_OFFLINE_DATA_COLLECTION_STATUS_NEVER] = ((const char*) 198),
1189 [SK_SMART_OFFLINE_DATA_COLLECTION_STATUS_SUCCESS] = ((const char*) 251),
1190 [SK_SMART_OFFLINE_DATA_COLLECTION_STATUS_INPROGRESS] = ((const char*) 314),
1191 [SK_SMART_OFFLINE_DATA_COLLECTION_STATUS_SUSPENDED] = ((const char*) 345),
1192 [SK_SMART_OFFLINE_DATA_COLLECTION_STATUS_ABORTED] = ((const char*) 431),
1193 [SK_SMART_OFFLINE_DATA_COLLECTION_STATUS_FATAL] = ((const char*) 515),
1194 [SK_SMART_OFFLINE_DATA_COLLECTION_STATUS_UNKNOWN] = ((const char*) 595)
11201195 };
11211196 /* %STRINGPOOLSTOP% */
11221197
11301205
11311206 /* %STRINGPOOLSTART% */
11321207 static const char* const map[] = {
1133 [SK_SMART_SELF_TEST_EXECUTION_STATUS_SUCCESS_OR_NEVER] = ((const char*) 555),
1134 [SK_SMART_SELF_TEST_EXECUTION_STATUS_ABORTED] = ((const char*) 645),
1135 [SK_SMART_SELF_TEST_EXECUTION_STATUS_INTERRUPTED] = ((const char*) 692),
1136 [SK_SMART_SELF_TEST_EXECUTION_STATUS_FATAL] = ((const char*) 777),
1137 [SK_SMART_SELF_TEST_EXECUTION_STATUS_ERROR_UNKNOWN] = ((const char*) 936),
1138 [SK_SMART_SELF_TEST_EXECUTION_STATUS_ERROR_ELECTRICAL] = ((const char*) 1037),
1139 [SK_SMART_SELF_TEST_EXECUTION_STATUS_ERROR_SERVO] = ((const char*) 1120),
1140 [SK_SMART_SELF_TEST_EXECUTION_STATUS_ERROR_READ] = ((const char*) 1217),
1141 [SK_SMART_SELF_TEST_EXECUTION_STATUS_ERROR_HANDLING] = ((const char*) 1294),
1142 [SK_SMART_SELF_TEST_EXECUTION_STATUS_INPROGRESS] = ((const char*) 1416)
1208 [SK_SMART_SELF_TEST_EXECUTION_STATUS_SUCCESS_OR_NEVER] = ((const char*) 610),
1209 [SK_SMART_SELF_TEST_EXECUTION_STATUS_ABORTED] = ((const char*) 700),
1210 [SK_SMART_SELF_TEST_EXECUTION_STATUS_INTERRUPTED] = ((const char*) 747),
1211 [SK_SMART_SELF_TEST_EXECUTION_STATUS_FATAL] = ((const char*) 832),
1212 [SK_SMART_SELF_TEST_EXECUTION_STATUS_ERROR_UNKNOWN] = ((const char*) 991),
1213 [SK_SMART_SELF_TEST_EXECUTION_STATUS_ERROR_ELECTRICAL] = ((const char*) 1092),
1214 [SK_SMART_SELF_TEST_EXECUTION_STATUS_ERROR_SERVO] = ((const char*) 1175),
1215 [SK_SMART_SELF_TEST_EXECUTION_STATUS_ERROR_READ] = ((const char*) 1272),
1216 [SK_SMART_SELF_TEST_EXECUTION_STATUS_ERROR_HANDLING] = ((const char*) 1349),
1217 [SK_SMART_SELF_TEST_EXECUTION_STATUS_INPROGRESS] = ((const char*) 1471)
11431218 };
11441219 /* %STRINGPOOLSTOP% */
11451220
12281303 else if (!strcmp(a->name, "temperature-centi-celsius"))
12291304 a->pretty_value = (fourtyeight & 0xFFFF)*100 + 273150;
12301305 else if (!strcmp(a->name, "power-on-minutes"))
1231 a->pretty_value = (((uint64_t) a->raw[0]) | (uint64_t) a->raw[1]) * 60 * 1000;
1306 a->pretty_value = fourtyeight * 60 * 1000;
12321307 else if (!strcmp(a->name, "power-on-seconds"))
12331308 a->pretty_value = fourtyeight * 1000;
12341309 else if (!strcmp(a->name, "power-on-half-minutes"))
12361311 else if (!strcmp(a->name, "power-on-hours") ||
12371312 !strcmp(a->name, "loaded-hours") ||
12381313 !strcmp(a->name, "head-flying-hours"))
1239 a->pretty_value = fourtyeight * 60 * 60 * 1000;
1240 else if (!strcmp(a->name, "reallocated-sector-count"))
1314 a->pretty_value = (fourtyeight & 0xFFFFFFFFU) * 60 * 60 * 1000;
1315 else if (!strcmp(a->name, "reallocated-sector-count") ||
1316 !strcmp(a->name, "current-pending-sector"))
12411317 a->pretty_value = fourtyeight & 0xFFFFFFFFU;
12421318 else
12431319 a->pretty_value = fourtyeight;
12441320 }
12451321
1322 typedef void (*SkSmartAttributeVerify)(SkDisk *d, SkSmartAttributeParsedData *a);
1323
12461324 typedef struct SkSmartAttributeInfo {
12471325 const char *name;
12481326 SkSmartAttributeUnit unit;
1327 SkSmartAttributeVerify verify;
12491328 } SkSmartAttributeInfo;
1329
1330 static void verify_temperature(SkDisk *d, SkSmartAttributeParsedData *a) {
1331 assert(a);
1332 assert(a->pretty_unit == SK_SMART_ATTRIBUTE_UNIT_MKELVIN);
1333
1334 if (a->pretty_value < SK_MKELVIN_VALID_MIN ||
1335 a->pretty_value > SK_MKELVIN_VALID_MAX) {
1336 a->pretty_unit = SK_SMART_ATTRIBUTE_UNIT_UNKNOWN;
1337 d->attribute_verification_bad = TRUE;
1338 }
1339 }
1340
1341 static void verify_short_time(SkDisk *d, SkSmartAttributeParsedData *a) {
1342 assert(a);
1343 assert(a->pretty_unit == SK_SMART_ATTRIBUTE_UNIT_MSECONDS);
1344
1345 if (a->pretty_value < SK_MSECOND_VALID_MIN ||
1346 a->pretty_value > SK_MSECOND_VALID_SHORT_MAX) {
1347 a->pretty_unit = SK_SMART_ATTRIBUTE_UNIT_UNKNOWN;
1348 d->attribute_verification_bad = TRUE;
1349 }
1350 }
1351
1352 static void verify_long_time(SkDisk *d, SkSmartAttributeParsedData *a) {
1353 assert(a);
1354 assert(a->pretty_unit == SK_SMART_ATTRIBUTE_UNIT_MSECONDS);
1355
1356 if (a->pretty_value < SK_MSECOND_VALID_MIN ||
1357 a->pretty_value > SK_MSECOND_VALID_LONG_MAX) {
1358 a->pretty_unit = SK_SMART_ATTRIBUTE_UNIT_UNKNOWN;
1359 d->attribute_verification_bad = TRUE;
1360 }
1361 }
1362
1363 static void verify_sectors(SkDisk *d, SkSmartAttributeParsedData *a) {
1364 uint64_t max_sectors;
1365
1366 assert(d);
1367 assert(a);
1368 assert(a->pretty_unit == SK_SMART_ATTRIBUTE_UNIT_SECTORS);
1369
1370 max_sectors = d->size / 512ULL;
1371
1372 if (max_sectors > 0 && a->pretty_value > max_sectors) {
1373 a->pretty_value = SK_SMART_ATTRIBUTE_UNIT_UNKNOWN;
1374 d->attribute_verification_bad = TRUE;
1375 } else {
1376 if ((!strcmp(a->name, "reallocated-sector-count") ||
1377 !strcmp(a->name, "current-pending-sector")) &&
1378 a->pretty_value > 0)
1379 a->warn = TRUE;
1380 }
1381 }
12501382
12511383 /* This data is stolen from smartmontools */
12521384
12531385 /* %STRINGPOOLSTART% */
12541386 static const SkSmartAttributeInfo const attribute_info[256] = {
1255 [1] = { ((const char*) 1446), SK_SMART_ATTRIBUTE_UNIT_NONE },
1256 [2] = { ((const char*) 1466), SK_SMART_ATTRIBUTE_UNIT_UNKNOWN },
1257 [3] = { ((const char*) 1489), SK_SMART_ATTRIBUTE_UNIT_MSECONDS },
1258 [4] = { ((const char*) 1502), SK_SMART_ATTRIBUTE_UNIT_NONE },
1259 [5] = { ((const char*) 1519), SK_SMART_ATTRIBUTE_UNIT_SECTORS },
1260 [6] = { ((const char*) 1544), SK_SMART_ATTRIBUTE_UNIT_UNKNOWN },
1261 [7] = { ((const char*) 1564), SK_SMART_ATTRIBUTE_UNIT_NONE },
1262 [8] = { ((const char*) 1580), SK_SMART_ATTRIBUTE_UNIT_UNKNOWN },
1263 [9] = { ((const char*) 1602), SK_SMART_ATTRIBUTE_UNIT_MSECONDS },
1264 [10] = { ((const char*) 1617), SK_SMART_ATTRIBUTE_UNIT_NONE },
1265 [11] = { ((const char*) 1634), SK_SMART_ATTRIBUTE_UNIT_NONE },
1266 [12] = { ((const char*) 1658), SK_SMART_ATTRIBUTE_UNIT_NONE },
1267 [13] = { ((const char*) 1676), SK_SMART_ATTRIBUTE_UNIT_NONE },
1268 [187] = { ((const char*) 1697), SK_SMART_ATTRIBUTE_UNIT_SECTORS },
1269 [189] = { ((const char*) 1716), SK_SMART_ATTRIBUTE_UNIT_NONE },
1270 [190] = { ((const char*) 1732), SK_SMART_ATTRIBUTE_UNIT_MKELVIN },
1271 [191] = { ((const char*) 1760), SK_SMART_ATTRIBUTE_UNIT_NONE },
1272 [192] = { ((const char*) 1779), SK_SMART_ATTRIBUTE_UNIT_NONE },
1273 [193] = { ((const char*) 1803), SK_SMART_ATTRIBUTE_UNIT_NONE },
1274 [194] = { ((const char*) 1820), SK_SMART_ATTRIBUTE_UNIT_MKELVIN },
1275 [195] = { ((const char*) 1842), SK_SMART_ATTRIBUTE_UNIT_NONE },
1276 [196] = { ((const char*) 1865), SK_SMART_ATTRIBUTE_UNIT_NONE },
1277 [197] = { ((const char*) 1889), SK_SMART_ATTRIBUTE_UNIT_SECTORS },
1278 [198] = { ((const char*) 1912), SK_SMART_ATTRIBUTE_UNIT_SECTORS },
1279 [199] = { ((const char*) 1934), SK_SMART_ATTRIBUTE_UNIT_NONE },
1280 [200] = { ((const char*) 1955), SK_SMART_ATTRIBUTE_UNIT_NONE },
1281 [201] = { ((const char*) 1977), SK_SMART_ATTRIBUTE_UNIT_NONE },
1282 [202] = { ((const char*) 1998), SK_SMART_ATTRIBUTE_UNIT_NONE },
1283 [203] = { ((const char*) 2016), SK_SMART_ATTRIBUTE_UNIT_UNKNOWN },
1284 [204] = { ((const char*) 2031), SK_SMART_ATTRIBUTE_UNIT_NONE },
1285 [205] = { ((const char*) 2054), SK_SMART_ATTRIBUTE_UNIT_NONE },
1286 [206] = { ((const char*) 2076), SK_SMART_ATTRIBUTE_UNIT_UNKNOWN },
1287 [207] = { ((const char*) 2090), SK_SMART_ATTRIBUTE_UNIT_UNKNOWN },
1288 [208] = { ((const char*) 2108), SK_SMART_ATTRIBUTE_UNIT_UNKNOWN},
1289 [209] = { ((const char*) 2118), SK_SMART_ATTRIBUTE_UNIT_UNKNOWN },
1290 [220] = { ((const char*) 2143), SK_SMART_ATTRIBUTE_UNIT_UNKNOWN },
1291 [221] = { ((const char*) 2154), SK_SMART_ATTRIBUTE_UNIT_NONE },
1292 [222] = { ((const char*) 2175), SK_SMART_ATTRIBUTE_UNIT_MSECONDS },
1293 [223] = { ((const char*) 2188), SK_SMART_ATTRIBUTE_UNIT_NONE },
1294 [224] = { ((const char*) 2205), SK_SMART_ATTRIBUTE_UNIT_UNKNOWN },
1295 [225] = { ((const char*) 2219), SK_SMART_ATTRIBUTE_UNIT_NONE },
1296 [226] = { ((const char*) 2238), SK_SMART_ATTRIBUTE_UNIT_MSECONDS },
1297 [227] = { ((const char*) 2251), SK_SMART_ATTRIBUTE_UNIT_NONE },
1298 [228] = { ((const char*) 2266), SK_SMART_ATTRIBUTE_UNIT_NONE },
1299 [230] = { ((const char*) 2292), SK_SMART_ATTRIBUTE_UNIT_UNKNOWN },
1300 [231] = { ((const char*) 1740), SK_SMART_ATTRIBUTE_UNIT_MKELVIN },
1301 [240] = { ((const char*) 2307), SK_SMART_ATTRIBUTE_UNIT_MSECONDS },
1302 [250] = { ((const char*) 2325), SK_SMART_ATTRIBUTE_UNIT_NONE }
1387 [1] = { ((const char*) 1501), SK_SMART_ATTRIBUTE_UNIT_NONE, NULL },
1388 [2] = { ((const char*) 1521), SK_SMART_ATTRIBUTE_UNIT_UNKNOWN, NULL },
1389 [3] = { ((const char*) 1544), SK_SMART_ATTRIBUTE_UNIT_MSECONDS, verify_short_time },
1390 [4] = { ((const char*) 1557), SK_SMART_ATTRIBUTE_UNIT_NONE, NULL },
1391 [5] = { ((const char*) 1574), SK_SMART_ATTRIBUTE_UNIT_SECTORS, verify_sectors },
1392 [6] = { ((const char*) 1599), SK_SMART_ATTRIBUTE_UNIT_UNKNOWN, NULL },
1393 [7] = { ((const char*) 1619), SK_SMART_ATTRIBUTE_UNIT_NONE, NULL },
1394 [8] = { ((const char*) 1635), SK_SMART_ATTRIBUTE_UNIT_UNKNOWN, NULL },
1395 [9] = { ((const char*) 1657), SK_SMART_ATTRIBUTE_UNIT_MSECONDS, verify_long_time },
1396 [10] = { ((const char*) 1672), SK_SMART_ATTRIBUTE_UNIT_NONE, NULL },
1397 [11] = { ((const char*) 1689), SK_SMART_ATTRIBUTE_UNIT_NONE, NULL },
1398 [12] = { ((const char*) 1713), SK_SMART_ATTRIBUTE_UNIT_NONE, NULL },
1399 [13] = { ((const char*) 1731), SK_SMART_ATTRIBUTE_UNIT_NONE, NULL },
1400 [187] = { ((const char*) 1752), SK_SMART_ATTRIBUTE_UNIT_SECTORS, verify_sectors },
1401 [189] = { ((const char*) 1771), SK_SMART_ATTRIBUTE_UNIT_NONE, NULL },
1402 [190] = { ((const char*) 1787), SK_SMART_ATTRIBUTE_UNIT_MKELVIN, verify_temperature },
1403 [191] = { ((const char*) 1815), SK_SMART_ATTRIBUTE_UNIT_NONE, NULL },
1404 [192] = { ((const char*) 1834), SK_SMART_ATTRIBUTE_UNIT_NONE, NULL },
1405 [193] = { ((const char*) 1858), SK_SMART_ATTRIBUTE_UNIT_NONE, NULL },
1406 [194] = { ((const char*) 1875), SK_SMART_ATTRIBUTE_UNIT_MKELVIN, verify_temperature },
1407 [195] = { ((const char*) 1897), SK_SMART_ATTRIBUTE_UNIT_NONE, NULL },
1408 [196] = { ((const char*) 1920), SK_SMART_ATTRIBUTE_UNIT_NONE, NULL },
1409 [197] = { ((const char*) 1944), SK_SMART_ATTRIBUTE_UNIT_SECTORS, verify_sectors },
1410 [198] = { ((const char*) 1967), SK_SMART_ATTRIBUTE_UNIT_SECTORS, verify_sectors },
1411 [199] = { ((const char*) 1989), SK_SMART_ATTRIBUTE_UNIT_NONE, NULL },
1412 [200] = { ((const char*) 2010), SK_SMART_ATTRIBUTE_UNIT_NONE, NULL },
1413 [201] = { ((const char*) 2032), SK_SMART_ATTRIBUTE_UNIT_NONE, NULL },
1414 [202] = { ((const char*) 2053), SK_SMART_ATTRIBUTE_UNIT_NONE, NULL },
1415 [203] = { ((const char*) 2071), SK_SMART_ATTRIBUTE_UNIT_UNKNOWN, NULL },
1416 [204] = { ((const char*) 2086), SK_SMART_ATTRIBUTE_UNIT_NONE, NULL },
1417 [205] = { ((const char*) 2109), SK_SMART_ATTRIBUTE_UNIT_NONE, NULL },
1418 [206] = { ((const char*) 2131), SK_SMART_ATTRIBUTE_UNIT_UNKNOWN, NULL },
1419 [207] = { ((const char*) 2145), SK_SMART_ATTRIBUTE_UNIT_UNKNOWN, NULL },
1420 [208] = { ((const char*) 2163), SK_SMART_ATTRIBUTE_UNIT_UNKNOWN, NULL },
1421 [209] = { ((const char*) 2173), SK_SMART_ATTRIBUTE_UNIT_UNKNOWN, NULL },
1422 [220] = { ((const char*) 2198), SK_SMART_ATTRIBUTE_UNIT_UNKNOWN, NULL },
1423 [221] = { ((const char*) 2209), SK_SMART_ATTRIBUTE_UNIT_NONE, NULL },
1424 [222] = { ((const char*) 2230), SK_SMART_ATTRIBUTE_UNIT_MSECONDS, verify_long_time },
1425 [223] = { ((const char*) 2243), SK_SMART_ATTRIBUTE_UNIT_NONE, NULL },
1426 [224] = { ((const char*) 2260), SK_SMART_ATTRIBUTE_UNIT_UNKNOWN, NULL },
1427 [225] = { ((const char*) 2274), SK_SMART_ATTRIBUTE_UNIT_NONE, NULL },
1428 [226] = { ((const char*) 2293), SK_SMART_ATTRIBUTE_UNIT_MSECONDS, verify_short_time },
1429 [227] = { ((const char*) 2306), SK_SMART_ATTRIBUTE_UNIT_NONE, NULL },
1430 [228] = { ((const char*) 2321), SK_SMART_ATTRIBUTE_UNIT_NONE, NULL },
1431 [230] = { ((const char*) 2347), SK_SMART_ATTRIBUTE_UNIT_UNKNOWN, NULL },
1432 [231] = { ((const char*) 1795), SK_SMART_ATTRIBUTE_UNIT_MKELVIN, verify_temperature },
1433 [240] = { ((const char*) 2362), SK_SMART_ATTRIBUTE_UNIT_MSECONDS, verify_long_time },
1434 [250] = { ((const char*) 2380), SK_SMART_ATTRIBUTE_UNIT_NONE, NULL }
13031435 };
13041436 /* %STRINGPOOLSTOP% */
13051437
13061438 typedef enum SkSmartQuirk {
1307 SK_SMART_QUIRK_9_POWERONMINUTES = 1,
1308 SK_SMART_QUIRK_9_POWERONSECONDS = 2,
1309 SK_SMART_QUIRK_9_POWERONHALFMINUTES = 4,
1310 SK_SMART_QUIRK_192_EMERGENCYRETRACTCYCLECT = 8,
1311 SK_SMART_QUIRK_193_LOADUNLOAD = 16,
1312 SK_SMART_QUIRK_194_10XCELSIUS = 32,
1313 SK_SMART_QUIRK_194_UNKNOWN = 64,
1314 SK_SMART_QUIRK_200_WRITEERRORCOUNT = 128,
1315 SK_SMART_QUIRK_201_DETECTEDTACOUNT = 256,
1316 SK_SMART_QUIRK_9_UNKNOWN = 512
1439 SK_SMART_QUIRK_9_POWERONMINUTES = 0x0001,
1440 SK_SMART_QUIRK_9_POWERONSECONDS = 0x0002,
1441 SK_SMART_QUIRK_9_POWERONHALFMINUTES = 0x0004,
1442 SK_SMART_QUIRK_192_EMERGENCYRETRACTCYCLECT = 0x0008,
1443 SK_SMART_QUIRK_193_LOADUNLOAD = 0x0010,
1444 SK_SMART_QUIRK_194_10XCELSIUS = 0x0020,
1445 SK_SMART_QUIRK_194_UNKNOWN = 0x0040,
1446 SK_SMART_QUIRK_200_WRITEERRORCOUNT = 0x0080,
1447 SK_SMART_QUIRK_201_DETECTEDTACOUNT = 0x0100,
1448 SK_SMART_QUIRK_5_UNKNOWN = 0x0200,
1449 SK_SMART_QUIRK_9_UNKNOWN = 0x0400,
1450 SK_SMART_QUIRK_197_UNKNOWN = 0x0800,
1451 SK_SMART_QUIRK_198_UNKNOWN = 0x1000,
13171452 } SkSmartQuirk;
13181453
13191454 /* %STRINGPOOLSTART% */
13201455 static const char *quirk_name[] = {
1321 ((const char*) 2347),
1322 ((const char*) 2364),
1323 ((const char*) 2381),
13241456 ((const char*) 2402),
1325 ((const char*) 2430),
1326 ((const char*) 2445),
1327 ((const char*) 2460),
1328 ((const char*) 2472),
1329 ((const char*) 2492),
1330 ((const char*) 2512),
1457 ((const char*) 2419),
1458 ((const char*) 2436),
1459 ((const char*) 2457),
1460 ((const char*) 2485),
1461 ((const char*) 2500),
1462 ((const char*) 2515),
1463 ((const char*) 2527),
1464 ((const char*) 2547),
1465 ((const char*) 2567),
1466 ((const char*) 2577),
1467 ((const char*) 2587),
1468 ((const char*) 2599),
13311469 NULL
13321470 };
13331471 /* %STRINGPOOLSTOP% */
13401478
13411479 static const SkSmartQuirkDatabase quirk_database[] = { {
13421480
1343 /*** Seagate */
1344 "^ST9160821AS$",
1345 NULL,
1346 SK_SMART_QUIRK_9_UNKNOWN
1481 /*** Fujitsu */
1482 "^("
1483 "FUJITSU MHY2120BH|"
1484 "FUJITSU MHY2250BH"
1485 ")$",
1486 "^0085000B$", /* seems to be specific to this firmware */
1487 SK_SMART_QUIRK_9_POWERONMINUTES|
1488 SK_SMART_QUIRK_197_UNKNOWN|
1489 SK_SMART_QUIRK_198_UNKNOWN
13471490 }, {
1348
1349 /*** Fujitsu */
13501491 "^FUJITSU MHR2040AT$",
13511492 NULL,
13521493 SK_SMART_QUIRK_9_POWERONSECONDS|
14651606 SK_SMART_QUIRK_9_POWERONMINUTES|
14661607 SK_SMART_QUIRK_193_LOADUNLOAD
14671608 }, {
1468
1609 "^HTS541010G9SA00$",
1610 "^MBZOC60P$",
1611 SK_SMART_QUIRK_5_UNKNOWN
1612 }, {
14691613 NULL,
14701614 NULL,
14711615 0
15481692 if (quirk) {
15491693 switch (id) {
15501694
1695 case 5:
1696 if (quirk & SK_SMART_QUIRK_5_UNKNOWN)
1697 return NULL;
1698
1699 break;
1700
15511701 case 9:
15521702 /* %STRINGPOOLSTART% */
15531703 if (quirk & SK_SMART_QUIRK_9_POWERONMINUTES) {
15541704 static const SkSmartAttributeInfo a = {
1555 ((const char*) 2522), SK_SMART_ATTRIBUTE_UNIT_MSECONDS
1705 ((const char*) 2611), SK_SMART_ATTRIBUTE_UNIT_MSECONDS, verify_long_time
15561706 };
15571707 return &a;
15581708
15591709 } else if (quirk & SK_SMART_QUIRK_9_POWERONSECONDS) {
15601710 static const SkSmartAttributeInfo a = {
1561 ((const char*) 2539), SK_SMART_ATTRIBUTE_UNIT_MSECONDS
1711 ((const char*) 2628), SK_SMART_ATTRIBUTE_UNIT_MSECONDS, verify_long_time
15621712 };
15631713 return &a;
15641714
15651715 } else if (quirk & SK_SMART_QUIRK_9_POWERONHALFMINUTES) {
15661716 static const SkSmartAttributeInfo a = {
1567 ((const char*) 2556), SK_SMART_ATTRIBUTE_UNIT_MSECONDS
1717 ((const char*) 2645), SK_SMART_ATTRIBUTE_UNIT_MSECONDS, verify_long_time
15681718 };
15691719 return &a;
15701720 } else if (quirk & SK_SMART_QUIRK_9_UNKNOWN)
15771727 /* %STRINGPOOLSTART% */
15781728 if (quirk & SK_SMART_QUIRK_192_EMERGENCYRETRACTCYCLECT) {
15791729 static const SkSmartAttributeInfo a = {
1580 ((const char*) 2578), SK_SMART_ATTRIBUTE_UNIT_NONE
1730 ((const char*) 2667), SK_SMART_ATTRIBUTE_UNIT_NONE, NULL
15811731 };
15821732 return &a;
15831733 }
15891739 /* %STRINGPOOLSTART% */
15901740 if (quirk & SK_SMART_QUIRK_194_10XCELSIUS) {
15911741 static const SkSmartAttributeInfo a = {
1592 ((const char*) 2608), SK_SMART_ATTRIBUTE_UNIT_MKELVIN
1742 ((const char*) 2697), SK_SMART_ATTRIBUTE_UNIT_MKELVIN, verify_temperature
15931743 };
15941744 return &a;
15951745 } else if (quirk & SK_SMART_QUIRK_194_UNKNOWN)
15981748
15991749 break;
16001750
1751 case 197:
1752 if (quirk & SK_SMART_QUIRK_197_UNKNOWN)
1753 return NULL;
1754
1755 break;
1756
1757 case 198:
1758 if (quirk & SK_SMART_QUIRK_198_UNKNOWN)
1759 return NULL;
1760
1761 break;
1762
16011763 case 200:
16021764 /* %STRINGPOOLSTART% */
16031765 if (quirk & SK_SMART_QUIRK_200_WRITEERRORCOUNT) {
16041766 static const SkSmartAttributeInfo a = {
1605 ((const char*) 2634), SK_SMART_ATTRIBUTE_UNIT_NONE
1767 ((const char*) 2723), SK_SMART_ATTRIBUTE_UNIT_NONE, NULL
16061768 };
16071769 return &a;
16081770 }
16141776 /* %STRINGPOOLSTART% */
16151777 if (quirk & SK_SMART_QUIRK_201_DETECTEDTACOUNT) {
16161778 static const SkSmartAttributeInfo a = {
1617 ((const char*) 2652), SK_SMART_ATTRIBUTE_UNIT_NONE
1779 ((const char*) 2741), SK_SMART_ATTRIBUTE_UNIT_NONE, NULL
16181780 };
16191781 return &a;
16201782 }
16961858 uint8_t *p;
16971859 unsigned n;
16981860
1699 if (!d->smart_thresholds_valid) {
1700 a->threshold_valid = FALSE;
1701 return;
1702 }
1861 if (!d->smart_thresholds_valid)
1862 goto fail;
17031863
17041864 for (n = 0, p = d->smart_thresholds+2; n < 30; n++, p+=12)
17051865 if (p[0] == a->id)
17061866 break;
17071867
1708 if (n >= 30) {
1709 a->threshold_valid = FALSE;
1710 a->good_valid = FALSE;
1711 return;
1712 }
1868 if (n >= 30)
1869 goto fail;
17131870
17141871 a->threshold = p[1];
17151872 a->threshold_valid = p[1] != 0xFE;
17161873
1717 a->good_valid = FALSE;
1718 a->good = TRUE;
1874 a->good_now_valid = FALSE;
1875 a->good_now = TRUE;
1876 a->good_in_the_past_valid = FALSE;
1877 a->good_in_the_past = TRUE;
17191878
17201879 /* Always-Fail and Always-Passing thresholds are not relevant
17211880 * for our assessment. */
17221881 if (p[1] >= 1 && p[1] <= 0xFD) {
17231882
17241883 if (a->worst_value_valid) {
1725 a->good = a->good && (a->worst_value > a->threshold);
1726 a->good_valid = TRUE;
1884 a->good_in_the_past = a->good_in_the_past && (a->worst_value > a->threshold);
1885 a->good_in_the_past_valid = TRUE;
17271886 }
17281887
17291888 if (a->current_value_valid) {
1730 a->good = a->good && (a->current_value > a->threshold);
1731 a->good_valid = TRUE;
1889 a->good_now = a->good_now && (a->current_value > a->threshold);
1890 a->good_now_valid = TRUE;
17321891 }
17331892 }
1893
1894 a->warn =
1895 (a->good_now_valid && !a->good_now) ||
1896 (a->good_in_the_past_valid && !a->good_in_the_past);
1897
1898 return;
1899
1900 fail:
1901 a->threshold_valid = FALSE;
1902 a->good_now_valid = FALSE;
1903 a->good_in_the_past_valid = FALSE;
1904 a->warn = FALSE;
17341905 }
17351906
17361907 int sk_disk_smart_parse_attributes(SkDisk *d, SkSmartAttributeParseCallback cb, void* userdata) {
17801951
17811952 find_threshold(d, &a);
17821953
1783 /* Handle a few fields specially */
1784 if ((!strcmp(a.name, "reallocated-sector-count") ||
1785 !strcmp(a.name, "current-pending-sector")) &&
1786 a.pretty_unit == SK_SMART_ATTRIBUTE_UNIT_SECTORS &&
1787 a.pretty_value > 0) {
1788 a.good = FALSE;
1789 a.good_valid = TRUE;
1790 }
1954 if (i && i->verify)
1955 i->verify(d, &a);
17911956
17921957 cb(d, &a, userdata);
17931958 free(an);
18061971 const char * const map[] = {
18071972 [SK_SMART_ATTRIBUTE_UNIT_UNKNOWN] = NULL,
18081973 [SK_SMART_ATTRIBUTE_UNIT_NONE] = ((const char*) 30),
1809 [SK_SMART_ATTRIBUTE_UNIT_MSECONDS] = ((const char*) 2670),
1810 [SK_SMART_ATTRIBUTE_UNIT_SECTORS] = ((const char*) 2673),
1811 [SK_SMART_ATTRIBUTE_UNIT_MKELVIN] = ((const char*) 2681)
1974 [SK_SMART_ATTRIBUTE_UNIT_MSECONDS] = ((const char*) 2759),
1975 [SK_SMART_ATTRIBUTE_UNIT_SECTORS] = ((const char*) 2762),
1976 [SK_SMART_ATTRIBUTE_UNIT_MKELVIN] = ((const char*) 2770)
18121977 };
18131978 /* %STRINGPOOLSTOP% */
18141979
19972162
19982163 /* %STRINGPOOLSTART% */
19992164 const char * const map[] = {
2000 [SK_SMART_OVERALL_GOOD] = ((const char*) 2684),
2001 [SK_SMART_OVERALL_BAD_STATUS] = ((const char*) 2689),
2002 [SK_SMART_OVERALL_BAD_ATTRIBUTE] = ((const char*) 2700),
2003 [SK_SMART_OVERALL_BAD_SECTOR] = ((const char*) 2714)
2165 [SK_SMART_OVERALL_GOOD] = ((const char*) 2773),
2166 [SK_SMART_OVERALL_BAD_ATTRIBUTE_IN_THE_PAST] = ((const char*) 2778),
2167 [SK_SMART_OVERALL_BAD_SECTOR] = ((const char*) 2804),
2168 [SK_SMART_OVERALL_BAD_ATTRIBUTE_NOW] = ((const char*) 2815),
2169 [SK_SMART_OVERALL_BAD_SECTOR_MANY] = ((const char*) 2833),
2170 [SK_SMART_OVERALL_BAD_STATUS] = ((const char*) 2849),
20042171 };
20052172 /* %STRINGPOOLSTOP% */
20062173
20102177 return _P(map[overall]);
20112178 }
20122179
2013 static void bad_attribute_cb(SkDisk *d, const SkSmartAttributeParsedData *a, SkBool *good) {
2014 if (a->prefailure && a->good_valid && !a->good)
2180 static void bad_attribute_now_cb(SkDisk *d, const SkSmartAttributeParsedData *a, SkBool *good) {
2181 if (a->prefailure && a->good_now_valid && !a->good_now)
20152182 *good = FALSE;
2183 }
2184
2185 static void bad_attribute_in_the_past_cb(SkDisk *d, const SkSmartAttributeParsedData *a, SkBool *good) {
2186 if (a->prefailure && a->good_in_the_past_valid && !a->good_in_the_past)
2187 *good = FALSE;
2188 }
2189
2190 static uint64_t u64log2(uint64_t n) {
2191 unsigned r;
2192
2193 if (n <= 1)
2194 return 0;
2195
2196 r = 0;
2197 for (;;) {
2198 n = n >> 1;
2199 if (!n)
2200 return r;
2201 r++;
2202 }
20162203 }
20172204
20182205 int sk_disk_smart_get_overall(SkDisk *d, SkSmartOverall *overall) {
20192206 SkBool good;
2020 uint64_t sectors;
2207 uint64_t sectors, sector_threshold;
20212208
20222209 assert(d);
20232210 assert(overall);
20242211
2212 /* First, check SMART self-assesment */
20252213 if (sk_disk_smart_status(d, &good) < 0)
20262214 return -1;
20272215
20302218 return 0;
20312219 }
20322220
2221 /* Second, check if the number of bad sectors is greater than
2222 * a certain threshold */
20332223 if (sk_disk_smart_get_bad(d, &sectors) < 0) {
20342224 if (errno != ENOENT)
20352225 return -1;
2036 } else if (sectors > 0) {
2226 sectors = 0;
2227 } else {
2228
2229 /* We use log2(n_sectors) as a threshold here. We had to pick
2230 * something, and this makes a bit of sense, or doesn't it? */
2231 sector_threshold = u64log2(d->size/512);
2232
2233 if (sectors >= sector_threshold) {
2234 *overall = SK_SMART_OVERALL_BAD_SECTOR_MANY;
2235 return 0;
2236 }
2237 }
2238
2239 /* Third, check if any of the SMART attributes is bad */
2240 good = TRUE;
2241 if (sk_disk_smart_parse_attributes(d, (SkSmartAttributeParseCallback) bad_attribute_now_cb, &good) < 0)
2242 return -1;
2243
2244 if (!good) {
2245 *overall = SK_SMART_OVERALL_BAD_ATTRIBUTE_NOW;
2246 return 0;
2247 }
2248
2249 /* Fourth, check if there are any bad sectors at all */
2250 if (sectors > 0) {
20372251 *overall = SK_SMART_OVERALL_BAD_SECTOR;
20382252 return 0;
20392253 }
20402254
2255 /* Fifth, check if any of the SMART attributes ever was bad */
20412256 good = TRUE;
2042 if (sk_disk_smart_parse_attributes(d, (SkSmartAttributeParseCallback) bad_attribute_cb, &good) < 0)
2257 if (sk_disk_smart_parse_attributes(d, (SkSmartAttributeParseCallback) bad_attribute_in_the_past_cb, &good) < 0)
20432258 return -1;
20442259
20452260 if (!good) {
2046 *overall = SK_SMART_OVERALL_BAD_ATTRIBUTE;
2261 *overall = SK_SMART_OVERALL_BAD_ATTRIBUTE_IN_THE_PAST;
20472262 return 0;
20482263 }
20492264
2265 /* Sixth, there's really nothing to complain about, so give it a pass */
20502266 *overall = SK_SMART_OVERALL_GOOD;
20512267 return 0;
20522268 }
21262342 snprintf(tc, sizeof(tc), "%3u", a->current_value);
21272343 tc[sizeof(tc)-1] = 0;
21282344
2129 highlight = a->good_valid && !a->good && isatty(1);
2345 highlight = a->warn && isatty(1);
21302346
21312347 if (highlight)
21322348 fprintf(stderr, HIGHLIGHT);
21332349
2134 printf("%3u %-27s %-3s %-3s %-3s %-11s 0x%02x%02x%02x%02x%02x%02x %-7s %-7s %-3s\n",
2350 printf("%3u %-27s %-3s %-3s %-3s %-11s 0x%02x%02x%02x%02x%02x%02x %-7s %-7s %-4s %-4s\n",
21352351 a->id,
21362352 print_name(name, sizeof(name), a->id, a->name),
21372353 a->current_value_valid ? tc : "n/a",
21412357 a->raw[0], a->raw[1], a->raw[2], a->raw[3], a->raw[4], a->raw[5],
21422358 a->prefailure ? "prefail" : "old-age",
21432359 a->online ? "online" : "offline",
2144 a->good_valid ? yes_no(a->good) : "n/a");
2360 a->good_now_valid ? yes_no(a->good_now) : "n/a",
2361 a->good_in_the_past_valid ? yes_no(a->good_in_the_past) : "n/a");
21452362
21462363 if (highlight)
21472364 fprintf(stderr, ENDHIGHLIGHT);
21542371
21552372 assert(d);
21562373
2157 printf("Device: %s\n"
2374 printf("Device: %s%s%s\n"
21582375 "Type: %s\n",
2376 d->name ? disk_type_to_prefix_string(d->type) : "",
2377 d->name ? ":" : "",
21592378 d->name ? d->name : "n/a",
2160 disk_type_to_string(d->type));
2379 disk_type_to_human_string(d->type));
21612380
21622381 ret = sk_disk_get_size(d, &size);
21632382 if (ret >= 0)
21922411 printf(" %s", _P(quirk_name[i]));
21932412
21942413 printf("\n");
2195
21962414 }
21972415
21982416 ret = sk_disk_check_sleep_mode(d, &awake);
22072425 uint64_t value, power_on;
22082426
22092427 ret = sk_disk_smart_status(d, &good);
2210 printf("SMART Disk Health Good: %s\n",
2211 ret >= 0 ? yes_no(good) : strerror(errno));
2212
2428 printf("%sSMART Disk Health Good: %s%s\n",
2429 ret >= 0 && !good ? HIGHLIGHT : "",
2430 ret >= 0 ? yes_no(good) : strerror(errno),
2431 ret >= 0 && !good ? ENDHIGHLIGHT : "");
22132432 if ((ret = sk_disk_smart_read_data(d)) < 0)
22142433 return ret;
22152434
22672486 else
22682487 printf("Temperature: %s\n", print_value(pretty, sizeof(pretty), value, SK_SMART_ATTRIBUTE_UNIT_MKELVIN));
22692488
2489 printf("Attribute Parsing Verification: %s\n",
2490 d->attribute_verification_bad ? "Bad" : "Good");
2491
22702492 if (sk_disk_smart_get_overall(d, &overall) < 0)
22712493 printf("Overall Status: %s\n", strerror(errno));
22722494 else
22752497 sk_smart_overall_to_string(overall),
22762498 overall != SK_SMART_OVERALL_GOOD ? ENDHIGHLIGHT : "");
22772499
2278 printf("%3s %-27s %5s %5s %5s %-11s %-14s %-7s %-7s %-3s\n",
2500 printf("%3s %-27s %5s %5s %5s %-11s %-14s %-7s %-7s %-4s %-4s\n",
22792501 "ID#",
22802502 "Name",
22812503 "Value",
22852507 "Raw",
22862508 "Type",
22872509 "Updates",
2288 "Good");
2510 "Good",
2511 "Good/Past");
22892512
22902513 if ((ret = sk_disk_smart_parse_attributes(d, disk_dump_attributes, NULL)) < 0)
22912514 return ret;
23122535 struct udev *udev;
23132536 struct udev_device *dev = NULL, *usb;
23142537 int r = -1;
2538 const char *a;
23152539
23162540 assert(d);
23172541
23222546
23232547 if (!(dev = udev_device_new_from_devnum(udev, 'b', devnum))) {
23242548 errno = ENODEV;
2549 goto finish;
2550 }
2551
2552 if ((a = udev_device_get_property_value(dev, "ID_ATA_SMART_ACCESS"))) {
2553 unsigned u;
2554
2555 for (u = 0; u < _SK_DISK_TYPE_MAX; u++) {
2556 const char *t;
2557
2558 if (!(t = disk_type_to_prefix_string(u)))
2559 continue;
2560
2561 if (!strcmp(a, t)) {
2562 d->type = u;
2563 r = 0;
2564 goto finish;
2565 }
2566 }
2567
2568 d->type = SK_DISK_TYPE_NONE;
2569 r = 0;
23252570 goto finish;
23262571 }
23272572
23422587 }
23432588
23442589 if ((vid == 0x0c0b && pid == 0xb159) ||
2345 (vid == 0x04fc && pid == 0x0c25))
2590 (vid == 0x04fc && pid == 0x0c25) ||
2591 (vid == 0x04fc && pid == 0x0c15))
23462592 d->type = SK_DISK_TYPE_SUNPLUS;
2347 if ((vid == 0x152d && pid == 0x2329) ||
2593 else if ((vid == 0x152d && pid == 0x2329) ||
23482594 (vid == 0x152d && pid == 0x2336) ||
23492595 (vid == 0x152d && pid == 0x2338) ||
23502596 (vid == 0x152d && pid == 0x2339))
23532599 d->type = SK_DISK_TYPE_ATA_PASSTHROUGH_12;
23542600
23552601 } else if (udev_device_get_parent_with_subsystem_devtype(dev, "ide", NULL))
2356 d->type = SK_DISK_TYPE_ATA;
2602 d->type = SK_DISK_TYPE_LINUX_IDE;
23572603 else if (udev_device_get_parent_with_subsystem_devtype(dev, "scsi", NULL))
2358