diff -ur mpt-status-1.1.3-ratz/Makefile mpt-status-1.1.4-ratz/Makefile --- mpt-status-1.1.3-ratz/Makefile 2005-07-15 10:00:33.000000000 +0200 +++ mpt-status-1.1.4-ratz/Makefile 2005-07-16 18:40:06.000000000 +0200 @@ -6,6 +6,12 @@ CC := gcc INSTALL := install ARCH := $(shell uname -m) +REDHAT := $(shell if [ -e /etc/redhat-release ]; \ + then echo "true"; else echo "false"; fi) + +ifeq "${REDHAT}" "true" + DFLAGS := ${FLAGS} -DREDHAT +endif ifeq "${ARCH}" "sparc64" CFLAGS :=-I${KERNEL_PATH}/drivers/message/fusion -Iincl -Wall -W -O2 \ -m64 -pipe -mcpu=ultrasparc -mcmodel=medlow Only in mpt-status-1.1.4-ratz: contrib diff -ur mpt-status-1.1.3-ratz/doc/Changelog mpt-status-1.1.4-ratz/doc/Changelog --- mpt-status-1.1.3-ratz/doc/Changelog 2005-07-15 10:04:14.000000000 +0200 +++ mpt-status-1.1.4-ratz/doc/Changelog 2005-11-11 09:39:14.000000000 +0100 @@ -1,4 +1,28 @@ -2005-07-15, ratz [ratz@tac.ch]: +2005-11-11, ratz [ratz@drugphish.ch]: + o mpt-status.h + - Fixed VERSION string + o mpt-status.c + - Merged patch by Thomas Richer to allow setting the ioc unit + - Added Copyright note + - Removed the modprobe call since this is braindead. Not all + people have mpt loaded as module. Making it easy to use does + not mean making it dumb. + - added the -q parameter which quietens down the warning on the + config page mismatch. + +2005-07-16, ratz [ratz@drugphish.ch]: + o Makefile + - incorporated patch to auto-detect redhat, done by Matti + Hiljanen + o doc/INSTALL + - removed RH specific entry, since RH is now auto-detected + o doc/THANKS + - Matti earned his stars ;) + o contrib/mpt-status.spec + - Added preliminary support for RPM building, work done by + Jean-Philippe Civade. + +2005-07-15, ratz [ratz@drugphish.ch]: * Version: 1.1.3 [released] o mpt-status.h - incorporated compile fixes for redhat based distros from @@ -28,7 +52,7 @@ - initial import: I consider them important, even though it's just a very simple tool ... so far ;) -2005-06-16, ratz [ratz@tac.ch]: +2005-06-16, ratz [ratz@drugphish.ch]: * Version: 1.1.3 o doc/Changelog - corrected date format @@ -40,7 +64,7 @@ - Lindent'ed - added comment regarding compilation warning -2005-06-09, ratz [ratz@tac.ch]: +2005-06-09, ratz [ratz@drugphish.ch]: * Version: 1.1.2 o mpt-status.c - removed some local headers and put into mpt-status.h diff -ur mpt-status-1.1.3-ratz/doc/INSTALL mpt-status-1.1.4-ratz/doc/INSTALL --- mpt-status-1.1.3-ratz/doc/INSTALL 2005-07-15 09:28:50.000000000 +0200 +++ mpt-status-1.1.4-ratz/doc/INSTALL 2005-07-16 18:41:33.000000000 +0200 @@ -8,11 +8,6 @@ make KERNEL_PATH=/path/to/your/kernel/src -if you happen to be on a Redhat based distro and you can't compile the biest, -try: - - make DFLAGS="-DREDHAT" - If this does not work, send me (Roberto Nibali) an email with the output and I try to fix it. You might also need to minor tweak the Makefile shipped with this package. diff -ur mpt-status-1.1.3-ratz/doc/THANKS mpt-status-1.1.4-ratz/doc/THANKS --- mpt-status-1.1.3-ratz/doc/THANKS 2005-07-15 09:23:20.000000000 +0200 +++ mpt-status-1.1.4-ratz/doc/THANKS 2005-07-16 18:53:20.000000000 +0200 @@ -2,7 +2,10 @@ specific order or preference, it's a silly little tool anyway ;). -Klaus Ade Johnstad: Offered me remote access to hardware to develop and test - mpt-status. -Jean-Philippe Civade: Various little fixes regarding Redhat based distros and - a small document contribution on kernel source building +Klaus Ade Johnstad: - Offered me remote access to hardware to develop and + test mpt-status. +Jean-Philippe Civade: - Various little fixes regarding Redhat based distros + and a small document contribution on kernel source + building + - Initial RPM spec +Matti Hiljanen: - Added Redhat auto-detection diff -ur mpt-status-1.1.3-ratz/mpt-status.c mpt-status-1.1.4-ratz/mpt-status.c --- mpt-status-1.1.3-ratz/mpt-status.c 2005-07-15 08:28:21.000000000 +0200 +++ mpt-status-1.1.4-ratz/mpt-status.c 2005-11-11 09:42:57.000000000 +0100 @@ -2,6 +2,7 @@ This is a program to print the status of an LSI 1030 RAID controller. Copyright (C) 2004 CNET Networks, Inc. +Copyright (C) 2005 Roberto Nibali 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 @@ -33,6 +34,7 @@ #include "mpt-status.h" static int m = 0; +static int quiet_mode = 0; /* pagetype: pagewhich: @@ -58,8 +60,8 @@ */ void *read_page(unsigned int pagetype, unsigned int pagewhich, - unsigned int pagenumber, int address, unsigned int version) -{ + unsigned int pagenumber, int address, unsigned int version, + int ioc_unit) { char command[REALLYBIG]; char reply[REALLYBIG]; char sense[REALLYBIG]; @@ -82,7 +84,7 @@ memset((void *)sense, 0, sizeof(sense)); memset((void *)in, 0, sizeof(in)); - cmd->hdr.iocnum = 0; /* XXX maybe you have more than one controller? */ + cmd->hdr.iocnum = ioc_unit; cmd->hdr.port = 0; cmd->hdr.maxDataSize = BIG; cmd->timeout = 10; @@ -110,11 +112,16 @@ } if (version != config_reply->Header.PageVersion) { - fprintf(stderr, - "Version mismatch on pagetype %u, page number %u: expected %d, got %d\n", - pagetype, pagenumber, version, - config_reply->Header.PageVersion); - exit(EXIT_FAILURE); + if (quiet_mode != 0) { + fprintf(stderr, + "Version mismatch on pagetype %u, page number %u: expected %d, got %d\n", + pagetype, pagenumber, version, + config_reply->Header.PageVersion); + fprintf(stderr, "Nothing to worry about, you can turn" + "this warning off using the -q parameter\n"); + } + // Open question: Do we bail out on this? + //exit(EXIT_FAILURE); } config_request->Action = pagewhich; @@ -136,21 +143,20 @@ return in; } -void print_usage(const char *prog) -{ +void print_usage(const char *prog) { printf("Usage:\n"); - printf("%s [-i ]\n", prog); + printf("%s [-i ] [-u ]" + "[-h] [-s] [-v] [-q]\n", prog); exit(EXIT_SUCCESS); } -void print_version(void) -{ +void print_version(void) { printf("Version: %s\n", VERSION); exit(EXIT_SUCCESS); } -void print_information(int id_of_primary_device, int print_status_only) -{ +void print_information(int id_of_primary_device, int print_status_only, + int ioc_unit) { RaidVolumePage0_t *page; RaidPhysDiskPage0_t *phys; char *VolumeTypes[] = { "IS", "IME", "IM" }; @@ -165,7 +171,9 @@ page = read_page(MPI_CONFIG_PAGETYPE_RAID_VOLUME, MPI_CONFIG_ACTION_PAGE_READ_CURRENT, ioc, - id_of_primary_device, MPI_RAIDVOLPAGE0_PAGEVERSION); + id_of_primary_device, + MPI_RAIDVOLPAGE0_PAGEVERSION, + ioc_unit); if (1 == print_status_only) { printf("log_id %d", page->VolumeID); } else { @@ -173,9 +181,8 @@ page->VolumeIOC, page->VolumeID, page->VolumeType < - sizeof(VolumeTypes) ? VolumeTypes[page-> - VolumeType] : - "unknown", page->NumPhysDisks, + sizeof(VolumeTypes) ? VolumeTypes[page-> VolumeType] : + "unknown", page->NumPhysDisks, page->MaxLBA / (2 * 1024 * 1024)); printf(", state"); } @@ -228,7 +235,8 @@ MPI_CONFIG_ACTION_PAGE_READ_CURRENT, 0, page->PhysDisk[i].PhysDiskNum, - MPI_RAIDPHYSDISKPAGE0_PAGEVERSION); + MPI_RAIDPHYSDISKPAGE0_PAGEVERSION, + ioc_unit); memset(vendor, 0, sizeof(vendor)); memset(productid, 0, sizeof(productid)); memset(rev, 0, sizeof(rev)); @@ -290,15 +298,7 @@ } } -void do_init(void) -{ - if (0 != getuid()) { - fprintf(stderr, " You need to be root to run this program\n"); - exit(EXIT_FAILURE); - } - - system("/sbin/modprobe mptctl"); - +void do_init(void) { m = open("/dev/mptctl", O_RDWR); if (-1 == m) { int save_errno = errno; @@ -312,17 +312,18 @@ fprintf(stderr, " Are you sure your controller is supported by mptlinux?\n"); } + fprintf(stderr, "Also make sure mptctl is loaded into the kernel\n"); exit(EXIT_FAILURE); } } -int main(int argc, char *argv[]) -{ +int main(int argc, char *argv[]) { int ch; int print_status_only = PRINT_STATUS_ONLY; int id_of_primary_device = 0; + int ioc_unit = 0; - while ((ch = getopt(argc, argv, "i:hsv")) != EOF) { + while ((ch = getopt(argc, argv, "i:hqsu:v")) != EOF) { switch (ch) { case 'i': id_of_primary_device = strtoul(optarg, NULL, 10); @@ -330,18 +331,24 @@ case 'h': print_usage(argv[0]); break; + case 'q': + quiet_mode = 1; + break; case 's': print_status_only = 1; break; + case 'u': + ioc_unit = strtoul(optarg, NULL, 10); + break; case 'v': print_version(); break; default: + print_usage(argv[0]); break; } } - do_init(); - print_information(id_of_primary_device, print_status_only); + print_information(id_of_primary_device, print_status_only, ioc_unit); exit(EXIT_SUCCESS); } diff -ur mpt-status-1.1.3-ratz/mpt-status.h mpt-status-1.1.4-ratz/mpt-status.h --- mpt-status-1.1.3-ratz/mpt-status.h 2005-07-15 08:35:13.000000000 +0200 +++ mpt-status-1.1.4-ratz/mpt-status.h 2005-11-11 09:40:10.000000000 +0100 @@ -13,16 +13,17 @@ #include "lsi/mpi_ioc.h" #include "lsi/mpi_cnfg.h" -#define VERSION "1.1.2" +#define VERSION "1.1.4" #define BIG 1024 #define REALLYBIG 10240 #define PRINT_STATUS_ONLY 0 -void *read_page(unsigned int, unsigned int, unsigned int, int, unsigned int); +void *read_page(unsigned int, unsigned int, unsigned int, int, + unsigned int, int); void print_usage(const char *); void print_version(void); -void print_information(int, int); +void print_information(int, int, int); void do_init(void); #endif /* End of mpt-status.h */