array-info-0.15/0000755000176200017620000000000010627047461014725 5ustar rpinsonrpinson00000000000000array-info-0.15/COPYING0000644000176200017620000004310310627047461015761 0ustar rpinsonrpinson00000000000000 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 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 of the License, 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, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. array-info-0.15/ChangeLog0000644000176200017620000002642710627047461016512 0ustar rpinsonrpinson000000000000002007-05-29 18:01 Raphael Pinson * Makefile: mandir is /usr/local/man by default 2007-05-29 17:56 Raphael Pinson * Makefile: No $(MAN) rule since the final product is $(MAN).gz $(MAN) is not kept in the build process. 2007-05-29 17:50 Raphael Pinson * Makefile: $mandir is /usr/share/man in Makefile, use $DOCBOOK2XMAN variable 2007-05-29 15:43 Petter Reinholdtsen * Makefile: Improve manual page building and install rule. 2007-05-29 14:09 Raphael Pinson * Makefile, plugins/Makefile: Bump version to 0.14 in Makefiles and release 0.14 2007-05-29 14:05 Raphael Pinson * NEWS: Update ChangeLog Update NEWS to release 0.14 2007-05-29 13:50 Petter Reinholdtsen * README: More wishes. 2007-02-21 17:28 Petter Reinholdtsen * NEWS, plugins/compaq_info.c: Add ID for raid controllers HP Smart Array E200i. 2007-02-08 00:44 Petter Reinholdtsen * NEWS: Typo. 2007-02-08 00:26 Petter Reinholdtsen * linuxheaders/linux/cciss_ioctl.h: Get build working on sarge. 2007-02-08 00:11 Petter Reinholdtsen * README: Update todo entries. 2007-02-07 23:59 Raphael Pinson * Makefile: gzip the manpage with --best 2007-02-07 23:37 Raphael Pinson * Makefile: * Ignore gzip in $(MAN) in case the gz already existed * Update ChangeLog 2007-02-07 22:17 Raphael Pinson * Makefile: Generate a bz2 archive in dist: 2007-02-07 19:08 Raphael Pinson * NEWS: * Release 0.13 * Update Changelog 2007-02-07 19:06 Raphael Pinson * Makefile: * Remove ChangeLog before regenerating it in changelog: * Update ChangeLog 2007-02-07 18:59 Petter Reinholdtsen * Makefile, include/Makefile: Clean up clean and distclean targets. 2007-02-07 18:55 Raphael Pinson * Makefile: Build tarball in current directory for dist: target 2007-02-07 18:38 Raphael Pinson * Makefile, lib/Makefile: * *.a removed in clean: target * using $(MAKE) in Makefile 2007-02-07 18:36 Raphael Pinson * Makefile, include/Makefile, lib/Makefile, plugins/Makefile: * Add make headers in Makefiles * Add distclean rules and fix clean rules in Makefiles 2007-02-07 18:22 Raphael Pinson * INSTALL, Makefile, array-info.1.docbook: Add array-info.1.docbook to generate manpages. 2007-02-07 18:17 Petter Reinholdtsen * NEWS, README, include/array_plugin.h, plugins/compaq_info.c, plugins/md_info.c: Changed the 'status is ok' message for the md plugin to match the one in the cciss and ida plugin, and make the string common across all plugins. 2007-02-07 18:13 Raphael Pinson * INSTALL: Add INSTALL file 2007-02-07 17:56 Raphael Pinson * NEWS: Complete NEWS 2007-02-07 17:49 Raphael Pinson * Makefile: * Fix spaces to tab in Makefile 2007-02-07 17:49 Raphael Pinson * Changelog, Contributors, Makefile, NEWS: * Remove Changelog * Add the contents in Changelog to NEWS * Add a changelog: target in Makefile * Add a Contributors file to generate ChangeLog from cvs2cl 2007-02-07 12:22 Petter Reinholdtsen * linuxheaders/: cciss_ioctl.h, linux/cciss_ioctl.h: Move cciss_ioctl.h to its proper location. 2007-02-07 11:05 Raphael Pinson * COPYING: Add COPYING 2007-02-07 11:01 Raphael Pinson * Makefile: Remove existing tarball in dist: before creating it again 2007-02-07 11:00 Raphael Pinson * Makefile: * Remove duplicate package name and version * Update to version 0.13 2007-02-07 10:57 Raphael Pinson * Makefile: * Add distclean target * Add dist target 2007-02-06 17:50 Petter Reinholdtsen * linuxheaders/cciss_ioctl.h: Add a working cciss_ioctl.h header for those without one. 2007-02-06 17:48 Petter Reinholdtsen * main.c: Print the default plugin path in the usage info block. 2007-02-06 17:39 Petter Reinholdtsen * plugins/Makefile: Correct DESTDIR handling. 2007-02-05 17:33 Petter Reinholdtsen * README: Mention problem with detecting errors on a cciss RAID. 2007-02-05 16:46 Petter Reinholdtsen * NEWS, plugins/compaq_info.c: Add ID for raid controller Compaq Smart Array 64xx. 2007-02-05 14:35 Petter Reinholdtsen * plugins/compaq_info.c: Remove empty line at the end of the status block. 2007-02-05 14:28 Petter Reinholdtsen * NEWS: Document path change. 2007-02-05 14:27 Petter Reinholdtsen * Makefile: Cleanup. 2007-02-05 14:27 Petter Reinholdtsen * Makefile: array-info need root access. Install it in sbin/, not bin/. 2007-02-03 16:49 Petter Reinholdtsen * README: Add simple todo item. 2007-02-03 11:04 Petter Reinholdtsen * NEWS, plugins/Makefile, plugins/cciss_cmd.c, plugins/cciss_info.c, plugins/cciss_info.h, plugins/compaq_info.c, plugins/compaq_info.h, plugins/ida_cmd.c, plugins/ida_info.c, plugins/ida_info.h, plugins/md_info.c, plugins/xmalloc.ic: Convert the cciss and ida plugin to the new shared library framework. Some code cleanup. 2007-02-01 15:43 Petter Reinholdtsen * array_plugin.c, include/array_plugin.h, plugins/md_info.c, plugins/md_info.h: Rewrite plugin API to pass driver data between the functions. 2007-02-01 15:42 Petter Reinholdtsen * lib/array_plugin_api.c: Indent. 2007-01-31 14:32 Petter Reinholdtsen * array_plugin.c, include/array_plugin.h, plugins/md_info.c, plugins/md_info.h: Remove the need to link libarray-info into plugins by providing the functions needed in a list of callbacks. 2007-01-26 11:29 Petter Reinholdtsen * plugins/Makefile: Update version number. 2007-01-26 11:26 Petter Reinholdtsen * lib/Makefile, plugins/Makefile: Make sure shared objects are build with position independend code. Patch from Raphaėl Pinson. 2007-01-26 11:24 Petter Reinholdtsen * plugins/Makefile: Correct install target. 2007-01-26 00:13 Petter Reinholdtsen * include/array_info.h: Bump version number. 2007-01-26 00:09 Petter Reinholdtsen * plugins/: md_info.c, md_info.h: Reduce the number of exported symbols to make sure the array_plugin interface is used. 2007-01-26 00:02 Petter Reinholdtsen * include/array_plugin.h, plugins/md_info.c: Correct the prototypes. 2007-01-25 16:14 Petter Reinholdtsen * Makefile, include/array_plugin.h, lib/Makefile, plugins/Makefile: Make sure the install target installs the plugins. 2007-01-25 14:31 Petter Reinholdtsen * plugins/compaq_info.c: Include controller id when reporting an unknown controller. 2007-01-25 14:29 Petter Reinholdtsen * NEWS, plugins/compaq_info.c: Add ID for raid controller HP Smart Array E200. 2007-01-25 14:15 Petter Reinholdtsen * Makefile, NEWS, linuxheaders/cpqarray.h, linuxheaders/ida_cmd.h, linuxheaders/ida_ioctl.h: Include needed header files copied from the linux kernel tree. 2007-01-25 14:11 Petter Reinholdtsen * Makefile: Add install target. 2007-01-25 12:30 Petter Reinholdtsen * README: Start on readme with the key information. 2007-01-25 12:14 Petter Reinholdtsen * NEWS: Start on NEWS file. 2007-01-25 12:14 Petter Reinholdtsen * plugins/compaq_info.c: Fix typo in status message. 2002-07-30 16:12 Benoit Gaussen * Makefile, array_plugin.c, main.c, include/array_info.h, include/array_plugin.h, include/array_plugin_api.h, lib/Makefile, lib/array_plugin_api.c, plugins/Makefile, plugins/md_info.c: Functions add and show infos 2002-07-29 18:55 Benoit Gaussen * main.c: Trivial fix 2002-07-29 18:52 Benoit Gaussen * array_info.h, cciss_cmd.c, cciss_info.c, cciss_info.h, compaq_data.h, compaq_info.c, compaq_info.h, ida_cmd.c, ida_info.c, ida_info.h, md_cmd.c, md_data.h, md_info.c, md_info.h: Remove moved files 2002-07-29 18:49 Benoit Gaussen * Changelog, Makefile, array_plugin.c, array_utils.c, main.c, include/Makefile, include/array_info.h, include/array_plugin.h, include/array_plugin_api.h, lib/Makefile, lib/array_plugin_api.c, plugins/Makefile, plugins/cciss_cmd.c, plugins/cciss_info.c, plugins/cciss_info.h, plugins/compaq_data.h, plugins/compaq_info.c, plugins/compaq_info.h, plugins/ida_cmd.c, plugins/ida_info.c, plugins/ida_info.h, plugins/md_cmd.c, plugins/md_data.h, plugins/md_info.c, plugins/md_info.h: Add plugin support Change directory structure 2002-07-25 18:51 Benoit Gaussen * array_utils.c, cciss_cmd.c, cciss_info.c, cciss_info.h, compaq_data.h, compaq_info.c, compaq_info.h, ida_cmd.c, ida_info.c, ida_info.h, main.c, md_cmd.c, md_data.h, md_info.c, md_info.h: CVS Fixes 2002-07-25 18:47 Benoit Gaussen * array_info.h, md_info.c, md_info.h: CVS Fixes 2002-07-25 17:15 Benoit Gaussen * Changelog, md_data.h, md_info.c, md_info.h: MD Update... 2002-07-25 15:55 Benoit Gaussen * md_data.h, md_info.c, md_info.h: MD Update... 2002-07-25 13:01 Benoit Gaussen * md_info.c: MD Updates 2002-07-25 12:59 Benoit Gaussen * array_info.c: Old file removal 2002-07-25 12:58 Benoit Gaussen * Makefile, md_info.c: MD Updates 2002-07-25 12:54 Benoit Gaussen * Makefile, compaq_info.c, md_data.h, md_info.c, md_info.h: MD Updates 2002-07-24 17:23 Benoit Gaussen * main.c, md_info.c: Fix mistakes... 2002-07-24 17:12 Benoit Gaussen * array_utils.c, compaq_info.c, compaq_info.h, md_info.c, md_info.h: Rewrite goes on... 2002-07-24 17:04 Benoit Gaussen * Changelog, Makefile, array_info.c, array_info.h, array_utils.c, cciss_info.c, cciss_info.h, ida_cmd.c, ida_info.c, ida_info.h, main.c, md_info.c, md_info.h, compaq_data.h, compaq_info.c, compaq_info.h, md_data.h: Rewrite goes on... 2002-07-24 13:01 Benoit Gaussen * array_info.c, array_info.h, array_utils.c, cciss_cmd.c, cciss_info.c, cciss_info.h, ida_info.c, ida_info.h, main.c, md_info.c, md_info.h: Major data structures changes 2002-07-24 11:45 Benoit Gaussen * array_utils.c, Changelog, Makefile, array_info.c, array_info.h, cciss_cmd.c, cciss_info.c, cciss_info.h, ida_cmd.c, ida_info.c, ida_info.h, main.c, md_cmd.c, md_info.c, md_info.h: CVS tree creation 2002-07-24 11:45 Benoit Gaussen * array_utils.c, Changelog, Makefile, array_info.c, array_info.h, cciss_cmd.c, cciss_info.c, cciss_info.h, ida_cmd.c, ida_info.c, ida_info.h, main.c, md_cmd.c, md_info.c, md_info.h: Initial revision array-info-0.15/Contributors0000644000176200017620000000033410627047461017345 0ustar rpinsonrpinson00000000000000# Do not modify the format of this file. # It is required by cvs2cl to generate the ChangeLog. trez42:Benoit Gaussen pere:Petter Reinholdtsen raphink:Raphael Pinson array-info-0.15/INSTALL0000644000176200017620000000305610627047461015762 0ustar rpinsonrpinson00000000000000Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. This file is free documentation, based on the Free Software Foundation INSTALL documentation; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. Build dependencies ================== In order to build this package, you need recent Linux kernel headers and docbook2x. Basic Installation ================== To build this program, use the folling commands: 1. `cd` to the directory containing the package's source code 2. Type `make all. Optionally, you might set the ARRAY_PLUGIN_PATH variable (with e.g. `make all ARRAY_PLUGIN_PATH=/usr/lib/array-info/plugins`) 3. Type `make install` to install the programs and any data files and documentation. Optionally, you might set the prefix and DESTDIR options (with e.g. `make install prefix=/usr DESTDIR=/home/foo/array-info). By default, the program will be installed in /usr/local/bin, /usr/local/man, etc. 4. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. array-info-0.15/Makefile0000644000176200017620000000360710627047461016373 0ustar rpinsonrpinson00000000000000DESTDIR = prefix = /usr/local sbindir = $(prefix)/sbin pkglibdir = $(prefix)/lib/array-info mandir = /usr/local/man subdirs = lib plugins include INCLUDES = -I./include -I./linuxheaders CFLAGS = -g2 -Wall $(INCLUDES) -DARRAY_PLUGIN_PATH=\"$(ARRAY_PLUGIN_PATH)\" LDFLAGS = -L./lib -larray-info -ldl OBJS = array_plugin.o array_utils.o main.o ARRAY_PLUGIN_PATH=$(pkglibdir)/plugins OUTPUT = array-info MAN = array-info.1 REL_NAME = array-info REL_VER = 0.15 DISTDIR=$(REL_NAME)-$(REL_VER) TARGZ=$(REL_NAME)_$(REL_VER).tar.gz TARBZ2=$(REL_NAME)_$(REL_VER).tar.bz2 DOCBOOK2XMAN=docbook2x-man DISTLIST = $(shell ls | grep -v $(TARGZ) | grep -v $(TARBZ2)| grep -v $(DISTDIR)) all : build_lib build_plugins $(OUTPUT) $(MAN).gz build_lib : make -C lib build_plugins : make -C plugins $(OUTPUT) : $(OBJS) $(CC) -o $(OUTPUT) $(OBJS) $(LDFLAGS) $(MAN).gz : $(MAN).docbook $(DOCBOOK2XMAN) $(MAN).docbook -gzip --best $(MAN) install : all $(MAN).gz mkdir -p $(DESTDIR)$(sbindir)/. cp $(OUTPUT) $(DESTDIR)$(sbindir)/. for dir in $(subdirs) ; do \ $(MAKE) -C $$dir $@; \ done mkdir -p $(DESTDIR)$(mandir)/man1 cp $(MAN).gz $(DESTDIR)$(mandir)/man1/ release : indent clean cd .. && cp -a $(REL_NAME) $(REL_NAME)-$(REL_VER) && tar czf $(REL_NAME)-$(REL_VER).tar.gz $(REL_NAME)-$(REL_VER) indent : find . -name "*.[ch]" -exec indent -kr -i8 -ts8 -sob -l80 -ss -bs -psl {} \; && find . -name "*~" -exec rm {} \; clean distclean :: for dir in $(subdirs) ; do \ $(MAKE) -C $$dir $@ ; \ done clean :: rm -f *~ $(OBJS) distclean :: clean rm -f *~ $(OBJS) $(OUTPUT) $(MAN).gz $(TARGZ) $(TARBZ2) changelog : rm -f ChangeLog cvs2cl -U Contributors -I ChangeLog dist : distclean rm -rf $(DISTDIR) rm -f $(TARGZ) $(TARBZ2) mkdir $(DISTDIR) cp -r $(DISTLIST) $(DISTDIR) -find $(DISTDIR) -type d -name CVS -exec rm -rf {} \; tar czf $(TARGZ) $(DISTDIR) tar cjf $(TARBZ2) $(DISTDIR) rm -rf $(DISTDIR) array-info-0.15/NEWS0000644000176200017620000000211110627047461015417 0ustar rpinsonrpinson000000000000000.15 (2007-05-29) * Fix man build rule in Makefile 0.14 (2007-05-29) * Add ID for raid controllers HP Smart Array E200i. * Fix cciss_ioctl.h to build on all Linux kernels. 0.13 (2007-02-07) * Add plugin support * Fix typo in status output. * Include needed header files copied from the linux kernel tree. * Add ID for raid controllers HP Smart Array E200 and Compaq Smart Array 64xx. * Rewritten the plugin architecture to load array drivers as shared libraries. * Moved default installation directory from bin/ to sbin/, as array-info need to run as a privileged user to get device access. * Changed the 'status is ok' message for the md plugin to match the one in the cciss and ida plugin, and make the string common across all plugins. 0.12 (2002-07-25) * Major code rewrite. * Change data structures to be more controller independant. * Add initial support for MD devices (need some tests and feedback...). 2002-07-29 * Add plugin support. * Change directory structure. 2002-07-29 * Major code rewrite... again... * Plugin support for controllers. array-info-0.15/README0000644000176200017620000000170410627047461015607 0ustar rpinsonrpinson00000000000000array-info ========== array-info is a tool to retrieve informations and logical drives status from several RAID controllers (currently Compaq IDA and CISS). TODO ---- Verify that the cciss check actually detect broken disks. It did not on a test machine with Compaq Smart Array 64xx, where the disk led was red and "hpacucli ctrl slot=0 physicaldrive all show status" showed "Predictive Failure" on one of the disks. It did detect failure when one disk was physically removed from the machine. Get array-info to report the status of all detected RAID systems when executed without any options, making the -d /path/to/dev optional. Add support for output formatted as nagios expect it, to make it trivial to use array-info as a nagios plugin. License ------- GNU General Public License Author ------ Benoit Gaussen Download -------- The latest version is available from . array-info-0.15/array-info.1.docbook0000644000176200017620000000772110627047461020504 0ustar rpinsonrpinson00000000000000 RaphaĆ«l Pinson raphink@ubuntu.com 2006 RaphaĆ«l Pinson 2006-12-15 array-info 1 array-info check the status of a HP (Compaq) SmartArray controller array-info -d array_device_path -a|-l|-A|-c|-s|-L|-h DESCRIPTION Array-info is a command line tool to retrieve informations and logical drives status from several RAID controllers (currently HP Compaq IDA and CISS and MD). It displays informations about the firmware version, Rom revision, number of physical and logical drives on the controller, aswell as the fault tolerance, size, number of physical disks and status for each logical drive. OPTIONS Generic options: Path to array device, e.g. /dev/ida/c0d0 or /dev/cciss/c0d1 Show informations about all drives Show informations about selected logical drive Show informations about controller Show informations about logical drives Show physical device informations Show status of logical drives Show all informations Show version Show help about options COPYRIGHT This manual page was written by RaphaĆ«l Pinson <raphink@ubuntu.com>. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU General Public License, Version 2 or any later version published by the Free Software Foundation. array-info-0.15/array_plugin.c0000644000176200017620000001151410627047461017567 0ustar rpinsonrpinson00000000000000/* * array-info - Array Controllers Informations * Copyright (C) 2002 Benoit Gaussen (ben@trez42.net) * * $Log: array_plugin.c,v $ * Revision 1.4 2007/02/01 14:43:26 pere * Rewrite plugin API to pass driver data between the functions. * * Revision 1.3 2007/01/31 13:32:29 pere * Remove the need to link libarray-info into plugins by providing the functions needed in a list of callbacks. * * Revision 1.2 2002/07/30 14:12:46 trez42 * Functions add and show infos * * Revision 1.1 2002/07/29 16:49:10 trez42 * Add plugin support * Change directory structure * * * 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 of the License, 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, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include #include #include "array_plugin.h" void array_add_plugin(array_plugin_list_t ** list, array_plugin_t * plugin, void *so_handle, char *so_path) { array_plugin_list_t *new; new = malloc(sizeof (array_plugin_list_t)); new->plugin = plugin; new->plugin_path = so_path; new->plugin_handle = so_handle; new->next = *list; *list = new; } int array_plugin_register(array_plugin_list_t ** plugin_list, char *so_path) { array_plugin_t *plugin; void *so_handle; if ((so_handle = dlopen(so_path, RTLD_NOW)) == NULL) { printf("dlopen error: %s\n", dlerror()); return -1; } if ((plugin = dlsym(so_handle, "array_plugin")) == NULL) { printf("dlsym error: %s\n", dlerror()); return -1; } if (VERSION_MAJOR(plugin->array_info_version) < ARRAY_INFO_VERSION_MAJOR) { printf("%s: wrong version (compiled for %d.%d.%d)\n", so_path, VERSION_MAJOR(plugin->array_info_version), VERSION_MINOR(plugin->array_info_version), VERSION_PATCH(plugin->array_info_version)); return -1; } array_add_plugin(plugin_list, plugin, so_handle, so_path); return 0; } array_plugin_list_t * array_load_plugins(char *so_path) { DIR *so_dir; struct dirent *dir_ent; array_plugin_list_t *plugin_list = NULL; if ((so_dir = opendir(so_path)) == NULL) { perror("array_plugin_open"); return NULL; } while ((dir_ent = readdir(so_dir))) { char *path; struct stat sbuf; if (strcasecmp (dir_ent->d_name + strlen(dir_ent->d_name) - 3, ".so")) continue; path = malloc(strlen(so_path) + strlen(dir_ent->d_name) + 2); strcpy(path, so_path); strcat(path, "/"); strcat(path, dir_ent->d_name); if (stat(path, &sbuf) == -1) { perror("array_plugin_open"); return NULL; } if (!S_ISREG(sbuf.st_mode)) { free(path); continue; } array_plugin_register(&plugin_list, path); } closedir(so_dir); return plugin_list; } void array_close_plugins(array_plugin_list_t * plugin_list) { array_plugin_list_t *prev; while (plugin_list) { prev = plugin_list; dlclose(plugin_list->plugin_handle); plugin_list = plugin_list->next; free(prev); } } void array_show_plugins(array_plugin_list_t * plugin_list) { while (plugin_list) { printf("%s : %s\n", plugin_list->plugin_path, plugin_list->plugin->plugin_description()); plugin_list = plugin_list->next; } } array_plugin_t * find_plugin(array_plugin_list_t * plugin_list, array_data_t * array_data) { int i; while (plugin_list) { for (i = 0; plugin_list->plugin->device_majors[i].type; i++) if (plugin_list->plugin->device_majors[i].type == array_data->device_major.type && plugin_list->plugin->device_majors[i].major == array_data->device_major.major && (plugin_list->plugin->device_majors[i].minor == -1 || plugin_list->plugin->device_majors[i]. minor == array_data->device_major.minor)) return plugin_list->plugin; plugin_list = plugin_list->next; } return NULL; } int array_dispatch(array_plugin_list_t * plugin_list, array_data_t * array_data) { array_plugin_t *plugin; array_infos_t *info; array_plugin_callbacks_t callbacks; if (!(plugin = find_plugin(plugin_list, array_data))) return -1; callbacks.array_add_infos = &array_add_infos; plugin->driver_data = plugin->ctrl_open(array_data); plugin->ctrl_req(plugin->driver_data); info = plugin->ctrl_infos(plugin->driver_data, &callbacks); array_show_infos(info, array_data->dump_flags); plugin->ctrl_free(plugin->driver_data); plugin->ctrl_close(plugin->driver_data); return 0; } array-info-0.15/array_utils.c0000644000176200017620000000363210627047461017433 0ustar rpinsonrpinson00000000000000/* * array-info - Array Controllers Informations * Copyright (C) 2002 Benoit Gaussen (ben@trez42.net) * * $Log: array_utils.c,v $ * Revision 1.6 2002/07/29 16:49:10 trez42 * Add plugin support * Change directory structure * * Revision 1.5 2002/07/25 16:51:14 trez42 * CVS Fixes * * * 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 of the License, 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, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "array_info.h" void * xmalloc(int size) { void *addr; if (!(addr = malloc(size))) { printf("Cannot allocate memory...\n"); } return addr; } array_data_t * open_ctrl(char *device_path) { int fd; struct stat stat_buf; array_data_t *array_data; if ((fd = open(device_path, O_RDONLY)) < 0) perror("open"); fstat(fd, &stat_buf); if (!(S_ISBLK(stat_buf.st_mode) || (S_ISCHR(stat_buf.st_mode)))) { printf("%s is not a valid block or char device...\n", device_path); return NULL; } if (!(array_data = xmalloc(sizeof (*array_data)))) return NULL; array_data->fd = fd; array_data->device_major.type = S_ISBLK(stat_buf.st_mode) ? BLOCK_DEVICE : CHAR_DEVICE; array_data->device_major.major = major(stat_buf.st_rdev); array_data->device_major.minor = minor(stat_buf.st_rdev); return array_data; } void close_ctrl(array_data_t * ctrl_data) { close(ctrl_data->fd); free(ctrl_data); } array-info-0.15/include/0000755000176200017620000000000010627047461016350 5ustar rpinsonrpinson00000000000000array-info-0.15/include/Makefile0000644000176200017620000000010410627047461020003 0ustar rpinsonrpinson00000000000000#!/usr/bin/make -f install : clean : rm -f *~ distclean : clean array-info-0.15/include/array_info.h0000644000176200017620000000513610627047461020657 0ustar rpinsonrpinson00000000000000/* * array-info - Array Controllers Informations * Copyright (C) 2002 Benoit Gaussen (ben@trez42.net) * * $Log: array_info.h,v $ * Revision 1.3 2007/01/25 23:13:10 pere * Bump version number. * * Revision 1.2 2002/07/30 14:12:46 trez42 * Functions add and show infos * * Revision 1.1 2002/07/29 16:50:19 trez42 * Add plugin support * Change directory structure * * Revision 1.4 2002/07/25 16:47:42 trez42 * CVS Fixes * * * 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 of the License, 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, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _ARRAY_INFO_H_ #define _ARRAY_INFO_H_ #include #include #include #include #include #include #include #include #include #include #include #include #define ARRAY_INFO_RELEASE_NAME "array-info" #define ARRAY_INFO_VERSION_MAJOR 0 #define ARRAY_INFO_VERSION_MINOR 13 #define ARRAY_INFO_VERSION_PATCH 0 #define ARRAY_INFO_VERSION (((ARRAY_INFO_VERSION_MAJOR)<<16) + ((ARRAY_INFO_VERSION_MINOR)<<8) + (ARRAY_INFO_VERSION_PATCH)) #define VERSION_MAJOR(a) (a>>16 & 0xff) #define VERSION_MINOR(a) (a>>8 & 0xff) #define VERSION_PATCH(a) (a & 0xff) typedef struct { #define BLOCK_DEVICE 1 #define CHAR_DEVICE 2 char type; char major; char minor; } device_major_t; #define ARRAY_INFO_LEVEL_CTRL (1<<0) #define ARRAY_INFO_LEVEL_LDRV (1<<1) #define ARRAY_INFO_LEVEL_LDRV_STATUS (1<<2) #define ARRAY_INFO_LEVEL_ALL (0xff) typedef struct { int fd; device_major_t device_major; u_int8_t query_flags; #define QUERY_SELECTED_LDRV (1<<0) #define QUERY_ALL_LDRV (1<<1) u_int8_t dump_flags; } array_data_t; typedef struct array_infos_s { char level; char *string; struct array_infos_s *prev; struct array_infos_s *next; } array_infos_t; struct array_board { u_int32_t id; char *name; }; /* Prototypes */ array_data_t *open_ctrl(char *device_path); void close_ctrl(array_data_t * array_data); #endif /* _ARRAY_INFO_H_ */ array-info-0.15/include/array_plugin.h0000644000176200017620000000610610627047461021220 0ustar rpinsonrpinson00000000000000/* * array-info - Array Controllers Informations * Copyright (C) 2002 Benoit Gaussen (ben@trez42.net) * * $Log: array_plugin.h,v $ * Revision 1.7 2007/02/07 17:17:43 pere * Changed the 'status is ok' message for the md plugin to match the one * in the cciss and ida plugin, and make the string common across all * plugins. * * Revision 1.6 2007/02/01 14:43:26 pere * Rewrite plugin API to pass driver data between the functions. * * Revision 1.5 2007/01/31 13:32:29 pere * Remove the need to link libarray-info into plugins by providing the functions needed in a list of callbacks. * * Revision 1.4 2007/01/25 23:02:41 pere * Correct the prototypes. * * Revision 1.3 2007/01/25 15:14:06 pere * Make sure the install target installs the plugins. * * Revision 1.2 2002/07/30 14:12:46 trez42 * Functions add and show infos * * Revision 1.1 2002/07/29 16:50:19 trez42 * Add plugin support * Change directory structure * * * 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 of the License, 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, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _ARRAY_PLUGIN_H_ #define _ARRAY_PLUGIN_H_ #include "array_info.h" typedef struct array_plugin_callbacks_s { void (*array_add_infos) (array_infos_t ** info, char level, char *string, ...); } array_plugin_callbacks_t; typedef void *driver_data_ptr_t; typedef struct { device_major_t *device_majors; u_int32_t plugin_version; u_int32_t array_info_version; driver_data_ptr_t driver_data; char *(*plugin_description) (void); driver_data_ptr_t(*ctrl_open) (array_data_t *); int (*ctrl_close) (driver_data_ptr_t); int (*ctrl_req) (driver_data_ptr_t); array_infos_t *(*ctrl_infos) (driver_data_ptr_t, array_plugin_callbacks_t * callbacks); void (*ctrl_free) (driver_data_ptr_t); } array_plugin_t; typedef struct array_plugin_list_s { array_plugin_t *plugin; void *plugin_handle; char *plugin_path; struct array_plugin_list_s *next; } array_plugin_list_t; // Prototypes array_plugin_list_t *array_load_plugins(char *so_path); void array_close_plugins(array_plugin_list_t * plugin_list); void array_show_plugins(array_plugin_list_t * plugin_list); int array_dispatch(array_plugin_list_t * plugin_list, array_data_t * array_data); // Plugin API void array_show_infos(array_infos_t * info, char level); void array_add_infos(array_infos_t ** info, char level, char *string, ...); /* Make sure all plugins report an OK volume the same way */ #define LOGICAL_VOLUME_OK "Logical drive is ok" #endif // _ARRAY_PLUGIN_H_ array-info-0.15/lib/0000755000176200017620000000000010627047461015473 5ustar rpinsonrpinson00000000000000array-info-0.15/lib/Makefile0000644000176200017620000000062710627047461017140 0ustar rpinsonrpinson00000000000000#!/usr/bin/make -f INCLUDES = -I../include CFLAGS = -g2 -Wall $(INCLUDES) -fPIC OBJS = array_plugin_api.o OUTPUT = libarray-info.a all : $(OUTPUT) $(OUTPUT) : $(OBJS) ar -cr $(OUTPUT) $(OBJS) ranlib $(OUTPUT) install: indent : find . -name "*.[ch]" -exec indent -kr -i8 -ts8 -sob -l80 -ss -bs -psl {} \; && find . -name "*~" -exec rm {} \; clean : rm -f *~ $(OBJS) $(OUTPUT) distclean : clean array-info-0.15/lib/array_plugin_api.c0000644000176200017620000000375310627047461021174 0ustar rpinsonrpinson00000000000000/* * array-info - Array Controllers Informations * Copyright (C) 2002 Benoit Gaussen (ben@trez42.net) * * $Log: array_plugin_api.c,v $ * Revision 1.3 2007/02/01 14:42:35 pere * Indent. * * Revision 1.2 2002/07/30 14:12:46 trez42 * Functions add and show infos * * Revision 1.1 2002/07/29 16:50:19 trez42 * Add plugin support * Change directory structure * * * 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 of the License, 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, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include "array_plugin.h" void array_show_infos(array_infos_t * info, char level) { unsigned char min_level = 0xff; array_infos_t *tail; while (info) { if (level & info->level) if (info->level < min_level) min_level = info->level; tail = info; info = info->next; } while (tail) { if (level & tail->level) printf("%s", tail->string); tail = tail->prev; } } void array_add_infos(array_infos_t ** info, char level, char *string, ...) { va_list ap; array_infos_t *new; char *final_str; int nb; new = malloc(sizeof (array_infos_t)); final_str = malloc(80); new->level = level; va_start(ap, string); va_end(ap); if ((nb = vsnprintf(final_str, 80, string, ap)) > 80) { free(final_str); final_str = malloc(nb); vsnprintf(final_str, nb, string, ap); } new->string = final_str; new->next = *info; new->prev = NULL; if (*info) (*info)->prev = new; *info = new; } array-info-0.15/linuxheaders/0000755000176200017620000000000010627047461017420 5ustar rpinsonrpinson00000000000000array-info-0.15/linuxheaders/linux/0000755000176200017620000000000010627047461020557 5ustar rpinsonrpinson00000000000000array-info-0.15/linuxheaders/linux/cciss_ioctl.h0000644000176200017620000001535510627047461023237 0ustar rpinsonrpinson00000000000000#ifndef CCISS_IOCTLH #define CCISS_IOCTLH #include #include #define CCISS_IOC_MAGIC 'B' typedef struct _cciss_pci_info_struct { unsigned char bus; unsigned char dev_fn; unsigned short domain; __u32 board_id; } cciss_pci_info_struct; typedef struct _cciss_coalint_struct { __u32 delay; __u32 count; } cciss_coalint_struct; typedef char NodeName_type[16]; typedef __u32 Heartbeat_type; #define CISS_PARSCSIU2 0x0001 #define CISS_PARCSCIU3 0x0002 #define CISS_FIBRE1G 0x0100 #define CISS_FIBRE2G 0x0200 typedef __u32 BusTypes_type; typedef char FirmwareVer_type[4]; typedef __u32 DriverVer_type; #define MAX_KMALLOC_SIZE 128000 #ifndef CCISS_CMD_H // This defines are duplicated in cciss_cmd.h in the driver directory //general boundary defintions #define SENSEINFOBYTES 32//note that this value may vary between host implementations //Command Status value #define CMD_SUCCESS 0x0000 #define CMD_TARGET_STATUS 0x0001 #define CMD_DATA_UNDERRUN 0x0002 #define CMD_DATA_OVERRUN 0x0003 #define CMD_INVALID 0x0004 #define CMD_PROTOCOL_ERR 0x0005 #define CMD_HARDWARE_ERR 0x0006 #define CMD_CONNECTION_LOST 0x0007 #define CMD_ABORTED 0x0008 #define CMD_ABORT_FAILED 0x0009 #define CMD_UNSOLICITED_ABORT 0x000A #define CMD_TIMEOUT 0x000B #define CMD_UNABORTABLE 0x000C //transfer direction #define XFER_NONE 0x00 #define XFER_WRITE 0x01 #define XFER_READ 0x02 #define XFER_RSVD 0x03 //task attribute #define ATTR_UNTAGGED 0x00 #define ATTR_SIMPLE 0x04 #define ATTR_HEADOFQUEUE 0x05 #define ATTR_ORDERED 0x06 #define ATTR_ACA 0x07 //cdb type #define TYPE_CMD 0x00 #define TYPE_MSG 0x01 // Type defs used in the following structs #define BYTE __u8 #define WORD __u16 #define HWORD __u16 #define DWORD __u32 /* Workaround for missing define */ #ifndef __user # define __user #endif /* __user */ #define CISS_MAX_LUN 16 #define LEVEL2LUN 1 // index into Target(x) structure, due to byte swapping #define LEVEL3LUN 0 #pragma pack(1) //Command List Structure typedef union _SCSI3Addr_struct { struct { BYTE Dev; BYTE Bus:6; BYTE Mode:2; // b00 } PeripDev; struct { BYTE DevLSB; BYTE DevMSB:6; BYTE Mode:2; // b01 } LogDev; struct { BYTE Dev:5; BYTE Bus:3; BYTE Targ:6; BYTE Mode:2; // b10 } LogUnit; } SCSI3Addr_struct; typedef struct _PhysDevAddr_struct { DWORD TargetId:24; DWORD Bus:6; DWORD Mode:2; SCSI3Addr_struct Target[2]; //2 level target device addr } PhysDevAddr_struct; typedef struct _LogDevAddr_struct { DWORD VolId:30; DWORD Mode:2; BYTE reserved[4]; } LogDevAddr_struct; typedef union _LUNAddr_struct { BYTE LunAddrBytes[8]; SCSI3Addr_struct SCSI3Lun[4]; PhysDevAddr_struct PhysDev; LogDevAddr_struct LogDev; } LUNAddr_struct; typedef struct _RequestBlock_struct { BYTE CDBLen; struct { BYTE Type:3; BYTE Attribute:3; BYTE Direction:2; } Type; HWORD Timeout; BYTE CDB[16]; } RequestBlock_struct; typedef union _MoreErrInfo_struct{ struct { BYTE Reserved[3]; BYTE Type; DWORD ErrorInfo; }Common_Info; struct{ BYTE Reserved[2]; BYTE offense_size;//size of offending entry BYTE offense_num; //byte # of offense 0-base DWORD offense_value; }Invalid_Cmd; }MoreErrInfo_struct; typedef struct _ErrorInfo_struct { BYTE ScsiStatus; BYTE SenseLen; HWORD CommandStatus; DWORD ResidualCnt; MoreErrInfo_struct MoreErrInfo; BYTE SenseInfo[SENSEINFOBYTES]; } ErrorInfo_struct; #pragma pack() #endif /* CCISS_CMD_H */ typedef struct _IOCTL_Command_struct { LUNAddr_struct LUN_info; RequestBlock_struct Request; ErrorInfo_struct error_info; WORD buf_size; /* size in bytes of the buf */ BYTE __user *buf; } IOCTL_Command_struct; typedef struct _BIG_IOCTL_Command_struct { LUNAddr_struct LUN_info; RequestBlock_struct Request; ErrorInfo_struct error_info; DWORD malloc_size; /* < MAX_KMALLOC_SIZE in cciss.c */ DWORD buf_size; /* size in bytes of the buf */ /* < malloc_size * MAXSGENTRIES */ BYTE __user *buf; } BIG_IOCTL_Command_struct; typedef struct _LogvolInfo_struct{ __u32 LunID; int num_opens; /* number of opens on the logical volume */ int num_parts; /* number of partitions configured on logvol */ } LogvolInfo_struct; #define CCISS_GETPCIINFO _IOR(CCISS_IOC_MAGIC, 1, cciss_pci_info_struct) #define CCISS_GETINTINFO _IOR(CCISS_IOC_MAGIC, 2, cciss_coalint_struct) #define CCISS_SETINTINFO _IOW(CCISS_IOC_MAGIC, 3, cciss_coalint_struct) #define CCISS_GETNODENAME _IOR(CCISS_IOC_MAGIC, 4, NodeName_type) #define CCISS_SETNODENAME _IOW(CCISS_IOC_MAGIC, 5, NodeName_type) #define CCISS_GETHEARTBEAT _IOR(CCISS_IOC_MAGIC, 6, Heartbeat_type) #define CCISS_GETBUSTYPES _IOR(CCISS_IOC_MAGIC, 7, BusTypes_type) #define CCISS_GETFIRMVER _IOR(CCISS_IOC_MAGIC, 8, FirmwareVer_type) #define CCISS_GETDRIVVER _IOR(CCISS_IOC_MAGIC, 9, DriverVer_type) #define CCISS_REVALIDVOLS _IO(CCISS_IOC_MAGIC, 10) #define CCISS_PASSTHRU _IOWR(CCISS_IOC_MAGIC, 11, IOCTL_Command_struct) #define CCISS_DEREGDISK _IO(CCISS_IOC_MAGIC, 12) /* no longer used... use REGNEWD instead */ #define CCISS_REGNEWDISK _IOW(CCISS_IOC_MAGIC, 13, int) #define CCISS_REGNEWD _IO(CCISS_IOC_MAGIC, 14) #define CCISS_RESCANDISK _IO(CCISS_IOC_MAGIC, 16) #define CCISS_GETLUNINFO _IOR(CCISS_IOC_MAGIC, 17, LogvolInfo_struct) #define CCISS_BIG_PASSTHRU _IOWR(CCISS_IOC_MAGIC, 18, BIG_IOCTL_Command_struct) #ifdef __KERNEL__ #ifdef CONFIG_COMPAT /* 32 bit compatible ioctl structs */ typedef struct _IOCTL32_Command_struct { LUNAddr_struct LUN_info; RequestBlock_struct Request; ErrorInfo_struct error_info; WORD buf_size; /* size in bytes of the buf */ __u32 buf; /* 32 bit pointer to data buffer */ } IOCTL32_Command_struct; typedef struct _BIG_IOCTL32_Command_struct { LUNAddr_struct LUN_info; RequestBlock_struct Request; ErrorInfo_struct error_info; DWORD malloc_size; /* < MAX_KMALLOC_SIZE in cciss.c */ DWORD buf_size; /* size in bytes of the buf */ /* < malloc_size * MAXSGENTRIES */ __u32 buf; /* 32 bit pointer to data buffer */ } BIG_IOCTL32_Command_struct; #define CCISS_PASSTHRU32 _IOWR(CCISS_IOC_MAGIC, 11, IOCTL32_Command_struct) #define CCISS_BIG_PASSTHRU32 _IOWR(CCISS_IOC_MAGIC, 18, BIG_IOCTL32_Command_struct) #endif /* CONFIG_COMPAT */ #endif /* __KERNEL__ */ #endif array-info-0.15/linuxheaders/cpqarray.h0000644000176200017620000000617210627047461021421 0ustar rpinsonrpinson00000000000000/* * Disk Array driver for Compaq SMART2 Controllers * Copyright 1998 Compaq Computer Corporation * * 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 of the License, 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, GOOD TITLE or * NON INFRINGEMENT. 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, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * Questions/Comments/Bugfixes to arrays@compaq.com * * If you want to make changes, improve or add functionality to this * driver, you'll probably need the Compaq Array Controller Interface * Specificiation (Document number ECG086/1198) */ #ifndef CPQARRAY_H #define CPQARRAY_H #ifdef __KERNEL__ #include #include #include #include #include #endif #include "ida_cmd.h" #define IO_OK 0 #define IO_ERROR 1 #define NWD 16 #define NWD_SHIFT 4 #define IDA_MAX_PART 16 #define IDA_TIMER (5*HZ) #define IDA_TIMEOUT (10*HZ) #define MISC_NONFATAL_WARN 0x01 typedef struct { unsigned blk_size; unsigned nr_blks; unsigned cylinders; unsigned heads; unsigned sectors; int usage_count; } drv_info_t; #ifdef __KERNEL__ struct ctlr_info; typedef struct ctlr_info ctlr_info_t; struct access_method { void (*submit_command)(ctlr_info_t *h, cmdlist_t *c); void (*set_intr_mask)(ctlr_info_t *h, unsigned long val); unsigned long (*fifo_full)(ctlr_info_t *h); unsigned long (*intr_pending)(ctlr_info_t *h); unsigned long (*command_completed)(ctlr_info_t *h); }; struct board_type { __u32 board_id; char *product_name; struct access_method *access; }; struct ctlr_info { int ctlr; char devname[8]; __u32 log_drv_map; __u32 drv_assign_map; __u32 drv_spare_map; __u32 mp_failed_drv_map; char firm_rev[4]; struct pci_dev *pdev; int ctlr_sig; int log_drives; int highest_lun; int phys_drives; struct pci_dev *pci_dev; /* NULL if EISA */ __u32 board_id; char *product_name; void *vaddr; unsigned long paddr; unsigned long io_mem_addr; unsigned long io_mem_length; int intr; int usage_count; drv_info_t drv[NWD]; struct proc_dir_entry *proc; struct access_method access; cmdlist_t *reqQ; cmdlist_t *cmpQ; cmdlist_t *cmd_pool; dma_addr_t cmd_pool_dhandle; __u32 *cmd_pool_bits; unsigned int Qdepth; unsigned int maxQsinceinit; unsigned int nr_requests; unsigned int nr_allocs; unsigned int nr_frees; struct timer_list timer; unsigned int misc_tflags; // Disk structures we need to pass back struct gendisk gendisk; // Index by Minor Numbers struct hd_struct hd[256]; int sizes[256]; int blocksizes[256]; int hardsizes[256]; }; #endif #endif /* CPQARRAY_H */ array-info-0.15/linuxheaders/ida_cmd.h0000644000176200017620000001555410627047461021163 0ustar rpinsonrpinson00000000000000/* * Disk Array driver for Compaq SMART2 Controllers * Copyright 1998 Compaq Computer Corporation * * 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 of the License, 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, GOOD TITLE or * NON INFRINGEMENT. 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, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * Questions/Comments/Bugfixes to arrays@compaq.com * */ #ifndef ARRAYCMD_H #define ARRAYCMD_H #include #if 0 #include #endif /* for the Smart Array 42XX cards */ #define S42XX_REQUEST_PORT_OFFSET 0x40 #define S42XX_REPLY_INTR_MASK_OFFSET 0x34 #define S42XX_REPLY_PORT_OFFSET 0x44 #define S42XX_INTR_STATUS 0x30 #define S42XX_INTR_OFF 0x08 #define S42XX_INTR_PENDING 0x08 #define COMMAND_FIFO 0x04 #define COMMAND_COMPLETE_FIFO 0x08 #define INTR_MASK 0x0C #define INTR_STATUS 0x10 #define INTR_PENDING 0x14 #define FIFO_NOT_EMPTY 0x01 #define FIFO_NOT_FULL 0x02 #define BIG_PROBLEM 0x40 #define LOG_NOT_CONF 2 #pragma pack(1) typedef struct { __u32 size; __u32 addr; } sg_t; #define RCODE_NONFATAL 0x02 #define RCODE_FATAL 0x04 #define RCODE_INVREQ 0x10 typedef struct { __u16 next; __u8 cmd; __u8 rcode; __u32 blk; __u16 blk_cnt; __u8 sg_cnt; __u8 reserved; } rhdr_t; #define SG_MAX 32 typedef struct { rhdr_t hdr; sg_t sg[SG_MAX]; __u32 bp; } rblk_t; typedef struct { __u8 unit; __u8 prio; __u16 size; } chdr_t; #define CMD_RWREQ 0x00 #define CMD_IOCTL_PEND 0x01 typedef struct cmdlist { chdr_t hdr; rblk_t req; __u32 size; int retry_cnt; __u32 busaddr; int ctlr; struct cmdlist *prev; struct cmdlist *next; struct request *rq; struct completion *waiting; int type; } cmdlist_t; #define ID_CTLR 0x11 typedef struct { __u8 nr_drvs; __u32 cfg_sig; __u8 firm_rev[4]; __u8 rom_rev[4]; __u8 hw_rev; __u32 bb_rev; __u32 drv_present_map; __u32 ext_drv_map; __u32 board_id; __u8 cfg_error; __u32 non_disk_bits; __u8 bad_ram_addr; __u8 cpu_rev; __u8 pdpi_rev; __u8 epic_rev; __u8 wcxc_rev; __u8 marketing_rev; __u8 ctlr_flags; __u8 host_flags; __u8 expand_dis; __u8 scsi_chips; __u32 max_req_blocks; __u32 ctlr_clock; __u8 drvs_per_bus; __u16 big_drv_present_map[8]; __u16 big_ext_drv_map[8]; __u16 big_non_disk_map[8]; __u16 task_flags; __u8 icl_bus; __u8 red_modes; __u8 cur_red_mode; __u8 red_ctlr_stat; __u8 red_fail_reason; __u8 reserved[403]; } id_ctlr_t; typedef struct { __u16 cyl; __u8 heads; __u8 xsig; __u8 psectors; __u16 wpre; __u8 maxecc; __u8 drv_ctrl; __u16 pcyls; __u8 pheads; __u16 landz; __u8 sect_per_track; __u8 cksum; } drv_param_t; #define ID_LOG_DRV 0x10 typedef struct { __u16 blk_size; __u32 nr_blks; drv_param_t drv; __u8 fault_tol; __u8 reserved; __u8 bios_disable; } id_log_drv_t; #define ID_LOG_DRV_EXT 0x18 typedef struct { __u32 log_drv_id; __u8 log_drv_label[64]; __u8 reserved[418]; } id_log_drv_ext_t; #define SENSE_LOG_DRV_STAT 0x12 typedef struct { __u8 status; __u32 fail_map; __u16 read_err[32]; __u16 write_err[32]; __u8 drv_err_data[256]; __u8 drq_timeout[32]; __u32 blks_to_recover; __u8 drv_recovering; __u16 remap_cnt[32]; __u32 replace_drv_map; __u32 act_spare_map; __u8 spare_stat; __u8 spare_repl_map[32]; __u32 repl_ok_map; __u8 media_exch; __u8 cache_fail; __u8 expn_fail; __u8 unit_flags; __u16 big_fail_map[8]; __u16 big_remap_map[128]; __u16 big_repl_map[8]; __u16 big_act_spare_map[8]; __u8 big_spar_repl_map[128]; __u16 big_repl_ok_map[8]; __u8 big_drv_rebuild; __u8 reserved[36]; } sense_log_drv_stat_t; #define START_RECOVER 0x13 #define ID_PHYS_DRV 0x15 typedef struct { __u8 scsi_bus; __u8 scsi_id; __u16 blk_size; __u32 nr_blks; __u32 rsvd_blks; __u8 drv_model[40]; __u8 drv_sn[40]; __u8 drv_fw[8]; __u8 scsi_iq_bits; __u8 compaq_drv_stmp; __u8 last_fail; __u8 phys_drv_flags; __u8 phys_drv_flags1; __u8 scsi_lun; __u8 phys_drv_flags2; __u8 reserved; __u32 spi_speed_rules; __u8 phys_connector[2]; __u8 phys_box_on_bus; __u8 phys_bay_in_box; } id_phys_drv_t; #define BLINK_DRV_LEDS 0x16 typedef struct { __u32 blink_duration; __u32 reserved; __u8 blink[256]; __u8 reserved1[248]; } blink_drv_leds_t; #define SENSE_BLINK_LEDS 0x17 typedef struct { __u32 blink_duration; __u32 btime_elap; __u8 blink[256]; __u8 reserved1[248]; } sense_blink_leds_t; #define IDA_READ 0x20 #define IDA_WRITE 0x30 #define IDA_WRITE_MEDIA 0x31 #define RESET_TO_DIAG 0x40 #define DIAG_PASS_THRU 0x41 #define SENSE_CONFIG 0x50 #define SET_CONFIG 0x51 typedef struct { __u32 cfg_sig; __u16 compat_port; __u8 data_dist_mode; __u8 surf_an_ctrl; __u16 ctlr_phys_drv; __u16 log_unit_phys_drv; __u16 fault_tol_mode; __u8 phys_drv_param[16]; drv_param_t drv; __u32 drv_asgn_map; __u16 dist_factor; __u32 spare_asgn_map; __u8 reserved[6]; __u16 os; __u8 ctlr_order; __u8 extra_info; __u32 data_offs; __u8 parity_backedout_write_drvs; __u8 parity_dist_mode; __u8 parity_shift_fact; __u8 bios_disable_flag; __u32 blks_on_vol; __u32 blks_per_drv; __u8 scratch[16]; __u16 big_drv_map[8]; __u16 big_spare_map[8]; __u8 ss_source_vol; __u8 mix_drv_cap_range; struct { __u16 big_drv_map[8]; __u32 blks_per_drv; __u16 fault_tol_mode; __u16 dist_factor; } MDC_range[4]; __u8 reserved1[248]; } config_t; #define BYPASS_VOL_STATE 0x52 #define SS_CREATE_VOL 0x53 #define CHANGE_CONFIG 0x54 #define SENSE_ORIG_CONF 0x55 #define REORDER_LOG_DRV 0x56 typedef struct { __u8 old_units[32]; } reorder_log_drv_t; #define LABEL_LOG_DRV 0x57 typedef struct { __u8 log_drv_label[64]; } label_log_drv_t; #define SS_TO_VOL 0x58 #define SET_SURF_DELAY 0x60 typedef struct { __u16 delay; __u8 reserved[510]; } surf_delay_t; #define SET_OVERHEAT_DELAY 0x61 typedef struct { __u16 delay; } overhead_delay_t; #define SET_MP_DELAY typedef struct { __u16 delay; __u8 reserved[510]; } mp_delay_t; #define SENSE_SURF_STATUS 0x70 #define PASSTHRU_A 0x91 typedef struct { __u8 target; __u8 bus; __u8 lun; __u32 timeout; __u32 flags; __u8 status; __u8 error; __u8 cdb_len; __u8 sense_error; __u8 sense_key; __u32 sense_info; __u8 sense_code; __u8 sense_qual; __u32 residual; __u8 reserved[4]; __u8 cdb[12]; } scsi_param_t; #define RESUME_BACKGROUND_ACTIVITY 0x99 #define SENSE_CONTROLLER_PERFORMANCE 0xa8 #define FLUSH_CACHE 0xc2 #define COLLECT_BUFFER 0xd2 #define READ_FLASH_ROM 0xf6 #define WRITE_FLASH_ROM 0xf7 #pragma pack() #endif /* ARRAYCMD_H */ array-info-0.15/linuxheaders/ida_ioctl.h0000644000176200017620000000646610627047461021534 0ustar rpinsonrpinson00000000000000/* * Disk Array driver for Compaq SMART2 Controllers * Copyright 1998 Compaq Computer Corporation * * 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 of the License, 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, GOOD TITLE or * NON INFRINGEMENT. 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, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * Questions/Comments/Bugfixes to arrays@compaq.com * */ #ifndef IDA_IOCTL_H #define IDA_IOCTL_H #include "ida_cmd.h" #include "cpqarray.h" #define IDAGETDRVINFO 0x27272828 #define IDAPASSTHRU 0x28282929 #define IDAGETCTLRSIG 0x29293030 #define IDAREVALIDATEVOLS 0x30303131 #define IDADRIVERVERSION 0x31313232 #define IDAGETPCIINFO 0x32323333 #define IDADEREGDISK 0x33333434 #define IDAREGNEWDISK 0x34343535 #define IDAGETLOGINFO 0x35353636 #define IDABIGPASSTHRU 0x36363535 typedef struct _ida_pci_info_struct { unsigned char bus; unsigned char dev_fn; __u32 board_id; } ida_pci_info_struct; typedef struct _idaLogvolInfo_struct{ int LogVolID; int num_opens; /* number of opens on the logical volume */ int num_parts; /* number of partitions configured on logvol */ } idaLogvolInfo_struct; /* * Normally, the ioctl determines the logical unit for this command by * the major,minor number of the fd passed to ioctl. If you need to send * a command to a different/nonexistant unit (such as during config), you * can override the normal behavior by setting the unit valid bit. (Normally, * it should be zero) The controller the command is sent to is still * determined by the major number of the open device. */ #define UNITVALID 0x80 typedef struct { __u8 cmd; __u8 rcode; __u8 unit; __u32 blk; __u16 blk_cnt; /* currently, sg_cnt is assumed to be 1: only the 0th element of sg is used */ struct { void *addr; size_t size; } sg[SG_MAX]; int sg_cnt; union ctlr_cmds { drv_info_t drv; unsigned char buf[1024]; id_ctlr_t id_ctlr; drv_param_t drv_param; id_log_drv_t id_log_drv; id_log_drv_ext_t id_log_drv_ext; sense_log_drv_stat_t sense_log_drv_stat; id_phys_drv_t id_phys_drv; blink_drv_leds_t blink_drv_leds; sense_blink_leds_t sense_blink_leds; config_t config; reorder_log_drv_t reorder_log_drv; label_log_drv_t label_log_drv; surf_delay_t surf_delay; overhead_delay_t overhead_delay; mp_delay_t mp_delay; scsi_param_t scsi_param; } c; } ida_ioctl_t; #define IDA_MAX_KMALLOC_SIZE 128000 /* transfer type of the commands */ #define IDA_XFER_NONE 0x00 #define IDA_XFER_READ 0x01 #define IDA_XFER_WRITE 0x02 #define IDA_XFER_BOTH 0x03 typedef struct { __u8 cmd; __u8 rcode; __u8 unit; __u32 blk; __u16 blk_cnt; __u8 xfer_type; __u8 *buff; size_t buff_size; __u32 buff_malloc_size; scsi_param_t *scsi_param; /* used only for PASSTHRU_A */ } ida_big_ioctl_t; #endif /* IDA_IOCTL_H */ array-info-0.15/main.c0000644000176200017620000001202710627047461016017 0ustar rpinsonrpinson00000000000000/* * array-info - Array Controllers Informations * Copyright (C) 2002 Benoit Gaussen (ben@trez42.net) * * $Log: main.c,v $ * Revision 1.9 2007/02/06 16:48:28 pere * Print the default plugin path in the usage info block. * * Revision 1.8 2002/07/30 14:12:46 trez42 * Functions add and show infos * * Revision 1.7 2002/07/29 16:55:16 trez42 * Trivial fix * * Revision 1.6 2002/07/29 16:49:10 trez42 * Add plugin support * Change directory structure * * Revision 1.5 2002/07/25 16:51:14 trez42 * CVS Fixes * * * 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 of the License, 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, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include "array_info.h" #include "array_plugin.h" void print_version() { printf("%s v%d.%d.%d by Benoit Gaussen (ben@trez42.net)\n\n", ARRAY_INFO_RELEASE_NAME, ARRAY_INFO_VERSION_MAJOR, ARRAY_INFO_VERSION_MINOR, ARRAY_INFO_VERSION_PATCH); printf("http://sourceforge.net/projects/array-info\n\n"); } void print_help() { printf("%s v%d.%d.%d by Benoit Gaussen (ben@trez42.net)\n\n", ARRAY_INFO_RELEASE_NAME, ARRAY_INFO_VERSION_MAJOR, ARRAY_INFO_VERSION_MINOR, ARRAY_INFO_VERSION_PATCH); printf ("Usage:\n" " %s -d array_device_path [-a|-l|-A|-c|-s|-L|-h]\n\n" "Options:\n" " --device=PATH -d path to array device\n" " --all-drives -a show informations about all drives\n" " --logical-drive -l show informations about selected logical drive\n" " --show-ctrl -c show informations about controller\n" " --show-logical -L show informations about logical drives\n" " --show-status -s show status of logical drives\n" " --show-all -A show all informations\n" " --plugin-path=PATH path to plugins directory (%s)\n" " --plugin-list show plugin list\n" " --version -V show version\n" " --help -h display this help message\n\n", ARRAY_INFO_RELEASE_NAME, ARRAY_PLUGIN_PATH); } void array_info_exit(array_plugin_list_t * plugin_list, array_data_t * array_data, int ret) { if (plugin_list) array_close_plugins(plugin_list); if (array_data) close_ctrl(array_data); exit(ret); } int main(int argc, char **argv) { u_int8_t query_flags = 0; u_int8_t dump_flags = 0; char *device_path; char *plugin_path = NULL; array_plugin_list_t *plugin_list = NULL; array_data_t *array_data = NULL; int opt_ok = 0, opt_sh_plugin = 0; while (1) { int c, option_index = 0; static struct option long_options[] = { {"device", required_argument, NULL, 'd'}, {"all-drives", no_argument, NULL, 'a'}, {"log-drive", no_argument, NULL, 'l'}, {"show-all", no_argument, NULL, 'A'}, {"show-satus", no_argument, NULL, 's'}, {"show-ctrl", no_argument, NULL, 'c'}, {"show-log", no_argument, NULL, 'L'}, {"plugin-path", required_argument, NULL, '0'}, {"plugin-list", no_argument, NULL, '1'}, {"version", no_argument, NULL, 'V'}, {"help", no_argument, NULL, 'h'}, {0, 0, 0, 0} }; if ((c = getopt_long(argc, argv, "d:alAscL0:1Vh", long_options, &option_index)) == -1) break; switch (c) { case 'a': query_flags = QUERY_ALL_LDRV; break; case 'l': query_flags = QUERY_SELECTED_LDRV; break; case 'd': opt_ok = 1; device_path = optarg; break; case 'A': dump_flags = ARRAY_INFO_LEVEL_ALL; break; case 's': dump_flags |= ARRAY_INFO_LEVEL_LDRV_STATUS; break; case 'c': dump_flags |= ARRAY_INFO_LEVEL_CTRL; break; case 'L': dump_flags |= ARRAY_INFO_LEVEL_LDRV; break; case '0': plugin_path = optarg; break; case '1': opt_sh_plugin = 1; break; case 'V': print_version(); return 0; default: print_help(); return 0; } } if ((opt_ok == 0) && (opt_sh_plugin == 0)) { print_help(); return 0; } if (!plugin_path) plugin_path = ARRAY_PLUGIN_PATH; plugin_list = array_load_plugins(plugin_path); if (opt_sh_plugin == 1) { array_show_plugins(plugin_list); array_info_exit(plugin_list, array_data, 0); } if (!(array_data = open_ctrl(device_path))) { array_info_exit(plugin_list, array_data, -1); } array_data->query_flags = query_flags ? query_flags : QUERY_ALL_LDRV; array_data->dump_flags = dump_flags ? dump_flags : ARRAY_INFO_LEVEL_ALL; array_dispatch(plugin_list, array_data); array_info_exit(plugin_list, array_data, 0); return 0; } array-info-0.15/plugins/0000755000176200017620000000000010627047461016406 5ustar rpinsonrpinson00000000000000array-info-0.15/plugins/Makefile0000644000176200017620000000177610627047461020061 0ustar rpinsonrpinson00000000000000#!/usr/bin/make -f DESTDIR = prefix = /usr/local bindir = $(prefix)/bin pkglibdir = $(prefix)/lib/array-info ARRAY_PLUGIN_PATH=$(pkglibdir)/plugins INCLUDES = -I../include -I../linuxheaders CFLAGS = -fPIC -g2 -W -Wall $(INCLUDES) LDFLAGS = -fPIC ida_OBJS = ida_info.o ida_cmd.o compaq_info.o cciss_OBJS = cciss_info.o cciss_cmd.o compaq_info.o md_OBJS = md_info.o OUTPUT = md_info.so cciss_info.so ida_info.so REL_NAME = array-info REL_VER = 0.15 all : $(OUTPUT) ida_info.so: $(ida_OBJS) $(CC) --shared -o $@ $^ $(LDFLAGS) cciss_info.so: $(cciss_OBJS) $(CC) --shared -o $@ $^ $(LDFLAGS) md_info.so: $(md_OBJS) $(CC) --shared -o $@ $^ $(LDFLAGS) install: install -d $(DESTDIR)$(ARRAY_PLUGIN_PATH) for plug in $(OUTPUT) ; do \ install -c $$plug $(DESTDIR)$(ARRAY_PLUGIN_PATH)/. ; \ done indent : find . -name "*.[ch]" -exec indent -kr -i8 -ts8 -sob -l80 -ss -bs -psl {} \; && find . -name "*~" -exec rm {} \; clean : rm -f *~ $(md_OBJS) $(cciss_OBJS) $(ida_OBJS) distclean : rm -f $(OUTPUT) array-info-0.15/plugins/cciss_cmd.c0000644000176200017620000000411110627047461020476 0ustar rpinsonrpinson00000000000000/* * array-info - Array Controllers Informations * Copyright (C) 2002 Benoit Gaussen (ben@trez42.net) * * $Log: cciss_cmd.c,v $ * Revision 1.2 2007/02/03 10:04:05 pere * Convert the cciss and ida plugin to the new shared library framework. Some code cleanup. * * Revision 1.1 2002/07/29 16:50:19 trez42 * Add plugin support * Change directory structure * * Revision 1.3 2002/07/25 16:51:14 trez42 * CVS Fixes * * * 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 of the License, 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, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "array_info.h" #include "cciss_info.h" int cciss_bmic_cmd(cciss_ctrl_data_t * ctrl_data, int opcode, int dir, void *buf, int buf_size) { IOCTL_Command_struct cciss_io; struct cciss_bmic_cdb *bmic_cdb; int ret; memset(&cciss_io, 0, sizeof (cciss_io)); cciss_io.Request.Type.Type = TYPE_CMD; cciss_io.Request.Type.Attribute = ATTR_SIMPLE; cciss_io.Request.Type.Direction = dir == CCISS_CMD_READ ? XFER_READ : XFER_WRITE; cciss_io.Request.Timeout = 0; cciss_io.Request.CDBLen = sizeof (*bmic_cdb); bmic_cdb = (void *) cciss_io.Request.CDB; bmic_cdb->opcode = dir == CCISS_CMD_READ ? OPCODE_CDB_READ : OPCODE_CDB_WRITE; bmic_cdb->bmic_opcode = opcode; bmic_cdb->log_drive = ctrl_data->log_drive; bmic_cdb->size = buf_size; cciss_io.buf = buf; cciss_io.buf_size = buf_size; if ((ret = ioctl(ctrl_data->fd, CCISS_PASSTHRU, &cciss_io)) < 0) { perror("ioctl"); return ret; } return cciss_io.error_info.CommandStatus; } array-info-0.15/plugins/cciss_info.c0000644000176200017620000001226210627047461020674 0ustar rpinsonrpinson00000000000000/* * array-info - Array Controllers Informations * Copyright (C) 2002 Benoit Gaussen (ben@trez42.net) * * $Log: cciss_info.c,v $ * Revision 1.2 2007/02/03 10:04:05 pere * Convert the cciss and ida plugin to the new shared library framework. Some code cleanup. * * Revision 1.1 2002/07/29 16:50:19 trez42 * Add plugin support * Change directory structure * * Revision 1.4 2002/07/25 16:51:14 trez42 * CVS Fixes * * * 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 of the License, 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, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "array_info.h" #include "array_plugin.h" #include "cciss_info.h" #include "compaq_info.h" static cciss_ctrl_data_t cciss_ctrl_data; #include "xmalloc.ic" static int cciss_sense_ldrv(cciss_ctrl_data_t * ctrl_data, u_int8_t ldrv) { struct id_log_drv ldrv_info; struct sense_log_drv ldrv_status; int ret; if ((ret = cciss_bmic_cmd(ctrl_data, OPCODE_BMIC_IDLOG, CCISS_CMD_READ, &ldrv_info, sizeof (ldrv_info))) != CMD_SUCCESS) { printf ("Error while getting CCISS logical drive %d informations (err=%d)...\n", ldrv, ret); return -1; } if ((ret = cciss_bmic_cmd(ctrl_data, OPCODE_BMIC_SENSELOG, CCISS_CMD_READ, &ldrv_status, sizeof (ldrv_status))) != CMD_SUCCESS) { printf ("Error while getting CCISS logical drive %d status (err=%d)...\n", ldrv, ret); return -1; } ctrl_data->ctrl.ldrvs[ldrv].log_drive = ldrv; ctrl_data->ctrl.ldrvs[ldrv].nr_blks = ldrv_info.nr_blks; ctrl_data->ctrl.ldrvs[ldrv].blk_size = ldrv_info.blk_size; ctrl_data->ctrl.ldrvs[ldrv].fault_tol = ldrv_info.fault_tol; ctrl_data->ctrl.ldrvs[ldrv].status = ldrv_status.status; ctrl_data->ctrl.ldrvs[ldrv].blks_to_recover = ldrv_status.blks_to_recover; return 0; } static int cciss_ctrl_req(driver_data_ptr_t data) { struct id_ctrl ctrl_info; int ret; cciss_ctrl_data_t *ctrl_data = (cciss_ctrl_data_t *) data; if ((ret = cciss_bmic_cmd(ctrl_data, OPCODE_BMIC_IDCTRL, CCISS_CMD_READ, &ctrl_info, sizeof (ctrl_info))) != CMD_SUCCESS) { printf ("Error while getting CCISS controller informations (err=%d)...\n", ret); return -1; } ctrl_data->ctrl.board_id = ctrl_info.board_id; memcpy(ctrl_data->ctrl.firm_rev, ctrl_info.firm_rev, 4); memcpy(ctrl_data->ctrl.rom_rev, ctrl_info.rom_rev, 4); ctrl_data->ctrl.nr_ldrvs = ctrl_info.nr_drvs; if (ctrl_data->query_flags == QUERY_ALL_LDRV) { int i; ctrl_data->ctrl.ldrvs = xmalloc(sizeof (compaq_log_drive_t) * ctrl_data->ctrl.nr_ldrvs); for (i = 0; i < ctrl_data->ctrl.nr_ldrvs; i++) cciss_sense_ldrv(ctrl_data, i); } else { ctrl_data->ctrl.ldrvs = xmalloc(sizeof (compaq_log_drive_t)); cciss_sense_ldrv(ctrl_data, ctrl_data->log_drive); } return 0; } static device_major_t cciss_device_majors[] = { {BLOCK_DEVICE, COMPAQ_CISS_MAJOR, -1}, {BLOCK_DEVICE, COMPAQ_CISS_MAJOR1, -1}, {BLOCK_DEVICE, COMPAQ_CISS_MAJOR2, -1}, {BLOCK_DEVICE, COMPAQ_CISS_MAJOR3, -1}, {BLOCK_DEVICE, COMPAQ_CISS_MAJOR4, -1}, {BLOCK_DEVICE, COMPAQ_CISS_MAJOR5, -1}, {BLOCK_DEVICE, COMPAQ_CISS_MAJOR6, -1}, {BLOCK_DEVICE, COMPAQ_CISS_MAJOR7, -1}, {0, 0, 0}, }; static driver_data_ptr_t cciss_ctrl_open(array_data_t * array_data) { cciss_ctrl_data.fd = array_data->fd; cciss_ctrl_data.log_drive = array_data->device_major.minor / 16; cciss_ctrl_data.query_flags = array_data->query_flags; return &cciss_ctrl_data; } static int cciss_ctrl_close(driver_data_ptr_t data) { cciss_ctrl_data_t *ctrl_data = (cciss_ctrl_data_t *) data; return 0; } static char * cciss_description(void) { static char description[35]; snprintf(description, 35, "CCISS Linux driver plugin v%d.%d.%d", CCISS_INFO_VERSION >> 16 & 0xff, CCISS_INFO_VERSION >> 8 & 0xff, CCISS_INFO_VERSION & 0xff); return description; } static void cciss_ctrl_free(driver_data_ptr_t data) { cciss_ctrl_data_t *ctrl_data = (cciss_ctrl_data_t *) data; if (ctrl_data->ctrl.ldrvs) { free(ctrl_data->ctrl.ldrvs); ctrl_data->ctrl.ldrvs = NULL; } } static array_infos_t * cciss_ctrl_infos(driver_data_ptr_t data, array_plugin_callbacks_t * callbacks) { cciss_ctrl_data_t *ctrl_data = (cciss_ctrl_data_t *) data; compaq_ctrl_t *ctrl = &(ctrl_data->ctrl); return compaq_ctrl_infos(ctrl, callbacks, ctrl_data->query_flags, ctrl_data->log_drive); } array_plugin_t array_plugin = { .device_majors = cciss_device_majors, .plugin_version = CCISS_INFO_VERSION, .array_info_version = ARRAY_INFO_VERSION, .plugin_description = cciss_description, .ctrl_open = cciss_ctrl_open, .ctrl_close = cciss_ctrl_close, .ctrl_req = cciss_ctrl_req, .ctrl_infos = cciss_ctrl_infos, .ctrl_free = cciss_ctrl_free }; array-info-0.15/plugins/cciss_info.h0000644000176200017620000001015510627047461020700 0ustar rpinsonrpinson00000000000000/* * array-info - Array Controllers Informations * Copyright (C) 2002 Benoit Gaussen (ben@trez42.net) * * $Log: cciss_info.h,v $ * Revision 1.2 2007/02/03 10:04:05 pere * Convert the cciss and ida plugin to the new shared library framework. Some code cleanup. * * Revision 1.1 2002/07/29 16:50:19 trez42 * Add plugin support * Change directory structure * * Revision 1.4 2002/07/25 16:51:14 trez42 * CVS Fixes * * * 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 of the License, 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, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _CCISS_INFO_H_ #define _CCISS_INFO_H_ #include #include #include "compaq_data.h" #define CCISS_INFO_VERSION ((0<<16) + (0<<8) + 0) #define CCISS_CMD_READ 0 #define CCISS_CMD_WRITE 1 struct cciss_bmic_cdb { u_int8_t opcode; #define OPCODE_CDB_READ 0x26 #define OPCODE_CDB_WRITE 0x27 u_int8_t log_drive; u_int8_t phys_drive; u_int8_t reserverd1[3]; u_int8_t bmic_opcode; #define OPCODE_BMIC_IDLOG 0x10 #define OPCODE_BMIC_IDCTRL 0x11 #define OPCODE_BMIC_SENSELOG 0x12 u_int16_t size; u_int8_t reserved2; } __attribute__ ((packed)); struct id_ctrl { u_int8_t nr_drvs; u_int32_t cfg_sig; u_int8_t firm_rev[4]; u_int8_t rom_rev[4]; u_int8_t hw_rev; u_int32_t bb_rev; u_int32_t drv_present_map; u_int32_t ext_drv_map; u_int32_t board_id; u_int8_t cfg_error; u_int32_t non_disk_bits; u_int8_t bad_ram_addr; u_int8_t cpu_rev; u_int8_t pdpi_rev; u_int8_t epic_rev; u_int8_t wcxc_rev; u_int8_t marketing_rev; u_int8_t ctlr_flags; u_int8_t host_flags; u_int8_t expand_dis; u_int8_t scsi_chips; u_int32_t max_req_blocks; u_int32_t ctlr_clock; u_int8_t drvs_per_bus; u_int16_t big_drv_present_map[8]; u_int16_t big_ext_drv_map[8]; u_int16_t big_non_disk_map[8]; u_int16_t task_flags; u_int8_t icl_bus; u_int8_t red_modes; u_int8_t cur_red_mode; u_int8_t red_ctlr_stat; u_int8_t red_fail_reason; u_int8_t reserved[403]; } __attribute__ ((packed)); struct drv_param { u_int16_t cyl; u_int8_t heads; u_int8_t xsig; u_int8_t psectors; u_int16_t wpre; u_int8_t maxecc; u_int8_t drv_ctrl; u_int16_t pcyls; u_int8_t pheads; u_int16_t landz; u_int8_t sect_per_track; u_int8_t cksum; } __attribute__ ((packed)); struct id_log_drv { u_int16_t blk_size; u_int32_t nr_blks; struct drv_param drv; u_int8_t fault_tol; u_int8_t reserved; u_int8_t bios_disable; } __attribute__ ((packed)); struct sense_log_drv { u_int8_t status; u_int32_t fail_map; u_int16_t read_err[32]; u_int16_t write_err[32]; u_int8_t drv_err_data[256]; u_int8_t drq_timeout[32]; u_int32_t blks_to_recover; u_int8_t drv_recovering; u_int16_t remap_cnt[32]; u_int32_t replace_drv_map; u_int32_t act_spare_map; u_int8_t spare_stat; u_int8_t spare_repl_map[32]; u_int32_t repl_ok_map; u_int8_t media_exch; u_int8_t cache_fail; u_int8_t expn_fail; u_int8_t unit_flags; u_int16_t big_fail_map[8]; u_int16_t big_remap_map[128]; u_int16_t big_repl_map[8]; u_int16_t big_act_spare_map[8]; u_int8_t big_spar_repl_map[128]; u_int16_t big_repl_ok_map[8]; u_int8_t big_drv_rebuild; u_int8_t reserved[36]; } __attribute__ ((packed)); typedef struct { int vers_major; int vers_minor; int vers_patchlevel; struct id_ctrl ctrl_info; compaq_log_drive_t ldrv; } cciss_ctrl_t; typedef struct { int fd; compaq_ctrl_t ctrl; u_int8_t log_drive; u_int8_t query_flags; } cciss_ctrl_data_t; /* Prototypes */ int cciss_bmic_cmd(cciss_ctrl_data_t * ctrl_data, int opcode, int dir, void *buf, int buf_size); #endif /* _CCISS_INFO_H_ */ array-info-0.15/plugins/compaq_data.h0000644000176200017620000000261010627047461021027 0ustar rpinsonrpinson00000000000000/* * array-info - Array Controllers Informations * Copyright (C) 2002 Benoit Gaussen (ben@trez42.net) * * $Log: compaq_data.h,v $ * Revision 1.1 2002/07/29 16:50:19 trez42 * Add plugin support * Change directory structure * * Revision 1.2 2002/07/25 16:51:14 trez42 * CVS Fixes * * * 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 of the License, 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, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _COMPAQ_DATA_H_ #define _COMPAQ_DATA_H_ typedef struct { u_int8_t log_drive; u_int32_t nr_blks; u_int16_t blk_size; u_int8_t fault_tol; u_int8_t status; u_int32_t blks_to_recover; } compaq_log_drive_t; typedef struct { u_int32_t board_id; u_int8_t nr_ldrvs; u_int8_t firm_rev[4]; u_int8_t rom_rev[4]; compaq_log_drive_t *ldrvs; } compaq_ctrl_t; #endif /* COMPAQ_DATA_H_ */ array-info-0.15/plugins/compaq_info.c0000644000176200017620000001447710627047461021062 0ustar rpinsonrpinson00000000000000/* * array-info - Array Controllers Informations * Copyright (C) 2002 Benoit Gaussen (ben@trez42.net) * * $Log: compaq_info.c,v $ * Revision 1.9 2007/02/21 16:28:40 pere * Add ID for raid controllers HP Smart Array E200i. * * Revision 1.8 2007/02/07 17:17:43 pere * Changed the 'status is ok' message for the md plugin to match the one * in the cciss and ida plugin, and make the string common across all * plugins. * * Revision 1.7 2007/02/05 15:46:38 pere * Add ID for raid controller Compaq Smart Array 64xx. * * Revision 1.6 2007/02/05 13:35:02 pere * Remove empty line at the end of the status block. * * Revision 1.5 2007/02/03 10:04:05 pere * Convert the cciss and ida plugin to the new shared library framework. Some code cleanup. * * Revision 1.4 2007/01/25 13:31:08 pere * Include controller id when reporting an unknown controller. * * Revision 1.3 2007/01/25 13:29:06 pere * Add ID for raid controller HP Smart Array E200. * * Revision 1.2 2007/01/25 11:14:07 pere * Fix typo in status message. * * Revision 1.1 2002/07/29 16:50:19 trez42 * Add plugin support * Change directory structure * * Revision 1.4 2002/07/25 16:51:14 trez42 * CVS Fixes * * * 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 of the License, 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, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "array_plugin.h" #include "array_info.h" #include "compaq_info.h" /* RAID level */ static const char *compaq_raid_level_str[] = { "RAID 0 (Stripping)", "RAID 4", "RAID 1 (Mirroring)", "RAID 5", "RAID 5+1", "Unknown RAID code (5)", "Unknown RAID code (6)" }; /* Status of logical drive */ static const char *compaq_ldrv_status_str[] = { LOGICAL_VOLUME_OK, "Logical drive is failed", "Logical drive is not configured", "Logical drive is using interim recovery mode", "Logical drive is ready for recovery operation", "Logical drive is currently recovering", "Wrong physical drive was replaced", "A physical drive is not properly connected", "Hardware is overheating", "Hardware has overheated", "Logical drive is currently expanding", "Logical drive is not yet available", "Logical drive is queued for expansion", }; static struct array_board compaq_boards[] = { {0x0040110E, "Compaq IDA"}, {0x0140110E, "Compaq IDA-2"}, {0x1040110E, "Compaq IAES"}, {0x2040110E, "Compaq SMART"}, {0x3040110E, "Compaq SMART-2/E"}, {0x3211103C, "HP Smart Array E200i"}, {0x3212103C, "HP Smart Array E200"}, {0x40300E11, "Compaq SMART-2/P"}, {0x40310E11, "Compaq SMART-2SL"}, {0x40320E11, "Compaq Smart Array 3200"}, {0x40330E11, "Compaq Smart Array 3100ES"}, {0x40340E11, "Compaq Smart Array 221"}, {0x40400E11, "Compaq Integrated Array"}, {0x40480E11, "Compaq Raid LC2"}, {0x40500E11, "Compaq Smart Array 4200"}, {0x40510E11, "Compaq Smart Array 4250ES"}, {0x40580E11, "Compaq Smart Array 431"}, {0x40700E11, "Compaq Smart Array 5300"}, {0x40800E11, "Compaq Smart Array 5i"}, {0x40820E11, "Compaq Smart Array 532"}, {0x40910e11, "Compaq Smart Array 64xx"}, {0, 0} }; static char * array_id2str(struct array_board *arrays, u_int32_t id) { static char unknownstr[512]; int i = 0; while (arrays[i].id) { if (arrays[i].id == id) return arrays[i].name; i++; } snprintf(unknownstr, sizeof (unknownstr), "Unknown Controller id 0x%x", id); return unknownstr; } static void compaq_ldrv_infos(compaq_ctrl_t * ctrl, array_infos_t * compaq_infos, array_plugin_callbacks_t * callbacks, u_int8_t ldrv) { callbacks->array_add_infos(&compaq_infos, ARRAY_INFO_LEVEL_LDRV, "\tLogical drive %2d :\n" "\t Fault tolerance : %s\n", ldrv, compaq_raid_level_str[ctrl->ldrvs[ldrv]. fault_tol]); callbacks->array_add_infos(&compaq_infos, ARRAY_INFO_LEVEL_LDRV, "\t Size : %2.2f GiB (%d blocks of %d bytes)\n", (double) ctrl->ldrvs[ldrv].nr_blks * ctrl->ldrvs[ldrv].blk_size / 1024 / 1024 / 1024, ctrl->ldrvs[ldrv].nr_blks, ctrl->ldrvs[ldrv].blk_size); callbacks->array_add_infos(&compaq_infos, ARRAY_INFO_LEVEL_LDRV_STATUS, "\t Status : %s", compaq_ldrv_status_str[ctrl->ldrvs[ldrv]. status]); switch (ctrl->ldrvs[ldrv].status) { case LDRV_STATUS_INTERIMRECOVERY: case LDRV_STATUS_RECOVERING: case LDRV_STATUS_EXPANDINGLDRV:{ double percentdone = 100 * (double) (ctrl->ldrvs[ldrv].nr_blks - ctrl->ldrvs[ldrv].blks_to_recover) / (double) ctrl->ldrvs[ldrv].nr_blks; callbacks->array_add_infos(&compaq_infos, ARRAY_INFO_LEVEL_LDRV_STATUS, "\t(%3.2f%% done)\n", percentdone); break; } default: callbacks->array_add_infos(&compaq_infos, ARRAY_INFO_LEVEL_LDRV_STATUS, "\n"); break; } } array_infos_t * compaq_ctrl_infos(compaq_ctrl_t * ctrl, array_plugin_callbacks_t * callbacks, u_int8_t query_flags, u_int8_t log_drive) { array_infos_t *compaq_infos = NULL; callbacks->array_add_infos(&compaq_infos, ARRAY_INFO_LEVEL_CTRL, "%s\n", array_id2str(compaq_boards, ctrl->board_id)); callbacks->array_add_infos(&compaq_infos, ARRAY_INFO_LEVEL_CTRL, "\tFirmware revision : %c%c%c%c\n" "\tRom revision : %c%c%c%c\n", ctrl->firm_rev[0], ctrl->firm_rev[1], ctrl->firm_rev[2], ctrl->firm_rev[3], ctrl->rom_rev[0], ctrl->rom_rev[1], ctrl->rom_rev[2], ctrl->rom_rev[3]); callbacks->array_add_infos(&compaq_infos, ARRAY_INFO_LEVEL_CTRL, "\t%-2d logical drive%s configured.\n\n", ctrl->nr_ldrvs, ctrl->nr_ldrvs > 1 ? "s" : ""); if (query_flags == QUERY_ALL_LDRV) { u_int8_t i; for (i = 0; i < ctrl->nr_ldrvs; i++) compaq_ldrv_infos(ctrl, compaq_infos, callbacks, i); } else compaq_ldrv_infos(ctrl, compaq_infos, callbacks, log_drive); return compaq_infos; } array-info-0.15/plugins/compaq_info.h0000644000176200017620000000402110627047461021047 0ustar rpinsonrpinson00000000000000/* * array-info - Array Controllers Informations * Copyright (C) 2002 Benoit Gaussen (ben@trez42.net) * * $Log: compaq_info.h,v $ * Revision 1.2 2007/02/03 10:04:05 pere * Convert the cciss and ida plugin to the new shared library framework. Some code cleanup. * * Revision 1.1 2002/07/29 16:50:19 trez42 * Add plugin support * Change directory structure * * Revision 1.3 2002/07/25 16:51:14 trez42 * CVS Fixes * * * 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 of the License, 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, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _COMPAQ_INFO_H_ #define _COMPAQ_INFO_H_ #include "ida_info.h" #include "cciss_info.h" #define COMPAQ_INFO_VERSION ((0<<16) + (0<<8) + 0) #define LDRV_STATUS_OK 0 #define LDRV_STATUS_FAILED 1 #define LDRV_STATUS_NOTCONFIGURED 2 #define LDRV_STATUS_INTERIMRECOVERY 3 #define LDRV_STATUS_READYFORRECOVERY 4 #define LDRV_STATUS_RECOVERING 5 #define LDRV_STATUS_WRONGPHYSDRVREPLACED 6 #define LDRV_STATUS_PHYSDRVBADCONN 7 #define LDRV_STATUS_EXPANDINGLDRV 10 #define LDRV_STATUS_LDRVNOTAVAILABLE 11 #define LDRV_STATUS_LDRVQUEUEDEXPANSION 12 /* Prototypes */ array_infos_t *compaq_ctrl_infos(compaq_ctrl_t * ctrl, array_plugin_callbacks_t * callbacks, u_int8_t query_flags, u_int8_t log_drive); #endif /* COMPAQ_INFO_H_ */ array-info-0.15/plugins/ida_cmd.c0000644000176200017620000000301310627047461020127 0ustar rpinsonrpinson00000000000000/* * array-info - Array Controllers Informations * Copyright (C) 2002 Benoit Gaussen (ben@trez42.net) * * $Log: ida_cmd.c,v $ * Revision 1.2 2007/02/03 10:04:05 pere * Convert the cciss and ida plugin to the new shared library framework. Some code cleanup. * * Revision 1.1 2002/07/29 16:50:19 trez42 * Add plugin support * Change directory structure * * Revision 1.3 2002/07/25 16:51:14 trez42 * CVS Fixes * * * 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 of the License, 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, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "array_info.h" #include "ida_info.h" #include "xmalloc.ic" ida_ioctl_t * ida_bmic_cmd(ida_ctrl_data_t * ctrl_data, u_int8_t opcode) { ida_ioctl_t *ida_io; int ret; ida_io = xmalloc(sizeof (*ida_io)); memset(ida_io, 0, sizeof (*ida_io)); ida_io->cmd = opcode; if ((ret = ioctl(ctrl_data->fd, IDAPASSTHRU, ida_io)) < 0) { perror("ioctl"); return NULL; } return ida_io; } array-info-0.15/plugins/ida_info.c0000644000176200017620000001206110627047461020322 0ustar rpinsonrpinson00000000000000/* * array-info - Array Controllers Informations * Copyright (C) 2002 Benoit Gaussen (ben@trez42.net) * * $Log: ida_info.c,v $ * Revision 1.2 2007/02/03 10:04:05 pere * Convert the cciss and ida plugin to the new shared library framework. Some code cleanup. * * Revision 1.1 2002/07/29 16:50:19 trez42 * Add plugin support * Change directory structure * * Revision 1.4 2002/07/25 16:51:14 trez42 * CVS Fixes * * * 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 of the License, 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, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "array_info.h" #include "array_plugin.h" #include "ida_info.h" #include "compaq_info.h" static ida_ctrl_data_t ida_ctrl_data; #include "xmalloc.ic" static int ida_sense_ldrv(ida_ctrl_data_t * ctrl_data, u_int8_t ldrv) { ida_ioctl_t *ida_io_ldrv, *ida_io_sense; id_log_drv_t *ldrv_info; sense_log_drv_stat_t *ldrv_status; if ((ida_io_ldrv = ida_bmic_cmd(ctrl_data, ID_LOG_DRV)) == NULL) { printf ("Error while getting IDA logical drive %d informations...\n", ldrv); return -1; } if ((ida_io_sense = ida_bmic_cmd(ctrl_data, SENSE_LOG_DRV_STAT)) == NULL) { printf("Error while getting IDA logical drive %d status...\n", ldrv); return -1; } ldrv_info = &ida_io_ldrv->c.id_log_drv; ldrv_status = &ida_io_sense->c.sense_log_drv_stat; ctrl_data->ctrl.ldrvs[ldrv].log_drive = ldrv; ctrl_data->ctrl.ldrvs[ldrv].nr_blks = ldrv_info->nr_blks; ctrl_data->ctrl.ldrvs[ldrv].blk_size = ldrv_info->blk_size; ctrl_data->ctrl.ldrvs[ldrv].fault_tol = ldrv_info->fault_tol; ctrl_data->ctrl.ldrvs[ldrv].status = ldrv_status->status; ctrl_data->ctrl.ldrvs[ldrv].blks_to_recover = ldrv_status->blks_to_recover; free(ida_io_ldrv); free(ida_io_sense); return 0; } static int ida_ctrl_req(driver_data_ptr_t data) { ida_ioctl_t *ida_io; id_ctlr_t *ctrl_info; ida_ctrl_data_t *ctrl_data = (ida_ctrl_data_t *) data; if ((ida_io = ida_bmic_cmd(ctrl_data, ID_CTLR)) == NULL) { printf("Error while getting IDA controller informations...\n"); return -1; } ctrl_info = &ida_io->c.id_ctlr; ctrl_data->ctrl.board_id = ctrl_info->board_id; memcpy(ctrl_data->ctrl.firm_rev, ctrl_info->firm_rev, 4); memcpy(ctrl_data->ctrl.rom_rev, ctrl_info->rom_rev, 4); ctrl_data->ctrl.nr_ldrvs = ctrl_info->nr_drvs; if (ctrl_data->query_flags == QUERY_ALL_LDRV) { int i; ctrl_data->ctrl.ldrvs = xmalloc(sizeof (compaq_log_drive_t) * ctrl_data->ctrl.nr_ldrvs); for (i = 0; i < ctrl_data->ctrl.nr_ldrvs; i++) ida_sense_ldrv(ctrl_data, i); } else { ctrl_data->ctrl.ldrvs = xmalloc(sizeof (compaq_log_drive_t)); ida_sense_ldrv(ctrl_data, ctrl_data->log_drive); } return 0; } static driver_data_ptr_t ida_ctrl_open(array_data_t * array_data) { ida_ctrl_data.fd = array_data->fd; ida_ctrl_data.log_drive = array_data->device_major.minor / 16; ida_ctrl_data.query_flags = array_data->query_flags; return &ida_ctrl_data; } static int ida_ctrl_close(driver_data_ptr_t data) { ida_ctrl_data_t *ctrl_data = (ida_ctrl_data_t *) data; return 0; } static char * ida_description() { static char description[35]; snprintf(description, 35, "Compaq IDA driver plugin v%d.%d.%d", IDA_INFO_VERSION >> 16 & 0xff, IDA_INFO_VERSION >> 8 & 0xff, IDA_INFO_VERSION & 0xff); return description; } static void ida_ctrl_free(driver_data_ptr_t data) { ida_ctrl_data_t *ctrl_data = (ida_ctrl_data_t *) data; if (ctrl_data->ctrl.ldrvs) { free(ctrl_data->ctrl.ldrvs); ctrl_data->ctrl.ldrvs = NULL; } } static array_infos_t * ida_ctrl_infos(driver_data_ptr_t data, array_plugin_callbacks_t * callbacks) { ida_ctrl_data_t *ctrl_data = (ida_ctrl_data_t *) data; compaq_ctrl_t *ctrl = &(ctrl_data->ctrl); return compaq_ctrl_infos(ctrl, callbacks, ctrl_data->query_flags, ctrl_data->log_drive); } static device_major_t ida_device_majors[] = { {BLOCK_DEVICE, COMPAQ_SMART2_MAJOR, -1}, {BLOCK_DEVICE, COMPAQ_SMART2_MAJOR1, -1}, {BLOCK_DEVICE, COMPAQ_SMART2_MAJOR2, -1}, {BLOCK_DEVICE, COMPAQ_SMART2_MAJOR3, -1}, {BLOCK_DEVICE, COMPAQ_SMART2_MAJOR4, -1}, {BLOCK_DEVICE, COMPAQ_SMART2_MAJOR5, -1}, {BLOCK_DEVICE, COMPAQ_SMART2_MAJOR6, -1}, {BLOCK_DEVICE, COMPAQ_SMART2_MAJOR7, -1}, {0, 0, 0}, }; array_plugin_t array_plugin = { .device_majors = ida_device_majors, .plugin_version = IDA_INFO_VERSION, .array_info_version = ARRAY_INFO_VERSION, .plugin_description = ida_description, .ctrl_open = ida_ctrl_open, .ctrl_close = ida_ctrl_close, .ctrl_req = ida_ctrl_req, .ctrl_infos = ida_ctrl_infos, .ctrl_free = ida_ctrl_free, }; array-info-0.15/plugins/ida_info.h0000644000176200017620000000302310627047461020325 0ustar rpinsonrpinson00000000000000/* * array-info - Array Controllers Informations * Copyright (C) 2002 Benoit Gaussen (ben@trez42.net) * * $Log: ida_info.h,v $ * Revision 1.2 2007/02/03 10:04:05 pere * Convert the cciss and ida plugin to the new shared library framework. Some code cleanup. * * Revision 1.1 2002/07/29 16:50:19 trez42 * Add plugin support * Change directory structure * * Revision 1.4 2002/07/25 16:51:14 trez42 * CVS Fixes * * * 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 of the License, 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, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _IDA_INFO_H_ #define _IDA_INFO_H_ #include #include #include "compaq_data.h" #define IDA_INFO_VERSION ((0<<16) + (0<<8) + 0) typedef struct { int fd; compaq_ctrl_t ctrl; u_int8_t log_drive; u_int8_t query_flags; } ida_ctrl_data_t; /* Prototypes */ ida_ioctl_t *ida_bmic_cmd(ida_ctrl_data_t * ctrl_data, u_int8_t opcode); #endif /* _IDA_INFO_H_ */ array-info-0.15/plugins/md_cmd.c0000644000176200017620000000227310627047461020001 0ustar rpinsonrpinson00000000000000/* * array-info - Array Controllers Informations * Copyright (C) 2002 Benoit Gaussen (ben@trez42.net) * * $Log: md_cmd.c,v $ * Revision 1.1 2002/07/29 16:50:19 trez42 * Add plugin support * Change directory structure * * Revision 1.2 2002/07/25 16:51:14 trez42 * CVS Fixes * * * 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 of the License, 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, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "array_info.h" #include "md_info.h" int md_cmd(int fd, int opcode, void *data) { int ret; if ((ret = ioctl(fd, opcode, data)) < 0) { perror("ioctl"); return ret; } return ret; } array-info-0.15/plugins/md_data.h0000644000176200017620000000300410627047461020145 0ustar rpinsonrpinson00000000000000/* * array-info - Array Controllers Informations * Copyright (C) 2002 Benoit Gaussen (ben@trez42.net) * * $Log: md_data.h,v $ * Revision 1.1 2002/07/29 16:50:19 trez42 * Add plugin support * Change directory structure * * Revision 1.5 2002/07/25 16:51:14 trez42 * CVS Fixes * * * 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 of the License, 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, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _MD_DATA_H_ #define _MD_DATA_H_ typedef struct { unsigned long array_size; int device_size; int fault_tol; int status; int errors; int creation_time; int nr_disks; int raid_disks; int active_disks; int working_disks; int failed_disks; int spare_disks; struct mdu_disk_info_s *disks; } md_log_drive_t; typedef struct { int vers_major; int vers_minor; int vers_patchlevel; md_log_drive_t ldrv; } md_ctrl_t; typedef struct { int fd; md_ctrl_t md_ctrl; } md_ctrl_data_t; #endif /* MD_DATA_H_ */ array-info-0.15/plugins/md_info.c0000644000176200017620000002262410627047461020173 0ustar rpinsonrpinson00000000000000/* * array-info - Array Controllers Informations * Copyright (C) 2002 Benoit Gaussen (ben@trez42.net) * * $Log: md_info.c,v $ * Revision 1.8 2007/02/07 17:17:43 pere * Changed the 'status is ok' message for the md plugin to match the one * in the cciss and ida plugin, and make the string common across all * plugins. * * Revision 1.7 2007/02/03 10:04:05 pere * Convert the cciss and ida plugin to the new shared library framework. Some code cleanup. * * Revision 1.6 2007/02/01 14:43:26 pere * Rewrite plugin API to pass driver data between the functions. * * Revision 1.5 2007/01/31 13:32:29 pere * Remove the need to link libarray-info into plugins by providing the functions needed in a list of callbacks. * * Revision 1.4 2007/01/25 23:09:33 pere * Reduce the number of exported symbols to make sure the array_plugin interface is used. * * Revision 1.3 2007/01/25 23:02:41 pere * Correct the prototypes. * * Revision 1.2 2002/07/30 14:12:46 trez42 * Functions add and show infos * * Revision 1.1 2002/07/29 16:50:19 trez42 * Add plugin support * Change directory structure * * Revision 1.12 2002/07/25 16:51:14 trez42 * CVS Fixes * * * 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 of the License, 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, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include "array_plugin.h" #include "md_info.h" #include "md_data.h" static device_major_t md_device_majors[] = { {BLOCK_DEVICE, MD_MAJOR, -1} , {0, 0, 0} }; static md_ctrl_data_t md_ctrl_data; /* RAID level */ static const char *md_raid_level_str[] = { // MD_RAID_RAID0 "RAID 0 (Stripping)", // MD_RAID_RAID1 "RAID 1 (Mirroring)", // MD_RAID_RAID5 "RAID 5", // MD_RAID_LINEAR "Linear", // MD_RAID_TRANSLUCENT "Translucent", // MD_RAID_HSM "HSM", // MD_RAID_MULTIPATH "Multipath", // MD_RAID_UNKNOWN "Unknown RAID type" }; #include "xmalloc.ic" static driver_data_ptr_t md_ctrl_open(array_data_t * array_data) { md_ctrl_data.fd = array_data->fd; return &md_ctrl_data; } static int md_ctrl_close(driver_data_ptr_t data) { return 0; } static char * md_description(void) { static char description[35]; snprintf(description, 35, "MD Linux driver plugin v%d.%d.%d", MD_INFO_VERSION >> 16 & 0xff, MD_INFO_VERSION >> 8 & 0xff, MD_INFO_VERSION & 0xff); return description; } static int md_cmd(int fd, int opcode, void *data) { int ret; if ((ret = ioctl(fd, opcode, data)) < 0) { perror("ioctl"); return ret; } return ret; } static void md_disks_req(void) { int i; if (!(md_ctrl_data.md_ctrl.ldrv.disks = xmalloc(sizeof (struct mdu_disk_info_s) * md_ctrl_data.md_ctrl.ldrv.nr_disks))) return; for (i = 0; i < md_ctrl_data.md_ctrl.ldrv.nr_disks; i++) { md_ctrl_data.md_ctrl.ldrv.disks[i].number = i; if (md_cmd (md_ctrl_data.fd, GET_DISK_INFO, &md_ctrl_data.md_ctrl.ldrv.disks[i])) { printf ("Warning: error while getting MD device %d informations...\n", i); continue; } } } static int md_ctrl_req(driver_data_ptr_t data) { struct mdu_array_info_s md_info; unsigned long dev_size; int raid_level; if (md_cmd(md_ctrl_data.fd, GET_ARRAY_INFO, &md_info) != 0) { printf("Error while getting MD device informations...\n"); return -1; } if (md_cmd(md_ctrl_data.fd, BLKGETSIZE, &dev_size) != 0) { printf("Error while getting MD device size...\n"); return -1; } md_ctrl_data.md_ctrl.vers_major = md_info.major_version; md_ctrl_data.md_ctrl.vers_minor = md_info.minor_version; md_ctrl_data.md_ctrl.vers_patchlevel = md_info.patch_version; md_ctrl_data.md_ctrl.ldrv.array_size = dev_size; md_ctrl_data.md_ctrl.ldrv.device_size = md_info.size; md_ctrl_data.md_ctrl.ldrv.creation_time = md_info.ctime; md_ctrl_data.md_ctrl.ldrv.nr_disks = md_info.nr_disks; md_ctrl_data.md_ctrl.ldrv.raid_disks = md_info.raid_disks; md_ctrl_data.md_ctrl.ldrv.active_disks = md_info.active_disks; md_ctrl_data.md_ctrl.ldrv.working_disks = md_info.working_disks; md_ctrl_data.md_ctrl.ldrv.failed_disks = md_info.failed_disks; md_ctrl_data.md_ctrl.ldrv.spare_disks = md_info.spare_disks; switch (md_info.level) { case -4: raid_level = MD_RAID_MULTIPATH; break; case -3: raid_level = MD_RAID_HSM; break; case -2: raid_level = MD_RAID_TRANSLUCENT; break; case -1: raid_level = MD_RAID_LINEAR; break; case 0: raid_level = MD_RAID_RAID0; break; case 1: raid_level = MD_RAID_RAID1; break; case 5: raid_level = MD_RAID_RAID5; break; default: raid_level = MD_RAID_UNKNOWN; } md_ctrl_data.md_ctrl.ldrv.fault_tol = raid_level; md_ctrl_data.md_ctrl.ldrv.status = md_info.state; md_disks_req(); return 0; } static array_infos_t * md_ctrl_infos(driver_data_ptr_t data, array_plugin_callbacks_t * callbacks) { array_infos_t *md_infos = NULL; callbacks->array_add_infos(&md_infos, ARRAY_INFO_LEVEL_CTRL, "MD Linux driver\n"); callbacks->array_add_infos(&md_infos, ARRAY_INFO_LEVEL_CTRL, "Version %d.%d.%d\n", md_ctrl_data.md_ctrl.vers_major, md_ctrl_data.md_ctrl.vers_minor, md_ctrl_data.md_ctrl.vers_patchlevel); callbacks->array_add_infos(&md_infos, ARRAY_INFO_LEVEL_LDRV, "Creation time : %s\n", ctime((time_t *) & md_ctrl_data.md_ctrl.ldrv. creation_time)); callbacks->array_add_infos(&md_infos, ARRAY_INFO_LEVEL_LDRV, "Fault tolerance : %s\n", md_raid_level_str[md_ctrl_data.md_ctrl.ldrv. fault_tol]); callbacks->array_add_infos(&md_infos, ARRAY_INFO_LEVEL_LDRV, "Array Size : %2.2f GiB\n", (double) md_ctrl_data.md_ctrl.ldrv. array_size * 512 / 1024 / 1024 / 1024); if (md_ctrl_data.md_ctrl.ldrv.status & (1 << MD_SB_CLEAN | 1 << MD_SB_ERRORS)) { callbacks->array_add_infos(&md_infos, ARRAY_INFO_LEVEL_LDRV_STATUS, "Status : %s\n", LOGICAL_VOLUME_OK); } else { callbacks->array_add_infos(&md_infos, ARRAY_INFO_LEVEL_LDRV_STATUS, "Status : Logical drive is %sclean, has %serrors\n", (md_ctrl_data.md_ctrl.ldrv. status & (1 << MD_SB_CLEAN)) ? "" : "not ", (md_ctrl_data.md_ctrl.ldrv. status & (1 << MD_SB_ERRORS)) ? "" : "no "); } callbacks->array_add_infos(&md_infos, ARRAY_INFO_LEVEL_LDRV, "Devices : %d\n", md_ctrl_data.md_ctrl.ldrv.nr_disks); if (md_ctrl_data.md_ctrl.ldrv.fault_tol >= MD_RAID_RAID0 && md_ctrl_data.md_ctrl.ldrv.fault_tol <= MD_RAID_RAID5) callbacks->array_add_infos(&md_infos, ARRAY_INFO_LEVEL_LDRV, "\tSize : %2.2f GiB\n", (double) md_ctrl_data.md_ctrl.ldrv. device_size / 1024 / 1024); callbacks->array_add_infos(&md_infos, ARRAY_INFO_LEVEL_LDRV, "\tRaid : %d\n", md_ctrl_data.md_ctrl.ldrv.raid_disks); callbacks->array_add_infos(&md_infos, ARRAY_INFO_LEVEL_LDRV, "\tActive : %d\n", md_ctrl_data.md_ctrl.ldrv.active_disks); callbacks->array_add_infos(&md_infos, ARRAY_INFO_LEVEL_LDRV, "\tWorking : %d\n", md_ctrl_data.md_ctrl.ldrv.working_disks); callbacks->array_add_infos(&md_infos, ARRAY_INFO_LEVEL_LDRV, "\tFailed : %d\n", md_ctrl_data.md_ctrl.ldrv.failed_disks); callbacks->array_add_infos(&md_infos, ARRAY_INFO_LEVEL_LDRV, "\tSpare : %d\n", md_ctrl_data.md_ctrl.ldrv.spare_disks); if (md_ctrl_data.md_ctrl.ldrv.nr_disks) { int i; callbacks->array_add_infos(&md_infos, ARRAY_INFO_LEVEL_LDRV, " RaidDevice State\n"); for (i = 0; i < md_ctrl_data.md_ctrl.ldrv.nr_disks; i++) { callbacks->array_add_infos(&md_infos, ARRAY_INFO_LEVEL_LDRV, " %10d ", md_ctrl_data.md_ctrl.ldrv. disks[i].raid_disk); if (md_ctrl_data.md_ctrl.ldrv.disks[i]. state & (1 << MD_DISK_ACTIVE)) callbacks->array_add_infos(&md_infos, ARRAY_INFO_LEVEL_LDRV, "active "); if (md_ctrl_data.md_ctrl.ldrv.disks[i]. state & (1 << MD_DISK_FAULTY)) callbacks->array_add_infos(&md_infos, ARRAY_INFO_LEVEL_LDRV, "faulty "); if (md_ctrl_data.md_ctrl.ldrv.disks[i]. state & (1 << MD_DISK_SYNC)) callbacks->array_add_infos(&md_infos, ARRAY_INFO_LEVEL_LDRV, "synchronized "); if (md_ctrl_data.md_ctrl.ldrv.disks[i]. state & (1 << MD_DISK_REMOVED)) callbacks->array_add_infos(&md_infos, ARRAY_INFO_LEVEL_LDRV, "removed "); callbacks->array_add_infos(&md_infos, ARRAY_INFO_LEVEL_LDRV, "\n"); } } return md_infos; } static void md_ctrl_free(driver_data_ptr_t data) { free(md_ctrl_data.md_ctrl.ldrv.disks); md_ctrl_data.md_ctrl.ldrv.disks = NULL; } array_plugin_t array_plugin = { .device_majors = md_device_majors, .plugin_version = MD_INFO_VERSION, .array_info_version = ARRAY_INFO_VERSION, .plugin_description = md_description, .ctrl_open = md_ctrl_open, .ctrl_close = md_ctrl_close, .ctrl_req = md_ctrl_req, .ctrl_infos = md_ctrl_infos, .ctrl_free = md_ctrl_free }; array-info-0.15/plugins/md_info.h0000644000176200017620000000424610627047461020200 0ustar rpinsonrpinson00000000000000/* * array-info - Array Controllers Informations * Copyright (C) 2002 Benoit Gaussen (ben@trez42.net) * * $Log: md_info.h,v $ * Revision 1.4 2007/02/01 14:43:26 pere * Rewrite plugin API to pass driver data between the functions. * * Revision 1.3 2007/01/31 13:32:29 pere * Remove the need to link libarray-info into plugins by providing the functions needed in a list of callbacks. * * Revision 1.2 2007/01/25 23:09:33 pere * Reduce the number of exported symbols to make sure the array_plugin interface is used. * * Revision 1.1 2002/07/29 16:50:19 trez42 * Add plugin support * Change directory structure * * Revision 1.9 2002/07/25 16:51:14 trez42 * CVS Fixes * * * 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 of the License, 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, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _MD_INFO_H_ #define _MD_INFO_H_ #include #include #define MD_INFO_VERSION ((0<<16) + (12<<8) + 0) /* * Superblock state bits from md_p.h */ #define MD_SB_CLEAN 0 #define MD_SB_ERRORS 1 /* * Device "operational" state bits from md_p.h */ #define MD_DISK_FAULTY 0 /* disk is faulty / operational */ #define MD_DISK_ACTIVE 1 /* disk is running or spare disk */ #define MD_DISK_SYNC 2 /* disk is in sync with the raid set */ #define MD_DISK_REMOVED 3 /* disk is in sync with the raid set */ #define MD_RAID_RAID0 0 #define MD_RAID_RAID1 1 #define MD_RAID_RAID5 2 #define MD_RAID_LINEAR 3 #define MD_RAID_TRANSLUCENT 4 #define MD_RAID_HSM 5 #define MD_RAID_MULTIPATH 6 #define MD_RAID_UNKNOWN 7 #endif /* _MD_INFO_H_ */ array-info-0.15/plugins/xmalloc.ic0000644000176200017620000000027610627047461020367 0ustar rpinsonrpinson00000000000000#include static void * xmalloc(int size) { void *addr; if (!(addr = malloc(size))) printf("Cannot allocate memory...\n"); return addr; }