mirror of
https://git.proxmox.com/git/mirror_smartmontools-debian
synced 2025-10-04 09:03:27 +00:00
Imported Upstream version 5.39
This commit is contained in:
parent
bed9426992
commit
e9e8c2b126
@ -1,6 +1,6 @@
|
||||
CHANGELOG for smartmontools
|
||||
|
||||
$Id: CHANGELOG 2993 2009-12-04 17:29:50Z chrfranke $
|
||||
$Id: CHANGELOG 2995 2009-12-09 21:01:43Z chrfranke $
|
||||
|
||||
The most recent version of this file is:
|
||||
http://smartmontools.svn.sourceforge.net/viewvc/smartmontools/trunk/smartmontools/CHANGELOG?view=markup
|
||||
@ -43,6 +43,10 @@ NOTES FOR FUTURE RELEASES: see TODO file.
|
||||
|
||||
<DEVELOPERS: ADDITIONS TO THE CHANGE LOG GO JUST BELOW HERE, PLEASE>
|
||||
|
||||
smartmontools 5.39 2009-12-09
|
||||
|
||||
[CF] do_release: Commit CHANGELOG and NEWS also. Allow to review changes.
|
||||
|
||||
[CF] Linux: Add workaround for Adaptec series 2, 5 and 5Z controllers
|
||||
with firmware >= 17380. Patch was provided by Phil Wilson, see:
|
||||
http://linux.adaptec.com/2009/07/24/using-smartmontools-538-with-series-255z-controllers-with-firmware-17380-onwards
|
||||
|
241
Doxyfile
241
Doxyfile
@ -1,241 +0,0 @@
|
||||
# Doxyfile 1.5.5
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Project related configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
DOXYFILE_ENCODING = UTF-8
|
||||
PROJECT_NAME = smartmontools
|
||||
PROJECT_NUMBER =
|
||||
OUTPUT_DIRECTORY = doc
|
||||
CREATE_SUBDIRS = NO
|
||||
OUTPUT_LANGUAGE = English
|
||||
BRIEF_MEMBER_DESC = YES
|
||||
REPEAT_BRIEF = YES
|
||||
ABBREVIATE_BRIEF =
|
||||
ALWAYS_DETAILED_SEC = YES
|
||||
INLINE_INHERITED_MEMB = NO
|
||||
FULL_PATH_NAMES = YES
|
||||
STRIP_FROM_PATH =
|
||||
STRIP_FROM_INC_PATH =
|
||||
SHORT_NAMES = NO
|
||||
JAVADOC_AUTOBRIEF = YES
|
||||
QT_AUTOBRIEF = NO
|
||||
MULTILINE_CPP_IS_BRIEF = NO
|
||||
DETAILS_AT_TOP = NO
|
||||
INHERIT_DOCS = YES
|
||||
SEPARATE_MEMBER_PAGES = NO
|
||||
TAB_SIZE = 8
|
||||
ALIASES =
|
||||
OPTIMIZE_OUTPUT_FOR_C = NO
|
||||
OPTIMIZE_OUTPUT_JAVA = NO
|
||||
OPTIMIZE_FOR_FORTRAN = NO
|
||||
OPTIMIZE_OUTPUT_VHDL = NO
|
||||
BUILTIN_STL_SUPPORT = NO
|
||||
CPP_CLI_SUPPORT = NO
|
||||
SIP_SUPPORT = NO
|
||||
DISTRIBUTE_GROUP_DOC = NO
|
||||
SUBGROUPING = YES
|
||||
TYPEDEF_HIDES_STRUCT = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# Build related configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
EXTRACT_ALL = YES
|
||||
EXTRACT_PRIVATE = YES
|
||||
EXTRACT_STATIC = YES
|
||||
EXTRACT_LOCAL_CLASSES = YES
|
||||
EXTRACT_LOCAL_METHODS = NO
|
||||
EXTRACT_ANON_NSPACES = YES
|
||||
HIDE_UNDOC_MEMBERS = NO
|
||||
HIDE_UNDOC_CLASSES = NO
|
||||
HIDE_FRIEND_COMPOUNDS = NO
|
||||
HIDE_IN_BODY_DOCS = NO
|
||||
INTERNAL_DOCS = NO
|
||||
CASE_SENSE_NAMES = YES
|
||||
HIDE_SCOPE_NAMES = NO
|
||||
SHOW_INCLUDE_FILES = YES
|
||||
INLINE_INFO = YES
|
||||
SORT_MEMBER_DOCS = YES
|
||||
SORT_BRIEF_DOCS = NO
|
||||
SORT_GROUP_NAMES = NO
|
||||
SORT_BY_SCOPE_NAME = NO
|
||||
GENERATE_TODOLIST = YES
|
||||
GENERATE_TESTLIST = YES
|
||||
GENERATE_BUGLIST = YES
|
||||
GENERATE_DEPRECATEDLIST= YES
|
||||
ENABLED_SECTIONS =
|
||||
MAX_INITIALIZER_LINES = 30
|
||||
SHOW_USED_FILES = YES
|
||||
SHOW_DIRECTORIES = NO
|
||||
FILE_VERSION_FILTER =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to warning and progress messages
|
||||
#---------------------------------------------------------------------------
|
||||
QUIET = NO
|
||||
WARNINGS = YES
|
||||
WARN_IF_UNDOCUMENTED = NO
|
||||
WARN_IF_DOC_ERROR = YES
|
||||
WARN_NO_PARAMDOC = NO
|
||||
WARN_FORMAT = "$file:$line: $text"
|
||||
WARN_LOGFILE =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the input files
|
||||
#---------------------------------------------------------------------------
|
||||
INPUT =
|
||||
INPUT_ENCODING = UTF-8
|
||||
FILE_PATTERNS = dev*.h \
|
||||
dev*.cpp \
|
||||
scsiata.cpp
|
||||
RECURSIVE = NO
|
||||
EXCLUDE =
|
||||
EXCLUDE_SYMLINKS = NO
|
||||
EXCLUDE_PATTERNS =
|
||||
EXCLUDE_SYMBOLS =
|
||||
EXAMPLE_PATH =
|
||||
EXAMPLE_PATTERNS =
|
||||
EXAMPLE_RECURSIVE = NO
|
||||
IMAGE_PATH =
|
||||
INPUT_FILTER =
|
||||
FILTER_PATTERNS =
|
||||
FILTER_SOURCE_FILES = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to source browsing
|
||||
#---------------------------------------------------------------------------
|
||||
SOURCE_BROWSER = YES
|
||||
INLINE_SOURCES = NO
|
||||
STRIP_CODE_COMMENTS = NO
|
||||
REFERENCED_BY_RELATION = NO
|
||||
REFERENCES_RELATION = NO
|
||||
REFERENCES_LINK_SOURCE = YES
|
||||
USE_HTAGS = NO
|
||||
VERBATIM_HEADERS = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the alphabetical class index
|
||||
#---------------------------------------------------------------------------
|
||||
ALPHABETICAL_INDEX = NO
|
||||
COLS_IN_ALPHA_INDEX = 5
|
||||
IGNORE_PREFIX =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the HTML output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_HTML = YES
|
||||
HTML_OUTPUT = html
|
||||
HTML_FILE_EXTENSION = .html
|
||||
HTML_HEADER =
|
||||
HTML_FOOTER =
|
||||
HTML_STYLESHEET =
|
||||
HTML_ALIGN_MEMBERS = YES
|
||||
GENERATE_HTMLHELP = NO
|
||||
GENERATE_DOCSET = NO
|
||||
DOCSET_FEEDNAME = "Doxygen generated docs"
|
||||
DOCSET_BUNDLE_ID = org.doxygen.Project
|
||||
HTML_DYNAMIC_SECTIONS = NO
|
||||
CHM_FILE =
|
||||
HHC_LOCATION =
|
||||
GENERATE_CHI = NO
|
||||
BINARY_TOC = NO
|
||||
TOC_EXPAND = NO
|
||||
DISABLE_INDEX = NO
|
||||
ENUM_VALUES_PER_LINE = 4
|
||||
GENERATE_TREEVIEW = NO
|
||||
TREEVIEW_WIDTH = 250
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the LaTeX output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_LATEX = YES
|
||||
LATEX_OUTPUT = latex
|
||||
LATEX_CMD_NAME = latex
|
||||
MAKEINDEX_CMD_NAME = makeindex
|
||||
COMPACT_LATEX = NO
|
||||
PAPER_TYPE = a4wide
|
||||
EXTRA_PACKAGES =
|
||||
LATEX_HEADER =
|
||||
PDF_HYPERLINKS = YES
|
||||
USE_PDFLATEX = YES
|
||||
LATEX_BATCHMODE = NO
|
||||
LATEX_HIDE_INDICES = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the RTF output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_RTF = NO
|
||||
RTF_OUTPUT = rtf
|
||||
COMPACT_RTF = NO
|
||||
RTF_HYPERLINKS = NO
|
||||
RTF_STYLESHEET_FILE =
|
||||
RTF_EXTENSIONS_FILE =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the man page output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_MAN = NO
|
||||
MAN_OUTPUT = man
|
||||
MAN_EXTENSION = .3
|
||||
MAN_LINKS = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the XML output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_XML = NO
|
||||
XML_OUTPUT = xml
|
||||
XML_SCHEMA =
|
||||
XML_DTD =
|
||||
XML_PROGRAMLISTING = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options for the AutoGen Definitions output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_AUTOGEN_DEF = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the Perl module output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_PERLMOD = NO
|
||||
PERLMOD_LATEX = NO
|
||||
PERLMOD_PRETTY = YES
|
||||
PERLMOD_MAKEVAR_PREFIX =
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the preprocessor
|
||||
#---------------------------------------------------------------------------
|
||||
ENABLE_PREPROCESSING = YES
|
||||
MACRO_EXPANSION = NO
|
||||
EXPAND_ONLY_PREDEF = NO
|
||||
SEARCH_INCLUDES = YES
|
||||
INCLUDE_PATH =
|
||||
INCLUDE_FILE_PATTERNS =
|
||||
PREDEFINED =
|
||||
EXPAND_AS_DEFINED =
|
||||
SKIP_FUNCTION_MACROS = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration::additions related to external references
|
||||
#---------------------------------------------------------------------------
|
||||
TAGFILES =
|
||||
GENERATE_TAGFILE =
|
||||
ALLEXTERNALS = NO
|
||||
EXTERNAL_GROUPS = YES
|
||||
PERL_PATH = /usr/bin/perl
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the dot tool
|
||||
#---------------------------------------------------------------------------
|
||||
CLASS_DIAGRAMS = YES
|
||||
MSCGEN_PATH =
|
||||
HIDE_UNDOC_RELATIONS = YES
|
||||
HAVE_DOT = NO
|
||||
CLASS_GRAPH = YES
|
||||
COLLABORATION_GRAPH = YES
|
||||
GROUP_GRAPHS = YES
|
||||
UML_LOOK = NO
|
||||
TEMPLATE_RELATIONS = NO
|
||||
INCLUDE_GRAPH = YES
|
||||
INCLUDED_BY_GRAPH = YES
|
||||
CALL_GRAPH = NO
|
||||
CALLER_GRAPH = NO
|
||||
GRAPHICAL_HIERARCHY = YES
|
||||
DIRECTORY_GRAPH = YES
|
||||
DOT_IMAGE_FORMAT = png
|
||||
DOT_PATH =
|
||||
DOTFILE_DIRS =
|
||||
DOT_GRAPH_MAX_NODES = 50
|
||||
MAX_DOT_GRAPH_DEPTH = 0
|
||||
DOT_TRANSPARENT = YES
|
||||
DOT_MULTI_TARGETS = NO
|
||||
GENERATE_LEGEND = YES
|
||||
DOT_CLEANUP = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration::additions related to the search engine
|
||||
#---------------------------------------------------------------------------
|
||||
SEARCHENGINE = NO
|
1723
Makefile.in
Normal file
1723
Makefile.in
Normal file
File diff suppressed because it is too large
Load Diff
4
NEWS
4
NEWS
@ -1,11 +1,11 @@
|
||||
smartmontools NEWS
|
||||
------------------
|
||||
$Id: NEWS 2989 2009-11-30 20:17:14Z chrfranke $
|
||||
$Id: NEWS 2995 2009-12-09 21:01:43Z chrfranke $
|
||||
|
||||
The most up-to-date version of this file is:
|
||||
http://smartmontools.svn.sourceforge.net/viewvc/smartmontools/trunk/smartmontools/NEWS?view=markup
|
||||
|
||||
Date <Not released yet, please try current SVN>
|
||||
Date 2009-12-09
|
||||
Summary: smartmontools release 5.39 (UNSTABLE/EXPERIMENTAL)
|
||||
-----------------------------------------------------------
|
||||
- Sourcecode repository moved from CVS to SVN
|
||||
|
1025
aclocal.m4
vendored
Normal file
1025
aclocal.m4
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1561
config.guess
vendored
Executable file
1561
config.guess
vendored
Executable file
File diff suppressed because it is too large
Load Diff
169
config.h.in
Normal file
169
config.h.in
Normal file
@ -0,0 +1,169 @@
|
||||
/* config.h.in. Generated from configure.in by autoheader. */
|
||||
|
||||
/* smartmontools CVS Tag */
|
||||
#undef CONFIG_H_CVSID
|
||||
|
||||
/* use mailx as default mailer */
|
||||
#undef DEFAULT_MAILER
|
||||
|
||||
/* Define to 1 if you have the `ata_identify_is_cached' function in os_*.c. */
|
||||
#undef HAVE_ATA_IDENTIFY_IS_CACHED
|
||||
|
||||
/* Define to 1 if C++ compiler supports __attribute__((packed)) */
|
||||
#undef HAVE_ATTR_PACKED
|
||||
|
||||
/* Define to 1 if you have the <dev/ata/atavar.h> header file. */
|
||||
#undef HAVE_DEV_ATA_ATAVAR_H
|
||||
|
||||
/* Define to 1 if you have the <dev/ciss/cissio.h> header file. */
|
||||
#undef HAVE_DEV_CISS_CISSIO_H
|
||||
|
||||
/* Define to 1 if you have the `getaddrinfo' function. */
|
||||
#undef HAVE_GETADDRINFO
|
||||
|
||||
/* Define to 1 if you have the `getdomainname' function. */
|
||||
#undef HAVE_GETDOMAINNAME
|
||||
|
||||
/* Define to 1 if you have the `gethostbyname' function. */
|
||||
#undef HAVE_GETHOSTBYNAME
|
||||
|
||||
/* Define to 1 if you have the `gethostname' function. */
|
||||
#undef HAVE_GETHOSTNAME
|
||||
|
||||
/* Define to 1 if you have the `getopt_long' function. */
|
||||
#undef HAVE_GETOPT_LONG
|
||||
|
||||
/* Define to 1 if you have the `get_os_version_str' function in os_*.c. */
|
||||
#undef HAVE_GET_OS_VERSION_STR
|
||||
|
||||
/* Define to 1 if the system has the type `int64_t'. */
|
||||
#undef HAVE_INT64_T
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#undef HAVE_INTTYPES_H
|
||||
|
||||
/* Define to 1 if you have the `usb' library (-lusb). */
|
||||
#undef HAVE_LIBUSB
|
||||
|
||||
/* Define to 1 if you have the <linux/cciss_ioctl.h> header file. */
|
||||
#undef HAVE_LINUX_CCISS_IOCTL_H
|
||||
|
||||
/* Define to 1 if you have the <linux/compiler.h> header file. */
|
||||
#undef HAVE_LINUX_COMPILER_H
|
||||
|
||||
/* Define to 1 if you have the <locale.h> header file. */
|
||||
#undef HAVE_LOCALE_H
|
||||
|
||||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
#undef HAVE_MEMORY_H
|
||||
|
||||
/* Define to 1 if you have the <netdb.h> header file. */
|
||||
#undef HAVE_NETDB_H
|
||||
|
||||
/* Define to 1 if you have the <selinux/selinux.h> header file. */
|
||||
#undef HAVE_SELINUX_SELINUX_H
|
||||
|
||||
/* Define to 1 if you have the `sigset' function. */
|
||||
#undef HAVE_SIGSET
|
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
#undef HAVE_STDINT_H
|
||||
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
#undef HAVE_STDLIB_H
|
||||
|
||||
/* Define to 1 if you have the <strings.h> header file. */
|
||||
#undef HAVE_STRINGS_H
|
||||
|
||||
/* Define to 1 if you have the <string.h> header file. */
|
||||
#undef HAVE_STRING_H
|
||||
|
||||
/* Define to 1 if you have the `strtoull' function. */
|
||||
#undef HAVE_STRTOULL
|
||||
|
||||
/* Define to 1 if you have the <sys/inttypes.h> header file. */
|
||||
#undef HAVE_SYS_INTTYPES_H
|
||||
|
||||
/* Define to 1 if you have the <sys/int_types.h> header file. */
|
||||
#undef HAVE_SYS_INT_TYPES_H
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#undef HAVE_SYS_STAT_H
|
||||
|
||||
/* Define to 1 if you have the <sys/tweio.h> header file. */
|
||||
#undef HAVE_SYS_TWEIO_H
|
||||
|
||||
/* Define to 1 if you have the <sys/twereg.h> header file. */
|
||||
#undef HAVE_SYS_TWEREG_H
|
||||
|
||||
/* Define to 1 if you have the <sys/tw_osl_ioctl.h> header file. */
|
||||
#undef HAVE_SYS_TW_OSL_IOCTL_H
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#undef HAVE_SYS_TYPES_H
|
||||
|
||||
/* Define to 1 if the system has the type `uint64_t'. */
|
||||
#undef HAVE_UINT64_T
|
||||
|
||||
/* Define to 1 if you have the `uname' function. */
|
||||
#undef HAVE_UNAME
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#undef HAVE_UNISTD_H
|
||||
|
||||
/* Define to 1 if the `snprintf' function is sane */
|
||||
#undef HAVE_WORKING_SNPRINTF
|
||||
|
||||
/* need assembly code os_solaris_ata.s */
|
||||
#undef NEED_SOLARIS_ATA_CODE
|
||||
|
||||
/* Define to 1 if os_*.cpp still uses the old interface */
|
||||
#undef OLD_INTERFACE
|
||||
|
||||
/* Name of package */
|
||||
#undef PACKAGE
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#undef PACKAGE_BUGREPORT
|
||||
|
||||
/* smartmontools Home Page */
|
||||
#undef PACKAGE_HOMEPAGE
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
#undef PACKAGE_NAME
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#undef PACKAGE_STRING
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#undef PACKAGE_TARNAME
|
||||
|
||||
/* Define to the home page for this package. */
|
||||
#undef PACKAGE_URL
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#undef PACKAGE_VERSION
|
||||
|
||||
/* smartmontools Build Host */
|
||||
#undef SMARTMONTOOLS_BUILD_HOST
|
||||
|
||||
/* smartmontools Configure Arguments */
|
||||
#undef SMARTMONTOOLS_CONFIGURE_ARGS
|
||||
|
||||
/* smartmontools Configure Date */
|
||||
#undef SMARTMONTOOLS_CONFIGURE_DATE
|
||||
|
||||
/* smartmontools Release Date */
|
||||
#undef SMARTMONTOOLS_RELEASE_DATE
|
||||
|
||||
/* smartmontools Release Time */
|
||||
#undef SMARTMONTOOLS_RELEASE_TIME
|
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#undef STDC_HEADERS
|
||||
|
||||
/* Version number of package */
|
||||
#undef VERSION
|
||||
|
||||
/* Define to 1 if SELinux support is enabled */
|
||||
#undef WITH_SELINUX
|
1686
config.sub
vendored
Executable file
1686
config.sub
vendored
Executable file
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,5 @@
|
||||
#
|
||||
# $Id: configure.in 2992 2009-12-04 17:05:21Z chrfranke $
|
||||
# $Id: configure.in 2995 2009-12-09 21:01:43Z chrfranke $
|
||||
#
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
AC_PREREQ(2.50)
|
||||
@ -7,9 +7,9 @@ AC_INIT(smartmontools, 5.39, smartmontools-support@lists.sourceforge.net)
|
||||
AC_CONFIG_SRCDIR(smartctl.cpp)
|
||||
|
||||
smartmontools_configure_date=`date -u +'%Y-%m-%d %T %Z'`
|
||||
smartmontools_cvs_tag=`echo '$Id: configure.in 2992 2009-12-04 17:05:21Z chrfranke $'`
|
||||
smartmontools_release_date=2009-11-30
|
||||
smartmontools_release_time="20:24:12 UTC"
|
||||
smartmontools_cvs_tag=`echo '$Id: configure.in 2995 2009-12-09 21:01:43Z chrfranke $'`
|
||||
smartmontools_release_date=2009-12-09
|
||||
smartmontools_release_time="21:00:32 UTC"
|
||||
|
||||
AC_DEFINE_UNQUOTED(SMARTMONTOOLS_CONFIGURE_ARGS, "$ac_configure_args", [smartmontools Configure Arguments])
|
||||
AC_DEFINE_UNQUOTED(SMARTMONTOOLS_CONFIGURE_DATE, "$smartmontools_configure_date", [smartmontools Configure Date])
|
||||
|
630
depcomp
Executable file
630
depcomp
Executable file
@ -0,0 +1,630 @@
|
||||
#! /bin/sh
|
||||
# depcomp - compile a program generating dependencies as side-effects
|
||||
|
||||
scriptversion=2009-04-28.21; # UTC
|
||||
|
||||
# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 Free
|
||||
# Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
|
||||
|
||||
case $1 in
|
||||
'')
|
||||
echo "$0: No command. Try \`$0 --help' for more information." 1>&2
|
||||
exit 1;
|
||||
;;
|
||||
-h | --h*)
|
||||
cat <<\EOF
|
||||
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
|
||||
|
||||
Run PROGRAMS ARGS to compile a file, generating dependencies
|
||||
as side-effects.
|
||||
|
||||
Environment variables:
|
||||
depmode Dependency tracking mode.
|
||||
source Source file read by `PROGRAMS ARGS'.
|
||||
object Object file output by `PROGRAMS ARGS'.
|
||||
DEPDIR directory where to store dependencies.
|
||||
depfile Dependency file to output.
|
||||
tmpdepfile Temporary file to use when outputing dependencies.
|
||||
libtool Whether libtool is used (yes/no).
|
||||
|
||||
Report bugs to <bug-automake@gnu.org>.
|
||||
EOF
|
||||
exit $?
|
||||
;;
|
||||
-v | --v*)
|
||||
echo "depcomp $scriptversion"
|
||||
exit $?
|
||||
;;
|
||||
esac
|
||||
|
||||
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
|
||||
echo "depcomp: Variables source, object and depmode must be set" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
|
||||
depfile=${depfile-`echo "$object" |
|
||||
sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
|
||||
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
|
||||
|
||||
rm -f "$tmpdepfile"
|
||||
|
||||
# Some modes work just like other modes, but use different flags. We
|
||||
# parameterize here, but still list the modes in the big case below,
|
||||
# to make depend.m4 easier to write. Note that we *cannot* use a case
|
||||
# here, because this file can only contain one case statement.
|
||||
if test "$depmode" = hp; then
|
||||
# HP compiler uses -M and no extra arg.
|
||||
gccflag=-M
|
||||
depmode=gcc
|
||||
fi
|
||||
|
||||
if test "$depmode" = dashXmstdout; then
|
||||
# This is just like dashmstdout with a different argument.
|
||||
dashmflag=-xM
|
||||
depmode=dashmstdout
|
||||
fi
|
||||
|
||||
cygpath_u="cygpath -u -f -"
|
||||
if test "$depmode" = msvcmsys; then
|
||||
# This is just like msvisualcpp but w/o cygpath translation.
|
||||
# Just convert the backslash-escaped backslashes to single forward
|
||||
# slashes to satisfy depend.m4
|
||||
cygpath_u="sed s,\\\\\\\\,/,g"
|
||||
depmode=msvisualcpp
|
||||
fi
|
||||
|
||||
case "$depmode" in
|
||||
gcc3)
|
||||
## gcc 3 implements dependency tracking that does exactly what
|
||||
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
|
||||
## it if -MD -MP comes after the -MF stuff. Hmm.
|
||||
## Unfortunately, FreeBSD c89 acceptance of flags depends upon
|
||||
## the command line argument order; so add the flags where they
|
||||
## appear in depend2.am. Note that the slowdown incurred here
|
||||
## affects only configure: in makefiles, %FASTDEP% shortcuts this.
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
|
||||
*) set fnord "$@" "$arg" ;;
|
||||
esac
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
done
|
||||
"$@"
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
mv "$tmpdepfile" "$depfile"
|
||||
;;
|
||||
|
||||
gcc)
|
||||
## There are various ways to get dependency output from gcc. Here's
|
||||
## why we pick this rather obscure method:
|
||||
## - Don't want to use -MD because we'd like the dependencies to end
|
||||
## up in a subdir. Having to rename by hand is ugly.
|
||||
## (We might end up doing this anyway to support other compilers.)
|
||||
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
|
||||
## -MM, not -M (despite what the docs say).
|
||||
## - Using -M directly means running the compiler twice (even worse
|
||||
## than renaming).
|
||||
if test -z "$gccflag"; then
|
||||
gccflag=-MD,
|
||||
fi
|
||||
"$@" -Wp,"$gccflag$tmpdepfile"
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
|
||||
## The second -e expression handles DOS-style file names with drive letters.
|
||||
sed -e 's/^[^:]*: / /' \
|
||||
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
|
||||
## This next piece of magic avoids the `deleted header file' problem.
|
||||
## The problem is that when a header file which appears in a .P file
|
||||
## is deleted, the dependency causes make to die (because there is
|
||||
## typically no way to rebuild the header). We avoid this by adding
|
||||
## dummy dependencies for each header file. Too bad gcc doesn't do
|
||||
## this for us directly.
|
||||
tr ' ' '
|
||||
' < "$tmpdepfile" |
|
||||
## Some versions of gcc put a space before the `:'. On the theory
|
||||
## that the space means something, we add a space to the output as
|
||||
## well.
|
||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
## correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
hp)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
sgi)
|
||||
if test "$libtool" = yes; then
|
||||
"$@" "-Wp,-MDupdate,$tmpdepfile"
|
||||
else
|
||||
"$@" -MDupdate "$tmpdepfile"
|
||||
fi
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
|
||||
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
|
||||
echo "$object : \\" > "$depfile"
|
||||
|
||||
# Clip off the initial element (the dependent). Don't try to be
|
||||
# clever and replace this with sed code, as IRIX sed won't handle
|
||||
# lines with more than a fixed number of characters (4096 in
|
||||
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
|
||||
# the IRIX cc adds comments like `#:fec' to the end of the
|
||||
# dependency line.
|
||||
tr ' ' '
|
||||
' < "$tmpdepfile" \
|
||||
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
|
||||
tr '
|
||||
' ' ' >> "$depfile"
|
||||
echo >> "$depfile"
|
||||
|
||||
# The second pass generates a dummy entry for each header file.
|
||||
tr ' ' '
|
||||
' < "$tmpdepfile" \
|
||||
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
|
||||
>> "$depfile"
|
||||
else
|
||||
# The sourcefile does not contain any dependencies, so just
|
||||
# store a dummy comment line, to avoid errors with the Makefile
|
||||
# "include basename.Plo" scheme.
|
||||
echo "#dummy" > "$depfile"
|
||||
fi
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
aix)
|
||||
# The C for AIX Compiler uses -M and outputs the dependencies
|
||||
# in a .u file. In older versions, this file always lives in the
|
||||
# current directory. Also, the AIX compiler puts `$object:' at the
|
||||
# start of each line; $object doesn't have directory information.
|
||||
# Version 6 uses the directory in both cases.
|
||||
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
|
||||
test "x$dir" = "x$object" && dir=
|
||||
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
|
||||
if test "$libtool" = yes; then
|
||||
tmpdepfile1=$dir$base.u
|
||||
tmpdepfile2=$base.u
|
||||
tmpdepfile3=$dir.libs/$base.u
|
||||
"$@" -Wc,-M
|
||||
else
|
||||
tmpdepfile1=$dir$base.u
|
||||
tmpdepfile2=$dir$base.u
|
||||
tmpdepfile3=$dir$base.u
|
||||
"$@" -M
|
||||
fi
|
||||
stat=$?
|
||||
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||
do
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
if test -f "$tmpdepfile"; then
|
||||
# Each line is of the form `foo.o: dependent.h'.
|
||||
# Do two passes, one to just change these to
|
||||
# `$object: dependent.h' and one to simply `dependent.h:'.
|
||||
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
|
||||
# That's a tab and a space in the [].
|
||||
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
|
||||
else
|
||||
# The sourcefile does not contain any dependencies, so just
|
||||
# store a dummy comment line, to avoid errors with the Makefile
|
||||
# "include basename.Plo" scheme.
|
||||
echo "#dummy" > "$depfile"
|
||||
fi
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
icc)
|
||||
# Intel's C compiler understands `-MD -MF file'. However on
|
||||
# icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
|
||||
# ICC 7.0 will fill foo.d with something like
|
||||
# foo.o: sub/foo.c
|
||||
# foo.o: sub/foo.h
|
||||
# which is wrong. We want:
|
||||
# sub/foo.o: sub/foo.c
|
||||
# sub/foo.o: sub/foo.h
|
||||
# sub/foo.c:
|
||||
# sub/foo.h:
|
||||
# ICC 7.1 will output
|
||||
# foo.o: sub/foo.c sub/foo.h
|
||||
# and will wrap long lines using \ :
|
||||
# foo.o: sub/foo.c ... \
|
||||
# sub/foo.h ... \
|
||||
# ...
|
||||
|
||||
"$@" -MD -MF "$tmpdepfile"
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
# Each line is of the form `foo.o: dependent.h',
|
||||
# or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
|
||||
# Do two passes, one to just change these to
|
||||
# `$object: dependent.h' and one to simply `dependent.h:'.
|
||||
sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
|
||||
# Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
# correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
|
||||
sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
hp2)
|
||||
# The "hp" stanza above does not work with aCC (C++) and HP's ia64
|
||||
# compilers, which have integrated preprocessors. The correct option
|
||||
# to use with these is +Maked; it writes dependencies to a file named
|
||||
# 'foo.d', which lands next to the object file, wherever that
|
||||
# happens to be.
|
||||
# Much of this is similar to the tru64 case; see comments there.
|
||||
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
|
||||
test "x$dir" = "x$object" && dir=
|
||||
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
|
||||
if test "$libtool" = yes; then
|
||||
tmpdepfile1=$dir$base.d
|
||||
tmpdepfile2=$dir.libs/$base.d
|
||||
"$@" -Wc,+Maked
|
||||
else
|
||||
tmpdepfile1=$dir$base.d
|
||||
tmpdepfile2=$dir$base.d
|
||||
"$@" +Maked
|
||||
fi
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
|
||||
do
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
if test -f "$tmpdepfile"; then
|
||||
sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
|
||||
# Add `dependent.h:' lines.
|
||||
sed -ne '2,${
|
||||
s/^ *//
|
||||
s/ \\*$//
|
||||
s/$/:/
|
||||
p
|
||||
}' "$tmpdepfile" >> "$depfile"
|
||||
else
|
||||
echo "#dummy" > "$depfile"
|
||||
fi
|
||||
rm -f "$tmpdepfile" "$tmpdepfile2"
|
||||
;;
|
||||
|
||||
tru64)
|
||||
# The Tru64 compiler uses -MD to generate dependencies as a side
|
||||
# effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
|
||||
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
|
||||
# dependencies in `foo.d' instead, so we check for that too.
|
||||
# Subdirectories are respected.
|
||||
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
|
||||
test "x$dir" = "x$object" && dir=
|
||||
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
|
||||
|
||||
if test "$libtool" = yes; then
|
||||
# With Tru64 cc, shared objects can also be used to make a
|
||||
# static library. This mechanism is used in libtool 1.4 series to
|
||||
# handle both shared and static libraries in a single compilation.
|
||||
# With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
|
||||
#
|
||||
# With libtool 1.5 this exception was removed, and libtool now
|
||||
# generates 2 separate objects for the 2 libraries. These two
|
||||
# compilations output dependencies in $dir.libs/$base.o.d and
|
||||
# in $dir$base.o.d. We have to check for both files, because
|
||||
# one of the two compilations can be disabled. We should prefer
|
||||
# $dir$base.o.d over $dir.libs/$base.o.d because the latter is
|
||||
# automatically cleaned when .libs/ is deleted, while ignoring
|
||||
# the former would cause a distcleancheck panic.
|
||||
tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4
|
||||
tmpdepfile2=$dir$base.o.d # libtool 1.5
|
||||
tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5
|
||||
tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504
|
||||
"$@" -Wc,-MD
|
||||
else
|
||||
tmpdepfile1=$dir$base.o.d
|
||||
tmpdepfile2=$dir$base.d
|
||||
tmpdepfile3=$dir$base.d
|
||||
tmpdepfile4=$dir$base.d
|
||||
"$@" -MD
|
||||
fi
|
||||
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
|
||||
do
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
if test -f "$tmpdepfile"; then
|
||||
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
|
||||
# That's a tab and a space in the [].
|
||||
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
|
||||
else
|
||||
echo "#dummy" > "$depfile"
|
||||
fi
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
#nosideeffect)
|
||||
# This comment above is used by automake to tell side-effect
|
||||
# dependency tracking mechanisms from slower ones.
|
||||
|
||||
dashmstdout)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout, regardless of -o.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
|
||||
# Remove `-o $object'.
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-o)
|
||||
shift
|
||||
;;
|
||||
$object)
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
test -z "$dashmflag" && dashmflag=-M
|
||||
# Require at least two characters before searching for `:'
|
||||
# in the target name. This is to cope with DOS-style filenames:
|
||||
# a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
|
||||
"$@" $dashmflag |
|
||||
sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
cat < "$tmpdepfile" > "$depfile"
|
||||
tr ' ' '
|
||||
' < "$tmpdepfile" | \
|
||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
## correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
dashXmstdout)
|
||||
# This case only exists to satisfy depend.m4. It is never actually
|
||||
# run, as this mode is specially recognized in the preamble.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
makedepend)
|
||||
"$@" || exit $?
|
||||
# Remove any Libtool call
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
# X makedepend
|
||||
shift
|
||||
cleared=no eat=no
|
||||
for arg
|
||||
do
|
||||
case $cleared in
|
||||
no)
|
||||
set ""; shift
|
||||
cleared=yes ;;
|
||||
esac
|
||||
if test $eat = yes; then
|
||||
eat=no
|
||||
continue
|
||||
fi
|
||||
case "$arg" in
|
||||
-D*|-I*)
|
||||
set fnord "$@" "$arg"; shift ;;
|
||||
# Strip any option that makedepend may not understand. Remove
|
||||
# the object too, otherwise makedepend will parse it as a source file.
|
||||
-arch)
|
||||
eat=yes ;;
|
||||
-*|$object)
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"; shift ;;
|
||||
esac
|
||||
done
|
||||
obj_suffix=`echo "$object" | sed 's/^.*\././'`
|
||||
touch "$tmpdepfile"
|
||||
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
|
||||
rm -f "$depfile"
|
||||
cat < "$tmpdepfile" > "$depfile"
|
||||
sed '1,2d' "$tmpdepfile" | tr ' ' '
|
||||
' | \
|
||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
## correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile" "$tmpdepfile".bak
|
||||
;;
|
||||
|
||||
cpp)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
|
||||
# Remove `-o $object'.
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-o)
|
||||
shift
|
||||
;;
|
||||
$object)
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
"$@" -E |
|
||||
sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
|
||||
-e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
|
||||
sed '$ s: \\$::' > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
cat < "$tmpdepfile" >> "$depfile"
|
||||
sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
msvisualcpp)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case "$arg" in
|
||||
-o)
|
||||
shift
|
||||
;;
|
||||
$object)
|
||||
shift
|
||||
;;
|
||||
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
|
||||
set fnord "$@"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
"$@" -E 2>/dev/null |
|
||||
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
|
||||
echo " " >> "$depfile"
|
||||
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
msvcmsys)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
none)
|
||||
exec "$@"
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Unknown depmode $depmode" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 2
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
121
do_release
121
do_release
@ -1,121 +0,0 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# do a smartmontools release
|
||||
# (C) 2003-9 Bruce Allen <ballen4705@users.sourceforge.net>,
|
||||
# Guido Guenther <agx@sigxcpu.org>
|
||||
# Christian Franke <smartmontools-support@lists.sourceforge.net>
|
||||
# $Id: do_release 2970 2009-10-26 18:36:22Z chrfranke $
|
||||
|
||||
# Notes on generating releases:
|
||||
# (1) update NEWS
|
||||
# (2) update CHANGELOG -- put in release number
|
||||
# (3) update release number in configure.in
|
||||
# (4) to test, run without '--commit'
|
||||
# (5) when satisfied, add option '--commit'
|
||||
|
||||
set -e
|
||||
|
||||
inc_release()
|
||||
{
|
||||
MINOR=`echo $VERSION | cut -d. -f2`
|
||||
MAJOR=`echo $VERSION | cut -d. -f1`
|
||||
PERL_OLD=$MAJOR\\.$MINOR
|
||||
((MINOR++))
|
||||
NEW_VERSION=$MAJOR.$MINOR
|
||||
PERL_NEW=$MAJOR\\.$MINOR
|
||||
NEW_RELEASE="RELEASE_${NEW_VERSION//\./_}"
|
||||
echo "New Version: $NEW_VERSION"
|
||||
echo "New Release: $NEW_RELEASE"
|
||||
}
|
||||
|
||||
COMMIT=
|
||||
RC=
|
||||
|
||||
case "$1" in
|
||||
--commit) COMMIT=yes; shift ;;
|
||||
esac
|
||||
|
||||
case "$*" in
|
||||
RC[1-9]) RC="$1" ;;
|
||||
FINAL) ;;
|
||||
*) echo "Usage: $0 [--commit] RC[1-9]|FINAL"; exit 1 ;;
|
||||
esac
|
||||
|
||||
# Check workdir
|
||||
case "`/bin/pwd`" in
|
||||
*/trunk/smartmontools) ;;
|
||||
*) echo "not run from trunk checkout"; exit 1 ;;
|
||||
esac
|
||||
|
||||
if [ ! -d ../../tags ]; then
|
||||
echo "tags directory missing"; exit 1
|
||||
fi
|
||||
|
||||
REV=`(cd ../.. && svnversion)` || exit 1
|
||||
if [ -z "`echo "$REV" | sed -n '/^[0-9][0-9]*$/p'`" ]; then
|
||||
echo "Working directory not clean: $REV"; exit 1
|
||||
fi
|
||||
|
||||
# Get release number
|
||||
VERSION=`sed -n 's|^AC_INIT[^,]*, *\([0-9.]*\) *,.*$|\1|p' configure.in`
|
||||
if [ -z "$VERSION" ]; then
|
||||
echo "AC_INIT not found in configure.in"; exit 1
|
||||
fi
|
||||
VERSIONRC="$VERSION"
|
||||
RELEASE="RELEASE_${VERSION//\./_}"
|
||||
|
||||
if [ "$RC" ]; then
|
||||
VERSIONRC="${VERSION}-${RC/#RC/rc}"
|
||||
RELEASE="${RELEASE}_${RC}"
|
||||
fi
|
||||
|
||||
if [ -e "../../tags/$RELEASE" ]; then
|
||||
echo "tags/$RELEASE exists"; exit 1
|
||||
fi
|
||||
|
||||
echo "r$REV: Release $VERSIONRC $RELEASE"
|
||||
set -v
|
||||
|
||||
# Update timestamp
|
||||
smartmontools_release_date=`date -u +"%Y-%m-%d"`
|
||||
smartmontools_release_time=`date -u +"%T %Z"`
|
||||
cat configure.in | sed "s|smartmontools_release_date=.*|smartmontools_release_date=${smartmontools_release_date}|" > configure.tmp
|
||||
cat configure.tmp | sed "s|smartmontools_release_time=.*|smartmontools_release_time=\"${smartmontools_release_time}\"|" > configure.in
|
||||
rm -f configure.tmp
|
||||
|
||||
# Create tag and commit
|
||||
cd ../..
|
||||
if [ "$COMMIT" = "yes" ]; then
|
||||
svn mkdir tags/$RELEASE
|
||||
svn copy trunk/smartmontools tags/$RELEASE/smartmontools
|
||||
svn commit -m "Release $VERSIONRC $RELEASE"
|
||||
fi
|
||||
cd trunk/smartmontools
|
||||
|
||||
# Build
|
||||
./autogen.sh
|
||||
|
||||
mkdir build
|
||||
cd build
|
||||
../configure
|
||||
make distcheck || exit 1
|
||||
make maintainer-clean
|
||||
cd ..
|
||||
|
||||
TARFILE=smartmontools-$VERSIONRC.tar.gz
|
||||
|
||||
mv -f build/smartmontools-$VERSION.tar.gz $TARFILE
|
||||
rm -rvf build
|
||||
|
||||
md5sum $TARFILE > $TARFILE.md5
|
||||
sha1sum $TARFILE > $TARFILE.sha1
|
||||
|
||||
# Increase release number
|
||||
if [ -z "$RC" ]; then
|
||||
inc_release
|
||||
if [ "$COMMIT" = "yes" ]; then
|
||||
perl -p -i.bak -e "s/$PERL_OLD/$PERL_NEW/" configure.in
|
||||
# svn commit -m "Bump release number to $NEW_VERSION" configure.in
|
||||
fi
|
||||
fi
|
||||
|
448
examplescripts/Makefile.in
Normal file
448
examplescripts/Makefile.in
Normal file
@ -0,0 +1,448 @@
|
||||
# Makefile.in generated by automake 1.11 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
|
||||
# Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
#
|
||||
# $Id: Makefile.am 2846 2009-07-18 14:18:51Z chrfranke $
|
||||
#
|
||||
|
||||
|
||||
VPATH = @srcdir@
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
subdir = examplescripts
|
||||
DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/configure.in
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = $(top_builddir)/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
|
||||
am__vpath_adj = case $$p in \
|
||||
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
|
||||
*) f=$$p;; \
|
||||
esac;
|
||||
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
|
||||
am__install_max = 40
|
||||
am__nobase_strip_setup = \
|
||||
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
|
||||
am__nobase_strip = \
|
||||
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
|
||||
am__nobase_list = $(am__nobase_strip_setup); \
|
||||
for p in $$list; do echo "$$p $$p"; done | \
|
||||
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
|
||||
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
|
||||
if (++n[$$2] == $(am__install_max)) \
|
||||
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
|
||||
END { for (dir in files) print dir, files[dir] }'
|
||||
am__base_list = \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
|
||||
am__installdirs = "$(DESTDIR)$(examplesdir)" \
|
||||
"$(DESTDIR)$(examplesdir)"
|
||||
SCRIPTS = $(examples_SCRIPTS)
|
||||
SOURCES =
|
||||
DIST_SOURCES =
|
||||
DATA = $(examples_DATA)
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMTAR = @AMTAR@
|
||||
ASFLAGS = @ASFLAGS@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCAS = @CCAS@
|
||||
CCASDEPMODE = @CCASDEPMODE@
|
||||
CCASFLAGS = @CCASFLAGS@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CXX = @CXX@
|
||||
CXXCPP = @CXXCPP@
|
||||
CXXDEPMODE = @CXXDEPMODE@
|
||||
CXXFLAGS = @CXXFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
GREP = @GREP@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAINT = @MAINT@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
OBJEXT = @OBJEXT@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_URL = @PACKAGE_URL@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
VERSION = @VERSION@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_CXX = @ac_ct_CXX@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
attributelog = @attributelog@
|
||||
attributelogdir = @attributelogdir@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
builddir = @builddir@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
docdir = @docdir@
|
||||
drivedbdir = @drivedbdir@
|
||||
dvidir = @dvidir@
|
||||
exampledir = @exampledir@
|
||||
exec_prefix = @exec_prefix@
|
||||
gcc_have_attr_packed = @gcc_have_attr_packed@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
htmldir = @htmldir@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
initddir = @initddir@
|
||||
install_sh = @install_sh@
|
||||
libc_have_working_snprintf = @libc_have_working_snprintf@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
os_deps = @os_deps@
|
||||
os_libs = @os_libs@
|
||||
pdfdir = @pdfdir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
releaseversion = @releaseversion@
|
||||
savestates = @savestates@
|
||||
savestatesdir = @savestatesdir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
smartd_suffix = @smartd_suffix@
|
||||
smartmontools_release_date = @smartmontools_release_date@
|
||||
smartmontools_release_time = @smartmontools_release_time@
|
||||
srcdir = @srcdir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
with_selinux = @with_selinux@
|
||||
examplesdir = $(exampledir)
|
||||
examples_DATA = README
|
||||
examples_SCRIPTS = Example1 \
|
||||
Example2 \
|
||||
Example3 \
|
||||
Example4
|
||||
|
||||
EXTRA_DIST = $(examples_SCRIPTS)
|
||||
MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
|
||||
&& { if test -f $@; then exit 0; else break; fi; }; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign examplescripts/Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --foreign examplescripts/Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(am__aclocal_m4_deps):
|
||||
install-examplesSCRIPTS: $(examples_SCRIPTS)
|
||||
@$(NORMAL_INSTALL)
|
||||
test -z "$(examplesdir)" || $(MKDIR_P) "$(DESTDIR)$(examplesdir)"
|
||||
@list='$(examples_SCRIPTS)'; test -n "$(examplesdir)" || list=; \
|
||||
for p in $$list; do \
|
||||
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
|
||||
if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \
|
||||
done | \
|
||||
sed -e 'p;s,.*/,,;n' \
|
||||
-e 'h;s|.*|.|' \
|
||||
-e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \
|
||||
$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \
|
||||
{ d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
|
||||
if ($$2 == $$4) { files[d] = files[d] " " $$1; \
|
||||
if (++n[d] == $(am__install_max)) { \
|
||||
print "f", d, files[d]; n[d] = 0; files[d] = "" } } \
|
||||
else { print "f", d "/" $$4, $$1 } } \
|
||||
END { for (d in files) print "f", d, files[d] }' | \
|
||||
while read type dir files; do \
|
||||
if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
|
||||
test -z "$$files" || { \
|
||||
echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(examplesdir)$$dir'"; \
|
||||
$(INSTALL_SCRIPT) $$files "$(DESTDIR)$(examplesdir)$$dir" || exit $$?; \
|
||||
} \
|
||||
; done
|
||||
|
||||
uninstall-examplesSCRIPTS:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(examples_SCRIPTS)'; test -n "$(examplesdir)" || exit 0; \
|
||||
files=`for p in $$list; do echo "$$p"; done | \
|
||||
sed -e 's,.*/,,;$(transform)'`; \
|
||||
test -n "$$list" || exit 0; \
|
||||
echo " ( cd '$(DESTDIR)$(examplesdir)' && rm -f" $$files ")"; \
|
||||
cd "$(DESTDIR)$(examplesdir)" && rm -f $$files
|
||||
install-examplesDATA: $(examples_DATA)
|
||||
@$(NORMAL_INSTALL)
|
||||
test -z "$(examplesdir)" || $(MKDIR_P) "$(DESTDIR)$(examplesdir)"
|
||||
@list='$(examples_DATA)'; test -n "$(examplesdir)" || list=; \
|
||||
for p in $$list; do \
|
||||
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
|
||||
echo "$$d$$p"; \
|
||||
done | $(am__base_list) | \
|
||||
while read files; do \
|
||||
echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(examplesdir)'"; \
|
||||
$(INSTALL_DATA) $$files "$(DESTDIR)$(examplesdir)" || exit $$?; \
|
||||
done
|
||||
|
||||
uninstall-examplesDATA:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(examples_DATA)'; test -n "$(examplesdir)" || list=; \
|
||||
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
|
||||
test -n "$$files" || exit 0; \
|
||||
echo " ( cd '$(DESTDIR)$(examplesdir)' && rm -f" $$files ")"; \
|
||||
cd "$(DESTDIR)$(examplesdir)" && rm -f $$files
|
||||
tags: TAGS
|
||||
TAGS:
|
||||
|
||||
ctags: CTAGS
|
||||
CTAGS:
|
||||
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
list='$(DISTFILES)'; \
|
||||
dist_files=`for file in $$list; do echo $$file; done | \
|
||||
sed -e "s|^$$srcdirstrip/||;t" \
|
||||
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||
case $$dist_files in \
|
||||
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||
sort -u` ;; \
|
||||
esac; \
|
||||
for file in $$dist_files; do \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test -d "$(distdir)/$$file"; then \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
|
||||
else \
|
||||
test -f "$(distdir)/$$file" \
|
||||
|| cp -p $$d/$$file "$(distdir)/$$file" \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
all-am: Makefile $(SCRIPTS) $(DATA)
|
||||
installdirs:
|
||||
for dir in "$(DESTDIR)$(examplesdir)" "$(DESTDIR)$(examplesdir)"; do \
|
||||
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
|
||||
done
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
`test -z '$(STRIP)' || \
|
||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-generic mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-generic
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-am
|
||||
|
||||
html-am:
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am: install-examplesDATA install-examplesSCRIPTS
|
||||
|
||||
install-dvi: install-dvi-am
|
||||
|
||||
install-dvi-am:
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-html: install-html-am
|
||||
|
||||
install-html-am:
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-info-am:
|
||||
|
||||
install-man:
|
||||
|
||||
install-pdf: install-pdf-am
|
||||
|
||||
install-pdf-am:
|
||||
|
||||
install-ps: install-ps-am
|
||||
|
||||
install-ps-am:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-generic
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am: uninstall-examplesDATA uninstall-examplesSCRIPTS
|
||||
|
||||
.MAKE: install-am install-strip
|
||||
|
||||
.PHONY: all all-am check check-am clean clean-generic distclean \
|
||||
distclean-generic distdir dvi dvi-am html html-am info info-am \
|
||||
install install-am install-data install-data-am install-dvi \
|
||||
install-dvi-am install-examplesDATA install-examplesSCRIPTS \
|
||||
install-exec install-exec-am install-html install-html-am \
|
||||
install-info install-info-am install-man install-pdf \
|
||||
install-pdf-am install-ps install-ps-am install-strip \
|
||||
installcheck installcheck-am installdirs maintainer-clean \
|
||||
maintainer-clean-generic mostlyclean mostlyclean-generic pdf \
|
||||
pdf-am ps ps-am uninstall uninstall-am uninstall-examplesDATA \
|
||||
uninstall-examplesSCRIPTS
|
||||
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
520
install-sh
Executable file
520
install-sh
Executable file
@ -0,0 +1,520 @@
|
||||
#!/bin/sh
|
||||
# install - install a program, script, or datafile
|
||||
|
||||
scriptversion=2009-04-28.21; # UTC
|
||||
|
||||
# This originates from X11R5 (mit/util/scripts/install.sh), which was
|
||||
# later released in X11R6 (xc/config/util/install.sh) with the
|
||||
# following copyright and license.
|
||||
#
|
||||
# Copyright (C) 1994 X Consortium
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to
|
||||
# deal in the Software without restriction, including without limitation the
|
||||
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
# sell copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
|
||||
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
# Except as contained in this notice, the name of the X Consortium shall not
|
||||
# be used in advertising or otherwise to promote the sale, use or other deal-
|
||||
# ings in this Software without prior written authorization from the X Consor-
|
||||
# tium.
|
||||
#
|
||||
#
|
||||
# FSF changes to this file are in the public domain.
|
||||
#
|
||||
# Calling this script install-sh is preferred over install.sh, to prevent
|
||||
# `make' implicit rules from creating a file called install from it
|
||||
# when there is no Makefile.
|
||||
#
|
||||
# This script is compatible with the BSD install script, but was written
|
||||
# from scratch.
|
||||
|
||||
nl='
|
||||
'
|
||||
IFS=" "" $nl"
|
||||
|
||||
# set DOITPROG to echo to test this script
|
||||
|
||||
# Don't use :- since 4.3BSD and earlier shells don't like it.
|
||||
doit=${DOITPROG-}
|
||||
if test -z "$doit"; then
|
||||
doit_exec=exec
|
||||
else
|
||||
doit_exec=$doit
|
||||
fi
|
||||
|
||||
# Put in absolute file names if you don't have them in your path;
|
||||
# or use environment vars.
|
||||
|
||||
chgrpprog=${CHGRPPROG-chgrp}
|
||||
chmodprog=${CHMODPROG-chmod}
|
||||
chownprog=${CHOWNPROG-chown}
|
||||
cmpprog=${CMPPROG-cmp}
|
||||
cpprog=${CPPROG-cp}
|
||||
mkdirprog=${MKDIRPROG-mkdir}
|
||||
mvprog=${MVPROG-mv}
|
||||
rmprog=${RMPROG-rm}
|
||||
stripprog=${STRIPPROG-strip}
|
||||
|
||||
posix_glob='?'
|
||||
initialize_posix_glob='
|
||||
test "$posix_glob" != "?" || {
|
||||
if (set -f) 2>/dev/null; then
|
||||
posix_glob=
|
||||
else
|
||||
posix_glob=:
|
||||
fi
|
||||
}
|
||||
'
|
||||
|
||||
posix_mkdir=
|
||||
|
||||
# Desired mode of installed file.
|
||||
mode=0755
|
||||
|
||||
chgrpcmd=
|
||||
chmodcmd=$chmodprog
|
||||
chowncmd=
|
||||
mvcmd=$mvprog
|
||||
rmcmd="$rmprog -f"
|
||||
stripcmd=
|
||||
|
||||
src=
|
||||
dst=
|
||||
dir_arg=
|
||||
dst_arg=
|
||||
|
||||
copy_on_change=false
|
||||
no_target_directory=
|
||||
|
||||
usage="\
|
||||
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
|
||||
or: $0 [OPTION]... SRCFILES... DIRECTORY
|
||||
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
|
||||
or: $0 [OPTION]... -d DIRECTORIES...
|
||||
|
||||
In the 1st form, copy SRCFILE to DSTFILE.
|
||||
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
|
||||
In the 4th, create DIRECTORIES.
|
||||
|
||||
Options:
|
||||
--help display this help and exit.
|
||||
--version display version info and exit.
|
||||
|
||||
-c (ignored)
|
||||
-C install only if different (preserve the last data modification time)
|
||||
-d create directories instead of installing files.
|
||||
-g GROUP $chgrpprog installed files to GROUP.
|
||||
-m MODE $chmodprog installed files to MODE.
|
||||
-o USER $chownprog installed files to USER.
|
||||
-s $stripprog installed files.
|
||||
-t DIRECTORY install into DIRECTORY.
|
||||
-T report an error if DSTFILE is a directory.
|
||||
|
||||
Environment variables override the default commands:
|
||||
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
|
||||
RMPROG STRIPPROG
|
||||
"
|
||||
|
||||
while test $# -ne 0; do
|
||||
case $1 in
|
||||
-c) ;;
|
||||
|
||||
-C) copy_on_change=true;;
|
||||
|
||||
-d) dir_arg=true;;
|
||||
|
||||
-g) chgrpcmd="$chgrpprog $2"
|
||||
shift;;
|
||||
|
||||
--help) echo "$usage"; exit $?;;
|
||||
|
||||
-m) mode=$2
|
||||
case $mode in
|
||||
*' '* | *' '* | *'
|
||||
'* | *'*'* | *'?'* | *'['*)
|
||||
echo "$0: invalid mode: $mode" >&2
|
||||
exit 1;;
|
||||
esac
|
||||
shift;;
|
||||
|
||||
-o) chowncmd="$chownprog $2"
|
||||
shift;;
|
||||
|
||||
-s) stripcmd=$stripprog;;
|
||||
|
||||
-t) dst_arg=$2
|
||||
shift;;
|
||||
|
||||
-T) no_target_directory=true;;
|
||||
|
||||
--version) echo "$0 $scriptversion"; exit $?;;
|
||||
|
||||
--) shift
|
||||
break;;
|
||||
|
||||
-*) echo "$0: invalid option: $1" >&2
|
||||
exit 1;;
|
||||
|
||||
*) break;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
|
||||
# When -d is used, all remaining arguments are directories to create.
|
||||
# When -t is used, the destination is already specified.
|
||||
# Otherwise, the last argument is the destination. Remove it from $@.
|
||||
for arg
|
||||
do
|
||||
if test -n "$dst_arg"; then
|
||||
# $@ is not empty: it contains at least $arg.
|
||||
set fnord "$@" "$dst_arg"
|
||||
shift # fnord
|
||||
fi
|
||||
shift # arg
|
||||
dst_arg=$arg
|
||||
done
|
||||
fi
|
||||
|
||||
if test $# -eq 0; then
|
||||
if test -z "$dir_arg"; then
|
||||
echo "$0: no input file specified." >&2
|
||||
exit 1
|
||||
fi
|
||||
# It's OK to call `install-sh -d' without argument.
|
||||
# This can happen when creating conditional directories.
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if test -z "$dir_arg"; then
|
||||
trap '(exit $?); exit' 1 2 13 15
|
||||
|
||||
# Set umask so as not to create temps with too-generous modes.
|
||||
# However, 'strip' requires both read and write access to temps.
|
||||
case $mode in
|
||||
# Optimize common cases.
|
||||
*644) cp_umask=133;;
|
||||
*755) cp_umask=22;;
|
||||
|
||||
*[0-7])
|
||||
if test -z "$stripcmd"; then
|
||||
u_plus_rw=
|
||||
else
|
||||
u_plus_rw='% 200'
|
||||
fi
|
||||
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
|
||||
*)
|
||||
if test -z "$stripcmd"; then
|
||||
u_plus_rw=
|
||||
else
|
||||
u_plus_rw=,u+rw
|
||||
fi
|
||||
cp_umask=$mode$u_plus_rw;;
|
||||
esac
|
||||
fi
|
||||
|
||||
for src
|
||||
do
|
||||
# Protect names starting with `-'.
|
||||
case $src in
|
||||
-*) src=./$src;;
|
||||
esac
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
dst=$src
|
||||
dstdir=$dst
|
||||
test -d "$dstdir"
|
||||
dstdir_status=$?
|
||||
else
|
||||
|
||||
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
|
||||
# might cause directories to be created, which would be especially bad
|
||||
# if $src (and thus $dsttmp) contains '*'.
|
||||
if test ! -f "$src" && test ! -d "$src"; then
|
||||
echo "$0: $src does not exist." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test -z "$dst_arg"; then
|
||||
echo "$0: no destination specified." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
dst=$dst_arg
|
||||
# Protect names starting with `-'.
|
||||
case $dst in
|
||||
-*) dst=./$dst;;
|
||||
esac
|
||||
|
||||
# If destination is a directory, append the input filename; won't work
|
||||
# if double slashes aren't ignored.
|
||||
if test -d "$dst"; then
|
||||
if test -n "$no_target_directory"; then
|
||||
echo "$0: $dst_arg: Is a directory" >&2
|
||||
exit 1
|
||||
fi
|
||||
dstdir=$dst
|
||||
dst=$dstdir/`basename "$src"`
|
||||
dstdir_status=0
|
||||
else
|
||||
# Prefer dirname, but fall back on a substitute if dirname fails.
|
||||
dstdir=`
|
||||
(dirname "$dst") 2>/dev/null ||
|
||||
expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
|
||||
X"$dst" : 'X\(//\)[^/]' \| \
|
||||
X"$dst" : 'X\(//\)$' \| \
|
||||
X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
|
||||
echo X"$dst" |
|
||||
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
|
||||
s//\1/
|
||||
q
|
||||
}
|
||||
/^X\(\/\/\)[^/].*/{
|
||||
s//\1/
|
||||
q
|
||||
}
|
||||
/^X\(\/\/\)$/{
|
||||
s//\1/
|
||||
q
|
||||
}
|
||||
/^X\(\/\).*/{
|
||||
s//\1/
|
||||
q
|
||||
}
|
||||
s/.*/./; q'
|
||||
`
|
||||
|
||||
test -d "$dstdir"
|
||||
dstdir_status=$?
|
||||
fi
|
||||
fi
|
||||
|
||||
obsolete_mkdir_used=false
|
||||
|
||||
if test $dstdir_status != 0; then
|
||||
case $posix_mkdir in
|
||||
'')
|
||||
# Create intermediate dirs using mode 755 as modified by the umask.
|
||||
# This is like FreeBSD 'install' as of 1997-10-28.
|
||||
umask=`umask`
|
||||
case $stripcmd.$umask in
|
||||
# Optimize common cases.
|
||||
*[2367][2367]) mkdir_umask=$umask;;
|
||||
.*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
|
||||
|
||||
*[0-7])
|
||||
mkdir_umask=`expr $umask + 22 \
|
||||
- $umask % 100 % 40 + $umask % 20 \
|
||||
- $umask % 10 % 4 + $umask % 2
|
||||
`;;
|
||||
*) mkdir_umask=$umask,go-w;;
|
||||
esac
|
||||
|
||||
# With -d, create the new directory with the user-specified mode.
|
||||
# Otherwise, rely on $mkdir_umask.
|
||||
if test -n "$dir_arg"; then
|
||||
mkdir_mode=-m$mode
|
||||
else
|
||||
mkdir_mode=
|
||||
fi
|
||||
|
||||
posix_mkdir=false
|
||||
case $umask in
|
||||
*[123567][0-7][0-7])
|
||||
# POSIX mkdir -p sets u+wx bits regardless of umask, which
|
||||
# is incompatible with FreeBSD 'install' when (umask & 300) != 0.
|
||||
;;
|
||||
*)
|
||||
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
|
||||
trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
|
||||
|
||||
if (umask $mkdir_umask &&
|
||||
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
|
||||
then
|
||||
if test -z "$dir_arg" || {
|
||||
# Check for POSIX incompatibilities with -m.
|
||||
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
|
||||
# other-writeable bit of parent directory when it shouldn't.
|
||||
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
|
||||
ls_ld_tmpdir=`ls -ld "$tmpdir"`
|
||||
case $ls_ld_tmpdir in
|
||||
d????-?r-*) different_mode=700;;
|
||||
d????-?--*) different_mode=755;;
|
||||
*) false;;
|
||||
esac &&
|
||||
$mkdirprog -m$different_mode -p -- "$tmpdir" && {
|
||||
ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
|
||||
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
|
||||
}
|
||||
}
|
||||
then posix_mkdir=:
|
||||
fi
|
||||
rmdir "$tmpdir/d" "$tmpdir"
|
||||
else
|
||||
# Remove any dirs left behind by ancient mkdir implementations.
|
||||
rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
|
||||
fi
|
||||
trap '' 0;;
|
||||
esac;;
|
||||
esac
|
||||
|
||||
if
|
||||
$posix_mkdir && (
|
||||
umask $mkdir_umask &&
|
||||
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
|
||||
)
|
||||
then :
|
||||
else
|
||||
|
||||
# The umask is ridiculous, or mkdir does not conform to POSIX,
|
||||
# or it failed possibly due to a race condition. Create the
|
||||
# directory the slow way, step by step, checking for races as we go.
|
||||
|
||||
case $dstdir in
|
||||
/*) prefix='/';;
|
||||
-*) prefix='./';;
|
||||
*) prefix='';;
|
||||
esac
|
||||
|
||||
eval "$initialize_posix_glob"
|
||||
|
||||
oIFS=$IFS
|
||||
IFS=/
|
||||
$posix_glob set -f
|
||||
set fnord $dstdir
|
||||
shift
|
||||
$posix_glob set +f
|
||||
IFS=$oIFS
|
||||
|
||||
prefixes=
|
||||
|
||||
for d
|
||||
do
|
||||
test -z "$d" && continue
|
||||
|
||||
prefix=$prefix$d
|
||||
if test -d "$prefix"; then
|
||||
prefixes=
|
||||
else
|
||||
if $posix_mkdir; then
|
||||
(umask=$mkdir_umask &&
|
||||
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
|
||||
# Don't fail if two instances are running concurrently.
|
||||
test -d "$prefix" || exit 1
|
||||
else
|
||||
case $prefix in
|
||||
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
|
||||
*) qprefix=$prefix;;
|
||||
esac
|
||||
prefixes="$prefixes '$qprefix'"
|
||||
fi
|
||||
fi
|
||||
prefix=$prefix/
|
||||
done
|
||||
|
||||
if test -n "$prefixes"; then
|
||||
# Don't fail if two instances are running concurrently.
|
||||
(umask $mkdir_umask &&
|
||||
eval "\$doit_exec \$mkdirprog $prefixes") ||
|
||||
test -d "$dstdir" || exit 1
|
||||
obsolete_mkdir_used=true
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
{ test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
|
||||
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
|
||||
{ test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
|
||||
test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
|
||||
else
|
||||
|
||||
# Make a couple of temp file names in the proper directory.
|
||||
dsttmp=$dstdir/_inst.$$_
|
||||
rmtmp=$dstdir/_rm.$$_
|
||||
|
||||
# Trap to clean up those temp files at exit.
|
||||
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
|
||||
|
||||
# Copy the file name to the temp name.
|
||||
(umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
|
||||
|
||||
# and set any options; do chmod last to preserve setuid bits.
|
||||
#
|
||||
# If any of these fail, we abort the whole thing. If we want to
|
||||
# ignore errors from any of these, just make sure not to ignore
|
||||
# errors from the above "$doit $cpprog $src $dsttmp" command.
|
||||
#
|
||||
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
|
||||
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
|
||||
{ test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
|
||||
{ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
|
||||
|
||||
# If -C, don't bother to copy if it wouldn't change the file.
|
||||
if $copy_on_change &&
|
||||
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
|
||||
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
|
||||
|
||||
eval "$initialize_posix_glob" &&
|
||||
$posix_glob set -f &&
|
||||
set X $old && old=:$2:$4:$5:$6 &&
|
||||
set X $new && new=:$2:$4:$5:$6 &&
|
||||
$posix_glob set +f &&
|
||||
|
||||
test "$old" = "$new" &&
|
||||
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
|
||||
then
|
||||
rm -f "$dsttmp"
|
||||
else
|
||||
# Rename the file to the real destination.
|
||||
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
|
||||
|
||||
# The rename failed, perhaps because mv can't rename something else
|
||||
# to itself, or perhaps because mv is so ancient that it does not
|
||||
# support -f.
|
||||
{
|
||||
# Now remove or move aside any old file at destination location.
|
||||
# We try this two ways since rm can't unlink itself on some
|
||||
# systems and the destination file might be busy for other
|
||||
# reasons. In this case, the final cleanup might fail but the new
|
||||
# file should still install successfully.
|
||||
{
|
||||
test ! -f "$dst" ||
|
||||
$doit $rmcmd -f "$dst" 2>/dev/null ||
|
||||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
|
||||
{ $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
|
||||
} ||
|
||||
{ echo "$0: cannot unlink or rename $dst" >&2
|
||||
(exit 1); exit 1
|
||||
}
|
||||
} &&
|
||||
|
||||
# Now rename the file to the real destination.
|
||||
$doit $mvcmd "$dsttmp" "$dst"
|
||||
}
|
||||
fi || exit 1
|
||||
|
||||
trap '' 0
|
||||
fi
|
||||
done
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
376
missing
Executable file
376
missing
Executable file
@ -0,0 +1,376 @@
|
||||
#! /bin/sh
|
||||
# Common stub for a few missing GNU programs while installing.
|
||||
|
||||
scriptversion=2009-04-28.21; # UTC
|
||||
|
||||
# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006,
|
||||
# 2008, 2009 Free Software Foundation, Inc.
|
||||
# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
if test $# -eq 0; then
|
||||
echo 1>&2 "Try \`$0 --help' for more information"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
run=:
|
||||
sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
|
||||
sed_minuso='s/.* -o \([^ ]*\).*/\1/p'
|
||||
|
||||
# In the cases where this matters, `missing' is being run in the
|
||||
# srcdir already.
|
||||
if test -f configure.ac; then
|
||||
configure_ac=configure.ac
|
||||
else
|
||||
configure_ac=configure.in
|
||||
fi
|
||||
|
||||
msg="missing on your system"
|
||||
|
||||
case $1 in
|
||||
--run)
|
||||
# Try to run requested program, and just exit if it succeeds.
|
||||
run=
|
||||
shift
|
||||
"$@" && exit 0
|
||||
# Exit code 63 means version mismatch. This often happens
|
||||
# when the user try to use an ancient version of a tool on
|
||||
# a file that requires a minimum version. In this case we
|
||||
# we should proceed has if the program had been absent, or
|
||||
# if --run hadn't been passed.
|
||||
if test $? = 63; then
|
||||
run=:
|
||||
msg="probably too old"
|
||||
fi
|
||||
;;
|
||||
|
||||
-h|--h|--he|--hel|--help)
|
||||
echo "\
|
||||
$0 [OPTION]... PROGRAM [ARGUMENT]...
|
||||
|
||||
Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
|
||||
error status if there is no known handling for PROGRAM.
|
||||
|
||||
Options:
|
||||
-h, --help display this help and exit
|
||||
-v, --version output version information and exit
|
||||
--run try to run the given command, and emulate it if it fails
|
||||
|
||||
Supported PROGRAM values:
|
||||
aclocal touch file \`aclocal.m4'
|
||||
autoconf touch file \`configure'
|
||||
autoheader touch file \`config.h.in'
|
||||
autom4te touch the output file, or create a stub one
|
||||
automake touch all \`Makefile.in' files
|
||||
bison create \`y.tab.[ch]', if possible, from existing .[ch]
|
||||
flex create \`lex.yy.c', if possible, from existing .c
|
||||
help2man touch the output file
|
||||
lex create \`lex.yy.c', if possible, from existing .c
|
||||
makeinfo touch the output file
|
||||
tar try tar, gnutar, gtar, then tar without non-portable flags
|
||||
yacc create \`y.tab.[ch]', if possible, from existing .[ch]
|
||||
|
||||
Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and
|
||||
\`g' are ignored when checking the name.
|
||||
|
||||
Send bug reports to <bug-automake@gnu.org>."
|
||||
exit $?
|
||||
;;
|
||||
|
||||
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
|
||||
echo "missing $scriptversion (GNU Automake)"
|
||||
exit $?
|
||||
;;
|
||||
|
||||
-*)
|
||||
echo 1>&2 "$0: Unknown \`$1' option"
|
||||
echo 1>&2 "Try \`$0 --help' for more information"
|
||||
exit 1
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
# normalize program name to check for.
|
||||
program=`echo "$1" | sed '
|
||||
s/^gnu-//; t
|
||||
s/^gnu//; t
|
||||
s/^g//; t'`
|
||||
|
||||
# Now exit if we have it, but it failed. Also exit now if we
|
||||
# don't have it and --version was passed (most likely to detect
|
||||
# the program). This is about non-GNU programs, so use $1 not
|
||||
# $program.
|
||||
case $1 in
|
||||
lex*|yacc*)
|
||||
# Not GNU programs, they don't have --version.
|
||||
;;
|
||||
|
||||
tar*)
|
||||
if test -n "$run"; then
|
||||
echo 1>&2 "ERROR: \`tar' requires --run"
|
||||
exit 1
|
||||
elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
|
||||
*)
|
||||
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
|
||||
# We have it, but it failed.
|
||||
exit 1
|
||||
elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
|
||||
# Could not run --version or --help. This is probably someone
|
||||
# running `$TOOL --version' or `$TOOL --help' to check whether
|
||||
# $TOOL exists and not knowing $TOOL uses missing.
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
# If it does not exist, or fails to run (possibly an outdated version),
|
||||
# try to emulate it.
|
||||
case $program in
|
||||
aclocal*)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. You should only need it if
|
||||
you modified \`acinclude.m4' or \`${configure_ac}'. You might want
|
||||
to install the \`Automake' and \`Perl' packages. Grab them from
|
||||
any GNU archive site."
|
||||
touch aclocal.m4
|
||||
;;
|
||||
|
||||
autoconf*)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. You should only need it if
|
||||
you modified \`${configure_ac}'. You might want to install the
|
||||
\`Autoconf' and \`GNU m4' packages. Grab them from any GNU
|
||||
archive site."
|
||||
touch configure
|
||||
;;
|
||||
|
||||
autoheader*)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. You should only need it if
|
||||
you modified \`acconfig.h' or \`${configure_ac}'. You might want
|
||||
to install the \`Autoconf' and \`GNU m4' packages. Grab them
|
||||
from any GNU archive site."
|
||||
files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
|
||||
test -z "$files" && files="config.h"
|
||||
touch_files=
|
||||
for f in $files; do
|
||||
case $f in
|
||||
*:*) touch_files="$touch_files "`echo "$f" |
|
||||
sed -e 's/^[^:]*://' -e 's/:.*//'`;;
|
||||
*) touch_files="$touch_files $f.in";;
|
||||
esac
|
||||
done
|
||||
touch $touch_files
|
||||
;;
|
||||
|
||||
automake*)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. You should only need it if
|
||||
you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
|
||||
You might want to install the \`Automake' and \`Perl' packages.
|
||||
Grab them from any GNU archive site."
|
||||
find . -type f -name Makefile.am -print |
|
||||
sed 's/\.am$/.in/' |
|
||||
while read f; do touch "$f"; done
|
||||
;;
|
||||
|
||||
autom4te*)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is needed, but is $msg.
|
||||
You might have modified some files without having the
|
||||
proper tools for further handling them.
|
||||
You can get \`$1' as part of \`Autoconf' from any GNU
|
||||
archive site."
|
||||
|
||||
file=`echo "$*" | sed -n "$sed_output"`
|
||||
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
|
||||
if test -f "$file"; then
|
||||
touch $file
|
||||
else
|
||||
test -z "$file" || exec >$file
|
||||
echo "#! /bin/sh"
|
||||
echo "# Created by GNU Automake missing as a replacement of"
|
||||
echo "# $ $@"
|
||||
echo "exit 0"
|
||||
chmod +x $file
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
|
||||
bison*|yacc*)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' $msg. You should only need it if
|
||||
you modified a \`.y' file. You may need the \`Bison' package
|
||||
in order for those modifications to take effect. You can get
|
||||
\`Bison' from any GNU archive site."
|
||||
rm -f y.tab.c y.tab.h
|
||||
if test $# -ne 1; then
|
||||
eval LASTARG="\${$#}"
|
||||
case $LASTARG in
|
||||
*.y)
|
||||
SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
|
||||
if test -f "$SRCFILE"; then
|
||||
cp "$SRCFILE" y.tab.c
|
||||
fi
|
||||
SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
|
||||
if test -f "$SRCFILE"; then
|
||||
cp "$SRCFILE" y.tab.h
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
if test ! -f y.tab.h; then
|
||||
echo >y.tab.h
|
||||
fi
|
||||
if test ! -f y.tab.c; then
|
||||
echo 'main() { return 0; }' >y.tab.c
|
||||
fi
|
||||
;;
|
||||
|
||||
lex*|flex*)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. You should only need it if
|
||||
you modified a \`.l' file. You may need the \`Flex' package
|
||||
in order for those modifications to take effect. You can get
|
||||
\`Flex' from any GNU archive site."
|
||||
rm -f lex.yy.c
|
||||
if test $# -ne 1; then
|
||||
eval LASTARG="\${$#}"
|
||||
case $LASTARG in
|
||||
*.l)
|
||||
SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
|
||||
if test -f "$SRCFILE"; then
|
||||
cp "$SRCFILE" lex.yy.c
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
if test ! -f lex.yy.c; then
|
||||
echo 'main() { return 0; }' >lex.yy.c
|
||||
fi
|
||||
;;
|
||||
|
||||
help2man*)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. You should only need it if
|
||||
you modified a dependency of a manual page. You may need the
|
||||
\`Help2man' package in order for those modifications to take
|
||||
effect. You can get \`Help2man' from any GNU archive site."
|
||||
|
||||
file=`echo "$*" | sed -n "$sed_output"`
|
||||
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
|
||||
if test -f "$file"; then
|
||||
touch $file
|
||||
else
|
||||
test -z "$file" || exec >$file
|
||||
echo ".ab help2man is required to generate this page"
|
||||
exit $?
|
||||
fi
|
||||
;;
|
||||
|
||||
makeinfo*)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. You should only need it if
|
||||
you modified a \`.texi' or \`.texinfo' file, or any other file
|
||||
indirectly affecting the aspect of the manual. The spurious
|
||||
call might also be the consequence of using a buggy \`make' (AIX,
|
||||
DU, IRIX). You might want to install the \`Texinfo' package or
|
||||
the \`GNU make' package. Grab either from any GNU archive site."
|
||||
# The file to touch is that specified with -o ...
|
||||
file=`echo "$*" | sed -n "$sed_output"`
|
||||
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
|
||||
if test -z "$file"; then
|
||||
# ... or it is the one specified with @setfilename ...
|
||||
infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
|
||||
file=`sed -n '
|
||||
/^@setfilename/{
|
||||
s/.* \([^ ]*\) *$/\1/
|
||||
p
|
||||
q
|
||||
}' $infile`
|
||||
# ... or it is derived from the source name (dir/f.texi becomes f.info)
|
||||
test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
|
||||
fi
|
||||
# If the file does not exist, the user really needs makeinfo;
|
||||
# let's fail without touching anything.
|
||||
test -f $file || exit 1
|
||||
touch $file
|
||||
;;
|
||||
|
||||
tar*)
|
||||
shift
|
||||
|
||||
# We have already tried tar in the generic part.
|
||||
# Look for gnutar/gtar before invocation to avoid ugly error
|
||||
# messages.
|
||||
if (gnutar --version > /dev/null 2>&1); then
|
||||
gnutar "$@" && exit 0
|
||||
fi
|
||||
if (gtar --version > /dev/null 2>&1); then
|
||||
gtar "$@" && exit 0
|
||||
fi
|
||||
firstarg="$1"
|
||||
if shift; then
|
||||
case $firstarg in
|
||||
*o*)
|
||||
firstarg=`echo "$firstarg" | sed s/o//`
|
||||
tar "$firstarg" "$@" && exit 0
|
||||
;;
|
||||
esac
|
||||
case $firstarg in
|
||||
*h*)
|
||||
firstarg=`echo "$firstarg" | sed s/h//`
|
||||
tar "$firstarg" "$@" && exit 0
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
echo 1>&2 "\
|
||||
WARNING: I can't seem to be able to run \`tar' with the given arguments.
|
||||
You may want to install GNU tar or Free paxutils, or check the
|
||||
command line arguments."
|
||||
exit 1
|
||||
;;
|
||||
|
||||
*)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is needed, and is $msg.
|
||||
You might have modified some files without having the
|
||||
proper tools for further handling them. Check the \`README' file,
|
||||
it often tells you about the needed prerequisites for installing
|
||||
this package. You may also peek at any GNU archive site, in case
|
||||
some other package would contain this missing \`$1' program."
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
555
os_os2.cpp
555
os_os2.cpp
@ -1,555 +0,0 @@
|
||||
/*
|
||||
* os_os2.c
|
||||
*
|
||||
* Home page of code is: http://smartmontools.sourceforge.net
|
||||
*
|
||||
* Copyright (C) 2004-8 Yuri Dario <smartmontools-support@lists.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* (for example COPYING); if not, write to the Free
|
||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
*
|
||||
* Thanks to Daniela Engert for providing sample code for SMART ioctl access.
|
||||
*
|
||||
*/
|
||||
|
||||
// These are needed to define prototypes for the functions defined below
|
||||
#include <errno.h>
|
||||
#include "atacmds.h"
|
||||
#include "scsicmds.h"
|
||||
#include "utility.h"
|
||||
|
||||
// This is to include whatever prototypes you define in os_generic.h
|
||||
#include "os_os2.h"
|
||||
|
||||
// Needed by '-V' option (CVS versioning) of smartd/smartctl
|
||||
const char *os_XXXX_c_cvsid="$Id: os_os2.cpp,v 1.9 2008/06/12 21:46:31 ballen4705 Exp $" \
|
||||
ATACMDS_H_CVSID OS_XXXX_H_CVSID SCSICMDS_H_CVSID UTILITY_H_CVSID;
|
||||
|
||||
// global handle to device driver
|
||||
static HFILE hDevice;
|
||||
|
||||
// Please eliminate the following block: both the two #includes and
|
||||
// the 'unsupported()' function. They are only here to warn
|
||||
// unsuspecting users that their Operating System is not supported! If
|
||||
// you wish, you can use a similar warning mechanism for any of the
|
||||
// functions in this file that you can not (or choose not to)
|
||||
// implement.
|
||||
|
||||
#include "config.h"
|
||||
|
||||
typedef struct _IDEREGS {
|
||||
UCHAR bFeaturesReg;
|
||||
UCHAR bSectorCountReg;
|
||||
UCHAR bSectorNumberReg;
|
||||
UCHAR bCylLowReg;
|
||||
UCHAR bCylHighReg;
|
||||
UCHAR bDriveHeadReg;
|
||||
UCHAR bCommandReg;
|
||||
UCHAR bReserved;
|
||||
} IDEREGS, *PIDEREGS, *LPIDEREGS;
|
||||
|
||||
static void unsupported(int which){
|
||||
static int warninggiven[4];
|
||||
|
||||
if (which<0 || which>3)
|
||||
return;
|
||||
|
||||
if (!warninggiven[which]) {
|
||||
char msg;
|
||||
debugmode=1;
|
||||
warninggiven[which]=1;
|
||||
|
||||
switch (which) {
|
||||
case 0:
|
||||
msg="generate a list of devices";
|
||||
break;
|
||||
case 1:
|
||||
msg="interface to Marvell-based SATA controllers";
|
||||
break;
|
||||
case 2:
|
||||
msg="interface to 3ware-based RAID controllers";
|
||||
break;
|
||||
case 3:
|
||||
msg="interface to SCSI devices";
|
||||
break;
|
||||
}
|
||||
pout("Under OS/2, smartmontools can not %s\n");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// print examples for smartctl. You should modify this function so
|
||||
// that the device paths are sensible for your OS, and to eliminate
|
||||
// unsupported commands (eg, 3ware controllers).
|
||||
void print_smartctl_examples(){
|
||||
printf("=================================================== SMARTCTL EXAMPLES =====\n\n");
|
||||
#ifdef HAVE_GETOPT_LONG
|
||||
printf(
|
||||
" smartctl -a /dev/hda (Prints all SMART information)\n\n"
|
||||
" smartctl --smart=on --offlineauto=on --saveauto=on /dev/hda\n"
|
||||
" (Enables SMART on first disk)\n\n"
|
||||
" smartctl -t long /dev/hda (Executes extended disk self-test)\n\n"
|
||||
" smartctl --attributes --log=selftest --quietmode=errorsonly /dev/hda\n"
|
||||
" (Prints Self-Test & Attribute errors)\n"
|
||||
" smartctl -a --device=3ware,2 /dev/sda\n"
|
||||
" (Prints all SMART info for 3rd ATA disk on 3ware RAID controller)\n"
|
||||
);
|
||||
#else
|
||||
printf(
|
||||
" smartctl -a /dev/hda (Prints all SMART information)\n"
|
||||
" smartctl -s on -o on -S on /dev/hda (Enables SMART on first disk)\n"
|
||||
" smartctl -t long /dev/hda (Executes extended disk self-test)\n"
|
||||
" smartctl -A -l selftest -q errorsonly /dev/hda\n"
|
||||
" (Prints Self-Test & Attribute errors)\n"
|
||||
" smartctl -a -d 3ware,2 /dev/sda\n"
|
||||
" (Prints all SMART info for 3rd ATA disk on 3ware RAID controller)\n"
|
||||
);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
static const char * skipdev(const char * s)
|
||||
{
|
||||
return (!strncmp(s, "/dev/", 5) ? s + 5 : s);
|
||||
}
|
||||
|
||||
// tries to guess device type given the name (a path). See utility.h
|
||||
// for return values.
|
||||
int guess_device_type (const char* dev_name) {
|
||||
|
||||
//printf( "dev_name %s\n", dev_name);
|
||||
dev_name = skipdev(dev_name);
|
||||
if (!strncmp(dev_name, "hd", 2))
|
||||
return CONTROLLER_ATA;
|
||||
if (!strncmp(dev_name, "scsi", 4))
|
||||
return CONTROLLER_SCSI;
|
||||
return CONTROLLER_UNKNOWN;
|
||||
}
|
||||
|
||||
// makes a list of ATA or SCSI devices for the DEVICESCAN directive of
|
||||
// smartd. Returns number N of devices, or -1 if out of
|
||||
// memory. Allocates N+1 arrays: one of N pointers (devlist); the
|
||||
// other N arrays each contain null-terminated character strings. In
|
||||
// the case N==0, no arrays are allocated because the array of 0
|
||||
// pointers has zero length, equivalent to calling malloc(0).
|
||||
int make_device_names (char*** devlist, const char* name) {
|
||||
unsupported(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Like open(). Return non-negative integer handle, only used by the
|
||||
// functions below. type=="ATA" or "SCSI". If you need to store
|
||||
// extra information about your devices, create a private internal
|
||||
// array within this file (see os_freebsd.cpp for an example). If you
|
||||
// can not open the device (permission denied, does not exist, etc)
|
||||
// set errno as open() does and return <0.
|
||||
int deviceopen(const char *pathname, char *type){
|
||||
|
||||
int fd;
|
||||
APIRET rc;
|
||||
ULONG ActionTaken;
|
||||
|
||||
//printf( "deviceopen pathname %s\n", pathname);
|
||||
rc = DosOpen ("\\DEV\\IBMS506$", &hDevice, &ActionTaken, 0, FILE_SYSTEM,
|
||||
OPEN_ACTION_OPEN_IF_EXISTS, OPEN_SHARE_DENYNONE |
|
||||
OPEN_FLAGS_NOINHERIT | OPEN_ACCESS_READONLY, NULL);
|
||||
if (rc) {
|
||||
char errmsg[256];
|
||||
snprintf(errmsg,256,"Smartctl open driver IBMS506$ failed (%d)", rc);
|
||||
errmsg[255]='\0';
|
||||
syserror(errmsg);
|
||||
return -1;
|
||||
}
|
||||
|
||||
pathname = skipdev(pathname);
|
||||
fd = tolower(pathname[2]) - 'a';
|
||||
|
||||
return fd;
|
||||
}
|
||||
|
||||
// Like close(). Acts only on integer handles returned by
|
||||
// deviceopen() above.
|
||||
int deviceclose(int fd){
|
||||
|
||||
DosClose( hDevice);
|
||||
hDevice = NULL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void print_ide_regs(const IDEREGS * r, int out)
|
||||
{
|
||||
pout("%s=0x%02x,%s=0x%02x, SC=0x%02x, NS=0x%02x, CL=0x%02x, CH=0x%02x, SEL=0x%02x\n",
|
||||
(out?"STS":"CMD"), r->bCommandReg, (out?"ERR":" FR"), r->bFeaturesReg,
|
||||
r->bSectorCountReg, r->bSectorNumberReg, r->bCylLowReg, r->bCylHighReg, r->bDriveHeadReg);
|
||||
}
|
||||
|
||||
//
|
||||
// OS/2 direct ioctl interface to IBMS506$
|
||||
//
|
||||
int dani_ioctl( int device, int request, void* arg)
|
||||
{
|
||||
unsigned char* buff = (unsigned char*) arg;
|
||||
APIRET rc;
|
||||
DSKSP_CommandParameters Parms;
|
||||
ULONG PLen = 1;
|
||||
ULONG DLen = 512; //sizeof (*buf);
|
||||
UCHAR temp;
|
||||
ULONG value = 0;
|
||||
IDEREGS regs;
|
||||
|
||||
//printf( "device %d, request 0x%x, arg[0] 0x%x, arg[2] 0x%x\n", device, request, buff[0], buff[2]);
|
||||
|
||||
Parms.byPhysicalUnit = device;
|
||||
switch( buff[0]) {
|
||||
case WIN_IDENTIFY:
|
||||
rc = DosDevIOCtl (hDevice, DSKSP_CAT_GENERIC, DSKSP_GET_INQUIRY_DATA,
|
||||
(PVOID)&Parms, PLen, &PLen, (PVOID)arg+4, DLen, &DLen);
|
||||
if (rc != 0)
|
||||
{
|
||||
printf ("DANIS506 ATA GET HD Failed (%d,0x%x)\n", rc, rc);
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
case WIN_SMART:
|
||||
switch( buff[2]) {
|
||||
case SMART_STATUS:
|
||||
DLen = sizeof(value);
|
||||
// OS/2 already checks CL/CH in IBM1S506 code!! see s506rte.c (ddk)
|
||||
// value: -1=not supported, 0=ok, 1=failing
|
||||
rc = DosDevIOCtl (hDevice, DSKSP_CAT_SMART, DSKSP_SMART_GETSTATUS,
|
||||
(PVOID)&Parms, PLen, &PLen, (PVOID)&value, DLen, &DLen);
|
||||
if (rc)
|
||||
{
|
||||
printf ("DANIS506 ATA GET SMART_STATUS failed (%d,0x%x)\n", rc, rc);
|
||||
return -1;
|
||||
}
|
||||
buff[4] = (unsigned char)value;
|
||||
break;
|
||||
case SMART_READ_VALUES:
|
||||
rc = DosDevIOCtl (hDevice, DSKSP_CAT_SMART, DSKSP_SMART_GET_ATTRIBUTES,
|
||||
(PVOID)&Parms, PLen, &PLen, (PVOID)arg+4, DLen, &DLen);
|
||||
if (rc)
|
||||
{
|
||||
printf ("DANIS506 ATA GET DSKSP_SMART_GET_ATTRIBUTES failed (%d,0x%x)\n", rc, rc);
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
case SMART_READ_THRESHOLDS:
|
||||
rc = DosDevIOCtl (hDevice, DSKSP_CAT_SMART, DSKSP_SMART_GET_THRESHOLDS,
|
||||
(PVOID)&Parms, PLen, &PLen, (PVOID)arg+4, DLen, &DLen);
|
||||
if (rc)
|
||||
{
|
||||
printf ("DANIS506 ATA GET DSKSP_SMART_GET_THRESHOLDS failed (%d,0x%x)\n", rc, rc);
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
case SMART_READ_LOG_SECTOR:
|
||||
buff[4] = buff[1]; // copy select field
|
||||
rc = DosDevIOCtl (hDevice, DSKSP_CAT_SMART, DSKSP_SMART_READ_LOG,
|
||||
(PVOID)&Parms, PLen, &PLen, (PVOID)arg+4, DLen, &DLen);
|
||||
if (rc)
|
||||
{
|
||||
printf ("DANIS506 ATA GET DSKSP_SMART_READ_LOG failed (%d,0x%x)\n", rc, rc);
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
case SMART_ENABLE:
|
||||
buff[0] = 1; // enable
|
||||
DLen = 1;
|
||||
rc = DosDevIOCtl (hDevice, DSKSP_CAT_SMART, DSKSP_SMART_ONOFF,
|
||||
(PVOID)&Parms, PLen, &PLen, (PVOID)buff, DLen, &DLen);
|
||||
if (rc) {
|
||||
printf ("DANIS506 ATA GET DSKSP_SMART_ONOFF failed (%d,0x%x)\n", rc, rc);
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
case SMART_DISABLE:
|
||||
buff[0] = 0; // disable
|
||||
DLen = 1;
|
||||
rc = DosDevIOCtl (hDevice, DSKSP_CAT_SMART, DSKSP_SMART_ONOFF,
|
||||
(PVOID)&Parms, PLen, &PLen, (PVOID)buff, DLen, &DLen);
|
||||
if (rc) {
|
||||
printf ("DANIS506 ATA GET DSKSP_SMART_ONOFF failed (%d,0x%x)\n", rc, rc);
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
#if 0
|
||||
case SMART_AUTO_OFFLINE:
|
||||
buff[0] = buff[3]; // select field
|
||||
DLen = 1;
|
||||
rc = DosDevIOCtl (hDevice, DSKSP_CAT_SMART, DSKSP_SMART_AUTO_OFFLINE,
|
||||
(PVOID)&Parms, PLen, &PLen, (PVOID)buff, DLen, &DLen);
|
||||
if (rc) {
|
||||
printf ("DANIS506 ATA GET DSKSP_SMART_ONOFF failed (%d,0x%x)\n", rc, rc);
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
case SMART_AUTOSAVE:
|
||||
buff[0] = buff[3]; // select field
|
||||
DLen = 1;
|
||||
rc = DosDevIOCtl (hDevice, DSKSP_CAT_SMART, DSKSP_SMART_AUTOSAVE_ONOFF,
|
||||
(PVOID)&Parms, PLen, &PLen, (PVOID)buff, DLen, &DLen);
|
||||
if (rc) {
|
||||
printf ("DANIS506 ATA DSKSP_SMART_AUTOSAVE_ONOFF failed (%d,0x%x)\n", rc, rc);
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
case SMART_IMMEDIATE_OFFLINE:
|
||||
buff[0] = buff[1]; // select field
|
||||
DLen = 1;
|
||||
rc = DosDevIOCtl (hDevice, DSKSP_CAT_SMART, DSKSP_SMART_EOLI,
|
||||
(PVOID)&Parms, PLen, &PLen, (PVOID)buff, DLen, &DLen);
|
||||
if (rc) {
|
||||
printf ("DANIS506 ATA GET DSKSP_SMART_EXEC_OFFLINE failed (%d,0x%x)\n", rc, rc);
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
fprintf( stderr, "device %d, request 0x%x, arg[0] 0x%x, arg[2] 0x%x\n", device, request, buff[0], buff[2]);
|
||||
fprintf( stderr, "unknown ioctl\n");
|
||||
return -1;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
//case WIN_PIDENTIFY:
|
||||
// break;
|
||||
default:
|
||||
fprintf( stderr, "unknown ioctl\n");
|
||||
return -1;
|
||||
break;
|
||||
}
|
||||
|
||||
// ok
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Interface to ATA devices. See os_linux.cpp for the cannonical example.
|
||||
// DETAILED DESCRIPTION OF ARGUMENTS
|
||||
// device: is the integer handle provided by deviceopen()
|
||||
// command: defines the different operations, see atacmds.h
|
||||
// select: additional input data IF NEEDED (which log, which type of
|
||||
// self-test).
|
||||
// data: location to write output data, IF NEEDED (1 or 512 bytes).
|
||||
// Note: not all commands use all arguments.
|
||||
// RETURN VALUES (for all commands BUT command==STATUS_CHECK)
|
||||
// -1 if the command failed
|
||||
// 0 if the command succeeded,
|
||||
// RETURN VALUES if command==STATUS_CHECK
|
||||
// -1 if the command failed OR the disk SMART status can't be determined
|
||||
// 0 if the command succeeded and disk SMART status is "OK"
|
||||
// 1 if the command succeeded and disk SMART status is "FAILING"
|
||||
|
||||
// huge value of buffer size needed because HDIO_DRIVE_CMD assumes
|
||||
// that buff[3] is the data size. Since the ATA_SMART_AUTOSAVE and
|
||||
// ATA_SMART_AUTO_OFFLINE use values of 0xf1 and 0xf8 we need the space.
|
||||
// Otherwise a 4+512 byte buffer would be enough.
|
||||
#define STRANGE_BUFFER_LENGTH (4+512*0xf8)
|
||||
|
||||
int ata_command_interface(int device, smart_command_set command, int select, char *data){
|
||||
unsigned char buff[STRANGE_BUFFER_LENGTH];
|
||||
// positive: bytes to write to caller. negative: bytes to READ from
|
||||
// caller. zero: non-data command
|
||||
int copydata=0;
|
||||
|
||||
const int HDIO_DRIVE_CMD_OFFSET = 4;
|
||||
|
||||
// See struct hd_drive_cmd_hdr in hdreg.h. Before calling ioctl()
|
||||
// buff[0]: ATA COMMAND CODE REGISTER
|
||||
// buff[1]: ATA SECTOR NUMBER REGISTER == LBA LOW REGISTER
|
||||
// buff[2]: ATA FEATURES REGISTER
|
||||
// buff[3]: ATA SECTOR COUNT REGISTER
|
||||
|
||||
// Note that on return:
|
||||
// buff[2] contains the ATA SECTOR COUNT REGISTER
|
||||
|
||||
// clear out buff. Large enough for HDIO_DRIVE_CMD (4+512 bytes)
|
||||
memset(buff, 0, STRANGE_BUFFER_LENGTH);
|
||||
|
||||
//printf( "command, select %d,%d\n", command, select);
|
||||
buff[0]=ATA_SMART_CMD;
|
||||
switch (command){
|
||||
case CHECK_POWER_MODE:
|
||||
buff[0]=ATA_CHECK_POWER_MODE;
|
||||
copydata=1;
|
||||
break;
|
||||
case READ_VALUES:
|
||||
buff[2]=ATA_SMART_READ_VALUES;
|
||||
buff[3]=1;
|
||||
copydata=512;
|
||||
break;
|
||||
case READ_THRESHOLDS:
|
||||
buff[2]=ATA_SMART_READ_THRESHOLDS;
|
||||
buff[1]=buff[3]=1;
|
||||
copydata=512;
|
||||
break;
|
||||
case READ_LOG:
|
||||
buff[2]=ATA_SMART_READ_LOG_SECTOR;
|
||||
buff[1]=select;
|
||||
buff[3]=1;
|
||||
copydata=512;
|
||||
break;
|
||||
case WRITE_LOG:
|
||||
break;
|
||||
case IDENTIFY:
|
||||
buff[0]=ATA_IDENTIFY_DEVICE;
|
||||
buff[3]=1;
|
||||
copydata=512;
|
||||
break;
|
||||
case PIDENTIFY:
|
||||
buff[0]=ATA_IDENTIFY_PACKET_DEVICE;
|
||||
buff[3]=1;
|
||||
copydata=512;
|
||||
break;
|
||||
case ENABLE:
|
||||
buff[2]=ATA_SMART_ENABLE;
|
||||
buff[1]=1;
|
||||
break;
|
||||
case DISABLE:
|
||||
buff[2]=ATA_SMART_DISABLE;
|
||||
buff[1]=1;
|
||||
break;
|
||||
case STATUS:
|
||||
case STATUS_CHECK:
|
||||
// this command only says if SMART is working. It could be
|
||||
// replaced with STATUS_CHECK below.
|
||||
buff[2]=ATA_SMART_STATUS;
|
||||
buff[4]=0;
|
||||
break;
|
||||
case AUTO_OFFLINE:
|
||||
buff[2]=ATA_SMART_AUTO_OFFLINE;
|
||||
buff[3]=select; // YET NOTE - THIS IS A NON-DATA COMMAND!!
|
||||
break;
|
||||
case AUTOSAVE:
|
||||
buff[2]=ATA_SMART_AUTOSAVE;
|
||||
buff[3]=select; // YET NOTE - THIS IS A NON-DATA COMMAND!!
|
||||
break;
|
||||
case IMMEDIATE_OFFLINE:
|
||||
buff[2]=ATA_SMART_IMMEDIATE_OFFLINE;
|
||||
buff[1]=select;
|
||||
break;
|
||||
//case STATUS_CHECK:
|
||||
// // This command uses HDIO_DRIVE_TASK and has different syntax than
|
||||
// // the other commands.
|
||||
// buff[1]=ATA_SMART_STATUS;
|
||||
// break;
|
||||
default:
|
||||
pout("Unrecognized command %d in linux_ata_command_interface()\n"
|
||||
"Please contact " PACKAGE_BUGREPORT "\n", command);
|
||||
errno=ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
#if 0
|
||||
// This command uses the HDIO_DRIVE_TASKFILE ioctl(). This is the
|
||||
// only ioctl() that can be used to WRITE data to the disk.
|
||||
if (command==WRITE_LOG) {
|
||||
unsigned char task[sizeof(ide_task_request_t)+512];
|
||||
ide_task_request_t *reqtask=(ide_task_request_t *) task;
|
||||
task_struct_t *taskfile=(task_struct_t *) reqtask->io_ports;
|
||||
int retval;
|
||||
|
||||
memset(task, 0, sizeof(task));
|
||||
|
||||
taskfile->data = 0;
|
||||
taskfile->feature = ATA_SMART_WRITE_LOG_SECTOR;
|
||||
taskfile->sector_count = 1;
|
||||
taskfile->sector_number = select;
|
||||
taskfile->low_cylinder = 0x4f;
|
||||
taskfile->high_cylinder = 0xc2;
|
||||
taskfile->device_head = 0;
|
||||
taskfile->command = ATA_SMART_CMD;
|
||||
|
||||
reqtask->data_phase = TASKFILE_OUT;
|
||||
reqtask->req_cmd = IDE_DRIVE_TASK_OUT;
|
||||
reqtask->out_size = 512;
|
||||
reqtask->in_size = 0;
|
||||
|
||||
// copy user data into the task request structure
|
||||
memcpy(task+sizeof(ide_task_request_t), data, 512);
|
||||
|
||||
if ((retval=dani_ioctl(device, HDIO_DRIVE_TASKFILE, task))) {
|
||||
if (retval==-EINVAL)
|
||||
pout("Kernel lacks HDIO_DRIVE_TASKFILE support; compile kernel with CONFIG_IDE_TASKFILE_IO set\n");
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif // 0
|
||||
|
||||
// We are now doing the HDIO_DRIVE_CMD type ioctl.
|
||||
if ((dani_ioctl(device, HDIO_DRIVE_CMD, buff)))
|
||||
return -1;
|
||||
|
||||
// There are two different types of ioctls(). The HDIO_DRIVE_TASK
|
||||
// one is this:
|
||||
if (command==STATUS_CHECK){
|
||||
int retval;
|
||||
|
||||
// Cyl low and Cyl high unchanged means "Good SMART status"
|
||||
if (buff[4]==0)
|
||||
return 0;
|
||||
|
||||
// These values mean "Bad SMART status"
|
||||
if (buff[4]==1)
|
||||
return 1;
|
||||
|
||||
// We haven't gotten output that makes sense; print out some debugging info
|
||||
syserror("Error SMART Status command failed");
|
||||
pout("Please get assistance from " PACKAGE_HOMEPAGE "\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
// CHECK POWER MODE command returns information in the Sector Count
|
||||
// register (buff[3]). Copy to return data buffer.
|
||||
if (command==CHECK_POWER_MODE)
|
||||
buff[HDIO_DRIVE_CMD_OFFSET]=buff[2];
|
||||
|
||||
// if the command returns data then copy it back
|
||||
if (copydata)
|
||||
memcpy(data, buff+HDIO_DRIVE_CMD_OFFSET, copydata);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int marvell_command_interface(int fd, smart_command_set command, int select, char *data){
|
||||
unsupported(1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
int highpoint_command_interface(int fd, smart_command_set command, int select, char *data)
|
||||
{
|
||||
unsupported(1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Interface to ATA devices behind 3ware escalade RAID controller
|
||||
// cards. Same description as ata_command_interface() above except
|
||||
// that 0 <= disknum <= 15 specifies the ATA disk attached to the
|
||||
// controller.
|
||||
int escalade_command_interface(int fd, int disknum, int escalade_type, smart_command_set command, int select, char *data){
|
||||
unsupported(2);
|
||||
return -1;
|
||||
}
|
||||
|
||||
int areca_command_interface(int fd, int disknum, smart_command_set command, int select, char *data){
|
||||
unsupported(2);
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Interface to SCSI devices. See os_linux.c
|
||||
int do_scsi_cmnd_io(int fd, struct scsi_cmnd_io * iop, int report) {
|
||||
unsupported(3);
|
||||
return -ENOSYS;
|
||||
}
|
70
os_os2.h
70
os_os2.h
@ -1,70 +0,0 @@
|
||||
/*
|
||||
* os_os2.c
|
||||
*
|
||||
* Home page of code is: http://smartmontools.sourceforge.net
|
||||
*
|
||||
* Copyright (C) 2004-8 Yuri Dario <smartmontools-support@lists.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* (for example COPYING); if not, write to the Free
|
||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef OS_OS2_H_
|
||||
#define OS_OS2_H_
|
||||
|
||||
#define OS_XXXX_H_CVSID "$Id: os_os2.h,v 1.5 2008/03/04 22:09:47 ballen4705 Exp $\n"
|
||||
|
||||
// Additional material should start here. Note: to keep the '-V' CVS
|
||||
// reporting option working as intended, you should only #include
|
||||
// system include files <something.h>. Local #include files
|
||||
// <"something.h"> should be #included in os_generic.c
|
||||
|
||||
#define INCL_DOS
|
||||
#include <os2.h>
|
||||
|
||||
#include "os_os2\hdreg.h"
|
||||
#include "os_linux.h"
|
||||
|
||||
#pragma pack(1)
|
||||
|
||||
#define DSKSP_CAT_SMART 0x80 /* SMART IOCTL category */
|
||||
#define DSKSP_SMART_ONOFF 0x20 /* turn SMART on or off */
|
||||
#define DSKSP_SMART_AUTOSAVE_ONOFF 0x21 /* turn SMART autosave on or off */
|
||||
#define DSKSP_SMART_SAVE 0x22 /* force save of SMART data */
|
||||
#define DSKSP_SMART_GETSTATUS 0x23 /* get SMART status (pass/fail) */
|
||||
#define DSKSP_SMART_GET_ATTRIBUTES 0x24 /* get SMART attributes table */
|
||||
#define DSKSP_SMART_GET_THRESHOLDS 0x25 /* get SMART thresholds table */
|
||||
#define DSKSP_SMART_READ_LOG 0x26
|
||||
#define DSKSP_SMART_WRITE_LOG 0x27
|
||||
#define DSKSP_SMART_READ_LOG_EXT 0x28
|
||||
#define DSKSP_SMART_WRITE_LOG_EXT 0x29
|
||||
#define DSKSP_SMART_EOLI 0x30 /* EXECUTE OFF-LINE IMMEDIATE */
|
||||
|
||||
#define SMART_CMD_ON 1 /* on value for related SMART functions */
|
||||
#define SMART_CMD_OFF 0 /* off value for related SMART functions */
|
||||
|
||||
#define DSKSP_CAT_GENERIC 0x90 /* generic IOCTL category */
|
||||
#define DSKSP_GET_INQUIRY_DATA 0x42 /* get ATA/ATAPI inquiry data */
|
||||
|
||||
typedef struct _DSKSP_CommandParameters {
|
||||
BYTE byPhysicalUnit; /* physical unit number 0-n */
|
||||
/* 0 = 1st disk, 1 = 2nd disk, ...*/
|
||||
/* 0x80 = Pri/Mas, 0x81=Pri/Sla, 0x82=Sec/Mas,*/
|
||||
} DSKSP_CommandParameters, *PDSKSP_CommandParameters;
|
||||
|
||||
struct SMART_ParamExt {
|
||||
UCHAR byPhysicalUnit; // 0=Pri/Mas, 1=Pri/Sla, 2=Sec/Mas, etc.
|
||||
ULONG LogAddress; // valid values 0-255. See ATA/ATPI standard
|
||||
// for details
|
||||
ULONG SectorCount; // valid values 0-255 See ATA/ATPI standard
|
||||
// for details
|
||||
ULONG reserved; // reserved. must be set to 0
|
||||
};
|
||||
|
||||
#endif /* OS_GENERIC_H_ */
|
@ -1,9 +0,0 @@
|
||||
#! /bin/sh
|
||||
CFLAGS="-s -Zomf -O3 -march=pentium -mcpu=pentium3" \
|
||||
CXXFLAGS="-s -Zomf -O3 -march=pentium -mcpu=pentium3" \
|
||||
LDFLAGS="-s -Zmap -Zhigh-mem -Zomf -Zexe -Zstack 0x100" \
|
||||
LIBS=" -lsyslog -lsocket" \
|
||||
LN_CP_F="cp.exe" \
|
||||
RANLIB="echo" \
|
||||
AR="emxomfar" \
|
||||
./configure --prefix=/usr/local/smartmontools
|
333
os_os2/hdreg.h
333
os_os2/hdreg.h
@ -1,333 +0,0 @@
|
||||
#ifndef _LINUX_HDREG_H
|
||||
#define _LINUX_HDREG_H
|
||||
|
||||
/*
|
||||
* This file contains some defines for the AT-hd-controller.
|
||||
* Various sources.
|
||||
*/
|
||||
|
||||
#define HD_IRQ 14 /* the standard disk interrupt */
|
||||
|
||||
/* ide.c has its own port definitions in "ide.h" */
|
||||
|
||||
/* Hd controller regs. Ref: IBM AT Bios-listing */
|
||||
#define HD_DATA 0x1f0 /* _CTL when writing */
|
||||
#define HD_ERROR 0x1f1 /* see err-bits */
|
||||
#define HD_NSECTOR 0x1f2 /* nr of sectors to read/write */
|
||||
#define HD_SECTOR 0x1f3 /* starting sector */
|
||||
#define HD_LCYL 0x1f4 /* starting cylinder */
|
||||
#define HD_HCYL 0x1f5 /* high byte of starting cyl */
|
||||
#define HD_CURRENT 0x1f6 /* 101dhhhh , d=drive, hhhh=head */
|
||||
#define HD_STATUS 0x1f7 /* see status-bits */
|
||||
#define HD_FEATURE HD_ERROR /* same io address, read=error, write=feature */
|
||||
#define HD_PRECOMP HD_FEATURE /* obsolete use of this port - predates IDE */
|
||||
#define HD_COMMAND HD_STATUS /* same io address, read=status, write=cmd */
|
||||
|
||||
#define HD_CMD 0x3f6 /* used for resets */
|
||||
#define HD_ALTSTATUS 0x3f6 /* same as HD_STATUS but doesn't clear irq */
|
||||
|
||||
/* remainder is shared between hd.c, ide.c, ide-cd.c, and the hdparm utility */
|
||||
|
||||
/* Bits of HD_STATUS */
|
||||
#define ERR_STAT 0x01
|
||||
#define INDEX_STAT 0x02
|
||||
#define ECC_STAT 0x04 /* Corrected error */
|
||||
#define DRQ_STAT 0x08
|
||||
#define SEEK_STAT 0x10
|
||||
#define WRERR_STAT 0x20
|
||||
#define READY_STAT 0x40
|
||||
#define BUSY_STAT 0x80
|
||||
|
||||
/* Values for HD_COMMAND */
|
||||
#define WIN_RESTORE 0x10
|
||||
#define WIN_READ 0x20
|
||||
#define WIN_WRITE 0x30
|
||||
#define WIN_WRITE_VERIFY 0x3C
|
||||
#define WIN_VERIFY 0x40
|
||||
#define WIN_FORMAT 0x50
|
||||
#define WIN_INIT 0x60
|
||||
#define WIN_SEEK 0x70
|
||||
#define WIN_DIAGNOSE 0x90
|
||||
#define WIN_SPECIFY 0x91 /* set drive geometry translation */
|
||||
#define WIN_IDLEIMMEDIATE 0xE1 /* force drive to become "ready" */
|
||||
#define WIN_SETIDLE1 0xE3
|
||||
#define WIN_SETIDLE2 0x97
|
||||
|
||||
#define WIN_STANDBYNOW1 0xE0
|
||||
#define WIN_STANDBYNOW2 0x94
|
||||
#define WIN_SLEEPNOW1 0xE6
|
||||
#define WIN_SLEEPNOW2 0x99
|
||||
#define WIN_CHECKPOWERMODE1 0xE5
|
||||
#define WIN_CHECKPOWERMODE2 0x98
|
||||
|
||||
#define WIN_DOORLOCK 0xDE /* lock door on removable drives */
|
||||
#define WIN_DOORUNLOCK 0xDF /* unlock door on removable drives */
|
||||
|
||||
#define WIN_MULTREAD 0xC4 /* read sectors using multiple mode */
|
||||
#define WIN_MULTWRITE 0xC5 /* write sectors using multiple mode */
|
||||
#define WIN_SETMULT 0xC6 /* enable/disable multiple mode */
|
||||
#define WIN_IDENTIFY 0xEC /* ask drive to identify itself */
|
||||
#define WIN_IDENTIFY_DMA 0xEE /* same as WIN_IDENTIFY, but DMA */
|
||||
#define WIN_SETFEATURES 0xEF /* set special drive features */
|
||||
#define WIN_READDMA 0xC8 /* read sectors using DMA transfers */
|
||||
#define WIN_WRITEDMA 0xCA /* write sectors using DMA transfers */
|
||||
|
||||
#define WIN_QUEUED_SERVICE 0xA2 /* */
|
||||
#define WIN_READDMA_QUEUED 0xC7 /* read sectors using Queued DMA transfers */
|
||||
#define WIN_WRITEDMA_QUEUED 0xCC /* write sectors using Queued DMA transfers */
|
||||
|
||||
#define WIN_READ_BUFFER 0xE4 /* force read only 1 sector */
|
||||
#define WIN_WRITE_BUFFER 0xE8 /* force write only 1 sector */
|
||||
|
||||
#define WIN_SMART 0xB0 /* self-monitoring and reporting */
|
||||
|
||||
/* Additional drive command codes used by ATAPI devices. */
|
||||
#define WIN_PIDENTIFY 0xA1 /* identify ATAPI device */
|
||||
#define WIN_SRST 0x08 /* ATAPI soft reset command */
|
||||
#define WIN_PACKETCMD 0xA0 /* Send a packet command. */
|
||||
|
||||
#define DISABLE_SEAGATE 0xFB
|
||||
#define EXABYTE_ENABLE_NEST 0xF0
|
||||
|
||||
/* WIN_SMART sub-commands */
|
||||
|
||||
#define SMART_READ_VALUES 0xd0
|
||||
#define SMART_READ_THRESHOLDS 0xd1
|
||||
#define SMART_AUTOSAVE 0xd2
|
||||
#define SMART_SAVE 0xd3
|
||||
#define SMART_IMMEDIATE_OFFLINE 0xd4
|
||||
#define SMART_READ_LOG_SECTOR 0xd5
|
||||
#define SMART_WRITE_LOG_SECTOR 0xd6
|
||||
#define SMART_ENABLE 0xd8
|
||||
#define SMART_DISABLE 0xd9
|
||||
#define SMART_STATUS 0xda
|
||||
#define SMART_AUTO_OFFLINE 0xdb
|
||||
|
||||
/* WIN_SETFEATURES sub-commands */
|
||||
|
||||
#define SETFEATURES_EN_WCACHE 0x02 /* Enable write cache */
|
||||
#define SETFEATURES_XFER 0x03 /* Set transfer mode */
|
||||
# define XFER_UDMA_7 0x47 /* 0100|0111 */
|
||||
# define XFER_UDMA_6 0x46 /* 0100|0110 */
|
||||
# define XFER_UDMA_5 0x45 /* 0100|0101 */
|
||||
# define XFER_UDMA_4 0x44 /* 0100|0100 */
|
||||
# define XFER_UDMA_3 0x43 /* 0100|0011 */
|
||||
# define XFER_UDMA_2 0x42 /* 0100|0010 */
|
||||
# define XFER_UDMA_1 0x41 /* 0100|0001 */
|
||||
# define XFER_UDMA_0 0x40 /* 0100|0000 */
|
||||
# define XFER_MW_DMA_2 0x22 /* 0010|0010 */
|
||||
# define XFER_MW_DMA_1 0x21 /* 0010|0001 */
|
||||
# define XFER_MW_DMA_0 0x20 /* 0010|0000 */
|
||||
# define XFER_SW_DMA_2 0x12 /* 0001|0010 */
|
||||
# define XFER_SW_DMA_1 0x11 /* 0001|0001 */
|
||||
# define XFER_SW_DMA_0 0x10 /* 0001|0000 */
|
||||
# define XFER_PIO_4 0x0C /* 0000|1100 */
|
||||
# define XFER_PIO_3 0x0B /* 0000|1011 */
|
||||
# define XFER_PIO_2 0x0A /* 0000|1010 */
|
||||
# define XFER_PIO_1 0x09 /* 0000|1001 */
|
||||
# define XFER_PIO_0 0x08 /* 0000|1000 */
|
||||
# define XFER_PIO_SLOW 0x00 /* 0000|0000 */
|
||||
#define SETFEATURES_DIS_DEFECT 0x04 /* Disable Defect Management */
|
||||
#define SETFEATURES_EN_APM 0x05 /* Enable advanced power management */
|
||||
#define SETFEATURES_DIS_MSN 0x31 /* Disable Media Status Notification */
|
||||
#define SETFEATURES_DIS_RLA 0x55 /* Disable read look-ahead feature */
|
||||
#define SETFEATURES_EN_RI 0x5D /* Enable release interrupt */
|
||||
#define SETFEATURES_EN_SI 0x5E /* Enable SERVICE interrupt */
|
||||
#define SETFEATURES_DIS_RPOD 0x66 /* Disable reverting to power on defaults */
|
||||
#define SETFEATURES_DIS_WCACHE 0x82 /* Disable write cache */
|
||||
#define SETFEATURES_EN_DEFECT 0x84 /* Enable Defect Management */
|
||||
#define SETFEATURES_DIS_APM 0x85 /* Disable advanced power management */
|
||||
#define SETFEATURES_EN_MSN 0x95 /* Enable Media Status Notification */
|
||||
#define SETFEATURES_EN_RLA 0xAA /* Enable read look-ahead feature */
|
||||
#define SETFEATURES_PREFETCH 0xAB /* Sets drive prefetch value */
|
||||
#define SETFEATURES_EN_RPOD 0xCC /* Enable reverting to power on defaults */
|
||||
#define SETFEATURES_DIS_RI 0xDD /* Disable release interrupt */
|
||||
#define SETFEATURES_DIS_SI 0xDE /* Disable SERVICE interrupt */
|
||||
|
||||
/* WIN_SECURITY sub-commands */
|
||||
|
||||
#define SECURITY_SET_PASSWORD 0xBA /* 0xF1 */
|
||||
#define SECURITY_UNLOCK 0xBB /* 0xF2 */
|
||||
#define SECURITY_ERASE_PREPARE 0xBC /* 0xF3 */
|
||||
#define SECURITY_ERASE_UNIT 0xBD /* 0xF4 */
|
||||
#define SECURITY_FREEZE_LOCK 0xBE /* 0xF5 */
|
||||
#define SECURITY_DISABLE_PASSWORD 0xBF /* 0xF6 */
|
||||
|
||||
/* Bits for HD_ERROR */
|
||||
#define MARK_ERR 0x01 /* Bad address mark */
|
||||
#define TRK0_ERR 0x02 /* couldn't find track 0 */
|
||||
#define ABRT_ERR 0x04 /* Command aborted */
|
||||
#define MCR_ERR 0x08 /* media change request */
|
||||
#define ID_ERR 0x10 /* ID field not found */
|
||||
#define ECC_ERR 0x40 /* Uncorrectable ECC error */
|
||||
#define BBD_ERR 0x80 /* pre-EIDE meaning: block marked bad */
|
||||
#define ICRC_ERR 0x80 /* new meaning: CRC error during transfer */
|
||||
|
||||
struct hd_geometry {
|
||||
unsigned char heads;
|
||||
unsigned char sectors;
|
||||
unsigned short cylinders;
|
||||
unsigned long start;
|
||||
};
|
||||
|
||||
/* hd/ide ctl's that pass (arg) ptrs to user space are numbered 0x030n/0x031n */
|
||||
#define HDIO_GETGEO 0x0301 /* get device geometry */
|
||||
#define HDIO_GET_UNMASKINTR 0x0302 /* get current unmask setting */
|
||||
#define HDIO_GET_MULTCOUNT 0x0304 /* get current IDE blockmode setting */
|
||||
#define HDIO_OBSOLETE_IDENTITY 0x0307 /* OBSOLETE, DO NOT USE: returns 142 bytes */
|
||||
#define HDIO_GET_KEEPSETTINGS 0x0308 /* get keep-settings-on-reset flag */
|
||||
#define HDIO_GET_32BIT 0x0309 /* get current io_32bit setting */
|
||||
#define HDIO_GET_NOWERR 0x030a /* get ignore-write-error flag */
|
||||
#define HDIO_GET_DMA 0x030b /* get use-dma flag */
|
||||
#define HDIO_GET_NICE 0x030c /* get nice flags */
|
||||
#define HDIO_GET_IDENTITY 0x030d /* get IDE identification info */
|
||||
|
||||
#define HDIO_DRIVE_RESET 0x031c /* execute a device reset */
|
||||
#define HDIO_TRISTATE_HWIF 0x031d /* execute a channel tristate */
|
||||
#ifndef __EMX__
|
||||
#define HDIO_DRIVE_TASK 0x031e /* execute task and special drive command */
|
||||
#endif
|
||||
#define HDIO_DRIVE_CMD 0x031f /* execute a special drive command */
|
||||
|
||||
#define HDIO_DRIVE_CMD_AEB HDIO_DRIVE_TASK
|
||||
|
||||
/* hd/ide ctl's that pass (arg) non-ptr values are numbered 0x032n/0x033n */
|
||||
#define HDIO_SET_MULTCOUNT 0x0321 /* change IDE blockmode */
|
||||
#define HDIO_SET_UNMASKINTR 0x0322 /* permit other irqs during I/O */
|
||||
#define HDIO_SET_KEEPSETTINGS 0x0323 /* keep ioctl settings on reset */
|
||||
#define HDIO_SET_32BIT 0x0324 /* change io_32bit flags */
|
||||
#define HDIO_SET_NOWERR 0x0325 /* change ignore-write-error flag */
|
||||
#define HDIO_SET_DMA 0x0326 /* change use-dma flag */
|
||||
#define HDIO_SET_PIO_MODE 0x0327 /* reconfig interface to new speed */
|
||||
#define HDIO_SCAN_HWIF 0x0328 /* register and (re)scan interface */
|
||||
#define HDIO_SET_NICE 0x0329 /* set nice flags */
|
||||
#define HDIO_UNREGISTER_HWIF 0x032a /* unregister interface */
|
||||
|
||||
/* BIG GEOMETRY */
|
||||
struct hd_big_geometry {
|
||||
unsigned char heads;
|
||||
unsigned char sectors;
|
||||
unsigned int cylinders;
|
||||
unsigned long start;
|
||||
};
|
||||
|
||||
/* hd/ide ctl's that pass (arg) ptrs to user space are numbered 0x033n/0x033n */
|
||||
#define HDIO_GETGEO_BIG 0x0330 /* */
|
||||
#define HDIO_GETGEO_BIG_RAW 0x0331 /* */
|
||||
|
||||
#define __NEW_HD_DRIVE_ID
|
||||
/* structure returned by HDIO_GET_IDENTITY, as per ANSI ATA2 rev.2f spec */
|
||||
struct hd_driveid {
|
||||
unsigned short config; /* lots of obsolete bit flags */
|
||||
unsigned short cyls; /* "physical" cyls */
|
||||
unsigned short reserved2; /* reserved (word 2) */
|
||||
unsigned short heads; /* "physical" heads */
|
||||
unsigned short track_bytes; /* unformatted bytes per track */
|
||||
unsigned short sector_bytes; /* unformatted bytes per sector */
|
||||
unsigned short sectors; /* "physical" sectors per track */
|
||||
unsigned short vendor0; /* vendor unique */
|
||||
unsigned short vendor1; /* vendor unique */
|
||||
unsigned short vendor2; /* vendor unique */
|
||||
unsigned char serial_no[20]; /* 0 = not_specified */
|
||||
unsigned short buf_type;
|
||||
unsigned short buf_size; /* 512 byte increments; 0 = not_specified */
|
||||
unsigned short ecc_bytes; /* for r/w long cmds; 0 = not_specified */
|
||||
unsigned char fw_rev[8]; /* 0 = not_specified */
|
||||
unsigned char model[40]; /* 0 = not_specified */
|
||||
unsigned char max_multsect; /* 0=not_implemented */
|
||||
unsigned char vendor3; /* vendor unique */
|
||||
unsigned short dword_io; /* 0=not_implemented; 1=implemented */
|
||||
unsigned char vendor4; /* vendor unique */
|
||||
unsigned char capability; /* bits 0:DMA 1:LBA 2:IORDYsw 3:IORDYsup*/
|
||||
unsigned short reserved50; /* reserved (word 50) */
|
||||
unsigned char vendor5; /* vendor unique */
|
||||
unsigned char tPIO; /* 0=slow, 1=medium, 2=fast */
|
||||
unsigned char vendor6; /* vendor unique */
|
||||
unsigned char tDMA; /* 0=slow, 1=medium, 2=fast */
|
||||
unsigned short field_valid; /* bits 0:cur_ok 1:eide_ok */
|
||||
unsigned short cur_cyls; /* logical cylinders */
|
||||
unsigned short cur_heads; /* logical heads */
|
||||
unsigned short cur_sectors; /* logical sectors per track */
|
||||
unsigned short cur_capacity0; /* logical total sectors on drive */
|
||||
unsigned short cur_capacity1; /* (2 words, misaligned int) */
|
||||
unsigned char multsect; /* current multiple sector count */
|
||||
unsigned char multsect_valid; /* when (bit0==1) multsect is ok */
|
||||
unsigned int lba_capacity; /* total number of sectors */
|
||||
unsigned short dma_1word; /* single-word dma info */
|
||||
unsigned short dma_mword; /* multiple-word dma info */
|
||||
unsigned short eide_pio_modes; /* bits 0:mode3 1:mode4 */
|
||||
unsigned short eide_dma_min; /* min mword dma cycle time (ns) */
|
||||
unsigned short eide_dma_time; /* recommended mword dma cycle time (ns) */
|
||||
unsigned short eide_pio; /* min cycle time (ns), no IORDY */
|
||||
unsigned short eide_pio_iordy; /* min cycle time (ns), with IORDY */
|
||||
unsigned short words69_70[2]; /* reserved words 69-70 */
|
||||
/* HDIO_GET_IDENTITY currently returns only words 0 through 70 */
|
||||
unsigned short words71_74[4]; /* reserved words 71-74 */
|
||||
unsigned short queue_depth; /* */
|
||||
unsigned short words76_79[4]; /* reserved words 76-79 */
|
||||
unsigned short major_rev_num; /* */
|
||||
unsigned short minor_rev_num; /* */
|
||||
unsigned short command_set_1; /* bits 0:Smart 1:Security 2:Removable 3:PM */
|
||||
unsigned short command_set_2; /* bits 14:Smart Enabled 13:0 zero */
|
||||
unsigned short cfsse; /* command set-feature supported extensions */
|
||||
unsigned short cfs_enable_1; /* command set-feature enabled */
|
||||
unsigned short cfs_enable_2; /* command set-feature enabled */
|
||||
unsigned short csf_default; /* command set-feature default */
|
||||
unsigned short dma_ultra; /* */
|
||||
unsigned short word89; /* reserved (word 89) */
|
||||
unsigned short word90; /* reserved (word 90) */
|
||||
unsigned short CurAPMvalues; /* current APM values */
|
||||
unsigned short word92; /* reserved (word 92) */
|
||||
unsigned short hw_config; /* hardware config */
|
||||
unsigned short words94_125[32];/* reserved words 94-125 */
|
||||
unsigned short last_lun; /* reserved (word 126) */
|
||||
unsigned short word127; /* reserved (word 127) */
|
||||
unsigned short dlf; /* device lock function
|
||||
* 15:9 reserved
|
||||
* 8 security level 1:max 0:high
|
||||
* 7:6 reserved
|
||||
* 5 enhanced erase
|
||||
* 4 expire
|
||||
* 3 frozen
|
||||
* 2 locked
|
||||
* 1 en/disabled
|
||||
* 0 capability
|
||||
*/
|
||||
unsigned short csfo; /* current set features options
|
||||
* 15:4 reserved
|
||||
* 3 auto reassign
|
||||
* 2 reverting
|
||||
* 1 read-look-ahead
|
||||
* 0 write cache
|
||||
*/
|
||||
unsigned short words130_155[26];/* reserved vendor words 130-155 */
|
||||
unsigned short word156;
|
||||
unsigned short words157_159[3];/* reserved vendor words 157-159 */
|
||||
unsigned short words160_255[95];/* reserved words 160-255 */
|
||||
};
|
||||
|
||||
/*
|
||||
* IDE "nice" flags. These are used on a per drive basis to determine
|
||||
* when to be nice and give more bandwidth to the other devices which
|
||||
* share the same IDE bus.
|
||||
*/
|
||||
#define IDE_NICE_DSC_OVERLAP (0) /* per the DSC overlap protocol */
|
||||
#define IDE_NICE_ATAPI_OVERLAP (1) /* not supported yet */
|
||||
#define IDE_NICE_0 (2) /* when sure that it won't affect us */
|
||||
#define IDE_NICE_1 (3) /* when probably won't affect us much */
|
||||
#define IDE_NICE_2 (4) /* when we know it's on our expense */
|
||||
|
||||
#ifdef __KERNEL__
|
||||
/*
|
||||
* These routines are used for kernel command line parameters from main.c:
|
||||
*/
|
||||
#include <linux/config.h>
|
||||
|
||||
#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
|
||||
int ide_register(int io_port, int ctl_port, int irq);
|
||||
void ide_unregister(unsigned int);
|
||||
#endif /* CONFIG_BLK_DEV_IDE || CONFIG_BLK_DEV_IDE_MODULE */
|
||||
|
||||
#endif /* __KERNEL__ */
|
||||
|
||||
#endif /* _LINUX_HDREG_H */
|
643
os_qnxnto.cpp
643
os_qnxnto.cpp
@ -1,643 +0,0 @@
|
||||
|
||||
|
||||
// This is needed for the various HAVE_* macros and PROJECT_* macros.
|
||||
#include "config.h"
|
||||
|
||||
// These are needed to define prototypes and structures for the
|
||||
// functions defined below
|
||||
#include "int64.h"
|
||||
#include "atacmds.h"
|
||||
#include "scsicmds.h"
|
||||
#include "utility.h"
|
||||
|
||||
// This is to include whatever structures and prototypes you define in
|
||||
// os_generic.h
|
||||
#include "os_qnxnto.h"
|
||||
|
||||
// Needed by '-V' option (CVS versioning) of smartd/smartctl. You
|
||||
// should have one *_H_CVSID macro appearing below for each file
|
||||
// appearing with #include "*.h" above. Please list these (below) in
|
||||
// alphabetic/dictionary order.
|
||||
const char *os_XXXX_c_cvsid="$Id: os_qnxnto.cpp,v 1.3 2008/06/12 21:46:31 ballen4705 Exp $" \
|
||||
ATACMDS_H_CVSID CONFIG_H_CVSID INT64_H_CVSID OS_QNXNTO_H_CVSID SCSICMDS_H_CVSID UTILITY_H_CVSID;
|
||||
|
||||
|
||||
// This is here to prevent compiler warnings for unused arguments of
|
||||
// functions.
|
||||
#define ARGUSED(x) ((void)(x))
|
||||
|
||||
// Please eliminate the following block: both the #include and
|
||||
// the 'unsupported()' function. They are only here to warn
|
||||
// unsuspecting users that their Operating System is not supported! If
|
||||
// you wish, you can use a similar warning mechanism for any of the
|
||||
// functions in this file that you can not (or choose not to)
|
||||
// implement.
|
||||
|
||||
|
||||
#ifdef HAVE_UNAME
|
||||
#include <sys/utsname.h>
|
||||
#endif
|
||||
//----------------------------------------------------------------------------------------------
|
||||
// private Functions
|
||||
static int ata_sense_data(void *sdata,int *error,int *key,int *asc,int *ascq);
|
||||
static int ata_interpret_sense(struct cam_pass_thru *cpt,void *sense,int *status,int rcount);
|
||||
static int ata_pass_thru(int fd,struct cam_pass_thru *pcpt);
|
||||
//----------------------------------------------------------------------------------------------
|
||||
static void unsupported(){
|
||||
static int warninggiven;
|
||||
|
||||
if (!warninggiven) {
|
||||
char *osname;
|
||||
extern unsigned char debugmode;
|
||||
unsigned char savedebugmode=debugmode;
|
||||
|
||||
#ifdef HAVE_UNAME
|
||||
struct utsname ostype;
|
||||
uname(&ostype);
|
||||
osname=ostype.sysname;
|
||||
#else
|
||||
osname="host's";
|
||||
#endif
|
||||
|
||||
debugmode=1;
|
||||
pout("\n"
|
||||
"############################################################################\n"
|
||||
"WARNING: smartmontools has not been ported to the %s Operating System.\n"
|
||||
"Please see the files os_generic.cpp and os_generic.h for porting instructions.\n"
|
||||
"############################################################################\n\n",
|
||||
osname);
|
||||
debugmode=savedebugmode;
|
||||
warninggiven=1;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
// End of the 'unsupported()' block that you should eliminate.
|
||||
|
||||
|
||||
// print examples for smartctl. You should modify this function so
|
||||
// that the device paths are sensible for your OS, and to eliminate
|
||||
// unsupported commands (eg, 3ware controllers).
|
||||
void print_smartctl_examples(){
|
||||
printf("=================================================== SMARTCTL EXAMPLES =====\n\n");
|
||||
#ifdef HAVE_GETOPT_LONG
|
||||
printf(
|
||||
" smartctl -a /dev/hd0 (Prints all SMART information)\n\n"
|
||||
" smartctl --smart=on --offlineauto=on --saveauto=on /dev/hd0\n"
|
||||
" (Enables SMART on first disk)\n\n"
|
||||
" smartctl -t long /dev/hd0 (Executes extended disk self-test)\n\n"
|
||||
" smartctl --attributes --log=selftest --quietmode=errorsonly /dev/hd0\n"
|
||||
" (Prints Self-Test & Attribute errors)\n"
|
||||
" smartctl -a --device=3ware,2 /dev/sda\n"
|
||||
" (Prints all SMART info for 3rd ATA disk on 3ware RAID controller)\n"
|
||||
);
|
||||
#else
|
||||
printf(
|
||||
" smartctl -a /dev/hd0 (Prints all SMART information)\n"
|
||||
" smartctl -s on -o on -S on /dev/hd0 (Enables SMART on first disk)\n"
|
||||
" smartctl -t long /dev/hd0 (Executes extended disk self-test)\n"
|
||||
" smartctl -A -l selftest -q errorsonly /dev/hd0\n"
|
||||
" (Prints Self-Test & Attribute errors)\n"
|
||||
" smartctl -a -d 3ware,2 /dev/sda\n"
|
||||
" (Prints all SMART info for 3rd ATA disk on 3ware RAID controller)\n"
|
||||
);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
// tries to guess device type given the name (a path). See utility.h
|
||||
// for return values.
|
||||
static const char *net_dev_prefix = "/dev/";
|
||||
static const char *net_dev_ata_disk = "hd";
|
||||
|
||||
int guess_device_type (const char* dev_name)
|
||||
{
|
||||
int len,dev_prefix_len;
|
||||
dev_prefix_len=strlen(net_dev_prefix);
|
||||
if(!dev_name||!(len=strlen(dev_name)))
|
||||
return(CONTROLLER_UNKNOWN);
|
||||
if (!strncmp(net_dev_prefix,dev_name,dev_prefix_len))
|
||||
{
|
||||
if(len<=dev_prefix_len)
|
||||
return(CONTROLLER_UNKNOWN);
|
||||
else
|
||||
dev_name += dev_prefix_len;
|
||||
}
|
||||
if(!strncmp(net_dev_ata_disk,dev_name,strlen(net_dev_ata_disk)))
|
||||
return(CONTROLLER_ATA);
|
||||
return(CONTROLLER_UNKNOWN);
|
||||
}
|
||||
|
||||
// makes a list of ATA or SCSI devices for the DEVICESCAN directive of
|
||||
// smartd. Returns number N of devices, or -1 if out of
|
||||
// memory. Allocates N+1 arrays: one of N pointers (devlist); the
|
||||
// other N arrays each contain null-terminated character strings. In
|
||||
// the case N==0, no arrays are allocated because the array of 0
|
||||
// pointers has zero length, equivalent to calling malloc(0).
|
||||
int make_device_names (char*** devlist, const char* name) {
|
||||
ARGUSED(devlist);
|
||||
ARGUSED(name);
|
||||
unsupported();
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Like open(). Return non-negative integer handle, only used by the
|
||||
// functions below. type=="ATA" or "SCSI". If you need to store
|
||||
// extra information about your devices, create a private internal
|
||||
// array within this file (see os_freebsd.cpp for an example). If you
|
||||
// can not open the device (permission denied, does not exist, etc)
|
||||
// set errno as open() does and return <0.
|
||||
int deviceopen(const char *pathname, char *type)
|
||||
{
|
||||
if(!strcmp(type, "ATA"))
|
||||
return(open(pathname,O_RDWR|O_NONBLOCK));
|
||||
else
|
||||
return(-1);
|
||||
}
|
||||
|
||||
// Like close(). Acts only on integer handles returned by
|
||||
// deviceopen() above.
|
||||
int deviceclose(int fd)
|
||||
{
|
||||
return(close(fd));
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------
|
||||
// Interface to ATA devices. See os_linux.cpp for the cannonical example.
|
||||
// DETAILED DESCRIPTION OF ARGUMENTS
|
||||
// device: is the integer handle provided by deviceopen()
|
||||
// command: defines the different operations, see atacmds.h
|
||||
// select: additional input data IF NEEDED (which log, which type of
|
||||
// self-test).
|
||||
// data: location to write output data, IF NEEDED (1 or 512 bytes).
|
||||
// Note: not all commands use all arguments.
|
||||
// RETURN VALUES (for all commands BUT command==STATUS_CHECK)
|
||||
// -1 if the command failed
|
||||
// 0 if the command succeeded,
|
||||
// RETURN VALUES if command==STATUS_CHECK
|
||||
// -1 if the command failed OR the disk SMART status can't be determined
|
||||
// 0 if the command succeeded and disk SMART status is "OK"
|
||||
// 1 if the command succeeded and disk SMART status is "FAILING"
|
||||
int ata_command_interface(int fd,smart_command_set command,int select,char *data)
|
||||
{
|
||||
struct cam_pass_thru cpt;
|
||||
ATA_SENSE sense;
|
||||
CDB *cdb;
|
||||
int status,rc;
|
||||
memset(&cpt,0x00,sizeof(struct cam_pass_thru));
|
||||
cdb=(CDB *)cpt.cam_cdb;
|
||||
rc=-1;
|
||||
switch(command)
|
||||
{
|
||||
case READ_VALUES:
|
||||
cpt.cam_flags = CAM_DIR_IN;
|
||||
cpt.cam_cdb_len = 16;
|
||||
cpt.cam_dxfer_len = 512;
|
||||
cpt.cam_data_ptr = (uint32_t)data;
|
||||
cpt.cam_sense_len = sizeof(sense);
|
||||
cpt.cam_sense_ptr = (uint32_t)&sense;
|
||||
cdb->ata_pass_thru.opcode = SC_ATA_PT16;
|
||||
cdb->ata_pass_thru.protocol = ATA_PROTO_PIO_DATA_IN;
|
||||
cdb->ata_pass_thru.flags = ATA_FLG_T_DIR|ATA_FLG_TLEN_STPSIU;
|
||||
cdb->ata_pass_thru.command = ATA_SMART_CMD;
|
||||
cdb->ata_pass_thru.features = ATA_SMART_READ_VALUES;
|
||||
cdb->ata_pass_thru.lba_mid = ATA_SMART_LBA_MID_SIG;
|
||||
cdb->ata_pass_thru.lba_high = ATA_SMART_LBA_HI_SIG;
|
||||
break;
|
||||
case READ_THRESHOLDS:
|
||||
cpt.cam_flags = CAM_DIR_IN;
|
||||
cpt.cam_cdb_len = 16;
|
||||
cpt.cam_dxfer_len = 512;
|
||||
cpt.cam_data_ptr = (uint32_t)data;
|
||||
cpt.cam_sense_len = sizeof(sense);
|
||||
cpt.cam_sense_ptr = (uint32_t)&sense;
|
||||
cdb->ata_pass_thru.opcode = SC_ATA_PT16;
|
||||
cdb->ata_pass_thru.protocol = ATA_PROTO_PIO_DATA_IN;
|
||||
cdb->ata_pass_thru.flags = ATA_FLG_T_DIR|ATA_FLG_TLEN_STPSIU;
|
||||
cdb->ata_pass_thru.command = ATA_SMART_CMD;
|
||||
cdb->ata_pass_thru.features = ATA_SMART_READ_THRESHOLDS;
|
||||
cdb->ata_pass_thru.lba_mid = ATA_SMART_LBA_MID_SIG;
|
||||
cdb->ata_pass_thru.lba_high = ATA_SMART_LBA_HI_SIG;
|
||||
break;
|
||||
case READ_LOG:
|
||||
cpt.cam_flags = CAM_DIR_IN;
|
||||
cpt.cam_cdb_len = 16;
|
||||
cpt.cam_dxfer_len = 512;
|
||||
cpt.cam_data_ptr = (uint32_t)data;
|
||||
cpt.cam_sense_len = sizeof(sense);
|
||||
cpt.cam_sense_ptr = (uint32_t)&sense;
|
||||
cdb->ata_pass_thru.opcode = SC_ATA_PT16;
|
||||
cdb->ata_pass_thru.protocol = ATA_PROTO_PIO_DATA_IN;
|
||||
cdb->ata_pass_thru.flags = ATA_FLG_T_DIR|ATA_FLG_TLEN_STPSIU;
|
||||
cdb->ata_pass_thru.command = ATA_SMART_CMD;
|
||||
cdb->ata_pass_thru.features = ATA_SMART_READ_LOG_SECTOR;
|
||||
cdb->ata_pass_thru.sector_count= 1;
|
||||
cdb->ata_pass_thru.lba_low = select;
|
||||
cdb->ata_pass_thru.lba_mid = ATA_SMART_LBA_MID_SIG;
|
||||
cdb->ata_pass_thru.lba_high = ATA_SMART_LBA_HI_SIG;
|
||||
break;
|
||||
case WRITE_LOG:
|
||||
return(-1);
|
||||
break;
|
||||
case IDENTIFY:
|
||||
cpt.cam_flags = CAM_DIR_IN;
|
||||
cpt.cam_cdb_len = 16;
|
||||
cpt.cam_dxfer_len = 512;
|
||||
cpt.cam_data_ptr = (uint32_t)data;
|
||||
cpt.cam_sense_len = sizeof(sense);
|
||||
cpt.cam_sense_ptr = (uint32_t)&sense;
|
||||
cdb->ata_pass_thru.opcode = SC_ATA_PT16;
|
||||
cdb->ata_pass_thru.protocol = ATA_PROTO_PIO_DATA_IN;
|
||||
cdb->ata_pass_thru.flags = ATA_FLG_T_DIR|ATA_FLG_TLEN_STPSIU;
|
||||
cdb->ata_pass_thru.command = ATA_IDENTIFY_DEVICE;
|
||||
break;
|
||||
case PIDENTIFY:
|
||||
cpt.cam_flags = CAM_DIR_IN;
|
||||
cpt.cam_cdb_len = 16;
|
||||
cpt.cam_dxfer_len = 512;
|
||||
cpt.cam_data_ptr = (uint32_t)data;
|
||||
cpt.cam_sense_len = sizeof(sense);
|
||||
cpt.cam_sense_ptr = (uint32_t)&sense;
|
||||
cdb->ata_pass_thru.opcode = SC_ATA_PT16;
|
||||
cdb->ata_pass_thru.protocol = ATA_PROTO_PIO_DATA_IN;
|
||||
cdb->ata_pass_thru.flags = ATA_FLG_T_DIR|ATA_FLG_TLEN_STPSIU;
|
||||
cdb->ata_pass_thru.command = ATA_IDENTIFY_PACKET_DEVICE;
|
||||
break;
|
||||
case ENABLE:
|
||||
cpt.cam_flags = CAM_DIR_NONE;
|
||||
cpt.cam_cdb_len = 16;
|
||||
cpt.cam_sense_len = sizeof(sense);
|
||||
cpt.cam_sense_ptr = (uint32_t)&sense;
|
||||
cdb->ata_pass_thru.opcode = SC_ATA_PT16;
|
||||
cdb->ata_pass_thru.protocol = ATA_PROTO_DATA_NONE;
|
||||
cdb->ata_pass_thru.command = ATA_SMART_CMD;
|
||||
cdb->ata_pass_thru.features = ATA_SMART_ENABLE;
|
||||
cdb->ata_pass_thru.lba_mid = ATA_SMART_LBA_MID_SIG;
|
||||
cdb->ata_pass_thru.lba_high = ATA_SMART_LBA_HI_SIG;
|
||||
break;
|
||||
case DISABLE:
|
||||
cpt.cam_flags = CAM_DIR_NONE;
|
||||
cpt.cam_cdb_len = 16;
|
||||
cpt.cam_sense_len = sizeof(sense);
|
||||
cpt.cam_sense_ptr = (uint32_t)&sense;
|
||||
cdb->ata_pass_thru.opcode = SC_ATA_PT16;
|
||||
cdb->ata_pass_thru.protocol = ATA_PROTO_DATA_NONE;
|
||||
cdb->ata_pass_thru.command = ATA_SMART_CMD;
|
||||
cdb->ata_pass_thru.features = ATA_SMART_DISABLE;
|
||||
cdb->ata_pass_thru.lba_mid = ATA_SMART_LBA_MID_SIG;
|
||||
cdb->ata_pass_thru.lba_high = ATA_SMART_LBA_HI_SIG;
|
||||
break;
|
||||
case AUTO_OFFLINE:
|
||||
// NOTE: According to ATAPI 4 and UP, this command is obsolete
|
||||
cpt.cam_flags = CAM_DIR_NONE;
|
||||
cpt.cam_cdb_len = 16;
|
||||
cpt.cam_sense_len = sizeof(sense);
|
||||
cpt.cam_sense_ptr = (uint32_t)&sense;
|
||||
cdb->ata_pass_thru.opcode = SC_ATA_PT16;
|
||||
cdb->ata_pass_thru.protocol = ATA_PROTO_DATA_NONE;
|
||||
cdb->ata_pass_thru.command = ATA_SMART_CMD;
|
||||
cdb->ata_pass_thru.features = ATA_SMART_AUTO_OFFLINE;
|
||||
cdb->ata_pass_thru.lba_low = select;
|
||||
cdb->ata_pass_thru.lba_mid = ATA_SMART_LBA_MID_SIG;
|
||||
cdb->ata_pass_thru.lba_high = ATA_SMART_LBA_HI_SIG;
|
||||
break;
|
||||
case AUTOSAVE:
|
||||
cpt.cam_flags = CAM_DIR_NONE;
|
||||
cpt.cam_cdb_len = 16;
|
||||
cpt.cam_sense_len = sizeof(sense);
|
||||
cpt.cam_sense_ptr = (uint32_t)&sense;
|
||||
cdb->ata_pass_thru.opcode = SC_ATA_PT16;
|
||||
cdb->ata_pass_thru.protocol = ATA_PROTO_DATA_NONE;
|
||||
cdb->ata_pass_thru.command = ATA_SMART_CMD;
|
||||
cdb->ata_pass_thru.features = ATA_SMART_AUTOSAVE;
|
||||
cdb->ata_pass_thru.sector_count= select;
|
||||
cdb->ata_pass_thru.lba_mid = ATA_SMART_LBA_MID_SIG;
|
||||
cdb->ata_pass_thru.lba_high = ATA_SMART_LBA_HI_SIG;
|
||||
break;
|
||||
case IMMEDIATE_OFFLINE:
|
||||
// NOTE: According to ATAPI 4 and UP, this command is obsolete
|
||||
cpt.cam_flags = CAM_DIR_NONE;
|
||||
cpt.cam_cdb_len = 16;
|
||||
cpt.cam_sense_len = sizeof(sense);
|
||||
cpt.cam_sense_ptr = (uint32_t)&sense;
|
||||
cdb->ata_pass_thru.opcode = SC_ATA_PT16;
|
||||
cdb->ata_pass_thru.protocol = ATA_PROTO_DATA_NONE;
|
||||
cdb->ata_pass_thru.command = ATA_SMART_CMD;
|
||||
cdb->ata_pass_thru.features = ATA_SMART_IMMEDIATE_OFFLINE;
|
||||
cdb->ata_pass_thru.lba_low = select;
|
||||
cdb->ata_pass_thru.lba_mid = ATA_SMART_LBA_MID_SIG;
|
||||
cdb->ata_pass_thru.lba_high = ATA_SMART_LBA_HI_SIG;
|
||||
break;
|
||||
case STATUS_CHECK:
|
||||
// same command, no HDIO in NetBSD
|
||||
case STATUS:
|
||||
cpt.cam_flags = CAM_DIR_NONE;
|
||||
cpt.cam_cdb_len = 16;
|
||||
cpt.cam_sense_len = sizeof(sense);
|
||||
cpt.cam_sense_ptr = (uint32_t)&sense;
|
||||
cdb->ata_pass_thru.opcode = SC_ATA_PT16;
|
||||
cdb->ata_pass_thru.protocol = ATA_PROTO_DATA_NONE;
|
||||
cdb->ata_pass_thru.flags = ATA_FLG_CK_COND;
|
||||
cdb->ata_pass_thru.command = ATA_SMART_CMD;
|
||||
cdb->ata_pass_thru.features = ATA_SMART_STATUS;
|
||||
cdb->ata_pass_thru.lba_mid = ATA_SMART_LBA_MID_SIG;
|
||||
cdb->ata_pass_thru.lba_high = ATA_SMART_LBA_HI_SIG;
|
||||
break;
|
||||
case CHECK_POWER_MODE:
|
||||
cpt.cam_flags = CAM_DIR_NONE;
|
||||
cpt.cam_cdb_len = 16;
|
||||
cpt.cam_sense_len = sizeof(sense);
|
||||
cpt.cam_sense_ptr = (uint32_t)&sense;
|
||||
cdb->ata_pass_thru.opcode = SC_ATA_PT16;
|
||||
cdb->ata_pass_thru.protocol = ATA_PROTO_DATA_NONE;
|
||||
cdb->ata_pass_thru.flags = ATA_FLG_CK_COND;
|
||||
cdb->ata_pass_thru.command = ATA_CHECK_POWER_MODE;
|
||||
break;
|
||||
default:
|
||||
pout("Unrecognized command %d in ata_command_interface()\n", command);
|
||||
errno=ENOSYS;
|
||||
return(-1);
|
||||
}
|
||||
// execute now
|
||||
if((status=ata_pass_thru(fd,&cpt))==EOK)
|
||||
{
|
||||
rc=status==EOK?0:-1;
|
||||
if(cpt.cam_status!=CAM_REQ_CMP)
|
||||
{
|
||||
ata_interpret_sense(&cpt,&sense,&status,0);
|
||||
if(command==STATUS||command==STATUS_CHECK)
|
||||
rc=((sense.desc.lba_high<<8)|sense.desc.lba_mid)==ATA_SMART_SIG?0:1;
|
||||
}
|
||||
}
|
||||
if(command==CHECK_POWER_MODE)
|
||||
data[0]=cdb->ata_pass_thru.sector_count;
|
||||
// finish
|
||||
return(rc);
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------
|
||||
int marvell_command_interface(int fd, smart_command_set command, int select, char *data)
|
||||
{
|
||||
ARGUSED(fd);
|
||||
ARGUSED(command);
|
||||
ARGUSED(select);
|
||||
ARGUSED(data);
|
||||
unsupported();
|
||||
return -1;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------
|
||||
int highpoint_command_interface(int fd, smart_command_set command, int select, char *data)
|
||||
{
|
||||
ARGUSED(fd);
|
||||
ARGUSED(command);
|
||||
ARGUSED(select);
|
||||
ARGUSED(data);
|
||||
unsupported();
|
||||
return -1;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------
|
||||
// Interface to ATA devices behind 3ware escalade/apache RAID
|
||||
// controller cards. Same description as ata_command_interface()
|
||||
// above except that 0 <= disknum <= 15 specifies the ATA disk
|
||||
// attached to the controller, and controller_type specifies the
|
||||
// precise type of 3ware controller. See os_linux.c
|
||||
int escalade_command_interface(int fd,int disknum,int controller_type,smart_command_set command,int select,char *data)
|
||||
{
|
||||
ARGUSED(fd);
|
||||
ARGUSED(disknum);
|
||||
ARGUSED(controller_type);
|
||||
ARGUSED(command);
|
||||
ARGUSED(select);
|
||||
ARGUSED(data);
|
||||
|
||||
unsupported();
|
||||
return -1;
|
||||
}
|
||||
|
||||
int areca_command_interface(int fd,int disknum,smart_command_set command,int select,char *data)
|
||||
{
|
||||
ARGUSED(fd);
|
||||
ARGUSED(disknum);
|
||||
ARGUSED(command);
|
||||
ARGUSED(select);
|
||||
ARGUSED(data);
|
||||
|
||||
unsupported();
|
||||
return -1;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------
|
||||
#include <errno.h>
|
||||
// Interface to SCSI devices. See os_linux.c
|
||||
int do_scsi_cmnd_io(int fd,struct scsi_cmnd_io * iop,int report)
|
||||
{
|
||||
ARGUSED(fd);
|
||||
ARGUSED(iop);
|
||||
ARGUSED(report);
|
||||
unsupported();
|
||||
return -ENOSYS;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------
|
||||
//----------------------------------------------------------------------------------------------
|
||||
static int ata_sense_data(void *sdata,int *error,int *key,int *asc,int *ascq)
|
||||
{
|
||||
SCSI_SENSE *sf;
|
||||
SCSI_SENSE_DESCRIPTOR *sd;
|
||||
sf=(SCSI_SENSE *)sdata;
|
||||
sd=(SCSI_SENSE_DESCRIPTOR *)sdata;
|
||||
*error=sf->error;
|
||||
if(*error & SENSE_DATA_FMT_DESCRIPTOR)
|
||||
{
|
||||
*key=sd->sense & SK_MSK;
|
||||
*asc=sd->asc;
|
||||
*ascq=sd->ascq;
|
||||
}
|
||||
else
|
||||
{
|
||||
*key=sf->sense & SK_MSK;
|
||||
*asc=sf->asc;
|
||||
*ascq=sf->ascq;
|
||||
}
|
||||
return(CAM_SUCCESS);
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------
|
||||
static int ata_interpret_sense(struct cam_pass_thru *cpt,void *sense,int *status,int rcount)
|
||||
{
|
||||
int retry;
|
||||
int key;
|
||||
int asc;
|
||||
int ascq;
|
||||
int error;
|
||||
*status=EIO;
|
||||
retry=CAM_TRUE;
|
||||
if(cpt->cam_status&CAM_AUTOSNS_VALID)
|
||||
{
|
||||
ata_sense_data(sense,&error,&key,&asc,&ascq);
|
||||
switch(key)
|
||||
{
|
||||
case SK_NO_SENSE: // No sense data (no error)
|
||||
retry=CAM_FALSE;
|
||||
*status=EOK;
|
||||
break;
|
||||
case SK_RECOVERED: // Recovered error
|
||||
switch(asc)
|
||||
{
|
||||
case ASC_ATA_PASS_THRU:
|
||||
switch(ascq)
|
||||
{
|
||||
case ASCQ_ATA_PASS_THRU_INFO_AVAIL:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
retry=CAM_FALSE;
|
||||
*status=EOK;
|
||||
break;
|
||||
case SK_NOT_RDY: // Device not ready
|
||||
*status=EAGAIN;
|
||||
switch(asc)
|
||||
{
|
||||
case ASC_NOT_READY:
|
||||
switch(ascq)
|
||||
{
|
||||
case ASCQ_BECOMING_READY:
|
||||
case ASCQ_CAUSE_NOT_REPORTABLE:
|
||||
default:
|
||||
retry=CAM_FALSE;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case ASC_MEDIA_NOT_PRESENT:
|
||||
*status=ENXIO;
|
||||
retry=CAM_FALSE;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case SK_MEDIUM: // Medium error
|
||||
case SK_HARDWARE: // Hardware error
|
||||
retry=CAM_FALSE;
|
||||
*status=EIO;
|
||||
break;
|
||||
case SK_ILLEGAL: // Illegal Request (bad command)
|
||||
retry=CAM_FALSE;
|
||||
*status=EINVAL;
|
||||
break;
|
||||
case SK_UNIT_ATN: // Unit Attention
|
||||
switch(asc)
|
||||
{
|
||||
case ASC_MEDIUM_CHANGED:
|
||||
*status=ESTALE;
|
||||
retry=CAM_FALSE;
|
||||
break;
|
||||
case ASC_BUS_RESET:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case SK_DATA_PROT: // Data Protect
|
||||
retry=CAM_FALSE;
|
||||
*status=EROFS;
|
||||
break;
|
||||
case SK_VENDOR: // Vendor Specific
|
||||
case SK_CPY_ABORT: // Copy Aborted
|
||||
retry=CAM_FALSE;
|
||||
*status=EIO;
|
||||
break;
|
||||
case SK_CMD_ABORT: // Aborted Command
|
||||
retry=CAM_FALSE;
|
||||
*status=ECANCELED;
|
||||
break;
|
||||
case SK_EQUAL: // Equal
|
||||
case SK_VOL_OFL: // Volume Overflow
|
||||
case SK_MISCMP: // Miscompare
|
||||
case SK_RESERVED: // Reserved
|
||||
break;
|
||||
}
|
||||
if(*status==EOK)
|
||||
{
|
||||
switch(cpt->cam_status&CAM_STATUS_MASK)
|
||||
{
|
||||
case CAM_REQ_CMP_ERR: // CCB request completed with an err
|
||||
retry=CAM_FALSE;
|
||||
*status=EIO;
|
||||
break;
|
||||
case CAM_BUSY: // CAM subsystem is busy
|
||||
*status=EAGAIN;
|
||||
break;
|
||||
case CAM_REQ_INVALID: // CCB request is invalid
|
||||
case CAM_PATH_INVALID: // Path ID supplied is invalid
|
||||
case CAM_DEV_NOT_THERE: // SCSI device not installed/there
|
||||
case CAM_SEL_TIMEOUT: // Target selection timeout
|
||||
case CAM_LUN_INVALID: // LUN supplied is invalid
|
||||
case CAM_TID_INVALID: // Target ID supplied is invalid
|
||||
retry=CAM_FALSE;
|
||||
*status=ENXIO;
|
||||
break;
|
||||
case CAM_CMD_TIMEOUT: // Command timeout
|
||||
*status=rcount?EAGAIN:EIO;
|
||||
break;
|
||||
case CAM_MSG_REJECT_REC: // Message reject received
|
||||
case CAM_SCSI_BUS_RESET: // SCSI bus reset sent/received
|
||||
case CAM_UNCOR_PARITY: // Uncorrectable parity err occurred
|
||||
case CAM_AUTOSENSE_FAIL: // Autosense: Request sense cmd fail
|
||||
case CAM_NO_HBA: // No HBA detected Error
|
||||
case CAM_DATA_RUN_ERR: // Data overrun/underrun error
|
||||
retry=CAM_FALSE;
|
||||
*status=EIO;
|
||||
break;
|
||||
case CAM_UNEXP_BUSFREE: // Unexpected BUS free
|
||||
case CAM_SEQUENCE_FAIL: // Target bus phase sequence failure
|
||||
*status=EIO;
|
||||
break;
|
||||
case CAM_PROVIDE_FAIL: // Unable to provide requ. capability
|
||||
retry=CAM_FALSE;
|
||||
*status=ENOTTY;
|
||||
break;
|
||||
case CAM_CCB_LEN_ERR: // CCB length supplied is inadequate
|
||||
case CAM_BDR_SENT: // A SCSI BDR msg was sent to target
|
||||
case CAM_REQ_TERMIO: // CCB request terminated by the host
|
||||
case CAM_FUNC_NOTAVAIL: // The requ. func is not available
|
||||
case CAM_NO_NEXUS: // Nexus is not established
|
||||
case CAM_IID_INVALID: // The initiator ID is invalid
|
||||
case CAM_CDB_RECVD: // The SCSI CDB has been received
|
||||
retry=CAM_FALSE;
|
||||
*status=EIO;
|
||||
break;
|
||||
case CAM_SCSI_BUSY: // SCSI bus busy
|
||||
*status=EAGAIN;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return(retry);
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------
|
||||
static int ata_pass_thru(int fd,struct cam_pass_thru *pcpt)
|
||||
{
|
||||
int icnt;
|
||||
int status;
|
||||
iov_t iov[3];
|
||||
struct cam_pass_thru cpt;
|
||||
cpt=*pcpt;
|
||||
icnt=1;
|
||||
SETIOV(&iov[0],&cpt,sizeof(cpt));
|
||||
cpt.cam_timeout=cpt.cam_timeout?cpt.cam_timeout:CAM_TIME_DEFAULT;
|
||||
if(cpt.cam_sense_len)
|
||||
{
|
||||
SETIOV(&iov[1],cpt.cam_sense_ptr,cpt.cam_sense_len);
|
||||
cpt.cam_sense_ptr=sizeof(cpt);
|
||||
icnt++;
|
||||
}
|
||||
if(cpt.cam_dxfer_len)
|
||||
{
|
||||
SETIOV(&iov[2],(void *)cpt.cam_data_ptr,cpt.cam_dxfer_len);
|
||||
cpt.cam_data_ptr=(paddr_t)sizeof(cpt)+cpt.cam_sense_len;
|
||||
icnt++;
|
||||
}
|
||||
if((status=devctlv(fd,DCMD_CAM_PASS_THRU,icnt,icnt,iov,iov,NULL)))
|
||||
pout("ata_pass_thru devctl: %s\n",strerror(status));
|
||||
pcpt->cam_status=cpt.cam_status;
|
||||
pcpt->cam_scsi_status=cpt.cam_scsi_status;
|
||||
return(status);
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------
|
896
os_qnxnto.h
896
os_qnxnto.h
@ -1,896 +0,0 @@
|
||||
/*
|
||||
* os_generic.h
|
||||
*
|
||||
* Home page of code is: http://smartmontools.sourceforge.net
|
||||
*
|
||||
* Copyright (C) Joerg Hering <smartmontools-support@lists.sourceforge.net>
|
||||
* Copyright (C) 2003-8 Bruce Allen <smartmontools-support@lists.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* (for example COPYING); if not, write to the Free
|
||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* This code was originally developed as a Senior Thesis by Michael Cornwell
|
||||
* at the Concurrent Systems Laboratory (now part of the Storage Systems
|
||||
* Research Center), Jack Baskin School of Engineering, University of
|
||||
* California, Santa Cruz. http://ssrc.soe.ucsc.edu/
|
||||
*
|
||||
*/
|
||||
#ifndef OS_QNXNTO_H_
|
||||
#define OS_QNXNTO_H_
|
||||
#define OS_QNXNTO_H_CVSID "$Id: os_qnxnto.h,v 1.2 2008/03/04 22:09:47 ballen4705 Exp $\n"
|
||||
|
||||
// Additional material should start here. Note: to keep the '-V' CVS
|
||||
// reporting option working as intended, you should only #include
|
||||
// system include files <something.h>. Local #include files
|
||||
// <"something.h"> should be #included in os_generic.c
|
||||
#include <sys/cpt.h>
|
||||
|
||||
#ifndef __TYPES_H_INCLUDED
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <gulliver.h>
|
||||
#include <sys/cpt.h>
|
||||
#include <sys/dcmd_cam.h>
|
||||
#include <sys/cam_device.h>
|
||||
#include "atacmds.h"
|
||||
|
||||
//----------------------------------------------------------------------------------------------------------
|
||||
typedef struct _ata_pass_thru ATA_PASS_THRU;
|
||||
typedef struct _eide_identify EIDE_IDENTIFY;
|
||||
typedef struct _ata_sense ATA_SENSE;
|
||||
|
||||
typedef void CCB;
|
||||
struct _sim_hba;
|
||||
struct _resmgr_context;
|
||||
|
||||
|
||||
typedef struct _drive_attribute
|
||||
{
|
||||
int id;
|
||||
int threshold;
|
||||
char *name;
|
||||
}DRIVE_ATTRIBUTE;
|
||||
|
||||
//----------------------------------------------------------------------------------------------------------
|
||||
/* UNIVOS OSD defines and data structures. */
|
||||
|
||||
#define INQLEN 36 /* Inquiry string length to store. */
|
||||
|
||||
#define CAM_SUCCESS 0 /* For signaling general success */
|
||||
#define CAM_FAILURE 1 /* For signaling general failure */
|
||||
|
||||
#define CAM_FALSE 0 /* General purpose flag value */
|
||||
#define CAM_TRUE 1 /* General purpose flag value */
|
||||
|
||||
//----------------------------------------------------------------------------------------------------------
|
||||
// Group 3 and 4, command codes 60H-9FH are reserved
|
||||
#define SC_ATA_PT16 0x85 // ATA Pass-through
|
||||
//----------------------------------------------------------------------------------------------------------
|
||||
#define ATA_SMART_LBA_MID_SIG 0x4f
|
||||
#define ATA_SMART_LBA_HI_SIG 0xc2
|
||||
#define ATA_SMART_SIG 0xc24f
|
||||
//----------------------------------------------------------------------------------------------------------
|
||||
struct _ata_pass_thru {
|
||||
uchar_t opcode;
|
||||
#define ATA_PROTO_MSK 0x1e
|
||||
#define ATA_PROTO_RESPONSE (15 << 1)
|
||||
#define ATA_PROTO_FPDMA (12 << 1)
|
||||
#define ATA_PROTO_UDMA_DATA_OUT (11 << 1)
|
||||
#define ATA_PROTO_UDMA_DATA_IN (10 << 1)
|
||||
#define ATA_PROTO_DEVICE_RESET (9 << 1)
|
||||
#define ATA_PROTO_DEVICE_DIAGNOSTIC (8 << 1)
|
||||
#define ATA_PROTO_DMA_QUEUED (7 << 1)
|
||||
#define ATA_PROTO_DMA (6 << 1)
|
||||
#define ATA_PROTO_PIO_DATA_OUT (5 << 1)
|
||||
#define ATA_PROTO_PIO_DATA_IN (4 << 1)
|
||||
#define ATA_PROTO_DATA_NONE (3 << 1)
|
||||
#define ATA_PROTO_SRST (1 << 1)
|
||||
#define ATA_PROTO_HRST (0 << 1)
|
||||
#define ATA_PROTO_EXTEND 0x01
|
||||
uchar_t protocol; // multiple count, protocol
|
||||
#define ATA_MCOUNT_MSK 0xe0
|
||||
|
||||
#define ATA_FLG_CK_COND 0x20
|
||||
#define ATA_FLG_T_DIR 0x08 // data from device
|
||||
#define ATA_FLG_BYT_BLOK 0x04
|
||||
#define ATA_FLG_TLEN_STPSIU 0x03
|
||||
#define ATA_FLG_TLEN_SECTOR_COUNT 0x02
|
||||
#define ATA_FLG_TLEN_FEATURE 0x01
|
||||
uchar_t flags;
|
||||
|
||||
uchar_t efeatures;
|
||||
uchar_t features;
|
||||
uchar_t esector_count;
|
||||
uchar_t sector_count;
|
||||
uchar_t elba_low;
|
||||
uchar_t lba_low;
|
||||
uchar_t elba_mid;
|
||||
uchar_t lba_mid;
|
||||
uchar_t elba_high;
|
||||
uchar_t lba_high;
|
||||
uchar_t device;
|
||||
uchar_t command;
|
||||
uchar_t control;
|
||||
} ata_pass_thru_;
|
||||
//----------------------------------------------------------------------------------------------------------
|
||||
#define SENSE_DATA_FMT_DESCRIPTOR 0x02
|
||||
|
||||
// Fixed Format Sense Data Structure
|
||||
// Note: The field "error" has the following format:
|
||||
// bit 7 - Address valid bit
|
||||
// bits 6-4 - Error class
|
||||
// bits 3-0 - Error code
|
||||
//
|
||||
// Error classes 0-6 are vendor unique and also indicate that the
|
||||
// sense data is in _nonextended_ format. (i.e. not usually used)
|
||||
// struct _scsi_nonextended_sense {
|
||||
// uchar_t sd_err;
|
||||
// ulong_t sd_block_address;
|
||||
// };
|
||||
//
|
||||
// An error class of 7 and an error code of 0 (70H) indicate SCSI-1
|
||||
// extended sense data format (or SCSI-2 sense data format).
|
||||
//
|
||||
// An error class of 7 and an error code of 1 (71H) indicate SCSI-2
|
||||
// deferred errors.
|
||||
//
|
||||
// Error codes 74H to 7EH are reserved and error code 7FH indicates
|
||||
// a vendor-specific sense data format.
|
||||
typedef struct _scsi_sense {
|
||||
uchar_t error; // Error Code
|
||||
uchar_t segment; // Segment number
|
||||
uchar_t sense; // Sense key/flags
|
||||
uchar_t info[4]; // Information (32bit big-endian value)
|
||||
uchar_t asl; // Additional Sense Length
|
||||
uchar_t csinfo[4]; // Command-Specific Information
|
||||
uchar_t asc; // Additional Sense Code
|
||||
uchar_t ascq; // Additional Sense Code Qualifier
|
||||
uchar_t fruc; // Field Replaceable Unit Code
|
||||
uchar_t sks; // Sense Key Specific
|
||||
ushort_t sks_data; // Sense Key Specific Data (16bit big-endian)
|
||||
ushort_t asb; // Additional Sense uchar_ts (Max 256-18)
|
||||
} SCSI_SENSE;
|
||||
|
||||
// Descriptor Format Sense Data Structure
|
||||
// error code of 72 current, 73 deferred
|
||||
// extended sense data format (or SCSI-2 sense data format).
|
||||
typedef struct _scsi_sense_descriptor {
|
||||
uchar_t error; // Error Code
|
||||
uchar_t sense; // Sense key/flags
|
||||
uchar_t asc; // Additional Sense Code
|
||||
uchar_t ascq; // Additional Sense Code Qualifier
|
||||
uchar_t rsvd[3];
|
||||
uchar_t asl; // Additional Sense Length
|
||||
} SCSI_SENSE_DESCRIPTOR;
|
||||
|
||||
typedef struct _scsi_sense_desriptor_header {
|
||||
uchar_t descriptor_type;
|
||||
uchar_t descriptor_len;
|
||||
} SCSI_SENSE_DESCRIPTOR_HEADER;
|
||||
|
||||
#define SENSE_DTYPE_INFORMATION 0x00
|
||||
#define SENSE_DTYPE_CSI 0x01 // Command Specific Information
|
||||
#define SENSE_DTYPE_SKS 0x02 // Sense Key Specific
|
||||
#define SENSE_DTYPE_FRU 0x03 // Field Replaceable Unit
|
||||
#define SENSE_DTYPE_STREAM 0x04
|
||||
#define SENSE_DTYPE_BLOCK 0x05
|
||||
#define SENSE_DTYPE_OSD_OBJ_IDENT 0x06 // OSD Object Identification
|
||||
#define SENSE_DTYPE_OSD_INTEGRITY 0x07 // OSD Response Integrity Check Value
|
||||
#define SENSE_DTYPE_OSD_ATR_IDENT 0x08 // OSD Attribute Identification
|
||||
#define SENSE_DTYPE_ATA 0x09
|
||||
|
||||
typedef struct _ata_status_descriptor {
|
||||
uchar_t descriptor_type;
|
||||
#define ATA_SD_DLEN 0x0c
|
||||
uchar_t descriptor_len; /* 0xc */
|
||||
#define ATA_SD_FLG_EXTEND 0x01
|
||||
uchar_t flags;
|
||||
uchar_t error;
|
||||
uchar_t esector_count; /* (15:8) */
|
||||
uchar_t sector_count; /* (7:0) */
|
||||
uchar_t elba_low; /* (15:8) */
|
||||
uchar_t lba_low; /* (7:0) */
|
||||
uchar_t elba_mid; /* (15:8) */
|
||||
uchar_t lba_mid; /* (7:0) */
|
||||
uchar_t elba_high; /* (15:8) */
|
||||
uchar_t lba_high; /* (7:0) */
|
||||
uchar_t device;
|
||||
uchar_t status;
|
||||
} ATA_STATUS_DESCRIPTOR;
|
||||
|
||||
//----------------------------------------------------------------------------------------------------------
|
||||
// Sense Keys
|
||||
#define SK_MSK 0x0F // mask to sd_sense field for key
|
||||
|
||||
#define SK_NO_SENSE 0 // No sense data (no error)
|
||||
#define ASCQ_FILEMARK_DETECTED 0x01
|
||||
#define ASCQ_EOPM_DETECTED 0x02 // End of Partition/Medium Detected
|
||||
#define ASCQ_SETMARK_DETECTED 0x03
|
||||
#define ASCQ_BOPM_DETECTED 0x04 // Beginning of Partition/Medium Detected
|
||||
|
||||
#define SK_RECOVERED 1 // Recovered error
|
||||
#define ASC_ATA_PASS_THRU 0x00
|
||||
#define ASCQ_ATA_PASS_THRU_INFO_AVAIL 0x1d
|
||||
|
||||
#define SK_NOT_RDY 2 // Device not ready
|
||||
#define ASC_NO_SEEK_COMPLETE 0x02
|
||||
#define ASC_NOT_READY 0x04
|
||||
#define ASCQ_CAUSE_NOT_REPORTABLE 0x00
|
||||
#define ASCQ_BECOMING_READY 0x01
|
||||
#define ASCQ_INIT_COMMAND_REQUIRED 0x02
|
||||
#define ASCQ_MANUAL_INTERVENTION_REQUIRED 0x03
|
||||
#define ASCQ_FORMAT_IN_PROGRESS 0x04
|
||||
#define ASCQ_UNKNOWN_CHANGED 0xff // NTO extension for fdc's
|
||||
#define ASC_MEDIA_FORMAT 0x30 // bad format
|
||||
#define ASC_MEDIA_NOT_PRESENT 0x3a
|
||||
#define ASC_NOT_CONFIGURED 0x3e
|
||||
|
||||
#define SK_MEDIUM 3 // Medium error
|
||||
#define ASC_UNRECOVERABLE_READ_ERROR 0x11
|
||||
#define ASC_RECORD_NOT_FOUND 0x14
|
||||
#define ASCQ_RECORD_NOT_FOUND 0x01
|
||||
#define ASC_UNABLE_TO_RECOVER_TOC 0x57
|
||||
#define ASC_INCOMPATIBLE_MEDIUM 0x64
|
||||
|
||||
#define SK_HARDWARE 4 // Hardware error
|
||||
#define ASC_INTERNAL_TARGET_FAILURE 0x44
|
||||
#define ASC_MEDIA_LOAD_EJECT_FAILURE 0x53
|
||||
#define ASCQ_UNRECOVERABLE_CIRC 0x06
|
||||
|
||||
#define SK_ILLEGAL 5 // Illegal Request (bad command)
|
||||
#define ASC_INVALID_COMMAND 0x20
|
||||
#define ASC_INVALID_FIELD 0x24
|
||||
#define ASC_INVALID_FIELD_PARAMETER 0x26
|
||||
#define ASC_COMMAND_SEQUENCE_ERROR 0x2c
|
||||
#define ASCQ_READ_SCRAMBLED 0x03
|
||||
#define ASC_ILLEGAL_MODE 0x64
|
||||
#define ASC_COPY_PROTECTION 0x6f
|
||||
|
||||
#define SK_UNIT_ATN 6 // Unit Attention
|
||||
#define ASC_MEDIUM_CHANGED 0x28
|
||||
#define ASC_BUS_RESET 0x29
|
||||
#define ASC_INSUFFICIENT_TIME_FOR_OPERATION 0x2e
|
||||
#define ASC_OPERATOR_REQUEST 0x5a
|
||||
#define ASCQ_OPERATOR_MEDIUM_REMOVAL 0x01
|
||||
|
||||
#define SK_DATA_PROT 7 // Data Protect
|
||||
#define ASC_WRITE_PROTECTED 0x27
|
||||
|
||||
#define SK_BLNK_CHK 8 // Blank Check
|
||||
#define SK_VENDOR 9 // Vendor Specific
|
||||
#define SK_CPY_ABORT 10 // Copy Aborted
|
||||
#define SK_CMD_ABORT 11 // Aborted Command
|
||||
#define SK_EQUAL 12 // Equal
|
||||
#define SK_VOL_OFL 13 // Volume Overflow
|
||||
#define SK_MISCMP 14 // Miscompare
|
||||
#define SK_RESERVED 15 // Reserved
|
||||
//----------------------------------------------------------------------------------------------------------
|
||||
// Command Descriptor Block structure definitions
|
||||
|
||||
// CDB Flags
|
||||
#define CF_LINK 0x01 // Linked-command indication
|
||||
#define CF_FLAG 0x02 // Linked-command with flag bit
|
||||
#define CF_VENDOR0 0x40 // Vendor unique bits
|
||||
#define CF_VENDOR1 0x80
|
||||
|
||||
#define CF_FUA 0x08
|
||||
#define CF_DPO 0x10
|
||||
|
||||
typedef union _cdb {
|
||||
// generic 6 byte command descriptor block
|
||||
struct {
|
||||
uchar_t opcode;
|
||||
uchar_t lun_opt;
|
||||
uchar_t lba_byte1;
|
||||
uchar_t lba_byte0; // LSB
|
||||
uchar_t transfer_len;
|
||||
uchar_t control;
|
||||
} gen6;
|
||||
|
||||
// generic 10 byte command descriptor block
|
||||
struct {
|
||||
uchar_t opcode;
|
||||
uchar_t lun_opt;
|
||||
uchar_t lba_byte3;
|
||||
uchar_t lba_byte4;
|
||||
uchar_t lba_byte1;
|
||||
uchar_t lba_byte0;
|
||||
uchar_t rsvd;
|
||||
uchar_t transfer_len[2];
|
||||
uchar_t control;
|
||||
} gen10;
|
||||
|
||||
// generic 12 byte command descriptor block
|
||||
struct {
|
||||
uchar_t opcode;
|
||||
uchar_t lun_opt;
|
||||
uchar_t lba_byte3;
|
||||
uchar_t lba_byte4;
|
||||
uchar_t lba_byte1;
|
||||
uchar_t lba_byte0;
|
||||
uchar_t transfer_len[4];
|
||||
uchar_t rsvd10;
|
||||
uchar_t control;
|
||||
} gen12;
|
||||
|
||||
struct _format_unit {
|
||||
uchar_t op_code;
|
||||
#define FU_RSVD0 0xc0 // reserved bits
|
||||
#define FU_FMTDAT 0x10
|
||||
#define FU_CMPLIST 0x08
|
||||
uchar_t defect_list_fmt;
|
||||
uchar_t track_num;
|
||||
ushort_t interleave;
|
||||
uchar_t rsvd1[7];
|
||||
} format_unit;
|
||||
|
||||
struct _format_unit_old {
|
||||
uchar_t op_code;
|
||||
uchar_t rsvd0;
|
||||
uchar_t medium_type_code;
|
||||
uchar_t rsvd1;
|
||||
uchar_t interleave;
|
||||
uchar_t rsvd2;
|
||||
#define FMT_RSVD3 0x80
|
||||
#define FMT_SECT_SIZE_CD 0x70
|
||||
#define FMT_IMMED 0x08
|
||||
#define FMT_HEAD 0x04
|
||||
#define FMT_ST 0x02
|
||||
#define FMT_CERT 0x01
|
||||
uchar_t cert;
|
||||
uchar_t track_addr;
|
||||
uchar_t rsvd4[4];
|
||||
} format_unit_old;
|
||||
|
||||
#define RW_OPT_RELADR 0x01
|
||||
#define RW_OPT_CORRCT 0x02 // Disable Corrections
|
||||
#define RW_OPT_FUA 0x08 // Force Unit Access
|
||||
#define RW_OPT_DPO 0x10 // Disable Page Out
|
||||
struct {
|
||||
uchar_t opcode;
|
||||
uchar_t lun_lba;
|
||||
uchar_t lba[2];
|
||||
uchar_t transfer_len;
|
||||
uchar_t control;
|
||||
} read_write6;
|
||||
|
||||
struct {
|
||||
uchar_t opcode;
|
||||
uchar_t lun_opt;
|
||||
uchar_t lba[4];
|
||||
uchar_t rsvd2;
|
||||
uchar_t transfer_len[2];
|
||||
uchar_t control;
|
||||
} read_write10;
|
||||
|
||||
struct {
|
||||
uchar_t opcode;
|
||||
uchar_t lun_opt;
|
||||
uchar_t lba[4];
|
||||
uchar_t transfer_len[4];
|
||||
uchar_t rsvd2;
|
||||
uchar_t control;
|
||||
} read_write12;
|
||||
|
||||
#define MSEL_OPT_PF 0x10 // Page Format
|
||||
#define MSEL_OPT_SP 0x01 // Save Page
|
||||
struct {
|
||||
uchar_t opcode;
|
||||
uchar_t lun_opt;
|
||||
uchar_t rsvd2;
|
||||
uchar_t rsvd3;
|
||||
uchar_t param_length;
|
||||
uchar_t control;
|
||||
} mode_select;
|
||||
|
||||
struct {
|
||||
uchar_t opcode;
|
||||
uchar_t lun_opt;
|
||||
uchar_t rsvd2;
|
||||
uchar_t rsvd3;
|
||||
uchar_t rsvd4;
|
||||
uchar_t rsvd5;
|
||||
uchar_t rsvd6;
|
||||
uchar_t param_length[2];
|
||||
uchar_t control;
|
||||
} mode_select10;
|
||||
|
||||
struct {
|
||||
uchar_t opcode;
|
||||
#define LS_OPT_SP 0x01 // Save Parameters
|
||||
#define LS_OPT_PCR 0x02 // Parameter Code Reset
|
||||
uchar_t lun_opt;
|
||||
#define LS_PC_CUR_THRESHOLD 0x00
|
||||
#define LS_PC_CUR_CUMULATIVE 0x01
|
||||
#define LS_PC_DFLT_THRESHOLD 0x02
|
||||
#define LS_PC_DFLT_CUMULATIVE 0x03
|
||||
uchar_t pc; // Page Control
|
||||
uchar_t rsvd3;
|
||||
uchar_t rsvd4;
|
||||
uchar_t rsvd5;
|
||||
uchar_t rsvd6;
|
||||
uchar_t param_length[2];
|
||||
uchar_t control;
|
||||
} log_select;
|
||||
|
||||
struct {
|
||||
uchar_t opcode;
|
||||
#define MSNS_OPT_DBD 0x08 // Disable Block Descriptors
|
||||
uchar_t lun_opt;
|
||||
#define PC_CURRENT 0x00
|
||||
#define PC_CHANGEABLE 0x40
|
||||
#define PC_DEFAULT 0x80
|
||||
#define PC_SAVED 0xC0
|
||||
#define PC_MSK 0xC0
|
||||
uchar_t pc_page;
|
||||
uchar_t subpage;
|
||||
uchar_t allocation_length;
|
||||
uchar_t control;
|
||||
} mode_sense;
|
||||
|
||||
struct _mode_sense10 {
|
||||
uchar_t opcode;
|
||||
uchar_t lun_opt;
|
||||
uchar_t pc_page;
|
||||
uchar_t subpage;
|
||||
uchar_t rsvd4;
|
||||
uchar_t rsvd5;
|
||||
uchar_t rsvd6;
|
||||
uchar_t allocation_length[2];
|
||||
uchar_t control;
|
||||
} mode_sense10;
|
||||
|
||||
struct {
|
||||
uchar_t opcode;
|
||||
uchar_t lun_opt;
|
||||
uchar_t pc_page;
|
||||
uchar_t rsvd3;
|
||||
uchar_t rsvd4;
|
||||
uchar_t parameter_pointer[2];
|
||||
uchar_t allocation_length[2];
|
||||
uchar_t control;
|
||||
} log_sense;
|
||||
|
||||
struct {
|
||||
uchar_t opcode;
|
||||
uchar_t lun_opt;
|
||||
uchar_t rsvd2;
|
||||
uchar_t rsvd3;
|
||||
uchar_t prevent;
|
||||
uchar_t control;
|
||||
} removal;
|
||||
|
||||
struct {
|
||||
uchar_t opcode;
|
||||
#define LD_OPT_IMMED 0x01
|
||||
uchar_t lun_opt;
|
||||
uchar_t rsvd2;
|
||||
uchar_t rsvd3;
|
||||
#define LD_CMD_START 0x01
|
||||
#define LD_CMD_LOEJ 0x02
|
||||
#define LD_CMD_STOP 0x00
|
||||
#define LD_CMD_EJECT 0x02
|
||||
#define LD_CMD_LOAD 0x03
|
||||
|
||||
// Sequential-Access
|
||||
#define LD_CMD_SA_HOLD 0x08
|
||||
#define LD_CMD_SA_EOT 0x04
|
||||
#define LD_CMD_SA_RT 0x02 // re-tension
|
||||
#define LD_CMD_SA_LOEJ 0x01
|
||||
|
||||
// Block
|
||||
#define LD_CMD_PC_MSK 0xf0
|
||||
#define LD_CMD_PC_NC 0
|
||||
#define LD_CMD_PC_ACTIVE 1
|
||||
#define LD_CMD_PC_IDLE 2
|
||||
#define LD_CMD_PC_STANDBY 3
|
||||
#define LD_CMD_PC_SLEEP 5
|
||||
|
||||
uchar_t cmd;
|
||||
uchar_t control;
|
||||
} load;
|
||||
|
||||
struct {
|
||||
uchar_t opcode;
|
||||
uchar_t lun_opt;
|
||||
#define SC_OPT_RELADR 0x01
|
||||
#define SC_OPT_IMMED 0x02
|
||||
uchar_t lba[4];
|
||||
uchar_t num_blocks[2];
|
||||
uchar_t control;
|
||||
} synchronize_cache;
|
||||
|
||||
// cdrom commands
|
||||
struct {
|
||||
uchar_t opcode;
|
||||
uchar_t rsvd1;
|
||||
uchar_t rsvd2;
|
||||
uchar_t rsvd3;
|
||||
uchar_t rsvd4;
|
||||
uchar_t rsvd5;
|
||||
uchar_t rsvd6;
|
||||
uchar_t allocation_length[2];
|
||||
uchar_t control;
|
||||
} read_disc_information;
|
||||
|
||||
struct {
|
||||
uchar_t opcode;
|
||||
uchar_t lun_opt;
|
||||
uchar_t rsvd2;
|
||||
uchar_t rsvd3;
|
||||
uchar_t rsvd4;
|
||||
uchar_t rsvd5;
|
||||
uchar_t rsvd6;
|
||||
uchar_t rsvd7;
|
||||
uchar_t resume;
|
||||
uchar_t control;
|
||||
} pause_resume;
|
||||
|
||||
struct {
|
||||
uchar_t opcode;
|
||||
uchar_t lun_opt;
|
||||
uchar_t rsvd2;
|
||||
uchar_t start_minute;
|
||||
uchar_t start_second;
|
||||
uchar_t start_frame;
|
||||
uchar_t end_minute;
|
||||
uchar_t end_second;
|
||||
uchar_t end_frame;
|
||||
uchar_t control;
|
||||
} play_audio_msf;
|
||||
|
||||
struct {
|
||||
uchar_t opcode;
|
||||
uchar_t lun_opt;
|
||||
uchar_t rsvd2;
|
||||
uchar_t rsvd3;
|
||||
uchar_t start_track;
|
||||
uchar_t start_index;
|
||||
uchar_t rsvd6;
|
||||
uchar_t end_track;
|
||||
uchar_t end_index;
|
||||
uchar_t control;
|
||||
} play_audio_ti;
|
||||
|
||||
struct {
|
||||
uchar_t opcode;
|
||||
#define CD_SCAN_DIR_FORWARD 0x00
|
||||
#define CD_SCAN_DIR_REVERSE 0x10
|
||||
uchar_t opt;
|
||||
uchar_t start_address[4];
|
||||
#define CD_SCAN_TYPE_LBA 0x00
|
||||
#define CD_SCAN_TYPE_MSF 0x40
|
||||
#define CD_SCAN_TYPE_TRK 0x80
|
||||
#define CD_SCAN_TYPE_MSK 0xc0
|
||||
uchar_t rsvd6;
|
||||
uchar_t rsvd7;
|
||||
uchar_t rsvd8;
|
||||
uchar_t type;
|
||||
uchar_t rsvd10;
|
||||
uchar_t rsvd11;
|
||||
} cd_scan;
|
||||
|
||||
struct {
|
||||
uchar_t opcode;
|
||||
#define RTOC_OPT_MSF 0x02
|
||||
uchar_t lun_opt;
|
||||
#define RTOC_FMT_TOC 0x0
|
||||
#define RTOC_FMT_SESSION 0x1
|
||||
#define RTOC_FMT_QSUBCODE 0x2
|
||||
#define RTOC_FMT_QSUBCHNL 0x3
|
||||
#define RTOC_FMT_ATIP 0x4
|
||||
#define RTOC_FMT_CDTEXT 0x5
|
||||
uchar_t format;
|
||||
uchar_t rsvd3;
|
||||
uchar_t rsvd4;
|
||||
uchar_t rsvd5;
|
||||
uchar_t start_track;
|
||||
uchar_t allocation_length[2];
|
||||
#define RTOC_CNTL_FMT_SESSION 0x40
|
||||
uchar_t control_format;
|
||||
} read_toc;
|
||||
|
||||
struct {
|
||||
uchar_t opcode;
|
||||
uchar_t lun_opt;
|
||||
uchar_t rsvd2[6];
|
||||
uchar_t allocation_length[2];
|
||||
uchar_t rsvd3[2];
|
||||
} mechanism_status;
|
||||
|
||||
struct {
|
||||
uchar_t opcode;
|
||||
#define EXCHANGE_OPT_IMMED 0x01
|
||||
uchar_t lun_opt;
|
||||
uchar_t rsvd2;
|
||||
uchar_t rsvd3;
|
||||
#define EXCHANGE_CMD_START 0x01
|
||||
#define EXCHANGE_CMD_LOEJ 0x02
|
||||
uchar_t cmd;
|
||||
uchar_t rsvd5;
|
||||
uchar_t rsvd6;
|
||||
uchar_t rsvd7;
|
||||
uchar_t slot;
|
||||
uchar_t rsvd9;
|
||||
uchar_t rsvd10;
|
||||
uchar_t rsvd11;
|
||||
} exchange;
|
||||
|
||||
struct {
|
||||
uchar_t opcode;
|
||||
uchar_t rt;
|
||||
uchar_t feature_number[2];
|
||||
uchar_t rsvd4;
|
||||
uchar_t rsvd5;
|
||||
uchar_t rsvd6;
|
||||
uchar_t allocation_length[2];
|
||||
uchar_t control;
|
||||
} get_configuration;
|
||||
|
||||
struct {
|
||||
uchar_t opcode;
|
||||
#define GE_OPT_POLLED 0x01
|
||||
uchar_t opt;
|
||||
uchar_t rsvd2;
|
||||
uchar_t rsvd3;
|
||||
#define NCR_OPERATIONAL_CHANGE 0x02
|
||||
#define NCR_POWER_MANAGEMENT 0x04
|
||||
#define NCR_EXTERNAL_REQUEST 0x08
|
||||
#define NCR_MEDIA 0x10
|
||||
#define NCR_MULTI_INITIATOR 0x20
|
||||
#define NCR_DEVICE_BUSY 0x40
|
||||
uchar_t ncr; // notification class request
|
||||
uchar_t rsvd5;
|
||||
uchar_t rsvd6;
|
||||
uchar_t allocation_length[2];
|
||||
uchar_t control;
|
||||
} get_event;
|
||||
|
||||
struct {
|
||||
uchar_t opcode;
|
||||
uchar_t lun_opt;
|
||||
uchar_t rsvd2;
|
||||
uchar_t rsvd3;
|
||||
uchar_t rsvd4;
|
||||
uchar_t rsvd5;
|
||||
uchar_t rsvd6;
|
||||
uchar_t allocation_length[2];
|
||||
uchar_t control;
|
||||
} read_formated_capacities;
|
||||
|
||||
struct {
|
||||
uchar_t opcode;
|
||||
uchar_t lun_opt;
|
||||
uchar_t read_speed[2];
|
||||
uchar_t write_speed[2];
|
||||
uchar_t rsvd2[6];
|
||||
} cd_speed;
|
||||
|
||||
struct {
|
||||
uchar_t opcode;
|
||||
#define RSCHNL_OPT_MSF 0x02
|
||||
uchar_t lun_opt;
|
||||
#define RSCHNL_DATA_SUBQ 0x40
|
||||
uchar_t data;
|
||||
uchar_t data_format;
|
||||
uchar_t rsvd4;
|
||||
uchar_t rsvd5;
|
||||
uchar_t track;
|
||||
uchar_t allocation_length[2];
|
||||
uchar_t control;
|
||||
} read_subchannel;
|
||||
|
||||
#define CD_FRAME_SYNC_SIZE 12
|
||||
#define CD_FRAME_HDR_SIZE 4
|
||||
#define CD_FRAME_SUB_HDR_SIZE 8
|
||||
#define CD_FRAME_EDC_SIZE 4
|
||||
#define CD_FRAME_ECC_SIZE 276
|
||||
#define CD_FRAME_AUX_SIZE 8
|
||||
#define CD_FRAME_ZERO_SIZE 8
|
||||
#define CD_FRAME_SPARE_SIZE 4
|
||||
#define CD_FRAME_C2_ERR_SIZE 294
|
||||
#define CD_FRAME_BLOCK_ERR_SIZE 2
|
||||
|
||||
struct {
|
||||
uchar_t opcode;
|
||||
uchar_t lun_stype;
|
||||
// expected sector type
|
||||
#define RDCD_EST_ANY_SECTOR (0 << 2)
|
||||
#define RDCD_EST_CDDA_SECTOR (1 << 2)
|
||||
#define RDCD_EST_YELLOW_MODE1_SECTOR (2 << 2)
|
||||
#define RDCD_EST_YELLOW_MODE2_SECTOR (3 << 2)
|
||||
#define RDCD_EST_XA_SECTOR (4 << 2)
|
||||
#define RDCD_EST_XA_FORM2_SECTOR (5 << 2)
|
||||
#define RDCD_EST_MSK (7 << 2)
|
||||
uchar_t lba[4];
|
||||
uchar_t transfer_len[3];
|
||||
uchar_t flags;
|
||||
#define RDCD_FLG_SYNC 0x80
|
||||
#define RDCD_FLG_UDATA 0x10
|
||||
#define RDCD_FLG_ECC 0x08
|
||||
#define RDCD_FLG_CD_ERR 0x02
|
||||
#define RDCD_FLG_CD_BLOCK_ERR 0x04
|
||||
#define RDCD_FLG_HC_NONE ( 0x00 << 5 )
|
||||
#define RDCD_FLG_HC_HDR ( 0x01 << 5 )
|
||||
#define RDCD_FLG_HC_SUBHEADER ( 0x02 << 5 )
|
||||
#define RDCD_FLG_HC_ALL_HEADERS ( 0x03 << 5 )
|
||||
uchar_t subch_selection;
|
||||
uchar_t rsvd3;
|
||||
} read_cd;
|
||||
|
||||
struct {
|
||||
uchar_t opcode;
|
||||
uchar_t lun_stype;
|
||||
uchar_t rsvd2;
|
||||
uchar_t start_minute;
|
||||
uchar_t start_second;
|
||||
uchar_t start_frame;
|
||||
uchar_t end_minute;
|
||||
uchar_t end_second;
|
||||
uchar_t end_frame;
|
||||
uchar_t flags;
|
||||
uchar_t subch_selection;
|
||||
uchar_t rsvd11;
|
||||
} read_cd_msf;
|
||||
|
||||
struct _ata_pass_thru {
|
||||
uchar_t opcode;
|
||||
#define ATA_PROTO_MSK 0x1e
|
||||
#define ATA_PROTO_RESPONSE (15 << 1)
|
||||
#define ATA_PROTO_FPDMA (12 << 1)
|
||||
#define ATA_PROTO_UDMA_DATA_OUT (11 << 1)
|
||||
#define ATA_PROTO_UDMA_DATA_IN (10 << 1)
|
||||
#define ATA_PROTO_DEVICE_RESET (9 << 1)
|
||||
#define ATA_PROTO_DEVICE_DIAGNOSTIC (8 << 1)
|
||||
#define ATA_PROTO_DMA_QUEUED (7 << 1)
|
||||
#define ATA_PROTO_DMA (6 << 1)
|
||||
#define ATA_PROTO_PIO_DATA_OUT (5 << 1)
|
||||
#define ATA_PROTO_PIO_DATA_IN (4 << 1)
|
||||
#define ATA_PROTO_DATA_NONE (3 << 1)
|
||||
#define ATA_PROTO_SRST (1 << 1)
|
||||
#define ATA_PROTO_HRST (0 << 1)
|
||||
#define ATA_PROTO_EXTEND 0x01
|
||||
uchar_t protocol; // multiple count, protocol
|
||||
#define ATA_MCOUNT_MSK 0xe0
|
||||
|
||||
#define ATA_FLG_CK_COND 0x20
|
||||
#define ATA_FLG_T_DIR 0x08 // data from device
|
||||
#define ATA_FLG_BYT_BLOK 0x04
|
||||
#define ATA_FLG_TLEN_STPSIU 0x03
|
||||
#define ATA_FLG_TLEN_SECTOR_COUNT 0x02
|
||||
#define ATA_FLG_TLEN_FEATURE 0x01
|
||||
uchar_t flags;
|
||||
|
||||
uchar_t efeatures;
|
||||
uchar_t features;
|
||||
uchar_t esector_count;
|
||||
uchar_t sector_count;
|
||||
uchar_t elba_low;
|
||||
uchar_t lba_low;
|
||||
uchar_t elba_mid;
|
||||
uchar_t lba_mid;
|
||||
uchar_t elba_high;
|
||||
uchar_t lba_high;
|
||||
uchar_t device;
|
||||
uchar_t command;
|
||||
uchar_t control;
|
||||
} ata_pass_thru;
|
||||
|
||||
// sequential access commands
|
||||
struct {
|
||||
uchar_t opcode;
|
||||
#define ERASE_OPT_LONG 0x01
|
||||
uchar_t opt;
|
||||
uchar_t rsvd[3];
|
||||
uchar_t control;
|
||||
} erase;
|
||||
|
||||
struct {
|
||||
uchar_t opcode;
|
||||
#define LOCATE_OPT_CP 0x2
|
||||
#define LOCATE_OPT_BT 0x4
|
||||
uchar_t opt;
|
||||
uchar_t rsvd2;
|
||||
uchar_t ba[4]; // block address
|
||||
uchar_t rsvd7;
|
||||
uchar_t partition;
|
||||
uchar_t control;
|
||||
} locate;
|
||||
|
||||
struct {
|
||||
uchar_t opcode;
|
||||
uchar_t opt;
|
||||
uchar_t rsvd2[3];
|
||||
uchar_t control;
|
||||
} read_block_limits;
|
||||
|
||||
#define RP_OPT_BT 0x01 // block address type
|
||||
#define RP_OPT_LNG 0x02 // long format
|
||||
#define RP_OPT_TCLP 0x04 // total current logical position
|
||||
struct {
|
||||
uchar_t opcode;
|
||||
uchar_t lun_opt;
|
||||
uchar_t rsvd2[7];
|
||||
uchar_t control;
|
||||
} read_position;
|
||||
|
||||
#define SRW_OPT_FIXED 0x01
|
||||
#define SRW_OPT_SILI 0x02
|
||||
struct {
|
||||
uchar_t opcode;
|
||||
uchar_t opt;
|
||||
uchar_t transfer_len[3];
|
||||
uchar_t control;
|
||||
} sa_read_write;
|
||||
|
||||
struct {
|
||||
uchar_t opcode;
|
||||
uchar_t opt;
|
||||
uchar_t rsvd[3];
|
||||
uchar_t control;
|
||||
} rewind;
|
||||
|
||||
struct {
|
||||
uchar_t opcode;
|
||||
#define SPACE_CODE_BLOCKS 0x00
|
||||
#define SPACE_CODE_FMRKS 0x01
|
||||
#define SPACE_CODE_SEQ_FMRKS 0x02
|
||||
#define SPACE_CODE_EOD 0x03
|
||||
#define SPACE_CODE_SMRKS 0x04
|
||||
#define SPACE_CODE_SEQ_SMRKS 0x05
|
||||
uchar_t lun_code;
|
||||
uchar_t count[3];
|
||||
uchar_t control;
|
||||
} space;
|
||||
|
||||
struct {
|
||||
uchar_t opcode;
|
||||
#define WF_OPT_IMMED 0x01
|
||||
#define WF_OPT_WSMK 0x02
|
||||
uchar_t opt;
|
||||
uchar_t transfer_length[3];
|
||||
uchar_t control;
|
||||
} write_filemarks;
|
||||
|
||||
struct {
|
||||
uchar_t opcode;
|
||||
#define RD_OPT_MEDIA 0x01
|
||||
uchar_t opt;
|
||||
uchar_t rsvd[5];
|
||||
uchar_t allocation_length[2];
|
||||
uchar_t control;
|
||||
} report_density;
|
||||
|
||||
struct {
|
||||
uchar_t opcode;
|
||||
#define FM_OPT_IMMED 0x01
|
||||
#define FM_OPT_VERIFY 0x02
|
||||
uchar_t opt;
|
||||
#define FM_FMT_DFLT 0x00
|
||||
#define FM_FMT_PARTITION 0x01
|
||||
#define FM_FMT_FORMAT_PARTITION 0x02
|
||||
uchar_t format;
|
||||
uchar_t transfer_length[2];
|
||||
uchar_t control;
|
||||
} format_media;
|
||||
} CDB;
|
||||
//----------------------------------------------------------------------------------------------------------
|
||||
|
||||
struct _ata_sense
|
||||
{
|
||||
SCSI_SENSE_DESCRIPTOR sense;
|
||||
ATA_STATUS_DESCRIPTOR desc;
|
||||
};
|
||||
//----------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
#endif /* OS_QNXNTO_H_ */
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,32 +0,0 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 9.00
|
||||
# Visual Studio 2005
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "smartctl_vc8", "smartctl_vc8.vcproj", "{3AFEDCDD-D289-4543-A91D-EFBA6C710247}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "smartd_vc8", "smartd_vc8.vcproj", "{C0762191-C2AC-40B6-A2EB-F1658BBDC4C6}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "syslogevt_vc8", "syslogevt_vc8.vcproj", "{FAB7557B-86EA-405D-B49D-33AB3F4D3E33}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{3AFEDCDD-D289-4543-A91D-EFBA6C710247}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{3AFEDCDD-D289-4543-A91D-EFBA6C710247}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{3AFEDCDD-D289-4543-A91D-EFBA6C710247}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{3AFEDCDD-D289-4543-A91D-EFBA6C710247}.Release|Win32.Build.0 = Release|Win32
|
||||
{C0762191-C2AC-40B6-A2EB-F1658BBDC4C6}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{C0762191-C2AC-40B6-A2EB-F1658BBDC4C6}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{C0762191-C2AC-40B6-A2EB-F1658BBDC4C6}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{C0762191-C2AC-40B6-A2EB-F1658BBDC4C6}.Release|Win32.Build.0 = Release|Win32
|
||||
{FAB7557B-86EA-405D-B49D-33AB3F4D3E33}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{FAB7557B-86EA-405D-B49D-33AB3F4D3E33}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{FAB7557B-86EA-405D-B49D-33AB3F4D3E33}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{FAB7557B-86EA-405D-B49D-33AB3F4D3E33}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
@ -1,156 +0,0 @@
|
||||
/*
|
||||
* os_win32/syslogevt.c
|
||||
*
|
||||
* Home page of code is: http://smartmontools.sourceforge.net
|
||||
*
|
||||
* Copyright (C) 2004-8 Christian Franke <smartmontools-support@lists.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* (for example COPYING); if not, write to the Free
|
||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
static char rcsid[] = "$Id: syslogevt.c,v 1.5 2008/03/04 22:09:48 ballen4705 Exp $";
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <process.h>
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
|
||||
#ifdef _DEBUG
|
||||
#include "syslogevt.h"
|
||||
#endif
|
||||
|
||||
|
||||
static int usage()
|
||||
{
|
||||
puts(
|
||||
"syslogevt $Revision: 1.5 $ Copyright (C) 2004-8 Christian Franke\n"
|
||||
"Home page is http://smartmontools.sourceforge.net/\n"
|
||||
"\n"
|
||||
"Usage: syslogevt [-ru] name [ident ...]\n"
|
||||
"\n"
|
||||
"Creates registry files \"name-r.reg\" and \"name-u.reg\" to (un)register\n"
|
||||
"this program as an event message file for message source(s) \"ident\".\n"
|
||||
"If \"ident\" is ommited, \"name\" is used. Options:\n"
|
||||
"\n"
|
||||
" -r run \"regedit name-r.reg\" after creating files\n"
|
||||
" -u run \"regedit name-u.reg\" after creating files\n"
|
||||
"\n"
|
||||
"Examples:\n"
|
||||
"\n"
|
||||
"syslogevt smartd (Create smartd-r.reg and smartd-u.reg)\n"
|
||||
"regedit smartd-r.reg (Register syslogevt.exe for smartd messages)\n"
|
||||
"\n"
|
||||
"syslogevt -r smartd (Same as above in one step)\n"
|
||||
"\n"
|
||||
"regedit smartd-u.reg (Undo the registration)\n"
|
||||
"\n"
|
||||
"CAUTION: A registry entry of an existing event source with the same \"ident\"\n"
|
||||
" will be overwritten by regedit without notice."
|
||||
);
|
||||
return 1;
|
||||
}
|
||||
|
||||
main(int argc, char ** argv)
|
||||
{
|
||||
int regedit, a1, ai;
|
||||
char name1[30+1], name2[30+1], mypath[MAX_PATH+1];
|
||||
const char * ident;
|
||||
FILE * f1, * f2;
|
||||
|
||||
#ifdef _DEBUG
|
||||
if (!(MSG_SYSLOG == 0 && MSG_SYSLOG_01 == 1 && MSG_SYSLOG_10 == 10)) {
|
||||
puts("Internal error: MSG_SYSLOG_n != n"); return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (argc < 2)
|
||||
return usage();
|
||||
|
||||
a1 = 1;
|
||||
regedit = 0;
|
||||
if (!strcmp(argv[a1], "-r")) {
|
||||
regedit = 1; a1++;
|
||||
}
|
||||
else if (!strcmp(argv[a1], "-u")) {
|
||||
regedit = -1; a1++;
|
||||
}
|
||||
|
||||
for (ai = a1; ai < argc; ai++) {
|
||||
ident = argv[ai];
|
||||
if (!(ident[0] && strlen(ident) < sizeof(name1)-10
|
||||
&& strcspn(ident, "-.:/\\") == strlen(ident) )) {
|
||||
return usage();
|
||||
}
|
||||
}
|
||||
|
||||
if (!GetModuleFileName(NULL, mypath, sizeof(mypath)-1)) {
|
||||
fputs("GetModuleFileName failed\n", stderr);
|
||||
return 1;
|
||||
}
|
||||
|
||||
ident = argv[a1];
|
||||
strcpy(name1, ident); strcat(name1, "-r.reg");
|
||||
strcpy(name2, ident); strcat(name2, "-u.reg");
|
||||
|
||||
if (!(f1 = fopen(name1, "w"))) {
|
||||
perror(name1); return 1;
|
||||
}
|
||||
if (!(f2 = fopen(name2, "w"))) {
|
||||
perror(name2); unlink(name1); return 1;
|
||||
}
|
||||
|
||||
fputs("REGEDIT4\n\n", f1);
|
||||
fputs("REGEDIT4\n\n", f2);
|
||||
|
||||
for (ai = (argc > a1+1 ? a1+1 : a1); ai < argc; ai++) {
|
||||
int i;
|
||||
ident = argv[ai];
|
||||
fputs("[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\Eventlog\\Application\\", f1);
|
||||
fputs(ident, f1); fputs("]\n\"EventMessageFile\"=\"", f1);
|
||||
for (i = 0; mypath[i]; i++) {
|
||||
if (mypath[i] == '\\')
|
||||
fputc('\\', f1);
|
||||
fputc(mypath[i], f1);
|
||||
}
|
||||
fputs("\"\n\"TypesSupported\"=dword:00000007\n\n", f1);
|
||||
|
||||
fputs("[-HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\Eventlog\\Application\\", f2);
|
||||
fputs(ident, f2); fputs("]\n\n", f2);
|
||||
}
|
||||
|
||||
fclose(f1);
|
||||
fclose(f2);
|
||||
|
||||
if (GetVersion() & 0x80000000) {
|
||||
puts("Warning: Event log not supported on Win9x/ME\n");
|
||||
if (regedit)
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (regedit) {
|
||||
if (spawnlp(P_WAIT, "regedit", "regedit", (regedit > 0 ? name1 : name2), (const char *)0) == -1) {
|
||||
fputs("regedit: cannot execute\n", stderr);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
fputs("Files generated. Use\n\n regedit ", stdout);
|
||||
puts(name1);
|
||||
fputs("\nto register event message file, and\n\n regedit ", stdout);
|
||||
puts(name2);
|
||||
fputs("\nto remove registration later.\n\n"
|
||||
"Do not remove this program when registered.\n", stdout);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
@ -1,161 +0,0 @@
|
||||
;/*
|
||||
; * os_win32/syslogevt.mc
|
||||
; *
|
||||
; * Home page of code is: http://smartmontools.sourceforge.net
|
||||
; *
|
||||
; * Copyright (C) 2004-8 Christian Franke <smartmontools-support@lists.sourceforge.net>
|
||||
; *
|
||||
; * This program is free software; you can redistribute it and/or modify
|
||||
; * it under the terms of the GNU General Public License as published by
|
||||
; * the Free Software Foundation; either version 2, or (at your option)
|
||||
; * any later version.
|
||||
; *
|
||||
; * You should have received a copy of the GNU General Public License
|
||||
; * (for example COPYING); if not, write to the Free
|
||||
; * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
; *
|
||||
; */
|
||||
;
|
||||
;// $Id: syslogevt.mc,v 1.5 2008/03/04 22:09:48 ballen4705 Exp $
|
||||
;
|
||||
;// Use message compiler "mc" to generate
|
||||
;// syslogevt.rc, syslogevt.h, msg00001.bin
|
||||
;// from this file.
|
||||
;// MSG_SYSLOG in syslogmsg.h must be zero
|
||||
;// MSG_SYSLOG_nn must be == nn
|
||||
;
|
||||
;
|
||||
|
||||
MessageId=0x0
|
||||
Severity=Success
|
||||
Facility=Application
|
||||
SymbolicName=MSG_SYSLOG
|
||||
Language=English
|
||||
%1
|
||||
.
|
||||
;// 1-10 Line SYSLOG Messages
|
||||
;// %1=Ident, %2=PID, %3=Severity, %[4-13]=Line 1-10
|
||||
MessageId=0x1
|
||||
Severity=Success
|
||||
Facility=Application
|
||||
SymbolicName=MSG_SYSLOG_01
|
||||
Language=English
|
||||
%1[%2]:%3: %4
|
||||
.
|
||||
MessageId=0x2
|
||||
Severity=Success
|
||||
Facility=Application
|
||||
SymbolicName=MSG_SYSLOG_02
|
||||
Language=English
|
||||
%1[%2]:%3%n
|
||||
%4%n
|
||||
%5
|
||||
.
|
||||
MessageId=0x3
|
||||
Severity=Success
|
||||
Facility=Application
|
||||
SymbolicName=MSG_SYSLOG_03
|
||||
Language=English
|
||||
%1[%2]:%3%n
|
||||
%4%n
|
||||
%5%n
|
||||
%6
|
||||
.
|
||||
MessageId=0x4
|
||||
Severity=Success
|
||||
Facility=Application
|
||||
SymbolicName=MSG_SYSLOG_04
|
||||
Language=English
|
||||
%1[%2]:%3%n
|
||||
%4%n
|
||||
%5%n
|
||||
%6%n
|
||||
%7
|
||||
.
|
||||
MessageId=0x5
|
||||
Severity=Success
|
||||
Facility=Application
|
||||
SymbolicName=MSG_SYSLOG_05
|
||||
Language=English
|
||||
%1[%2]:%3%n
|
||||
%4%n
|
||||
%5%n
|
||||
%6%n
|
||||
%7%n
|
||||
%8
|
||||
.
|
||||
MessageId=0x6
|
||||
Severity=Success
|
||||
Facility=Application
|
||||
SymbolicName=MSG_SYSLOG_06
|
||||
Language=English
|
||||
%1[%2]:%3%n
|
||||
%4%n
|
||||
%5%n
|
||||
%6%n
|
||||
%7%n
|
||||
%8%n
|
||||
%9
|
||||
.
|
||||
MessageId=0x7
|
||||
Severity=Success
|
||||
Facility=Application
|
||||
SymbolicName=MSG_SYSLOG_07
|
||||
Language=English
|
||||
%1[%2]:%3%n
|
||||
%4%n
|
||||
%5%n
|
||||
%6%n
|
||||
%7%n
|
||||
%8%n
|
||||
%9%n
|
||||
%10
|
||||
.
|
||||
MessageId=0x8
|
||||
Severity=Success
|
||||
Facility=Application
|
||||
SymbolicName=MSG_SYSLOG_08
|
||||
Language=English
|
||||
%1[%2]:%3%n
|
||||
%4%n
|
||||
%5%n
|
||||
%6%n
|
||||
%7%n
|
||||
%8%n
|
||||
%9%n
|
||||
%10%n
|
||||
%11
|
||||
.
|
||||
MessageId=0x9
|
||||
Severity=Success
|
||||
Facility=Application
|
||||
SymbolicName=MSG_SYSLOG_09
|
||||
Language=English
|
||||
%1[%2]:%3%n
|
||||
%4%n
|
||||
%5%n
|
||||
%6%n
|
||||
%7%n
|
||||
%8%n
|
||||
%9%n
|
||||
%10%n
|
||||
%11%n
|
||||
%12
|
||||
.
|
||||
MessageId=0xa
|
||||
Severity=Success
|
||||
Facility=Application
|
||||
SymbolicName=MSG_SYSLOG_10
|
||||
Language=English
|
||||
%1[%2]:%3%n
|
||||
%4%n
|
||||
%5%n
|
||||
%6%n
|
||||
%7%n
|
||||
%8%n
|
||||
%9%n
|
||||
%10%n
|
||||
%11%n
|
||||
%12%n
|
||||
%13
|
||||
.
|
@ -1,205 +0,0 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8,00"
|
||||
Name="syslogevt_vc8"
|
||||
ProjectGUID="{FAB7557B-86EA-405D-B49D-33AB3F4D3E33}"
|
||||
RootNamespace="syslogevt_vc8"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="syslogevt_vc8.d"
|
||||
IntermediateDirectory="syslogevt_vc8.d"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
PreprocessorDefinitions="_DEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="syslogevt_vc8.r"
|
||||
IntermediateDirectory="syslogevt_vc8.r"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="syslogevt.exe"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="true"
|
||||
ProgramDatabaseFile="$(IntDir)\$(TargetName).pdb"
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<File
|
||||
RelativePath=".\syslogevt.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\syslogevt.mc"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
Description="mc -r $(IntDir) syslogevt.mc"
|
||||
CommandLine="mc -r $(IntDir) syslogevt.mc
"
|
||||
Outputs="$(IntDir)\syslogevt.rc;$(IntDir)\msg00001.bin;syslogevt.h"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
Description="mc -r $(IntDir) syslogevt.mc"
|
||||
CommandLine="mc -r $(IntDir) syslogevt.mc
"
|
||||
Outputs="$(IntDir)\syslogevt.rc;$(IntDir)\msg00001.bin;syslogevt.h"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
1277
posix/getopt.c
1277
posix/getopt.c
File diff suppressed because it is too large
Load Diff
181
posix/getopt.h
181
posix/getopt.h
@ -1,181 +0,0 @@
|
||||
/* Declarations for getopt.
|
||||
Copyright (C) 1989-1994, 1996-1999, 2001 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
|
||||
#ifndef _GETOPT_H
|
||||
|
||||
#ifndef __need_getopt
|
||||
# define _GETOPT_H 1
|
||||
#endif
|
||||
|
||||
/* If __GNU_LIBRARY__ is not already defined, either we are being used
|
||||
standalone, or this is the first header included in the source file.
|
||||
If we are being used with glibc, we need to include <features.h>, but
|
||||
that does not exist if we are standalone. So: if __GNU_LIBRARY__ is
|
||||
not defined, include <ctype.h>, which will pull in <features.h> for us
|
||||
if it's from glibc. (Why ctype.h? It's guaranteed to exist and it
|
||||
doesn't flood the namespace with stuff the way some other headers do.) */
|
||||
#if !defined __GNU_LIBRARY__
|
||||
# include <ctype.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* For communication from `getopt' to the caller.
|
||||
When `getopt' finds an option that takes an argument,
|
||||
the argument value is returned here.
|
||||
Also, when `ordering' is RETURN_IN_ORDER,
|
||||
each non-option ARGV-element is returned here. */
|
||||
|
||||
extern char *optarg;
|
||||
|
||||
/* Index in ARGV of the next element to be scanned.
|
||||
This is used for communication to and from the caller
|
||||
and for communication between successive calls to `getopt'.
|
||||
|
||||
On entry to `getopt', zero means this is the first call; initialize.
|
||||
|
||||
When `getopt' returns -1, this is the index of the first of the
|
||||
non-option elements that the caller should itself scan.
|
||||
|
||||
Otherwise, `optind' communicates from one call to the next
|
||||
how much of ARGV has been scanned so far. */
|
||||
|
||||
extern int optind;
|
||||
|
||||
/* Callers store zero here to inhibit the error message `getopt' prints
|
||||
for unrecognized options. */
|
||||
|
||||
extern int opterr;
|
||||
|
||||
/* Set to an option character which was unrecognized. */
|
||||
|
||||
extern int optopt;
|
||||
|
||||
#ifndef __need_getopt
|
||||
/* Describe the long-named options requested by the application.
|
||||
The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector
|
||||
of `struct option' terminated by an element containing a name which is
|
||||
zero.
|
||||
|
||||
The field `has_arg' is:
|
||||
no_argument (or 0) if the option does not take an argument,
|
||||
required_argument (or 1) if the option requires an argument,
|
||||
optional_argument (or 2) if the option takes an optional argument.
|
||||
|
||||
If the field `flag' is not NULL, it points to a variable that is set
|
||||
to the value given in the field `val' when the option is found, but
|
||||
left unchanged if the option is not found.
|
||||
|
||||
To have a long-named option do something other than set an `int' to
|
||||
a compiled-in constant, such as set a value from `optarg', set the
|
||||
option's `flag' field to zero and its `val' field to a nonzero
|
||||
value (the equivalent single-letter option character, if there is
|
||||
one). For long options that have a zero `flag' field, `getopt'
|
||||
returns the contents of the `val' field. */
|
||||
|
||||
struct option
|
||||
{
|
||||
# if (defined __STDC__ && __STDC__) || defined __cplusplus
|
||||
const char *name;
|
||||
# else
|
||||
char *name;
|
||||
# endif
|
||||
/* has_arg can't be an enum because some compilers complain about
|
||||
type mismatches in all the code that assumes it is an int. */
|
||||
int has_arg;
|
||||
int *flag;
|
||||
int val;
|
||||
};
|
||||
|
||||
/* Names for the values of the `has_arg' field of `struct option'. */
|
||||
|
||||
# define no_argument 0
|
||||
# define required_argument 1
|
||||
# define optional_argument 2
|
||||
#endif /* need getopt */
|
||||
|
||||
|
||||
/* Get definitions and prototypes for functions to process the
|
||||
arguments in ARGV (ARGC of them, minus the program name) for
|
||||
options given in OPTS.
|
||||
|
||||
Return the option character from OPTS just read. Return -1 when
|
||||
there are no more options. For unrecognized options, or options
|
||||
missing arguments, `optopt' is set to the option letter, and '?' is
|
||||
returned.
|
||||
|
||||
The OPTS string is a list of characters which are recognized option
|
||||
letters, optionally followed by colons, specifying that that letter
|
||||
takes an argument, to be placed in `optarg'.
|
||||
|
||||
If a letter in OPTS is followed by two colons, its argument is
|
||||
optional. This behavior is specific to the GNU `getopt'.
|
||||
|
||||
The argument `--' causes premature termination of argument
|
||||
scanning, explicitly telling `getopt' that there are no more
|
||||
options.
|
||||
|
||||
If OPTS begins with `--', then non-option arguments are treated as
|
||||
arguments to the option '\0'. This behavior is specific to the GNU
|
||||
`getopt'. */
|
||||
|
||||
#if (defined __STDC__ && __STDC__) || defined __cplusplus
|
||||
# ifdef __GNU_LIBRARY__
|
||||
/* Many other libraries have conflicting prototypes for getopt, with
|
||||
differences in the consts, in stdlib.h. To avoid compilation
|
||||
errors, only prototype getopt for the GNU C library. */
|
||||
extern int getopt (int ___argc, char *const *___argv, const char *__shortopts);
|
||||
# else /* not __GNU_LIBRARY__ */
|
||||
extern int getopt ();
|
||||
# endif /* __GNU_LIBRARY__ */
|
||||
|
||||
# ifndef __need_getopt
|
||||
extern int getopt_long (int ___argc, char *const *___argv,
|
||||
const char *__shortopts,
|
||||
const struct option *__longopts, int *__longind);
|
||||
extern int getopt_long_only (int ___argc, char *const *___argv,
|
||||
const char *__shortopts,
|
||||
const struct option *__longopts, int *__longind);
|
||||
|
||||
/* Internal only. Users should not call this directly. */
|
||||
extern int _getopt_internal (int ___argc, char *const *___argv,
|
||||
const char *__shortopts,
|
||||
const struct option *__longopts, int *__longind,
|
||||
int __long_only);
|
||||
# endif
|
||||
#else /* not __STDC__ */
|
||||
extern int getopt ();
|
||||
# ifndef __need_getopt
|
||||
extern int getopt_long ();
|
||||
extern int getopt_long_only ();
|
||||
|
||||
extern int _getopt_internal ();
|
||||
# endif
|
||||
#endif /* __STDC__ */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Make sure we later can get all the definitions and declarations. */
|
||||
#undef __need_getopt
|
||||
|
||||
#endif /* getopt.h */
|
196
posix/getopt1.c
196
posix/getopt1.c
@ -1,196 +0,0 @@
|
||||
/* getopt_long and getopt_long_only entry points for GNU getopt.
|
||||
Copyright (C) 1987,88,89,90,91,92,93,94,96,97,98
|
||||
Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#ifdef _LIBC
|
||||
# include <getopt.h>
|
||||
#else
|
||||
# include "getopt.h"
|
||||
#endif
|
||||
|
||||
#if !defined __STDC__ || !__STDC__
|
||||
/* This is a separate conditional since some stdc systems
|
||||
reject `defined (const)'. */
|
||||
#ifndef const
|
||||
#define const
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
/* Comment out all this code if we are using the GNU C Library, and are not
|
||||
actually compiling the library itself. This code is part of the GNU C
|
||||
Library, but also included in many other GNU distributions. Compiling
|
||||
and linking in this code is a waste when using the GNU C library
|
||||
(especially if it is a shared library). Rather than having every GNU
|
||||
program understand `configure --with-gnu-libc' and omit the object files,
|
||||
it is simpler to just do this in the source for each such file. */
|
||||
|
||||
#define GETOPT_INTERFACE_VERSION 2
|
||||
#if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2
|
||||
#include <gnu-versions.h>
|
||||
#if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION
|
||||
#define ELIDE_CODE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef ELIDE_CODE
|
||||
|
||||
|
||||
/* This needs to come after some library #include
|
||||
to get __GNU_LIBRARY__ defined. */
|
||||
#ifdef __GNU_LIBRARY__
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
#endif
|
||||
|
||||
int
|
||||
getopt_long (argc, argv, options, long_options, opt_index)
|
||||
int argc;
|
||||
char *const *argv;
|
||||
const char *options;
|
||||
const struct option *long_options;
|
||||
int *opt_index;
|
||||
{
|
||||
return _getopt_internal (argc, argv, options, long_options, opt_index, 0);
|
||||
}
|
||||
|
||||
/* Like getopt_long, but '-' as well as '--' can indicate a long option.
|
||||
If an option that starts with '-' (not '--') doesn't match a long option,
|
||||
but does match a short option, it is parsed as a short option
|
||||
instead. */
|
||||
|
||||
int
|
||||
getopt_long_only (argc, argv, options, long_options, opt_index)
|
||||
int argc;
|
||||
char *const *argv;
|
||||
const char *options;
|
||||
const struct option *long_options;
|
||||
int *opt_index;
|
||||
{
|
||||
return _getopt_internal (argc, argv, options, long_options, opt_index, 1);
|
||||
}
|
||||
|
||||
# ifdef _LIBC
|
||||
libc_hidden_def (getopt_long)
|
||||
libc_hidden_def (getopt_long_only)
|
||||
# endif
|
||||
|
||||
#endif /* Not ELIDE_CODE. */
|
||||
|
||||
#ifdef TEST
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
int
|
||||
main (argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
{
|
||||
int c;
|
||||
int digit_optind = 0;
|
||||
|
||||
while (1)
|
||||
{
|
||||
int this_option_optind = optind ? optind : 1;
|
||||
int option_index = 0;
|
||||
static struct option long_options[] =
|
||||
{
|
||||
{"add", 1, 0, 0},
|
||||
{"append", 0, 0, 0},
|
||||
{"delete", 1, 0, 0},
|
||||
{"verbose", 0, 0, 0},
|
||||
{"create", 0, 0, 0},
|
||||
{"file", 1, 0, 0},
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
|
||||
c = getopt_long (argc, argv, "abc:d:0123456789",
|
||||
long_options, &option_index);
|
||||
if (c == -1)
|
||||
break;
|
||||
|
||||
switch (c)
|
||||
{
|
||||
case 0:
|
||||
printf ("option %s", long_options[option_index].name);
|
||||
if (optarg)
|
||||
printf (" with arg %s", optarg);
|
||||
printf ("\n");
|
||||
break;
|
||||
|
||||
case '0':
|
||||
case '1':
|
||||
case '2':
|
||||
case '3':
|
||||
case '4':
|
||||
case '5':
|
||||
case '6':
|
||||
case '7':
|
||||
case '8':
|
||||
case '9':
|
||||
if (digit_optind != 0 && digit_optind != this_option_optind)
|
||||
printf ("digits occur in two different argv-elements.\n");
|
||||
digit_optind = this_option_optind;
|
||||
printf ("option %c\n", c);
|
||||
break;
|
||||
|
||||
case 'a':
|
||||
printf ("option a\n");
|
||||
break;
|
||||
|
||||
case 'b':
|
||||
printf ("option b\n");
|
||||
break;
|
||||
|
||||
case 'c':
|
||||
printf ("option c with value `%s'\n", optarg);
|
||||
break;
|
||||
|
||||
case 'd':
|
||||
printf ("option d with value `%s'\n", optarg);
|
||||
break;
|
||||
|
||||
case '?':
|
||||
break;
|
||||
|
||||
default:
|
||||
printf ("?? getopt returned character code 0%o ??\n", c);
|
||||
}
|
||||
}
|
||||
|
||||
if (optind < argc)
|
||||
{
|
||||
printf ("non-option ARGV-elements: ");
|
||||
while (optind < argc)
|
||||
printf ("%s ", argv[optind++]);
|
||||
printf ("\n");
|
||||
}
|
||||
|
||||
exit (0);
|
||||
}
|
||||
|
||||
#endif /* TEST */
|
Loading…
Reference in New Issue
Block a user