Imported Upstream version 0.14
Martin Pitt
13 years ago
23 | 23 | atasmart.c \ |
24 | 24 | blob-examples/README \ |
25 | 25 | blob-examples/FUJITSU_MHY2120BH--0084000D \ |
26 | blob-examples/FUJITSU_MHY2120BH--0085000B \ | |
26 | 27 | blob-examples/FUJITSU_MHZ2160BH_G1--0084000A \ |
27 | 28 | blob-examples/Maxtor_96147H8--BAC51KJ0 \ |
28 | 29 | blob-examples/SAMSUNG_HD501LJ--CR100-12 \ |
82 | 83 | |
83 | 84 | atasmart.strpool.c: atasmart.c strpool |
84 | 85 | $(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. | |
1 | 1 | # @configure_input@ |
2 | 2 | |
3 | 3 | # 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. | |
5 | 6 | # This Makefile.in is free software; the Free Software Foundation |
6 | 7 | # gives unlimited permission to copy and/or distribute it, |
7 | 8 | # with or without modifications, as long as this notice is preserved. |
36 | 37 | |
37 | 38 | VPATH = @srcdir@ |
38 | 39 | pkgdatadir = $(datadir)/@PACKAGE@ |
40 | pkgincludedir = $(includedir)/@PACKAGE@ | |
39 | 41 | pkglibdir = $(libdir)/@PACKAGE@ |
40 | pkgincludedir = $(includedir)/@PACKAGE@ | |
42 | pkglibexecdir = $(libexecdir)/@PACKAGE@ | |
41 | 43 | am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd |
42 | 44 | install_sh_DATA = $(install_sh) -c -m 644 |
43 | 45 | install_sh_PROGRAM = $(install_sh) -c |
69 | 71 | mkinstalldirs = $(install_sh) -d |
70 | 72 | CONFIG_HEADER = config.h |
71 | 73 | CONFIG_CLEAN_FILES = libatasmart.pc |
74 | CONFIG_CLEAN_VPATH_FILES = | |
72 | 75 | am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; |
73 | 76 | am__vpath_adj = case $$p in \ |
74 | 77 | $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ |
75 | 78 | *) f=$$p;; \ |
76 | 79 | 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' | |
78 | 96 | am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(sbindir)" \ |
79 | 97 | "$(DESTDIR)$(pkgconfigdir)" "$(DESTDIR)$(includedir)" |
80 | libLTLIBRARIES_INSTALL = $(INSTALL) | |
81 | 98 | LTLIBRARIES = $(lib_LTLIBRARIES) |
82 | 99 | am__DEPENDENCIES_1 = |
83 | 100 | libatasmart_la_DEPENDENCIES = $(am__DEPENDENCIES_1) |
84 | 101 | am_libatasmart_la_OBJECTS = libatasmart_la-atasmart.strpool.lo |
85 | 102 | 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 $@ | |
90 | 110 | PROGRAMS = $(noinst_PROGRAMS) $(sbin_PROGRAMS) |
91 | 111 | am_skdump_OBJECTS = skdump.$(OBJEXT) |
92 | 112 | skdump_OBJECTS = $(am_skdump_OBJECTS) |
100 | 120 | DEFAULT_INCLUDES = -I.@am__isrc@ |
101 | 121 | depcomp = $(SHELL) $(top_srcdir)/depcomp |
102 | 122 | am__depfiles_maybe = depfiles |
123 | am__mv = mv -f | |
103 | 124 | COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ |
104 | 125 | $(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 = @ | |
108 | 136 | 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 " $@; | |
112 | 146 | SOURCES = $(libatasmart_la_SOURCES) $(skdump_SOURCES) sktest.c \ |
113 | 147 | $(strpool_SOURCES) |
114 | 148 | DIST_SOURCES = $(libatasmart_la_SOURCES) $(skdump_SOURCES) sktest.c \ |
120 | 154 | install-pdf-recursive install-ps-recursive install-recursive \ |
121 | 155 | installcheck-recursive installdirs-recursive pdf-recursive \ |
122 | 156 | ps-recursive uninstall-recursive |
123 | pkgconfigDATA_INSTALL = $(INSTALL_DATA) | |
124 | 157 | DATA = $(noinst_DATA) $(pkgconfig_DATA) |
125 | includeHEADERS_INSTALL = $(INSTALL_HEADER) | |
126 | 158 | HEADERS = $(include_HEADERS) |
127 | 159 | RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ |
128 | 160 | 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 | |
129 | 164 | ETAGS = etags |
130 | 165 | CTAGS = ctags |
131 | 166 | DIST_SUBDIRS = $(SUBDIRS) |
133 | 168 | distdir = $(PACKAGE)-$(VERSION) |
134 | 169 | top_distdir = $(distdir) |
135 | 170 | 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" | |
139 | 199 | DIST_ARCHIVES = $(distdir).tar.gz |
140 | 200 | GZIP_ENV = --best |
141 | 201 | distuninstallcheck_listfiles = find . -type f -print |
142 | 202 | distcleancheck_listfiles = find . -type f -print |
143 | 203 | ACLOCAL = @ACLOCAL@ |
144 | 204 | AMTAR = @AMTAR@ |
205 | AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ | |
145 | 206 | AR = @AR@ |
146 | 207 | AUTOCONF = @AUTOCONF@ |
147 | 208 | AUTOHEADER = @AUTOHEADER@ |
268 | 329 | atasmart.c \ |
269 | 330 | blob-examples/README \ |
270 | 331 | blob-examples/FUJITSU_MHY2120BH--0084000D \ |
332 | blob-examples/FUJITSU_MHY2120BH--0085000B \ | |
271 | 333 | blob-examples/FUJITSU_MHZ2160BH_G1--0084000A \ |
272 | 334 | blob-examples/Maxtor_96147H8--BAC51KJ0 \ |
273 | 335 | blob-examples/SAMSUNG_HD501LJ--CR100-12 \ |
319 | 381 | BUILT_SOURCES = \ |
320 | 382 | atasmart.strpool.c |
321 | 383 | |
384 | ACLOCAL_AMFLAGS = -I m4 | |
322 | 385 | all: $(BUILT_SOURCES) config.h |
323 | 386 | $(MAKE) $(AM_MAKEFLAGS) all-recursive |
324 | 387 | |
330 | 393 | @for dep in $?; do \ |
331 | 394 | case '$(am__configure_deps)' in \ |
332 | 395 | *$$dep*) \ |
333 | echo ' cd $(srcdir) && $(AUTOMAKE) --foreign '; \ | |
334 | cd $(srcdir) && $(AUTOMAKE) --foreign \ | |
396 | echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \ | |
397 | $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \ | |
335 | 398 | && exit 0; \ |
336 | 399 | exit 1;; \ |
337 | 400 | esac; \ |
338 | 401 | 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 | |
342 | 405 | .PRECIOUS: Makefile |
343 | 406 | Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status |
344 | 407 | @case '$?' in \ |
354 | 417 | $(SHELL) ./config.status --recheck |
355 | 418 | |
356 | 419 | $(top_srcdir)/configure: $(am__configure_deps) |
357 | cd $(srcdir) && $(AUTOCONF) | |
420 | $(am__cd) $(srcdir) && $(AUTOCONF) | |
358 | 421 | $(ACLOCAL_M4): $(am__aclocal_m4_deps) |
359 | cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) | |
422 | $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) | |
423 | $(am__aclocal_m4_deps): | |
360 | 424 | |
361 | 425 | config.h: stamp-h1 |
362 | 426 | @if test ! -f $@; then \ |
368 | 432 | @rm -f stamp-h1 |
369 | 433 | cd $(top_builddir) && $(SHELL) ./config.status config.h |
370 | 434 | $(srcdir)/config.h.in: $(am__configure_deps) |
371 | cd $(top_srcdir) && $(AUTOHEADER) | |
435 | ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) | |
372 | 436 | rm -f stamp-h1 |
373 | 437 | touch $@ |
374 | 438 | |
379 | 443 | install-libLTLIBRARIES: $(lib_LTLIBRARIES) |
380 | 444 | @$(NORMAL_INSTALL) |
381 | 445 | 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 \ | |
383 | 448 | 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"; \ | |
387 | 450 | 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 | } | |
389 | 456 | |
390 | 457 | uninstall-libLTLIBRARIES: |
391 | 458 | @$(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"; \ | |
396 | 464 | done |
397 | 465 | |
398 | 466 | clean-libLTLIBRARIES: |
404 | 472 | rm -f "$${dir}/so_locations"; \ |
405 | 473 | done |
406 | 474 | 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) | |
408 | 476 | |
409 | 477 | 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 | |
415 | 485 | install-sbinPROGRAMS: $(sbin_PROGRAMS) |
416 | 486 | @$(NORMAL_INSTALL) |
417 | 487 | 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 | |
428 | 509 | |
429 | 510 | uninstall-sbinPROGRAMS: |
430 | 511 | @$(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 | |
436 | 519 | |
437 | 520 | 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 | |
443 | 528 | skdump$(EXEEXT): $(skdump_OBJECTS) $(skdump_DEPENDENCIES) |
444 | 529 | @rm -f skdump$(EXEEXT) |
445 | $(LINK) $(skdump_OBJECTS) $(skdump_LDADD) $(LIBS) | |
530 | $(AM_V_CCLD)$(LINK) $(skdump_OBJECTS) $(skdump_LDADD) $(LIBS) | |
446 | 531 | sktest$(EXEEXT): $(sktest_OBJECTS) $(sktest_DEPENDENCIES) |
447 | 532 | @rm -f sktest$(EXEEXT) |
448 | $(LINK) $(sktest_OBJECTS) $(sktest_LDADD) $(LIBS) | |
533 | $(AM_V_CCLD)$(LINK) $(sktest_OBJECTS) $(sktest_LDADD) $(LIBS) | |
449 | 534 | strpool$(EXEEXT): $(strpool_OBJECTS) $(strpool_DEPENDENCIES) |
450 | 535 | @rm -f strpool$(EXEEXT) |
451 | $(LINK) $(strpool_OBJECTS) $(strpool_LDADD) $(LIBS) | |
536 | $(AM_V_CCLD)$(LINK) $(strpool_OBJECTS) $(strpool_LDADD) $(LIBS) | |
452 | 537 | |
453 | 538 | mostlyclean-compile: |
454 | 539 | -rm -f *.$(OBJEXT) |
462 | 547 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strpool.Po@am__quote@ |
463 | 548 | |
464 | 549 | .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@ | |
467 | 553 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ |
468 | 554 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ |
469 | 555 | @am__fastdepCC_FALSE@ $(COMPILE) -c $< |
470 | 556 | |
471 | 557 | .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@ | |
474 | 561 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ |
475 | 562 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ |
476 | 563 | @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` |
477 | 564 | |
478 | 565 | .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@ | |
481 | 569 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ |
482 | 570 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ |
483 | 571 | @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< |
484 | 572 | |
485 | 573 | 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@ | |
488 | 577 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='atasmart.strpool.c' object='libatasmart_la-atasmart.strpool.lo' libtool=yes @AMDEPBACKSLASH@ |
489 | 578 | @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 | |
491 | 580 | |
492 | 581 | mostlyclean-libtool: |
493 | 582 | -rm -f *.lo |
500 | 589 | install-pkgconfigDATA: $(pkgconfig_DATA) |
501 | 590 | @$(NORMAL_INSTALL) |
502 | 591 | 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 \ | |
504 | 594 | 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 $$?; \ | |
508 | 600 | done |
509 | 601 | |
510 | 602 | uninstall-pkgconfigDATA: |
511 | 603 | @$(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 | |
517 | 609 | install-includeHEADERS: $(include_HEADERS) |
518 | 610 | @$(NORMAL_INSTALL) |
519 | 611 | 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 \ | |
521 | 614 | 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 $$?; \ | |
525 | 620 | done |
526 | 621 | |
527 | 622 | uninstall-includeHEADERS: |
528 | 623 | @$(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 | |
534 | 629 | |
535 | 630 | # This directory's subdirectories are mostly independent; you can cd |
536 | 631 | # into them and run `make' without going through this Makefile. |
556 | 651 | else \ |
557 | 652 | local_target="$$target"; \ |
558 | 653 | fi; \ |
559 | (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ | |
654 | ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ | |
560 | 655 | || eval $$failcom; \ |
561 | 656 | done; \ |
562 | 657 | if test "$$dot_seen" = "no"; then \ |
590 | 685 | else \ |
591 | 686 | local_target="$$target"; \ |
592 | 687 | fi; \ |
593 | (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ | |
688 | ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ | |
594 | 689 | || eval $$failcom; \ |
595 | 690 | done && test -z "$$fail" |
596 | 691 | tags-recursive: |
597 | 692 | 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); \ | |
599 | 694 | done |
600 | 695 | ctags-recursive: |
601 | 696 | 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); \ | |
603 | 698 | done |
604 | 699 | |
605 | 700 | ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) |
614 | 709 | |
615 | 710 | TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ |
616 | 711 | $(TAGS_FILES) $(LISP) |
617 | tags=; \ | |
712 | set x; \ | |
618 | 713 | here=`pwd`; \ |
619 | 714 | if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ |
620 | 715 | include_option=--etags-include; \ |
626 | 721 | list='$(SUBDIRS)'; for subdir in $$list; do \ |
627 | 722 | if test "$$subdir" = .; then :; else \ |
628 | 723 | test ! -f $$subdir/TAGS || \ |
629 | tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ | |
724 | set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ | |
630 | 725 | fi; \ |
631 | 726 | done; \ |
632 | 727 | list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ |
635 | 730 | done | \ |
636 | 731 | $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ |
637 | 732 | 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 \ | |
639 | 735 | 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; \ | |
642 | 743 | fi |
643 | 744 | ctags: CTAGS |
644 | 745 | CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ |
645 | 746 | $(TAGS_FILES) $(LISP) |
646 | tags=; \ | |
647 | 747 | list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ |
648 | 748 | unique=`for i in $$list; do \ |
649 | 749 | if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ |
650 | 750 | done | \ |
651 | 751 | $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ |
652 | 752 | END { if (nonempty) { for (i in files) print i; }; }'`; \ |
653 | test -z "$(CTAGS_ARGS)$$tags$$unique" \ | |
753 | test -z "$(CTAGS_ARGS)$$unique" \ | |
654 | 754 | || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ |
655 | $$tags $$unique | |
755 | $$unique | |
656 | 756 | |
657 | 757 | GTAGS: |
658 | 758 | 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" | |
661 | 761 | |
662 | 762 | distclean-tags: |
663 | 763 | -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags |
664 | 764 | |
665 | 765 | distdir: $(DISTFILES) |
666 | 766 | $(am__remove_distdir) |
667 | test -d $(distdir) || mkdir $(distdir) | |
767 | test -d "$(distdir)" || mkdir "$(distdir)" | |
668 | 768 | @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ |
669 | 769 | topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ |
670 | 770 | list='$(DISTFILES)'; \ |
680 | 780 | if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ |
681 | 781 | if test -d $$d/$$file; then \ |
682 | 782 | 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; \ | |
683 | 786 | 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 {} \;; \ | |
685 | 789 | fi; \ |
686 | cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ | |
790 | cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ | |
687 | 791 | 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" \ | |
690 | 794 | || exit 1; \ |
691 | 795 | fi; \ |
692 | 796 | done |
693 | list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ | |
797 | @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ | |
694 | 798 | if test "$$subdir" = .; then :; else \ |
695 | 799 | test -d "$(distdir)/$$subdir" \ |
696 | 800 | || $(MKDIR_P) "$(distdir)/$$subdir" \ |
697 | 801 | || 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 && \ | |
701 | 815 | $(MAKE) $(AM_MAKEFLAGS) \ |
702 | top_distdir="$$top_distdir" \ | |
703 | distdir="$$distdir/$$subdir" \ | |
816 | top_distdir="$$new_top_distdir" \ | |
817 | distdir="$$new_distdir" \ | |
704 | 818 | am__remove_distdir=: \ |
705 | 819 | am__skip_length_check=: \ |
820 | am__skip_mode_fix=: \ | |
706 | 821 | distdir) \ |
707 | 822 | || exit 1; \ |
708 | 823 | fi; \ |
709 | 824 | 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 \ | |
711 | 827 | ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ |
712 | 828 | ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ |
713 | 829 | ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ |
714 | || chmod -R a+r $(distdir) | |
830 | || chmod -R a+r "$(distdir)" | |
715 | 831 | dist-gzip: distdir |
716 | 832 | tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz |
717 | 833 | $(am__remove_distdir) |
722 | 838 | |
723 | 839 | dist-lzma: distdir |
724 | 840 | 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 | |
725 | 845 | $(am__remove_distdir) |
726 | 846 | |
727 | 847 | dist-tarZ: distdir |
752 | 872 | bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ |
753 | 873 | *.tar.lzma*) \ |
754 | 874 | unlzma -c $(distdir).tar.lzma | $(am__untar) ;;\ |
875 | *.tar.xz*) \ | |
876 | xz -dc $(distdir).tar.xz | $(am__untar) ;;\ | |
755 | 877 | *.tar.Z*) \ |
756 | 878 | uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ |
757 | 879 | *.shar.gz*) \ |
763 | 885 | mkdir $(distdir)/_build |
764 | 886 | mkdir $(distdir)/_inst |
765 | 887 | chmod a-w $(distdir) |
888 | test -d $(distdir)/_build || exit 0; \ | |
766 | 889 | dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ |
767 | 890 | && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ |
768 | && cd $(distdir)/_build \ | |
891 | && am__cwd=`pwd` \ | |
892 | && $(am__cd) $(distdir)/_build \ | |
769 | 893 | && ../configure --srcdir=.. --prefix="$$dc_install_base" \ |
770 | 894 | $(DISTCHECK_CONFIGURE_FLAGS) \ |
771 | 895 | && $(MAKE) $(AM_MAKEFLAGS) \ |
787 | 911 | && rm -rf "$$dc_destdir" \ |
788 | 912 | && $(MAKE) $(AM_MAKEFLAGS) dist \ |
789 | 913 | && rm -rf $(DIST_ARCHIVES) \ |
790 | && $(MAKE) $(AM_MAKEFLAGS) distcleancheck | |
914 | && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ | |
915 | && cd "$$am__cwd" \ | |
916 | || exit 1 | |
791 | 917 | $(am__remove_distdir) |
792 | 918 | @(echo "$(distdir) archives ready for distribution: "; \ |
793 | 919 | list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ |
794 | 920 | sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' |
795 | 921 | distuninstallcheck: |
796 | @cd $(distuninstallcheck_dir) \ | |
922 | @$(am__cd) '$(distuninstallcheck_dir)' \ | |
797 | 923 | && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ |
798 | 924 | || { echo "ERROR: files left after uninstall:" ; \ |
799 | 925 | if test -n "$(DESTDIR)"; then \ |
842 | 968 | |
843 | 969 | distclean-generic: |
844 | 970 | -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) | |
845 | 972 | |
846 | 973 | maintainer-clean-generic: |
847 | 974 | @echo "This command is intended for maintainers to use" |
866 | 993 | |
867 | 994 | html: html-recursive |
868 | 995 | |
996 | html-am: | |
997 | ||
869 | 998 | info: info-recursive |
870 | 999 | |
871 | 1000 | info-am: |
874 | 1003 | |
875 | 1004 | install-dvi: install-dvi-recursive |
876 | 1005 | |
1006 | install-dvi-am: | |
1007 | ||
877 | 1008 | install-exec-am: install-libLTLIBRARIES install-sbinPROGRAMS |
878 | 1009 | |
879 | 1010 | install-html: install-html-recursive |
880 | 1011 | |
1012 | install-html-am: | |
1013 | ||
881 | 1014 | install-info: install-info-recursive |
882 | 1015 | |
1016 | install-info-am: | |
1017 | ||
883 | 1018 | install-man: |
884 | 1019 | |
885 | 1020 | install-pdf: install-pdf-recursive |
886 | 1021 | |
1022 | install-pdf-am: | |
1023 | ||
887 | 1024 | install-ps: install-ps-recursive |
1025 | ||
1026 | install-ps-am: | |
888 | 1027 | |
889 | 1028 | installcheck-am: |
890 | 1029 | |
911 | 1050 | uninstall-am: uninstall-includeHEADERS uninstall-libLTLIBRARIES \ |
912 | 1051 | uninstall-pkgconfigDATA uninstall-sbinPROGRAMS |
913 | 1052 | |
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 | |
916 | 1056 | |
917 | 1057 | .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ |
918 | 1058 | all all-am am--refresh check check-am clean clean-generic \ |
919 | 1059 | clean-libLTLIBRARIES clean-libtool clean-noinstPROGRAMS \ |
920 | 1060 | 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 \ | |
935 | 1076 | uninstall-includeHEADERS uninstall-libLTLIBRARIES \ |
936 | 1077 | uninstall-pkgconfigDATA uninstall-sbinPROGRAMS |
937 | 1078 | |
938 | 1079 | |
939 | 1080 | atasmart.strpool.c: atasmart.c strpool |
940 | 1081 | $(top_builddir)/strpool $< $@ |
1082 | ||
941 | 1083 | # Tell versions [3.59,3.63) of GNU make to not export all variables. |
942 | 1084 | # Otherwise a system limit (for SysV at least) may be exceeded. |
943 | 1085 | .NOEXPORT: |
0 | # generated automatically by aclocal 1.10.2 -*- Autoconf -*- | |
0 | # generated automatically by aclocal 1.11 -*- Autoconf -*- | |
1 | 1 | |
2 | 2 | # 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. | |
4 | 4 | # This file is free software; the Free Software Foundation |
5 | 5 | # gives unlimited permission to copy and/or distribute it, |
6 | 6 | # with or without modifications, as long as this notice is preserved. |
8135 | 8135 | # generated from the m4 files accompanying Automake X.Y. |
8136 | 8136 | # (This private macro should not be called outside this file.) |
8137 | 8137 | AC_DEFUN([AM_AUTOMAKE_VERSION], |
8138 | [am__api_version='1.10' | |
8138 | [am__api_version='1.11' | |
8139 | 8139 | dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to |
8140 | 8140 | dnl require some minimum version. Point them to the right macro. |
8141 | m4_if([$1], [1.10.2], [], | |
8141 | m4_if([$1], [1.11], [], | |
8142 | 8142 | [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl |
8143 | 8143 | ]) |
8144 | 8144 | |
8154 | 8154 | # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. |
8155 | 8155 | # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. |
8156 | 8156 | AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], |
8157 | [AM_AUTOMAKE_VERSION([1.10.2])dnl | |
8157 | [AM_AUTOMAKE_VERSION([1.11])dnl | |
8158 | 8158 | m4_ifndef([AC_AUTOCONF_VERSION], |
8159 | 8159 | [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl |
8160 | 8160 | _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) |
8214 | 8214 | |
8215 | 8215 | # AM_CONDITIONAL -*- Autoconf -*- |
8216 | 8216 | |
8217 | # Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006 | |
8217 | # Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008 | |
8218 | 8218 | # Free Software Foundation, Inc. |
8219 | 8219 | # |
8220 | 8220 | # This file is free software; the Free Software Foundation |
8221 | 8221 | # gives unlimited permission to copy and/or distribute it, |
8222 | 8222 | # with or without modifications, as long as this notice is preserved. |
8223 | 8223 | |
8224 | # serial 8 | |
8224 | # serial 9 | |
8225 | 8225 | |
8226 | 8226 | # AM_CONDITIONAL(NAME, SHELL-CONDITION) |
8227 | 8227 | # ------------------------------------- |
8234 | 8234 | AC_SUBST([$1_FALSE])dnl |
8235 | 8235 | _AM_SUBST_NOTMAKE([$1_TRUE])dnl |
8236 | 8236 | _AM_SUBST_NOTMAKE([$1_FALSE])dnl |
8237 | m4_define([_AM_COND_VALUE_$1], [$2])dnl | |
8237 | 8238 | if $2; then |
8238 | 8239 | $1_TRUE= |
8239 | 8240 | $1_FALSE='#' |
8247 | 8248 | Usually this means the macro was only invoked conditionally.]]) |
8248 | 8249 | fi])]) |
8249 | 8250 | |
8250 | # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 | |
8251 | # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009 | |
8251 | 8252 | # Free Software Foundation, Inc. |
8252 | 8253 | # |
8253 | 8254 | # This file is free software; the Free Software Foundation |
8254 | 8255 | # gives unlimited permission to copy and/or distribute it, |
8255 | 8256 | # with or without modifications, as long as this notice is preserved. |
8256 | 8257 | |
8257 | # serial 9 | |
8258 | # serial 10 | |
8258 | 8259 | |
8259 | 8260 | # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be |
8260 | 8261 | # written in clear, in which case automake, when reading aclocal.m4, |
8311 | 8312 | if test "$am_compiler_list" = ""; then |
8312 | 8313 | am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` |
8313 | 8314 | 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 | ||
8314 | 8325 | for depmode in $am_compiler_list; do |
8315 | 8326 | # Setup a source with many dependencies, because some compilers |
8316 | 8327 | # like to wrap large dependency lists on column 80 (with \), and |
8328 | 8339 | done |
8329 | 8340 | echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf |
8330 | 8341 | |
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" | |
8331 | 8348 | case $depmode in |
8349 | gcc) | |
8350 | # This depmode causes a compiler race in universal mode. | |
8351 | test "$am__universal" = false || continue | |
8352 | ;; | |
8332 | 8353 | nosideeffect) |
8333 | 8354 | # after this tag, mechanisms are not by side-effect, so they'll |
8334 | 8355 | # only be used when explicitly requested |
8338 | 8359 | break |
8339 | 8360 | fi |
8340 | 8361 | ;; |
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 | ;; | |
8341 | 8369 | none) break ;; |
8342 | 8370 | 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. | |
8346 | 8371 | if depmode=$depmode \ |
8347 | source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ | |
8372 | source=sub/conftest.c object=$am__obj \ | |
8348 | 8373 | 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 \ | |
8350 | 8375 | >/dev/null 2>conftest.err && |
8351 | 8376 | grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && |
8352 | 8377 | 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 && | |
8354 | 8379 | ${MAKE-make} -s -f confmf > /dev/null 2>&1; then |
8355 | 8380 | # icc doesn't choke on unknown options, it will just issue warnings |
8356 | 8381 | # or remarks (even with -Werror). So we grep stderr for any message |
8414 | 8439 | # gives unlimited permission to copy and/or distribute it, |
8415 | 8440 | # with or without modifications, as long as this notice is preserved. |
8416 | 8441 | |
8417 | #serial 4 | |
8442 | #serial 5 | |
8418 | 8443 | |
8419 | 8444 | # _AM_OUTPUT_DEPENDENCY_COMMANDS |
8420 | 8445 | # ------------------------------ |
8421 | 8446 | 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 | |
8468 | 8495 | done |
8469 | done | |
8496 | } | |
8470 | 8497 | ])# _AM_OUTPUT_DEPENDENCY_COMMANDS |
8471 | 8498 | |
8472 | 8499 | |
8486 | 8513 | # Do all the work for Automake. -*- Autoconf -*- |
8487 | 8514 | |
8488 | 8515 | # 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. | |
8490 | 8517 | # |
8491 | 8518 | # This file is free software; the Free Software Foundation |
8492 | 8519 | # gives unlimited permission to copy and/or distribute it, |
8493 | 8520 | # with or without modifications, as long as this notice is preserved. |
8494 | 8521 | |
8495 | # serial 13 | |
8522 | # serial 16 | |
8496 | 8523 | |
8497 | 8524 | # This macro actually does too much. Some checks are only needed if |
8498 | 8525 | # your package does certain things. But this isn't really a big deal. |
8509 | 8536 | # arguments mandatory, and then we can depend on a new Autoconf |
8510 | 8537 | # release and drop the old call support. |
8511 | 8538 | AC_DEFUN([AM_INIT_AUTOMAKE], |
8512 | [AC_PREREQ([2.60])dnl | |
8539 | [AC_PREREQ([2.62])dnl | |
8513 | 8540 | dnl Autoconf wants to disallow AM_ names. We explicitly allow |
8514 | 8541 | dnl the ones we care about. |
8515 | 8542 | m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl |
8560 | 8587 | AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) |
8561 | 8588 | AM_MISSING_PROG(AUTOHEADER, autoheader) |
8562 | 8589 | 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 | |
8565 | 8592 | AC_REQUIRE([AM_PROG_MKDIR_P])dnl |
8566 | 8593 | # We need awk for the "check" target. The system "awk" is bad on |
8567 | 8594 | # some platforms. |
8569 | 8596 | AC_REQUIRE([AC_PROG_MAKE_SET])dnl |
8570 | 8597 | AC_REQUIRE([AM_SET_LEADING_DOT])dnl |
8571 | 8598 | _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])])]) | |
8574 | 8601 | _AM_IF_OPTION([no-dependencies],, |
8575 | 8602 | [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 | |
8579 | 8606 | 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 | |
8583 | 8610 | 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 | |
8587 | 8614 | ]) |
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 | |
8588 | 8622 | ]) |
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])]) | |
8589 | 8629 | |
8590 | 8630 | |
8591 | 8631 | # When config.status generates a header, we must update the stamp-h file. |
8609 | 8649 | done |
8610 | 8650 | echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) |
8611 | 8651 | |
8612 | # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. | |
8652 | # Copyright (C) 2001, 2003, 2005, 2008 Free Software Foundation, Inc. | |
8613 | 8653 | # |
8614 | 8654 | # This file is free software; the Free Software Foundation |
8615 | 8655 | # gives unlimited permission to copy and/or distribute it, |
8620 | 8660 | # Define $install_sh. |
8621 | 8661 | AC_DEFUN([AM_PROG_INSTALL_SH], |
8622 | 8662 | [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 | |
8624 | 8671 | AC_SUBST(install_sh)]) |
8625 | 8672 | |
8626 | 8673 | # Copyright (C) 2003, 2005 Free Software Foundation, Inc. |
8646 | 8693 | |
8647 | 8694 | # Check to see how 'make' treats includes. -*- Autoconf -*- |
8648 | 8695 | |
8649 | # Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. | |
8696 | # Copyright (C) 2001, 2002, 2003, 2005, 2009 Free Software Foundation, Inc. | |
8650 | 8697 | # |
8651 | 8698 | # This file is free software; the Free Software Foundation |
8652 | 8699 | # gives unlimited permission to copy and/or distribute it, |
8653 | 8700 | # with or without modifications, as long as this notice is preserved. |
8654 | 8701 | |
8655 | # serial 3 | |
8702 | # serial 4 | |
8656 | 8703 | |
8657 | 8704 | # AM_MAKE_INCLUDE() |
8658 | 8705 | # ----------------- |
8661 | 8708 | [am_make=${MAKE-make} |
8662 | 8709 | cat > confinc << 'END' |
8663 | 8710 | am__doit: |
8664 | @echo done | |
8711 | @echo this is the am__doit target | |
8665 | 8712 | .PHONY: am__doit |
8666 | 8713 | END |
8667 | 8714 | # If we don't find an include directive, just comment out the code. |
8671 | 8718 | _am_result=none |
8672 | 8719 | # First try GNU make style include. |
8673 | 8720 | 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 | |
8684 | 8729 | # Now try BSD make style include. |
8685 | 8730 | if test "$am__include" = "#"; then |
8686 | 8731 | 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 | |
8692 | 8739 | fi |
8693 | 8740 | AC_SUBST([am__include]) |
8694 | 8741 | AC_SUBST([am__quote]) |
8733 | 8780 | |
8734 | 8781 | # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- |
8735 | 8782 | |
8736 | # Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005 | |
8783 | # Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008 | |
8737 | 8784 | # Free Software Foundation, Inc. |
8738 | 8785 | # |
8739 | 8786 | # This file is free software; the Free Software Foundation |
8740 | 8787 | # gives unlimited permission to copy and/or distribute it, |
8741 | 8788 | # with or without modifications, as long as this notice is preserved. |
8742 | 8789 | |
8743 | # serial 5 | |
8790 | # serial 6 | |
8744 | 8791 | |
8745 | 8792 | # AM_MISSING_PROG(NAME, PROGRAM) |
8746 | 8793 | # ------------------------------ |
8757 | 8804 | AC_DEFUN([AM_MISSING_HAS_RUN], |
8758 | 8805 | [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl |
8759 | 8806 | 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 | |
8761 | 8815 | # Use eval to expand $SHELL |
8762 | 8816 | if eval "$MISSING --run true"; then |
8763 | 8817 | am_missing_run="$MISSING --run " |
8826 | 8880 | AC_DEFUN([_AM_IF_OPTION], |
8827 | 8881 | [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) |
8828 | 8882 | |
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 | ||
8829 | 8900 | # Check to make sure that the build environment is sane. -*- Autoconf -*- |
8830 | 8901 | |
8831 | # Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 | |
8902 | # Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008 | |
8832 | 8903 | # Free Software Foundation, Inc. |
8833 | 8904 | # |
8834 | 8905 | # This file is free software; the Free Software Foundation |
8835 | 8906 | # gives unlimited permission to copy and/or distribute it, |
8836 | 8907 | # with or without modifications, as long as this notice is preserved. |
8837 | 8908 | |
8838 | # serial 4 | |
8909 | # serial 5 | |
8839 | 8910 | |
8840 | 8911 | # AM_SANITY_CHECK |
8841 | 8912 | # --------------- |
8844 | 8915 | # Just in case |
8845 | 8916 | sleep 1 |
8846 | 8917 | 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 | ||
8847 | 8931 | # Do `set' in a subshell so we don't clobber the current shell's |
8848 | 8932 | # arguments. Must try -L first in case configure is actually a |
8849 | 8933 | # symlink; some systems play weird games with the mod time of symlinks |
8850 | 8934 | # (eg FreeBSD returns the mod time of the symlink's containing |
8851 | 8935 | # directory). |
8852 | 8936 | 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` | |
8854 | 8938 | if test "$[*]" = "X"; then |
8855 | 8939 | # -L didn't work. |
8856 | set X `ls -t $srcdir/configure conftest.file` | |
8940 | set X `ls -t "$srcdir/configure" conftest.file` | |
8857 | 8941 | fi |
8858 | 8942 | rm -f conftest.file |
8859 | 8943 | if test "$[*]" != "X $srcdir/configure conftest.file" \ |
8877 | 8961 | Check your system clock]) |
8878 | 8962 | fi |
8879 | 8963 | 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 | ]) | |
8880 | 8991 | |
8881 | 8992 | # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. |
8882 | 8993 | # |
8906 | 9017 | INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" |
8907 | 9018 | AC_SUBST([INSTALL_STRIP_PROGRAM])]) |
8908 | 9019 | |
8909 | # Copyright (C) 2006 Free Software Foundation, Inc. | |
9020 | # Copyright (C) 2006, 2008 Free Software Foundation, Inc. | |
8910 | 9021 | # |
8911 | 9022 | # This file is free software; the Free Software Foundation |
8912 | 9023 | # gives unlimited permission to copy and/or distribute it, |
8913 | 9024 | # with or without modifications, as long as this notice is preserved. |
9025 | ||
9026 | # serial 2 | |
8914 | 9027 | |
8915 | 9028 | # _AM_SUBST_NOTMAKE(VARIABLE) |
8916 | 9029 | # --------------------------- |
8917 | 9030 | # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. |
8918 | 9031 | # This macro is traced by Automake. |
8919 | 9032 | 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($@)]) | |
8920 | 9038 | |
8921 | 9039 | # Check how to create a tarball. -*- Autoconf -*- |
8922 | 9040 |
63 | 63 | /* These three will be autotested for: */ |
64 | 64 | SK_DISK_TYPE_ATA_PASSTHROUGH_12, /* ATA passthrough over SCSI transport, 12-byte version */ |
65 | 65 | 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 */ | |
67 | 67 | |
68 | 68 | /* These three will not be autotested for */ |
69 | 69 | SK_DISK_TYPE_SUNPLUS, /* SunPlus USB/ATA bridges */ |
70 | 70 | 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 */ | |
73 | 74 | _SK_DISK_TYPE_MAX, |
74 | 75 | _SK_DISK_TYPE_TEST_MAX = SK_DISK_TYPE_SUNPLUS /* only auto test until here */ |
75 | 76 | } SkDiskType; |
113 | 114 | SkBool blob_smart_status:1; |
114 | 115 | SkBool blob_smart_status_valid:1; |
115 | 116 | |
117 | SkBool attribute_verification_bad:1; | |
118 | ||
116 | 119 | SkIdentifyParsedData identify_parsed_data; |
117 | 120 | SkSmartParsedData smart_parsed_data; |
118 | 121 | |
137 | 140 | SK_SMART_COMMAND_RETURN_STATUS = 0xDA |
138 | 141 | } SkSmartCommand; |
139 | 142 | |
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) { | |
141 | 152 | |
142 | 153 | /* %STRINGPOOLSTART% */ |
143 | 154 | static const char* const map[_SK_DISK_TYPE_MAX] = { |
144 | 155 | [SK_DISK_TYPE_ATA_PASSTHROUGH_16] = "16 Byte SCSI ATA SAT Passthru", |
145 | 156 | [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", | |
147 | 158 | [SK_DISK_TYPE_SUNPLUS] = "Sunplus SCSI ATA Passthru", |
148 | 159 | [SK_DISK_TYPE_JMICRON] = "JMicron SCSI ATA Passthru", |
149 | 160 | [SK_DISK_TYPE_BLOB] = "Blob", |
150 | [SK_DISK_TYPE_UNKNOWN] = "Unknown" | |
161 | [SK_DISK_TYPE_AUTO] = "Automatic", | |
162 | [SK_DISK_TYPE_NONE] = "None" | |
151 | 163 | }; |
152 | 164 | /* %STRINGPOOLSTOP% */ |
153 | 165 | |
157 | 169 | return _P(map[type]); |
158 | 170 | } |
159 | 171 | |
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 | ||
160 | 221 | static SkBool disk_smart_is_available(SkDisk *d) { |
161 | 222 | return d->identify_valid && !!(d->identify[164] & 1); |
162 | 223 | } |
188 | 249 | return !!(d->smart_data[367] & 41); |
189 | 250 | } |
190 | 251 | |
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) { | |
192 | 253 | uint8_t *bytes = cmd_data; |
193 | 254 | int ret; |
194 | 255 | |
195 | assert(d->type == SK_DISK_TYPE_ATA); | |
256 | assert(d->type == SK_DISK_TYPE_LINUX_IDE); | |
196 | 257 | |
197 | 258 | switch (direction) { |
198 | 259 | |
633 | 694 | static int disk_command(SkDisk *d, SkAtaCommand command, SkDirection direction, void* cmd_data, void* data, size_t *len) { |
634 | 695 | |
635 | 696 | 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, | |
637 | 698 | [SK_DISK_TYPE_ATA_PASSTHROUGH_12] = disk_passthrough_12_command, |
638 | 699 | [SK_DISK_TYPE_ATA_PASSTHROUGH_16] = disk_passthrough_16_command, |
639 | 700 | [SK_DISK_TYPE_SUNPLUS] = disk_sunplus_command, |
640 | 701 | [SK_DISK_TYPE_JMICRON] = disk_jmicron_command, |
641 | 702 | [SK_DISK_TYPE_BLOB] = NULL, |
642 | [SK_DISK_TYPE_UNKNOWN] = NULL | |
703 | [SK_DISK_TYPE_AUTO] = NULL, | |
704 | [SK_DISK_TYPE_NONE] = NULL | |
643 | 705 | }; |
644 | 706 | |
645 | 707 | assert(d); |
1119 | 1181 | else if (!strcmp(a->name, "temperature-centi-celsius")) |
1120 | 1182 | a->pretty_value = (fourtyeight & 0xFFFF)*100 + 273150; |
1121 | 1183 | 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; | |
1123 | 1185 | else if (!strcmp(a->name, "power-on-seconds")) |
1124 | 1186 | a->pretty_value = fourtyeight * 1000; |
1125 | 1187 | else if (!strcmp(a->name, "power-on-half-minutes")) |
1127 | 1189 | else if (!strcmp(a->name, "power-on-hours") || |
1128 | 1190 | !strcmp(a->name, "loaded-hours") || |
1129 | 1191 | !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")) | |
1132 | 1195 | a->pretty_value = fourtyeight & 0xFFFFFFFFU; |
1133 | 1196 | else |
1134 | 1197 | a->pretty_value = fourtyeight; |
1135 | 1198 | } |
1136 | 1199 | |
1200 | typedef void (*SkSmartAttributeVerify)(SkDisk *d, SkSmartAttributeParsedData *a); | |
1201 | ||
1137 | 1202 | typedef struct SkSmartAttributeInfo { |
1138 | 1203 | const char *name; |
1139 | 1204 | SkSmartAttributeUnit unit; |
1205 | SkSmartAttributeVerify verify; | |
1140 | 1206 | } 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 | } | |
1141 | 1260 | |
1142 | 1261 | /* This data is stolen from smartmontools */ |
1143 | 1262 | |
1144 | 1263 | /* %STRINGPOOLSTART% */ |
1145 | 1264 | 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 } | |
1194 | 1313 | }; |
1195 | 1314 | /* %STRINGPOOLSTOP% */ |
1196 | 1315 | |
1197 | 1316 | 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, | |
1208 | 1330 | } SkSmartQuirk; |
1209 | 1331 | |
1210 | 1332 | /* %STRINGPOOLSTART% */ |
1218 | 1340 | "194_UNKNOWN", |
1219 | 1341 | "200_WRITEERRORCOUNT", |
1220 | 1342 | "201_DETECTEDTACOUNT", |
1343 | "5_UNKNOWN", | |
1221 | 1344 | "9_UNKNOWN", |
1345 | "197_UNKNOWN", | |
1346 | "198_UNKNOWN", | |
1222 | 1347 | NULL |
1223 | 1348 | }; |
1224 | 1349 | /* %STRINGPOOLSTOP% */ |
1231 | 1356 | |
1232 | 1357 | static const SkSmartQuirkDatabase quirk_database[] = { { |
1233 | 1358 | |
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 | |
1238 | 1368 | }, { |
1239 | ||
1240 | /*** Fujitsu */ | |
1241 | 1369 | "^FUJITSU MHR2040AT$", |
1242 | 1370 | NULL, |
1243 | 1371 | SK_SMART_QUIRK_9_POWERONSECONDS| |
1356 | 1484 | SK_SMART_QUIRK_9_POWERONMINUTES| |
1357 | 1485 | SK_SMART_QUIRK_193_LOADUNLOAD |
1358 | 1486 | }, { |
1359 | ||
1487 | "^HTS541010G9SA00$", | |
1488 | "^MBZOC60P$", | |
1489 | SK_SMART_QUIRK_5_UNKNOWN | |
1490 | }, { | |
1360 | 1491 | NULL, |
1361 | 1492 | NULL, |
1362 | 1493 | 0 |
1439 | 1570 | if (quirk) { |
1440 | 1571 | switch (id) { |
1441 | 1572 | |
1573 | case 5: | |
1574 | if (quirk & SK_SMART_QUIRK_5_UNKNOWN) | |
1575 | return NULL; | |
1576 | ||
1577 | break; | |
1578 | ||
1442 | 1579 | case 9: |
1443 | 1580 | /* %STRINGPOOLSTART% */ |
1444 | 1581 | if (quirk & SK_SMART_QUIRK_9_POWERONMINUTES) { |
1445 | 1582 | 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 | |
1447 | 1584 | }; |
1448 | 1585 | return &a; |
1449 | 1586 | |
1450 | 1587 | } else if (quirk & SK_SMART_QUIRK_9_POWERONSECONDS) { |
1451 | 1588 | 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 | |
1453 | 1590 | }; |
1454 | 1591 | return &a; |
1455 | 1592 | |
1456 | 1593 | } else if (quirk & SK_SMART_QUIRK_9_POWERONHALFMINUTES) { |
1457 | 1594 | 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 | |
1459 | 1596 | }; |
1460 | 1597 | return &a; |
1461 | 1598 | } else if (quirk & SK_SMART_QUIRK_9_UNKNOWN) |
1468 | 1605 | /* %STRINGPOOLSTART% */ |
1469 | 1606 | if (quirk & SK_SMART_QUIRK_192_EMERGENCYRETRACTCYCLECT) { |
1470 | 1607 | 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 | |
1472 | 1609 | }; |
1473 | 1610 | return &a; |
1474 | 1611 | } |
1480 | 1617 | /* %STRINGPOOLSTART% */ |
1481 | 1618 | if (quirk & SK_SMART_QUIRK_194_10XCELSIUS) { |
1482 | 1619 | static const SkSmartAttributeInfo a = { |
1483 | "temperature-centi-celsius", SK_SMART_ATTRIBUTE_UNIT_MKELVIN | |
1620 | "temperature-centi-celsius", SK_SMART_ATTRIBUTE_UNIT_MKELVIN, verify_temperature | |
1484 | 1621 | }; |
1485 | 1622 | return &a; |
1486 | 1623 | } else if (quirk & SK_SMART_QUIRK_194_UNKNOWN) |
1489 | 1626 | |
1490 | 1627 | break; |
1491 | 1628 | |
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 | ||
1492 | 1641 | case 200: |
1493 | 1642 | /* %STRINGPOOLSTART% */ |
1494 | 1643 | if (quirk & SK_SMART_QUIRK_200_WRITEERRORCOUNT) { |
1495 | 1644 | static const SkSmartAttributeInfo a = { |
1496 | "write-error-count", SK_SMART_ATTRIBUTE_UNIT_NONE | |
1645 | "write-error-count", SK_SMART_ATTRIBUTE_UNIT_NONE, NULL | |
1497 | 1646 | }; |
1498 | 1647 | return &a; |
1499 | 1648 | } |
1505 | 1654 | /* %STRINGPOOLSTART% */ |
1506 | 1655 | if (quirk & SK_SMART_QUIRK_201_DETECTEDTACOUNT) { |
1507 | 1656 | static const SkSmartAttributeInfo a = { |
1508 | "detected-ta-count", SK_SMART_ATTRIBUTE_UNIT_NONE | |
1657 | "detected-ta-count", SK_SMART_ATTRIBUTE_UNIT_NONE, NULL | |
1509 | 1658 | }; |
1510 | 1659 | return &a; |
1511 | 1660 | } |
1587 | 1736 | uint8_t *p; |
1588 | 1737 | unsigned n; |
1589 | 1738 | |
1590 | if (!d->smart_thresholds_valid) { | |
1591 | a->threshold_valid = FALSE; | |
1592 | return; | |
1593 | } | |
1739 | if (!d->smart_thresholds_valid) | |
1740 | goto fail; | |
1594 | 1741 | |
1595 | 1742 | for (n = 0, p = d->smart_thresholds+2; n < 30; n++, p+=12) |
1596 | 1743 | if (p[0] == a->id) |
1597 | 1744 | break; |
1598 | 1745 | |
1599 | if (n >= 30) { | |
1600 | a->threshold_valid = FALSE; | |
1601 | a->good_valid = FALSE; | |
1602 | return; | |
1603 | } | |
1746 | if (n >= 30) | |
1747 | goto fail; | |
1604 | 1748 | |
1605 | 1749 | a->threshold = p[1]; |
1606 | 1750 | a->threshold_valid = p[1] != 0xFE; |
1607 | 1751 | |
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; | |
1610 | 1756 | |
1611 | 1757 | /* Always-Fail and Always-Passing thresholds are not relevant |
1612 | 1758 | * for our assessment. */ |
1613 | 1759 | if (p[1] >= 1 && p[1] <= 0xFD) { |
1614 | 1760 | |
1615 | 1761 | 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; | |
1618 | 1764 | } |
1619 | 1765 | |
1620 | 1766 | 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; | |
1623 | 1769 | } |
1624 | 1770 | } |
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; | |
1625 | 1783 | } |
1626 | 1784 | |
1627 | 1785 | int sk_disk_smart_parse_attributes(SkDisk *d, SkSmartAttributeParseCallback cb, void* userdata) { |
1671 | 1829 | |
1672 | 1830 | find_threshold(d, &a); |
1673 | 1831 | |
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); | |
1682 | 1834 | |
1683 | 1835 | cb(d, &a, userdata); |
1684 | 1836 | free(an); |
1889 | 2041 | /* %STRINGPOOLSTART% */ |
1890 | 2042 | const char * const map[] = { |
1891 | 2043 | [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", | |
1892 | 2048 | [SK_SMART_OVERALL_BAD_STATUS] = "BAD_STATUS", |
1893 | [SK_SMART_OVERALL_BAD_ATTRIBUTE] = "BAD_ATTRIBUTE", | |
1894 | [SK_SMART_OVERALL_BAD_SECTOR] = "BAD_SECTOR" | |
1895 | 2049 | }; |
1896 | 2050 | /* %STRINGPOOLSTOP% */ |
1897 | 2051 | |
1901 | 2055 | return _P(map[overall]); |
1902 | 2056 | } |
1903 | 2057 | |
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) | |
1906 | 2060 | *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 | } | |
1907 | 2081 | } |
1908 | 2082 | |
1909 | 2083 | int sk_disk_smart_get_overall(SkDisk *d, SkSmartOverall *overall) { |
1910 | 2084 | SkBool good; |
1911 | uint64_t sectors; | |
2085 | uint64_t sectors, sector_threshold; | |
1912 | 2086 | |
1913 | 2087 | assert(d); |
1914 | 2088 | assert(overall); |
1915 | 2089 | |
2090 | /* First, check SMART self-assesment */ | |
1916 | 2091 | if (sk_disk_smart_status(d, &good) < 0) |
1917 | 2092 | return -1; |
1918 | 2093 | |
1921 | 2096 | return 0; |
1922 | 2097 | } |
1923 | 2098 | |
2099 | /* Second, check if the number of bad sectors is greater than | |
2100 | * a certain threshold */ | |
1924 | 2101 | if (sk_disk_smart_get_bad(d, §ors) < 0) { |
1925 | 2102 | if (errno != ENOENT) |
1926 | 2103 | 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) { | |
1928 | 2129 | *overall = SK_SMART_OVERALL_BAD_SECTOR; |
1929 | 2130 | return 0; |
1930 | 2131 | } |
1931 | 2132 | |
2133 | /* Fifth, check if any of the SMART attributes ever was bad */ | |
1932 | 2134 | 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) | |
1934 | 2136 | return -1; |
1935 | 2137 | |
1936 | 2138 | if (!good) { |
1937 | *overall = SK_SMART_OVERALL_BAD_ATTRIBUTE; | |
2139 | *overall = SK_SMART_OVERALL_BAD_ATTRIBUTE_IN_THE_PAST; | |
1938 | 2140 | return 0; |
1939 | 2141 | } |
1940 | 2142 | |
2143 | /* Sixth, there's really nothing to complain about, so give it a pass */ | |
1941 | 2144 | *overall = SK_SMART_OVERALL_GOOD; |
1942 | 2145 | return 0; |
1943 | 2146 | } |
2017 | 2220 | snprintf(tc, sizeof(tc), "%3u", a->current_value); |
2018 | 2221 | tc[sizeof(tc)-1] = 0; |
2019 | 2222 | |
2020 | highlight = a->good_valid && !a->good && isatty(1); | |
2223 | highlight = a->warn && isatty(1); | |
2021 | 2224 | |
2022 | 2225 | if (highlight) |
2023 | 2226 | fprintf(stderr, HIGHLIGHT); |
2024 | 2227 | |
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", | |
2026 | 2229 | a->id, |
2027 | 2230 | print_name(name, sizeof(name), a->id, a->name), |
2028 | 2231 | a->current_value_valid ? tc : "n/a", |
2032 | 2235 | a->raw[0], a->raw[1], a->raw[2], a->raw[3], a->raw[4], a->raw[5], |
2033 | 2236 | a->prefailure ? "prefail" : "old-age", |
2034 | 2237 | 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"); | |
2036 | 2240 | |
2037 | 2241 | if (highlight) |
2038 | 2242 | fprintf(stderr, ENDHIGHLIGHT); |
2045 | 2249 | |
2046 | 2250 | assert(d); |
2047 | 2251 | |
2048 | printf("Device: %s\n" | |
2252 | printf("Device: %s%s%s\n" | |
2049 | 2253 | "Type: %s\n", |
2254 | d->name ? disk_type_to_prefix_string(d->type) : "", | |
2255 | d->name ? ":" : "", | |
2050 | 2256 | d->name ? d->name : "n/a", |
2051 | disk_type_to_string(d->type)); | |
2257 | disk_type_to_human_string(d->type)); | |
2052 | 2258 | |
2053 | 2259 | ret = sk_disk_get_size(d, &size); |
2054 | 2260 | if (ret >= 0) |
2083 | 2289 | printf(" %s", _P(quirk_name[i])); |
2084 | 2290 | |
2085 | 2291 | printf("\n"); |
2086 | ||
2087 | 2292 | } |
2088 | 2293 | |
2089 | 2294 | ret = sk_disk_check_sleep_mode(d, &awake); |
2098 | 2303 | uint64_t value, power_on; |
2099 | 2304 | |
2100 | 2305 | 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 : ""); | |
2104 | 2310 | if ((ret = sk_disk_smart_read_data(d)) < 0) |
2105 | 2311 | return ret; |
2106 | 2312 | |
2158 | 2364 | else |
2159 | 2365 | printf("Temperature: %s\n", print_value(pretty, sizeof(pretty), value, SK_SMART_ATTRIBUTE_UNIT_MKELVIN)); |
2160 | 2366 | |
2367 | printf("Attribute Parsing Verification: %s\n", | |
2368 | d->attribute_verification_bad ? "Bad" : "Good"); | |
2369 | ||
2161 | 2370 | if (sk_disk_smart_get_overall(d, &overall) < 0) |
2162 | 2371 | printf("Overall Status: %s\n", strerror(errno)); |
2163 | 2372 | else |
2166 | 2375 | sk_smart_overall_to_string(overall), |
2167 | 2376 | overall != SK_SMART_OVERALL_GOOD ? ENDHIGHLIGHT : ""); |
2168 | 2377 | |
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", | |
2170 | 2379 | "ID#", |
2171 | 2380 | "Name", |
2172 | 2381 | "Value", |
2176 | 2385 | "Raw", |
2177 | 2386 | "Type", |
2178 | 2387 | "Updates", |
2179 | "Good"); | |
2388 | "Good", | |
2389 | "Good/Past"); | |
2180 | 2390 | |
2181 | 2391 | if ((ret = sk_disk_smart_parse_attributes(d, disk_dump_attributes, NULL)) < 0) |
2182 | 2392 | return ret; |
2203 | 2413 | struct udev *udev; |
2204 | 2414 | struct udev_device *dev = NULL, *usb; |
2205 | 2415 | int r = -1; |
2416 | const char *a; | |
2206 | 2417 | |
2207 | 2418 | assert(d); |
2208 | 2419 | |
2213 | 2424 | |
2214 | 2425 | if (!(dev = udev_device_new_from_devnum(udev, 'b', devnum))) { |
2215 | 2426 | 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; | |
2216 | 2448 | goto finish; |
2217 | 2449 | } |
2218 | 2450 | |
2233 | 2465 | } |
2234 | 2466 | |
2235 | 2467 | if ((vid == 0x0c0b && pid == 0xb159) || |
2236 | (vid == 0x04fc && pid == 0x0c25)) | |
2468 | (vid == 0x04fc && pid == 0x0c25) || | |
2469 | (vid == 0x04fc && pid == 0x0c15)) | |
2237 | 2470 | d->type = SK_DISK_TYPE_SUNPLUS; |
2238 | if ((vid == 0x152d && pid == 0x2329) || | |
2471 | else if ((vid == 0x152d && pid == 0x2329) || | |
2239 | 2472 | (vid == 0x152d && pid == 0x2336) || |
2240 | 2473 | (vid == 0x152d && pid == 0x2338) || |
2241 | 2474 | (vid == 0x152d && pid == 0x2339)) |
2244 | 2477 | d->type = SK_DISK_TYPE_ATA_PASSTHROUGH_12; |
2245 | 2478 | |
2246 | 2479 | } 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; | |
2248 | 2481 | else if (udev_device_get_parent_with_subsystem_devtype(dev, "scsi", NULL)) |
2249 | 2482 | d->type = SK_DISK_TYPE_ATA_PASSTHROUGH_16; |
2250 | 2483 | else |
2251 | d->type = SK_DISK_TYPE_UNKNOWN; | |
2484 | d->type = SK_DISK_TYPE_AUTO; | |
2252 | 2485 | |
2253 | 2486 | r = 0; |
2254 | 2487 | |
2274 | 2507 | goto fail; |
2275 | 2508 | } |
2276 | 2509 | |
2277 | if (!name) { | |
2278 | d->fd = -1; | |
2510 | d->fd = -1; | |
2511 | d->size = (uint64_t) -1; | |
2512 | ||
2513 | if (!name) | |
2279 | 2514 | 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))) { | |
2284 | 2524 | errno = ENOMEM; |
2285 | 2525 | goto fail; |
2286 | 2526 | } |
2287 | 2527 | |
2288 | if ((d->fd = open(name, | |
2528 | if ((d->fd = open(d->name, | |
2289 | 2529 | O_RDONLY|O_NOCTTY|O_NONBLOCK |
2290 | 2530 | #ifdef O_CLOEXEC |
2291 | 2531 | |O_CLOEXEC |
2316 | 2556 | } |
2317 | 2557 | |
2318 | 2558 | /* 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) { | |
2323 | 2564 | /* We have no clue, so let's autotest for a working API */ |
2324 | 2565 | for (d->type = 0; d->type < _SK_DISK_TYPE_TEST_MAX; d->type++) |
2325 | 2566 | if (disk_identify_device(d) >= 0) |
2326 | 2567 | break; |
2327 | 2568 | if (d->type >= _SK_DISK_TYPE_TEST_MAX) |
2328 | d->type = SK_DISK_TYPE_UNKNOWN; | |
2569 | d->type = SK_DISK_TYPE_NONE; | |
2329 | 2570 | } else |
2330 | 2571 | disk_identify_device(d); |
2331 | 2572 |
156 | 156 | SkBool prefailure:1; |
157 | 157 | |
158 | 158 | /* 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; | |
160 | 161 | SkBool current_value_valid:1, worst_value_valid:1; |
162 | SkBool warn:1; | |
161 | 163 | uint8_t current_value, worst_value; |
162 | 164 | uint64_t pretty_value; |
163 | 165 | uint8_t raw[6]; |
170 | 172 | |
171 | 173 | typedef enum SkSmartOverall { |
172 | 174 | 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 */ | |
176 | 180 | _SK_SMART_OVERALL_MAX |
177 | 181 | |
178 | 182 | /* 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. */ | |
1 | 1 | static const char _strpool_[] = |
2 | 2 | "16 Byte SCSI ATA SAT Passthru\0" |
3 | 3 | "12 Byte SCSI ATA SAT Passthru\0" |
4 | "Native Linux ATA\0" | |
4 | "Native Linux IDE\0" | |
5 | 5 | "Sunplus SCSI ATA Passthru\0" |
6 | 6 | "JMicron SCSI ATA Passthru\0" |
7 | 7 | "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" | |
9 | 17 | "Off-line data collection activity was never started.\0" |
10 | 18 | "Off-line data collection activity was completed without error.\0" |
11 | 19 | "Off-line activity in progress.\0" |
81 | 89 | "194_UNKNOWN\0" |
82 | 90 | "200_WRITEERRORCOUNT\0" |
83 | 91 | "201_DETECTEDTACOUNT\0" |
92 | "5_UNKNOWN\0" | |
84 | 93 | "9_UNKNOWN\0" |
94 | "197_UNKNOWN\0" | |
95 | "198_UNKNOWN\0" | |
85 | 96 | "power-on-minutes\0" |
86 | 97 | "power-on-seconds\0" |
87 | 98 | "power-on-half-minutes\0" |
95 | 106 | "sectors\0" |
96 | 107 | "mK\0" |
97 | 108 | "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"; | |
101 | 114 | #ifndef STRPOOL |
102 | 115 | #define STRPOOL |
103 | 116 | #endif |
172 | 185 | /* These three will be autotested for: */ |
173 | 186 | SK_DISK_TYPE_ATA_PASSTHROUGH_12, /* ATA passthrough over SCSI transport, 12-byte version */ |
174 | 187 | 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 */ | |
176 | 189 | |
177 | 190 | /* These three will not be autotested for */ |
178 | 191 | SK_DISK_TYPE_SUNPLUS, /* SunPlus USB/ATA bridges */ |
179 | 192 | 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 */ | |
182 | 196 | _SK_DISK_TYPE_MAX, |
183 | 197 | _SK_DISK_TYPE_TEST_MAX = SK_DISK_TYPE_SUNPLUS /* only auto test until here */ |
184 | 198 | } SkDiskType; |
222 | 236 | SkBool blob_smart_status:1; |
223 | 237 | SkBool blob_smart_status_valid:1; |
224 | 238 | |
239 | SkBool attribute_verification_bad:1; | |
240 | ||
225 | 241 | SkIdentifyParsedData identify_parsed_data; |
226 | 242 | SkSmartParsedData smart_parsed_data; |
227 | 243 | |
246 | 262 | SK_SMART_COMMAND_RETURN_STATUS = 0xDA |
247 | 263 | } SkSmartCommand; |
248 | 264 | |
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) { | |
250 | 274 | |
251 | 275 | /* %STRINGPOOLSTART% */ |
252 | 276 | static const char* const map[_SK_DISK_TYPE_MAX] = { |
253 | 277 | [SK_DISK_TYPE_ATA_PASSTHROUGH_16] = ((const char*) 1), |
254 | 278 | [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), | |
256 | 280 | [SK_DISK_TYPE_SUNPLUS] = ((const char*) 78), |
257 | 281 | [SK_DISK_TYPE_JMICRON] = ((const char*) 104), |
258 | 282 | [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) | |
260 | 285 | }; |
261 | 286 | /* %STRINGPOOLSTOP% */ |
262 | 287 | |
266 | 291 | return _P(map[type]); |
267 | 292 | } |
268 | 293 | |
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 | ||
269 | 343 | static SkBool disk_smart_is_available(SkDisk *d) { |
270 | 344 | return d->identify_valid && !!(d->identify[164] & 1); |
271 | 345 | } |
297 | 371 | return !!(d->smart_data[367] & 41); |
298 | 372 | } |
299 | 373 | |
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) { | |
301 | 375 | uint8_t *bytes = cmd_data; |
302 | 376 | int ret; |
303 | 377 | |
304 | assert(d->type == SK_DISK_TYPE_ATA); | |
378 | assert(d->type == SK_DISK_TYPE_LINUX_IDE); | |
305 | 379 | |
306 | 380 | switch (direction) { |
307 | 381 | |
742 | 816 | static int disk_command(SkDisk *d, SkAtaCommand command, SkDirection direction, void* cmd_data, void* data, size_t *len) { |
743 | 817 | |
744 | 818 | 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, | |
746 | 820 | [SK_DISK_TYPE_ATA_PASSTHROUGH_12] = disk_passthrough_12_command, |
747 | 821 | [SK_DISK_TYPE_ATA_PASSTHROUGH_16] = disk_passthrough_16_command, |
748 | 822 | [SK_DISK_TYPE_SUNPLUS] = disk_sunplus_command, |
749 | 823 | [SK_DISK_TYPE_JMICRON] = disk_jmicron_command, |
750 | 824 | [SK_DISK_TYPE_BLOB] = NULL, |
751 | [SK_DISK_TYPE_UNKNOWN] = NULL | |
825 | [SK_DISK_TYPE_AUTO] = NULL, | |
826 | [SK_DISK_TYPE_NONE] = NULL | |
752 | 827 | }; |
753 | 828 | |
754 | 829 | assert(d); |
1110 | 1185 | |
1111 | 1186 | /* %STRINGPOOLSTART% */ |
1112 | 1187 | 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) | |
1120 | 1195 | }; |
1121 | 1196 | /* %STRINGPOOLSTOP% */ |
1122 | 1197 | |
1130 | 1205 | |
1131 | 1206 | /* %STRINGPOOLSTART% */ |
1132 | 1207 | 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) | |
1143 | 1218 | }; |
1144 | 1219 | /* %STRINGPOOLSTOP% */ |
1145 | 1220 | |
1228 | 1303 | else if (!strcmp(a->name, "temperature-centi-celsius")) |
1229 | 1304 | a->pretty_value = (fourtyeight & 0xFFFF)*100 + 273150; |
1230 | 1305 | 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; | |
1232 | 1307 | else if (!strcmp(a->name, "power-on-seconds")) |
1233 | 1308 | a->pretty_value = fourtyeight * 1000; |
1234 | 1309 | else if (!strcmp(a->name, "power-on-half-minutes")) |
1236 | 1311 | else if (!strcmp(a->name, "power-on-hours") || |
1237 | 1312 | !strcmp(a->name, "loaded-hours") || |
1238 | 1313 | !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")) | |
1241 | 1317 | a->pretty_value = fourtyeight & 0xFFFFFFFFU; |
1242 | 1318 | else |
1243 | 1319 | a->pretty_value = fourtyeight; |
1244 | 1320 | } |
1245 | 1321 | |
1322 | typedef void (*SkSmartAttributeVerify)(SkDisk *d, SkSmartAttributeParsedData *a); | |
1323 | ||
1246 | 1324 | typedef struct SkSmartAttributeInfo { |
1247 | 1325 | const char *name; |
1248 | 1326 | SkSmartAttributeUnit unit; |
1327 | SkSmartAttributeVerify verify; | |
1249 | 1328 | } 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 | } | |
1250 | 1382 | |
1251 | 1383 | /* This data is stolen from smartmontools */ |
1252 | 1384 | |
1253 | 1385 | /* %STRINGPOOLSTART% */ |
1254 | 1386 | 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 } | |
1303 | 1435 | }; |
1304 | 1436 | /* %STRINGPOOLSTOP% */ |
1305 | 1437 | |
1306 | 1438 | 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, | |
1317 | 1452 | } SkSmartQuirk; |
1318 | 1453 | |
1319 | 1454 | /* %STRINGPOOLSTART% */ |
1320 | 1455 | static const char *quirk_name[] = { |
1321 | ((const char*) 2347), | |
1322 | ((const char*) 2364), | |
1323 | ((const char*) 2381), | |
1324 | 1456 | ((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), | |
1331 | 1469 | NULL |
1332 | 1470 | }; |
1333 | 1471 | /* %STRINGPOOLSTOP% */ |
1340 | 1478 | |
1341 | 1479 | static const SkSmartQuirkDatabase quirk_database[] = { { |
1342 | 1480 | |
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 | |
1347 | 1490 | }, { |
1348 | ||
1349 | /*** Fujitsu */ | |
1350 | 1491 | "^FUJITSU MHR2040AT$", |
1351 | 1492 | NULL, |
1352 | 1493 | SK_SMART_QUIRK_9_POWERONSECONDS| |
1465 | 1606 | SK_SMART_QUIRK_9_POWERONMINUTES| |
1466 | 1607 | SK_SMART_QUIRK_193_LOADUNLOAD |
1467 | 1608 | }, { |
1468 | ||
1609 | "^HTS541010G9SA00$", | |
1610 | "^MBZOC60P$", | |
1611 | SK_SMART_QUIRK_5_UNKNOWN | |
1612 | }, { | |
1469 | 1613 | NULL, |
1470 | 1614 | NULL, |
1471 | 1615 | 0 |
1548 | 1692 | if (quirk) { |
1549 | 1693 | switch (id) { |
1550 | 1694 | |
1695 | case 5: | |
1696 | if (quirk & SK_SMART_QUIRK_5_UNKNOWN) | |
1697 | return NULL; | |
1698 | ||
1699 | break; | |
1700 | ||
1551 | 1701 | case 9: |
1552 | 1702 | /* %STRINGPOOLSTART% */ |
1553 | 1703 | if (quirk & SK_SMART_QUIRK_9_POWERONMINUTES) { |
1554 | 1704 | 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 | |
1556 | 1706 | }; |
1557 | 1707 | return &a; |
1558 | 1708 | |
1559 | 1709 | } else if (quirk & SK_SMART_QUIRK_9_POWERONSECONDS) { |
1560 | 1710 | 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 | |
1562 | 1712 | }; |
1563 | 1713 | return &a; |
1564 | 1714 | |
1565 | 1715 | } else if (quirk & SK_SMART_QUIRK_9_POWERONHALFMINUTES) { |
1566 | 1716 | 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 | |
1568 | 1718 | }; |
1569 | 1719 | return &a; |
1570 | 1720 | } else if (quirk & SK_SMART_QUIRK_9_UNKNOWN) |
1577 | 1727 | /* %STRINGPOOLSTART% */ |
1578 | 1728 | if (quirk & SK_SMART_QUIRK_192_EMERGENCYRETRACTCYCLECT) { |
1579 | 1729 | static const SkSmartAttributeInfo a = { |
1580 | ((const char*) 2578), SK_SMART_ATTRIBUTE_UNIT_NONE | |
1730 | ((const char*) 2667), SK_SMART_ATTRIBUTE_UNIT_NONE, NULL | |
1581 | 1731 | }; |
1582 | 1732 | return &a; |
1583 | 1733 | } |
1589 | 1739 | /* %STRINGPOOLSTART% */ |
1590 | 1740 | if (quirk & SK_SMART_QUIRK_194_10XCELSIUS) { |
1591 | 1741 | static const SkSmartAttributeInfo a = { |
1592 | ((const char*) 2608), SK_SMART_ATTRIBUTE_UNIT_MKELVIN | |
1742 | ((const char*) 2697), SK_SMART_ATTRIBUTE_UNIT_MKELVIN, verify_temperature | |
1593 | 1743 | }; |
1594 | 1744 | return &a; |
1595 | 1745 | } else if (quirk & SK_SMART_QUIRK_194_UNKNOWN) |
1598 | 1748 | |
1599 | 1749 | break; |
1600 | 1750 | |
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 | ||
1601 | 1763 | case 200: |
1602 | 1764 | /* %STRINGPOOLSTART% */ |
1603 | 1765 | if (quirk & SK_SMART_QUIRK_200_WRITEERRORCOUNT) { |
1604 | 1766 | static const SkSmartAttributeInfo a = { |
1605 | ((const char*) 2634), SK_SMART_ATTRIBUTE_UNIT_NONE | |
1767 | ((const char*) 2723), SK_SMART_ATTRIBUTE_UNIT_NONE, NULL | |
1606 | 1768 | }; |
1607 | 1769 | return &a; |
1608 | 1770 | } |
1614 | 1776 | /* %STRINGPOOLSTART% */ |
1615 | 1777 | if (quirk & SK_SMART_QUIRK_201_DETECTEDTACOUNT) { |
1616 | 1778 | static const SkSmartAttributeInfo a = { |
1617 | ((const char*) 2652), SK_SMART_ATTRIBUTE_UNIT_NONE | |
1779 | ((const char*) 2741), SK_SMART_ATTRIBUTE_UNIT_NONE, NULL | |
1618 | 1780 | }; |
1619 | 1781 | return &a; |
1620 | 1782 | } |
1696 | 1858 | uint8_t *p; |
1697 | 1859 | unsigned n; |
1698 | 1860 | |
1699 | if (!d->smart_thresholds_valid) { | |
1700 | a->threshold_valid = FALSE; | |
1701 | return; | |
1702 | } | |
1861 | if (!d->smart_thresholds_valid) | |
1862 | goto fail; | |
1703 | 1863 | |
1704 | 1864 | for (n = 0, p = d->smart_thresholds+2; n < 30; n++, p+=12) |
1705 | 1865 | if (p[0] == a->id) |
1706 | 1866 | break; |
1707 | 1867 | |
1708 | if (n >= 30) { | |
1709 | a->threshold_valid = FALSE; | |
1710 | a->good_valid = FALSE; | |
1711 | return; | |
1712 | } | |
1868 | if (n >= 30) | |
1869 | goto fail; | |
1713 | 1870 | |
1714 | 1871 | a->threshold = p[1]; |
1715 | 1872 | a->threshold_valid = p[1] != 0xFE; |
1716 | 1873 | |
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; | |
1719 | 1878 | |
1720 | 1879 | /* Always-Fail and Always-Passing thresholds are not relevant |
1721 | 1880 | * for our assessment. */ |
1722 | 1881 | if (p[1] >= 1 && p[1] <= 0xFD) { |
1723 | 1882 | |
1724 | 1883 | 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; | |
1727 | 1886 | } |
1728 | 1887 | |
1729 | 1888 | 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; | |
1732 | 1891 | } |
1733 | 1892 | } |
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; | |
1734 | 1905 | } |
1735 | 1906 | |
1736 | 1907 | int sk_disk_smart_parse_attributes(SkDisk *d, SkSmartAttributeParseCallback cb, void* userdata) { |
1780 | 1951 | |
1781 | 1952 | find_threshold(d, &a); |
1782 | 1953 | |
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); | |
1791 | 1956 | |
1792 | 1957 | cb(d, &a, userdata); |
1793 | 1958 | free(an); |
1806 | 1971 | const char * const map[] = { |
1807 | 1972 | [SK_SMART_ATTRIBUTE_UNIT_UNKNOWN] = NULL, |
1808 | 1973 | [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) | |
1812 | 1977 | }; |
1813 | 1978 | /* %STRINGPOOLSTOP% */ |
1814 | 1979 | |
1997 | 2162 | |
1998 | 2163 | /* %STRINGPOOLSTART% */ |
1999 | 2164 | 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), | |
2004 | 2171 | }; |
2005 | 2172 | /* %STRINGPOOLSTOP% */ |
2006 | 2173 | |
2010 | 2177 | return _P(map[overall]); |
2011 | 2178 | } |
2012 | 2179 | |
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) | |
2015 | 2182 | *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 | } | |
2016 | 2203 | } |
2017 | 2204 | |
2018 | 2205 | int sk_disk_smart_get_overall(SkDisk *d, SkSmartOverall *overall) { |
2019 | 2206 | SkBool good; |
2020 | uint64_t sectors; | |
2207 | uint64_t sectors, sector_threshold; | |
2021 | 2208 | |
2022 | 2209 | assert(d); |
2023 | 2210 | assert(overall); |
2024 | 2211 | |
2212 | /* First, check SMART self-assesment */ | |
2025 | 2213 | if (sk_disk_smart_status(d, &good) < 0) |
2026 | 2214 | return -1; |
2027 | 2215 | |
2030 | 2218 | return 0; |
2031 | 2219 | } |
2032 | 2220 | |
2221 | /* Second, check if the number of bad sectors is greater than | |
2222 | * a certain threshold */ | |
2033 | 2223 | if (sk_disk_smart_get_bad(d, §ors) < 0) { |
2034 | 2224 | if (errno != ENOENT) |
2035 | 2225 | 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) { | |
2037 | 2251 | *overall = SK_SMART_OVERALL_BAD_SECTOR; |
2038 | 2252 | return 0; |
2039 | 2253 | } |
2040 | 2254 | |
2255 | /* Fifth, check if any of the SMART attributes ever was bad */ | |
2041 | 2256 | 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) | |
2043 | 2258 | return -1; |
2044 | 2259 | |
2045 | 2260 | if (!good) { |
2046 | *overall = SK_SMART_OVERALL_BAD_ATTRIBUTE; | |
2261 | *overall = SK_SMART_OVERALL_BAD_ATTRIBUTE_IN_THE_PAST; | |
2047 | 2262 | return 0; |
2048 | 2263 | } |
2049 | 2264 | |
2265 | /* Sixth, there's really nothing to complain about, so give it a pass */ | |
2050 | 2266 | *overall = SK_SMART_OVERALL_GOOD; |
2051 | 2267 | return 0; |
2052 | 2268 | } |
2126 | 2342 | snprintf(tc, sizeof(tc), "%3u", a->current_value); |
2127 | 2343 | tc[sizeof(tc)-1] = 0; |
2128 | 2344 | |
2129 | highlight = a->good_valid && !a->good && isatty(1); | |
2345 | highlight = a->warn && isatty(1); | |
2130 | 2346 | |
2131 | 2347 | if (highlight) |
2132 | 2348 | fprintf(stderr, HIGHLIGHT); |
2133 | 2349 | |
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", | |
2135 | 2351 | a->id, |
2136 | 2352 | print_name(name, sizeof(name), a->id, a->name), |
2137 | 2353 | a->current_value_valid ? tc : "n/a", |
2141 | 2357 | a->raw[0], a->raw[1], a->raw[2], a->raw[3], a->raw[4], a->raw[5], |
2142 | 2358 | a->prefailure ? "prefail" : "old-age", |
2143 | 2359 | 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"); | |
2145 | 2362 | |
2146 | 2363 | if (highlight) |
2147 | 2364 | fprintf(stderr, ENDHIGHLIGHT); |
2154 | 2371 | |
2155 | 2372 | assert(d); |
2156 | 2373 | |
2157 | printf("Device: %s\n" | |
2374 | printf("Device: %s%s%s\n" | |
2158 | 2375 | "Type: %s\n", |
2376 | d->name ? disk_type_to_prefix_string(d->type) : "", | |
2377 | d->name ? ":" : "", | |
2159 | 2378 | d->name ? d->name : "n/a", |
2160 | disk_type_to_string(d->type)); | |
2379 | disk_type_to_human_string(d->type)); | |
2161 | 2380 | |
2162 | 2381 | ret = sk_disk_get_size(d, &size); |
2163 | 2382 | if (ret >= 0) |
2192 | 2411 | printf(" %s", _P(quirk_name[i])); |
2193 | 2412 | |
2194 | 2413 | printf("\n"); |
2195 | ||
2196 | 2414 | } |
2197 | 2415 | |
2198 | 2416 | ret = sk_disk_check_sleep_mode(d, &awake); |
2207 | 2425 | uint64_t value, power_on; |
2208 | 2426 | |
2209 | 2427 | 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 : ""); | |
2213 | 2432 | if ((ret = sk_disk_smart_read_data(d)) < 0) |
2214 | 2433 | return ret; |
2215 | 2434 | |
2267 | 2486 | else |
2268 | 2487 | printf("Temperature: %s\n", print_value(pretty, sizeof(pretty), value, SK_SMART_ATTRIBUTE_UNIT_MKELVIN)); |
2269 | 2488 | |
2489 | printf("Attribute Parsing Verification: %s\n", | |
2490 | d->attribute_verification_bad ? "Bad" : "Good"); | |
2491 | ||
2270 | 2492 | if (sk_disk_smart_get_overall(d, &overall) < 0) |
2271 | 2493 | printf("Overall Status: %s\n", strerror(errno)); |
2272 | 2494 | else |
2275 | 2497 | sk_smart_overall_to_string(overall), |
2276 | 2498 | overall != SK_SMART_OVERALL_GOOD ? ENDHIGHLIGHT : ""); |
2277 | 2499 | |
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", | |
2279 | 2501 | "ID#", |
2280 | 2502 | "Name", |
2281 | 2503 | "Value", |
2285 | 2507 | "Raw", |
2286 | 2508 | "Type", |
2287 | 2509 | "Updates", |
2288 | "Good"); | |
2510 | "Good", | |
2511 | "Good/Past"); | |
2289 | 2512 | |
2290 | 2513 | if ((ret = sk_disk_smart_parse_attributes(d, disk_dump_attributes, NULL)) < 0) |
2291 | 2514 | return ret; |
2312 | 2535 | struct udev *udev; |
2313 | 2536 | struct udev_device *dev = NULL, *usb; |
2314 | 2537 | int r = -1; |
2538 | const char *a; | |
2315 | 2539 | |
2316 | 2540 | assert(d); |
2317 | 2541 | |
2322 | 2546 | |
2323 | 2547 | if (!(dev = udev_device_new_from_devnum(udev, 'b', devnum))) { |
2324 | 2548 | 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; | |
2325 | 2570 | goto finish; |
2326 | 2571 | } |
2327 | 2572 | |
2342 | 2587 | } |
2343 | 2588 | |
2344 | 2589 | if ((vid == 0x0c0b && pid == 0xb159) || |
2345 | (vid == 0x04fc && pid == 0x0c25)) | |
2590 | (vid == 0x04fc && pid == 0x0c25) || | |
2591 | (vid == 0x04fc && pid == 0x0c15)) | |
2346 | 2592 | d->type = SK_DISK_TYPE_SUNPLUS; |
2347 | if ((vid == 0x152d && pid == 0x2329) || | |
2593 | else if ((vid == 0x152d && pid == 0x2329) || | |
2348 | 2594 | (vid == 0x152d && pid == 0x2336) || |
2349 | 2595 | (vid == 0x152d && pid == 0x2338) || |
2350 | 2596 | (vid == 0x152d && pid == 0x2339)) |
2353 | 2599 | d->type = SK_DISK_TYPE_ATA_PASSTHROUGH_12; |
2354 | 2600 | |
2355 | 2601 | } 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; | |
2357 | 2603 | else if (udev_device_get_parent_with_subsystem_devtype(dev, "scsi", NULL)) |
2358 |