Miscellaneous bugfixes and enhancements for s390-tools 1.8.0 SLES11 SP1
backported from latest upstream s390-tools version 1.8.3:
* general: Fix compile warnings & do minor bugfixes
* general: Adjust code to s390-tools upstream as far as possible
* lsreipl: Show defined vmcmd correctly
* fdasd:   Fix auto mode behavior
---
 README                         |   48 -
 cpuplugd/man/cpuplugd.conf.5   |    3 
 dasdinfo/dasdinfo.c            |    4 
 dasdview/dasdview.c            |   75 +-
 dasdview/dasdview.h            |    5 
 etc/init.d/cpuplugd            |   15 
 etc/init.d/dumpconf            |    8 
 etc/init.d/mon_statd           |   25 
 fdasd/fdasd.c                  |   92 +-
 fdasd/fdasd.h                  |    2 
 include/zt_common.h            |    7 
 ip_watcher/Makefile            |    1 
 ip_watcher/start_hsnc.sh       |    5 
 ip_watcher/xcec-bridge.c       |    3 
 ipl_tools/ccw.c                |  110 +-
 ipl_tools/chreipl.h            |    3 
 ipl_tools/getopt.c             |   49 -
 ipl_tools/ipl.c                |    6 
 ipl_tools/main.c               |   22 
 ipl_tools/man/chreipl.8        |   10 
 ipl_tools/man/chshut.8         |    6 
 ipl_tools/man/lsreipl.8        |    4 
 ipl_tools/man/lsshut.8         |    2 
 ipl_tools/system.c             |   13 
 libu2s/u2s.c                   |    6 
 libvtoc/vtoc.c                 |    2 
 mon_tools/mon_fsstatd.c        |    7 
 mon_tools/mon_fsstatd.h        |    2 
 mon_tools/mon_procd.c          |   13 
 mon_tools/mon_procd.h          |    2 
 qethconf/qethconf.8            |    9 
 scripts/dbginfo.sh             |  100 ++
 scripts/scsi_logging_level     |    4 
 scripts/zfcpdbf                | 1517 ++++++++++++++---------------------------
 scripts/zfcpdbf.1              |   16 
 tape390/tape390_common.c       |    3 
 tape390/tape390_crypt.c        |   16 
 tape390/tape390_display.c      |    4 
 tunedasd/src/tunedasd.c        |    4 
 vmconvert/lkcd_dump.h          |    6 
 vmconvert/main.cpp             |    3 
 vmcp/vmcp.c                    |   12 
 vmur/vmur.cpp                  |   10 
 zconf/chccwdev                 |   44 -
 zconf/chccwdev.8               |    8 
 zconf/chchp                    |   12 
 zconf/chchp.8                  |    2 
 zconf/chzcrypt                 |    3 
 zconf/chzcrypt.8               |    3 
 zconf/lschp                    |    2 
 zconf/lscss                    |    9 
 zconf/lscss.8                  |   11 
 zconf/lsluns.8                 |    2 
 zconf/lstape                   |   15 
 zconf/lstape.8                 |   15 
 zconf/lszcrypt.8               |    5 
 zconf/znetconf.8               |   60 -
 zdump/zgetdump.c               |   63 +
 zdump/zgetdump.h               |    4 
 zfcpdump/kernel/dump.c         |   91 ++
 zfcpdump/kernel/dump.h         |    8 
 zfcpdump/ramdisk/zfcp_dumper.c |   48 +
 62 files changed, 1238 insertions(+), 1421 deletions(-)

Index: s390-tools-sles11/ipl_tools/system.c
===================================================================
--- s390-tools-sles11.orig/ipl_tools/system.c
+++ s390-tools-sles11/ipl_tools/system.c
@@ -74,7 +74,7 @@ out:
 char *substring(size_t start, size_t stop, const char *src, char *dst,
 		size_t size)
 {
-	int count;
+	unsigned int count;
 
 	count = stop - start;
 	if (count >= --size)
@@ -102,7 +102,7 @@ int check_for_root(void)
 int ishex(char *cp)
 {
 
-	int i;
+	unsigned int i;
 	char c;
 
 	for (i = 0; i <= strlen(cp); i++) {
@@ -168,13 +168,13 @@ int strrd(char *string, char *file)
 
 	strncpy(path, file, sizeof(path));
 	if (access(path, R_OK) == 0) {
-		filp = fopen(path, "r");
+		filp = fopen(path, "rb");
 		if (!filp) {
 			fprintf(stderr,	"%s: Can not open %s: ", name, file);
 			fprintf(stderr, "%s\n", strerror(errno));
 			exit(1);
 		}
-		rc = fscanf(filp, "%s", string);
+		rc = fread(string, 4096, 1, filp);
 		fclose(filp);
 		/*
 		 *  special handling is required for
@@ -192,8 +192,11 @@ int strrd(char *string, char *file)
 					file);
 			fprintf(stderr, "%s\n", strerror(errno));
 			return -1;
-		} else
+		} else {
+			if (string[strlen(string) - 1] == '\n')
+				string[strlen(string) - 1] = 0;
 			return 0;
+		}
 	} else {
 		fprintf(stderr,	"%s: Can not open %s: ", name, file);
 		fprintf(stderr, "%s\n", strerror(errno));
Index: s390-tools-sles11/vmconvert/lkcd_dump.h
===================================================================
--- s390-tools-sles11.orig/vmconvert/lkcd_dump.h
+++ s390-tools-sles11/vmconvert/lkcd_dump.h
@@ -11,6 +11,7 @@
 #define LKCD_DUMP_H
 
 #include "dump.h"
+#include "zt_common.h"
 #include "register_content.h"
 
 
@@ -40,16 +41,15 @@
 
 #define GZIP_NOT_COMPRESSED -1
 
-
 class LKCDDump : public Dump
 {
 public:
 	LKCDDump(Dump*,const char*);
 	virtual ~LKCDDump(void){}
-	inline virtual void readMem(char* buf, int size) {
+	inline virtual void readMem(char* UNUSED(buf), int UNUSED(size)) {
 		throw(DumpException("LKCDDump::readMem() not implemented!"));
 	}
-	inline int seekMem(uint64_t offset){
+	inline int seekMem(uint64_t UNUSED(offset)){
 		throw(DumpException("LKCDDump::seekMem() not implemented!"));
 	}
 	inline virtual uint64_t getMemSize() const
Index: s390-tools-sles11/vmconvert/main.cpp
===================================================================
--- s390-tools-sles11.orig/vmconvert/main.cpp
+++ s390-tools-sles11/vmconvert/main.cpp
@@ -118,7 +118,8 @@ main(int argc, char* argv[])
 	if(stat(outputFileName,&s) == 0){
 		char answer[100];
 		printf("%s: overwrite file '%s'? ",argv[0],outputFileName);
-		scanf("%s",answer);
+		if(scanf("%s",answer) != 1)
+			exit(1);
 		if((strcmp(answer,"y") != 0) && (strcmp(answer,"yes") != 0))
 			exit(0);
 	}
Index: s390-tools-sles11/vmcp/vmcp.c
===================================================================
--- s390-tools-sles11.orig/vmcp/vmcp.c
+++ s390-tools-sles11/vmcp/vmcp.c
@@ -40,8 +40,8 @@ static void print_help(const char *name)
 
 static void print_version(const char *name)
 {
-	printf("%s: z/VM CP command interface version %s.\n"
-	       "Copyright IBM Corp. 2005, 2006.\n",
+	printf("%s: z/VM CP command interface version %s\n"
+	       "Copyright IBM Corp. 2005, 2006\n",
 	       name, RELEASE_STRING);
 }
 
@@ -152,8 +152,10 @@ static ssize_t read_buffer(int fd, char 
 	ssize_t ret;
 	ssize_t done;
 
-	for (done = 0; done < count; done += ret) {
+	for (done = 0; done < (ssize_t) count; done += ret) {
 		ret = read(fd, &buf[done], count - done);
+		if (ret == -1 && errno == EINTR)
+			continue;
 		if (ret == -1)
 			return -1;
 		if (ret == 0)
@@ -169,8 +171,10 @@ static ssize_t write_buffer(int fd, cons
 	ssize_t ret;
 	ssize_t done;
 
-	for (done = 0; done < count; done += ret) {
+	for (done = 0; done < (ssize_t) count; done += ret) {
 		ret = write(fd, &buf[done], count - done);
+		if (ret == -1 && errno == EINTR)
+			continue;
 		if (ret == -1)
 			return -1;
 		if (ret == 0)
Index: s390-tools-sles11/vmur/vmur.cpp
===================================================================
--- s390-tools-sles11.orig/vmur/vmur.cpp
+++ s390-tools-sles11/vmur/vmur.cpp
@@ -985,7 +985,7 @@ static void parse_opts_list(struct vmur 
 /*
  * Parse the command line: Default options
  */
-static void parse_opts_default(struct vmur *info, int argc, char *argv[])
+static void parse_opts_default(int argc, char *argv[])
 {
 	int opt, index;
 	static struct option long_options[] = {
@@ -1050,7 +1050,7 @@ static void parse_opts(struct vmur *info
 		ERR_EXIT("Missing command\n");
 
 	if (set_action(info, argv[1])) {
-		parse_opts_default(info, argc, argv);
+		parse_opts_default(argc, argv);
 		ERR("Unknown command '%s'\n", argv[1]);
 		std_usage_exit();
 	}
@@ -1474,7 +1474,8 @@ int write_vmdump(struct vmur *info, stru
 /*
  * Close VM virtual reader in case of a signal e.g. CTRL-C
 */
-static void ur_receive_sig_handler(int sig, siginfo_t *sip, void *p)
+static void ur_receive_sig_handler(int UNUSED(sig), siginfo_t *UNUSED(sip),
+				   void *UNUSED(p))
 {
 	close_reader(&vmur_info, "HOLD");
 	ERR_EXIT("Operation terminated, spool file received incompletely.\n");
@@ -1723,7 +1724,8 @@ static void rscs_punch_setup(struct vmur
 /*
  * Purge punch file in case of a signal e.g. CTRL-C
  */
-static void ur_write_sig_handler(int sig, siginfo_t *sip, void *p)
+static void ur_write_sig_handler(int UNUSED(sig), siginfo_t *UNUSED(sip),
+				 void *UNUSED(p))
 {
 	close_ur_device_purge(&vmur_info);
 	ERR_EXIT("Operation terminated, no spool file created.\n");
Index: s390-tools-sles11/zdump/zgetdump.c
===================================================================
--- s390-tools-sles11.orig/zdump/zgetdump.c
+++ s390-tools-sles11/zdump/zgetdump.c
@@ -87,10 +87,10 @@ char *usage_note =
 "> zgetdump -h\n";
 
 /* Version info */
-static const char version_text[] = "zgetdump: version "RELEASE_STRING".";
+static const char version_text[] = "zgetdump: version "RELEASE_STRING;
 
 /* Copyright notice */
-static const char copyright_notice[] = "Copyright IBM Corp. 2001, 2008.";
+static const char copyright_notice[] = "Copyright IBM Corp. 2001, 2008";
 
 /* global variables */
 
@@ -296,7 +296,10 @@ enum device_status get_device_from_busid
 		return UNDEFINED; /* device with devno does not exist	*/
 	snprintf(temp_file, PATH_MAX, "%s/online", dev_file);
 	fd = open(temp_file, O_RDONLY);
-	read(fd, buffer, 1);
+	if (read(fd, buffer, 1) == -1) {
+		perror("Could not read online attribute.");
+		exit(1);
+	}
 	close(fd);
 	if (buffer[0] != '1')
 		return OFFLINE;   /* device with devno is not online	*/
@@ -325,7 +328,10 @@ enum device_status get_device_from_busid
 	}
 	snprintf(temp_file, PATH_MAX, "%s/%s/dev", dev_file, direntp->d_name);
 	fd = open(temp_file, O_RDONLY);
-	read(fd, buffer, sizeof(buffer));
+	if (read(fd, buffer, sizeof(buffer)) == -1) {
+		perror("Could not read dev file.");
+		exit(1);
+	}
 	close(fd);
 	if (sscanf(buffer, "%i:%i", &major, &minor) != 2) {
 		fprintf(stderr, "Malformed content of %s: %s\n",
@@ -342,7 +348,7 @@ enum device_status get_device_from_busid
  * - valid magic number in the dump tool
  * - valid dump signature in the dump header
  * and set the volume's signature accordingly */
-int get_mvdump_volume_info(struct disk_info *vol, int vol_nr, off_t offset,
+int get_mvdump_volume_info(struct disk_info *vol, uint32_t vol_nr, off_t offset,
 			   struct mvdump_parm_table *table)
 {
 	int fd, rc;
@@ -459,7 +465,7 @@ int get_mvdump_info(int fd, int block_si
 void print_size_limit_info(uint64_t memory)
 {
 	fprintf(stderr, "Dump size limit: ");
-	if (memory == -1)
+	if (memory == (uint64_t) -1)
 		fprintf(stderr, "none\n");
 	else
 		fprintf(stderr, "%lldMB\n", (unsigned long long) memory /
@@ -471,7 +477,7 @@ void print_mvdump_info(int version, int 
 		       uint64_t memory, int force)
 {
 	int i;
-	
+
 	fprintf(stderr, "'%s' is part of Version %i multi-volume dump,\n"
 		"which is spread along the following DASD volumes:\n",
 		dump_device, version);
@@ -623,7 +629,10 @@ void print_lkcd_header(int fd)
 	dump_header_4_1_t dump_header;
 
 	lseek(fd, 0, SEEK_SET);
-	read(fd, &dump_header, sizeof(dump_header));
+	if (read(fd, &dump_header, sizeof(dump_header)) == -1) {
+		perror("Could not read dump header.");
+		exit(1);
+	}
 	fprintf(stderr, "\nThis is a lkcd dump:\n\n");
 	fprintf(stderr,
 		"Memory start   : 0x%"FMT64"x\n", dump_header.dh_memory_start);
@@ -746,9 +755,10 @@ void write_header()
 /* copy partition containing multi-volume dump data to stdout */
 int mvdump_copy(int fd, uint64_t partsize, uint64_t *totalsize)
 {
-	ssize_t n_read, n_written, count;
+	ssize_t n_read, n_written;
 	uint64_t part_offset;
 	int done = 0;
+	size_t count;
 
 	part_offset = HEADER_SIZE;
 	do {
@@ -862,7 +872,10 @@ int dump_end_times(int fd)
 {
 	int ret;
 
-	read(fd, (char *)&end_marker, sizeof(end_marker));
+	if (read(fd, &end_marker, sizeof(end_marker)) == -1) {
+		perror("Could not read end marker.");
+		exit(1);
+	}
 	s390_tod_to_timeval(end_marker.end_time, &h_time_end);
 	if ((strncmp(end_marker.end_string, "DUMP_END", 8) == 0) &&
 	    ((h_time_end.tv_sec - h_time_begin.tv_sec) >= 0)) {
@@ -884,7 +897,7 @@ int check_and_write_end_marker(int fd)
 			perror("\nwrite failed");
 			return 1;
 		}
-		if (rc < sizeof(end_marker)) {
+		if (rc < (ssize_t) sizeof(end_marker)) {
 			fprintf(stderr, "\nwrite failed: "
 				"No space left on device\n");
 			return 1;
@@ -900,7 +913,7 @@ int check_and_write_end_marker(int fd)
 
 /*	if a tape is part of the dump (not the last)	*/
 /*	it should have and ENDOFVOL marker		*/
-int vol_end(int fd)
+int vol_end(void)
 {
 	int ret;
 
@@ -934,7 +947,7 @@ void tape_forwards(int fd)
 
 /*	put current tape offline	*/
 /*	load & rewind next tape		*/
-void load_next(fd)
+void load_next(int fd)
 {
 	int ret;
 	struct mtop mymtop;
@@ -1009,11 +1022,11 @@ void parse_opts(int argc, char *argv[])
 	/* if devicename has been specified                        */
 
 	if ((option_a_set && !option_i_set) || (optind != argc-1)
-	    || (option_d_set && (option_i_set || option_a_set))) {
+	    || (option_d_set && option_i_set)) {
 		printf(help_text);
 		exit(1);
 
-		
+
 	}
 	strcpy(dump_device, argv[optind]);
 }
@@ -1118,12 +1131,13 @@ out:
 int main(int argc, char *argv[])
 {
 	uint64_t cur_time, size_limit;
-	int vol_count, cur_volnr, fd = -1;
+	int vol_count, fd = -1;
 	int version, dumper_arch, dasd_mv_flag = 0, block_size, rc;
 	int force_specified = 0;
 	enum dump_type d_type;
 	enum devnode_type type;
 	struct disk_info vol[MAX_DUMP_VOLUMES];
+	uint32_t cur_volnr;
 
 	rc = 0;
 	parse_opts(argc, argv);
@@ -1209,7 +1223,7 @@ is_dump_device:
 		rc = mvdump_check_or_copy(vol_count, vol);
 		goto out;
 	}
-	
+
 	if (!option_i_set) {		/* copy the dump to stdout */
 		print_s390_header(d_type);
 		write_header();
@@ -1235,8 +1249,7 @@ is_dump_device:
 
 		if (!check_and_write_end_marker(fd))
 			goto out;
-	}
-	if (option_i_set && !option_a_set) {		/* "-i" option */
+	} else if (!option_a_set) {		/* "-i" option */
 		fprintf(stderr, "\n> \"zgetdump -i\" checks if a dump on "
 			"either\n");
 		fprintf(stderr, "> a dasd volume or single tape is valid.\n");
@@ -1269,7 +1282,7 @@ is_dump_device:
 			goto out;
 		} else
 			fprintf(stderr, "Checking for End of Volume...\n");
-		if (vol_end(fd) != 0) {
+		if (vol_end() != 0) {
 			fprintf(stderr, "End of Volume not found: "
 				"this dump is NOT valid.\n\n");
 			rc = 1;
@@ -1280,9 +1293,7 @@ is_dump_device:
 			fprintf(stderr, "This part of the dump is valid.\n\n");
 			goto out;
 		}
-	}
-
-	if (option_i_set && option_a_set) {	/* "-i -a" option */
+	} else {	/* "-i -a" option */
 		fprintf(stderr, "\n> \"zgetdump -i -a\" checks if a "
 			"multi-volume tape dump is valid.\n");
 		fprintf(stderr, "> Please make sure that all volumes are "
@@ -1303,13 +1314,13 @@ is_dump_device:
 			fprintf(stderr, "Dump End Marker found: "
 				"this dump is valid.\n\n");
 			goto out;
-		} else if (vol_end(fd) != 0) {
+		} else if (vol_end() != 0) {
 			fprintf(stderr, "End of Volume not found: "
 				"this dump is NOT valid.\n\n");
 			rc = 1;
 			goto out;
 		}
-		while (vol_end(fd) == 0) {
+		while (vol_end() == 0) {
 			cur_volnr += 1;
 			fprintf(stderr, "Reached End of Volume %i.\n",
 				header.dh_volnr);
@@ -1334,7 +1345,7 @@ is_dump_device:
 				fprintf(stderr, "Dump End found: "
 					"this dump is valid.\n\n");
 				goto out;
-			} else if (vol_end(fd) != 0) {
+			} else if (vol_end() != 0) {
 				fprintf(stderr, "End of Volume not found: "
 					"this dump is NOT valid.\n\n");
 				rc = 1;
Index: s390-tools-sles11/zdump/zgetdump.h
===================================================================
--- s390-tools-sles11.orig/zdump/zgetdump.h
+++ s390-tools-sles11/zdump/zgetdump.h
@@ -38,7 +38,7 @@ typedef struct _s390_dump_header_s {
 	uint32_t             dh_version;                         /* 0x008 */
 
         /* the size of this header (in case we can't read it) */
-	uint32_t             dh_header_size;                     /* 0x00c */ 
+	uint32_t             dh_header_size;                     /* 0x00c */
 
         /* the level of this dump (just a header?) */
 	uint32_t             dh_dump_level;                      /* 0x010 */
@@ -186,7 +186,7 @@ struct disk_info {
 	dev_t device;
 	enum device_status status;
 	enum device_signature signature;
-	uint64_t start_offset;
+	off_t start_offset;
 	uint64_t part_size;
 	char bus_id[9];
 };
Index: s390-tools-sles11/include/zt_common.h
===================================================================
--- s390-tools-sles11.orig/include/zt_common.h
+++ s390-tools-sles11/include/zt_common.h
@@ -13,6 +13,13 @@
 #define STRINGIFY_1(x)			#x
 #define STRINGIFY(x)			STRINGIFY_1(x)
 
+#ifdef UNUSED
+#elif defined(__GNUC__)
+# define UNUSED(x) UNUSED_ ## x __attribute__((unused))
+#else
+# define UNUSED(x) x
+#endif
+
 #define RELEASE_STRING	STRINGIFY (S390_TOOLS_RELEASE)
 
 #endif /* ZT_COMMON_H */
Index: s390-tools-sles11/zconf/lstape
===================================================================
--- s390-tools-sles11.orig/zconf/lstape
+++ s390-tools-sles11/zconf/lstape
@@ -8,6 +8,7 @@
 # (Designed to work with 2.4 as well.)
 #
 # Author(s): S. Bader <shbader@de.ibm.com>
+#            Frank Munzert <munzert@de.ibm.com>
 #
 # This file is part of s390-tools
 #
@@ -58,11 +59,11 @@ function PrintUsage() {
 	:			subchannel set 0 and remove the leading '0.0.'
 	:			from the displayed bus id (only affects the
 	:			output of CCW devices).
-	:		--verbose
+	:		-V|--verbose
 	:			Print additional information that does not fit
 	:			into a single line (only affects the output for
 	:			SCSI devices).
-	:		--version
+	:		-v|--version
 	:			Display the version of the tools package and
 	:			the lstape command.
 	EOD
@@ -70,11 +71,9 @@ function PrintUsage() {
 
 function PrintVersion()
 {
-	local TVER="1.19"
-
 	cat <<-EOD
-	$CMD: version %S390_TOOLS_VERSION% ($TVER).
-	Copyright IBM Corp. 2003, 2007.
+	$CMD: version %S390_TOOLS_VERSION%
+	Copyright IBM Corp. 2003, 2007
 	EOD
 }
 
@@ -120,11 +119,11 @@ while [ $# -ne 0 ]; do
 		-s|--shortid)
 			SHORTID=true
 			;;
-		--version)
+		-v|--version)
 			PrintVersion
 			exit 0
 			;;
-		--verbose)
+		-V|--verbose)
 			VERBOSE=true;
 			;;
 		--ccw-only)
Index: s390-tools-sles11/zconf/lstape.8
===================================================================
--- s390-tools-sles11.orig/zconf/lstape.8
+++ s390-tools-sles11/zconf/lstape.8
@@ -6,10 +6,10 @@ lstape \- list tape devices.
 .SH SYNOPSIS
 .TP 16
 .B lstape
-.RB [ -h ]
+.RB [ -h | --help]
 .RB [ --scsi-only | --ccw-only ]
-.RB [ --version ]
-.RB [ --verbose ]
+.RB [ -v | --version ]
+.RB [ -V | --verbose ]
 .br
 .RB [ --online | --offline ]
 .RB [ -s ]
@@ -43,11 +43,11 @@ there is no sg_inq command available "NO
 Print help text.
 
 .TP 8
-\fB--version\fR
+\fB-v\fR or \fB--version\fR
 Print the version of the s390-tools package and the command.
 
 .TP
-\fB--verbose\fR
+\fB-V\fB or \fB--verbose\fR
 Adds additional information that does not fit into a single line of output.
 This is currently only used for SCSI devices.
 
@@ -88,8 +88,3 @@ List all tape devices that are available
 .RS
 Show all 3490 CCW devices that are online.
 .RE
-
-.SH AUTHOR
-.nf
-This man-page was written by Stefan Bader <shbader@de.ibm.com>.
-.fi
Index: s390-tools-sles11/tape390/tape390_common.c
===================================================================
--- s390-tools-sles11.orig/tape390/tape390_common.c
+++ s390-tools-sles11/tape390/tape390_common.c
@@ -59,7 +59,8 @@ int is_not_tape(char *device)
 			strcpy(last_line, line);
 	}
 	fclose(fh);
-	if (found && (major(stat_struct.st_rdev) == atoi(last_line)))
+	if (found && (major(stat_struct.st_rdev) ==
+		      (unsigned int) atoi(last_line)))
 		return (0);
 	else {
 		ERRMSG("%s: '%s' is not a tape device. \n", prog_name, device);
Index: s390-tools-sles11/tape390/tape390_crypt.c
===================================================================
--- s390-tools-sles11.orig/tape390/tape390_crypt.c
+++ s390-tools-sles11/tape390/tape390_crypt.c
@@ -137,8 +137,8 @@ static const char copyright_notice[] = "
  */
 static void print_version (void)
 {
-	printf ("%s version %s.\n", tool_name, RELEASE_STRING);
-	printf ("%s.\n", copyright_notice);
+	printf ("%s version %s\n", tool_name, RELEASE_STRING);
+	printf ("%s\n", copyright_notice);
 }
 
 /*
@@ -308,7 +308,7 @@ static void fill_kekl(char *s, char deli
 		ERRMSG_EXIT(EXIT_MISUSE,
 			    "%s: ERROR: delimiter '%c' found as first "
 			    "character.\n",prog_name,delimiter);
-	else if (i == strlen(s) - 1)
+	else if (i == (int) strlen(s) - 1)
 		ERRMSG_EXIT(EXIT_MISUSE,
 			    "%s: ERROR: Delimiter '%c' found as last "
 			    "character.\n",prog_name,delimiter);
@@ -416,7 +416,10 @@ static int set_encryption_keys(int fd, s
 		printf("--->> ATTENTION! <<---\n");
 		printf("All data on tape %s will be lost.\nType "
 		       "\"yes\" to continue: ", info->devname);
-		fgets(inp_buffer, sizeof(inp_buffer), stdin);
+		if (fgets(inp_buffer, sizeof(inp_buffer), stdin) == NULL) {
+			fprintf(stderr, "Reading from terminal failed.\n");
+			exit(1);
+		}
 		if (strcasecmp(inp_buffer,"yes\n")) {
 			printf("Tape and its encryption keys " 
 			       "remain unchanged.\n");
@@ -434,8 +437,9 @@ static int set_encryption_keys(int fd, s
  */
 static int switch_encryption_on_or_off(int fd,struct tape390_crypt *info)
 {
-	struct tape390_crypt_info myinfo = {0};
+	struct tape390_crypt_info myinfo;
 
+	memset(&myinfo, 0, sizeof(myinfo));
 	if (info->e_switch == ENCRYPTION_ON)
 		myinfo.status |= TAPE390_CRYPT_ON_MASK;
 	return ioctl(fd, TAPE390_CRYPT_SET, &myinfo);
@@ -479,8 +483,6 @@ static int query_encryption(int fd,struc
 	ret = ioctl(fd, TAPE390_KEKL_QUERY, &kekls);
 	if (ret)
 		return -2;
-	if (!TAPE390_MEDIUM_ENCRYPTED(myinfo))
-		return 0;
 	printf("KEKLs on TAPE:\n");
 	if (kekls.kekl[0].type == TAPE390_KEKL_TYPE_NONE) {
 		ERRMSG("Unable to retrieve key information.\n");
Index: s390-tools-sles11/tape390/tape390_display.c
===================================================================
--- s390-tools-sles11.orig/tape390/tape390_display.c
+++ s390-tools-sles11/tape390/tape390_display.c
@@ -197,9 +197,9 @@ int main(int argc, char *argv[]) {
 			}
 			case 'v': {
 				printf("tape390_display: zSeries tape "
-				       "display control program version %s.\n",
+				       "display control program version %s\n",
 					RELEASE_STRING);
-				printf("Copyright IBM Corp. 2002, 2006.\n");
+				printf("Copyright IBM Corp. 2002, 2006\n");
 				exit(0);
 			}
 			default:
Index: s390-tools-sles11/mon_tools/mon_fsstatd.c
===================================================================
--- s390-tools-sles11.orig/mon_tools/mon_fsstatd.c
+++ s390-tools-sles11/mon_tools/mon_fsstatd.c
@@ -43,7 +43,7 @@ struct mw_name_lens {
 /*
  * Clean up when SIGTERM or SIGINT received
  */
-void stop_fsstatd(int a)
+void stop_fsstatd(int UNUSED(a))
 {
 	remove(pid_file);
 	exit(0);
@@ -370,9 +370,8 @@ static int parse_options(int argc, char 
 			printf("%s", help_text);
 			exit(0);
 		case 'v':
-			printf("mon_fsstatd: version %s (%s)\n",
-				RELEASE_STRING, FSSTATD_VERSION);
-			printf("Copyright IBM Corp. 2006.\n");
+			printf("mon_fsstatd: version %s\n", RELEASE_STRING);
+			printf("Copyright IBM Corp. 2006\n");
 			exit(0);
 		case 'a':
 			attach = 1;
Index: s390-tools-sles11/mon_tools/mon_fsstatd.h
===================================================================
--- s390-tools-sles11.orig/mon_tools/mon_fsstatd.h
+++ s390-tools-sles11/mon_tools/mon_fsstatd.h
@@ -16,8 +16,6 @@
 #include <sys/ioctl.h>
 #include "../include/zt_common.h"
 
-#define FSSTATD_VERSION "1.0.0"
-
 /* mon_function values */
 #define MONWRITE_START_INTERVAL 0x00	/* start interval recording */
 #define MONWRITE_STOP_INTERVAL	0x01	/* stop interval or config recording */
Index: s390-tools-sles11/mon_tools/mon_procd.c
===================================================================
--- s390-tools-sles11.orig/mon_tools/mon_procd.c
+++ s390-tools-sles11/mon_tools/mon_procd.c
@@ -41,7 +41,7 @@ struct name_lens_t {
 static int num_cpus;
 static int curr_small_max, curr_big_max;
 static int prev_small_max, prev_big_max;
-static int pg_to_kb_shift, sort_tbl_size;
+static unsigned int pg_to_kb_shift, sort_tbl_size;
 static float e_time;
 static struct timeval prev_time, curr_time;
 static struct cpudata_t cpudata;
@@ -62,7 +62,7 @@ static const char *pid_file = "/var/run/
 /*
  * Clean up when SIGTERM or SIGINT received
  */
-void stop_procd(int a)
+void stop_procd(int UNUSED(a))
 {
 	remove(pid_file);
 	exit(0);
@@ -505,7 +505,7 @@ static int read_status(struct task_t *ta
 */
 static void cal_task_pcpu(struct task_t *task, const unsigned long long tics)
 {
-	int i, size;
+	unsigned int i, size;
 	__u64 etics;
 
 	if (proc_sum.task.total + 1 >= sort_tbl_size) {
@@ -794,7 +794,7 @@ static void task_usage(struct task_t *ta
 static void read_tasks(void)
 {
 	int size;
-	int i = 0, j = 0;
+	unsigned int i = 0, j = 0;
 	DIR *proc_dir;
 	struct direct *entry;
 	struct task_t task;
@@ -952,9 +952,8 @@ static int parse_options(int argc, char 
 			printf("%s", help_text);
 			exit(0);
 		case 'v':
-			printf( "mon_procd: version %s (%s)\n",
-				RELEASE_STRING, PROCD_VERSION);
-			printf("Copyright IBM Corp. 2007.\n");
+			printf( "mon_procd: version %s\n", RELEASE_STRING);
+			printf("Copyright IBM Corp. 2007\n");
 			exit(0);
 		case 'a':
 			attach = 1;
Index: s390-tools-sles11/mon_tools/mon_procd.h
===================================================================
--- s390-tools-sles11.orig/mon_tools/mon_procd.h
+++ s390-tools-sles11/mon_tools/mon_procd.h
@@ -14,8 +14,6 @@
 #include <linux/types.h>
 #include "../include/zt_common.h"
 
-#define PROCD_VERSION "1.0.0"
-
 /* mon_function values */
 #define MONWRITE_START_INTERVAL 0x00	/* start interval recording */
 #define MONWRITE_STOP_INTERVAL	0x01	/* stop interval or config recording */
Index: s390-tools-sles11/libu2s/u2s.c
===================================================================
--- s390-tools-sles11.orig/libu2s/u2s.c
+++ s390-tools-sles11/libu2s/u2s.c
@@ -56,7 +56,8 @@ static int check_directory(char *name, c
 	char *end;
 	int fd;
 	ssize_t count;
-	int dev_attr_len, dev_parm_len, namelen;
+	int dev_attr_len, dev_parm_len;
+	unsigned int namelen;
 
 	namelen = strlen(name);
 	if ((PATH_BUFFER_LENGTH - namelen) < sizeof(DEV_ATTRIBUTE))
@@ -90,7 +91,8 @@ static int check_directory(char *name, c
  */
 static int extract_busid(char *name, char *busid) {
 
-	int count, namelen;
+	int count;
+	unsigned int namelen;
 	char linkbuffer[PATH_BUFFER_LENGTH];
 	char *start, *end;
 
Index: s390-tools-sles11/scripts/dbginfo.sh
===================================================================
--- s390-tools-sles11.orig/scripts/dbginfo.sh
+++ s390-tools-sles11/scripts/dbginfo.sh
@@ -21,6 +21,7 @@ WORKPATH=$WORKPFX/$WORKDIR
 CMDOUTPUT=runtime.out
 VM_CMDOUTPUT=zvm_runtime.out
 SYSFSFILELIST=sysfsfiles.out
+FCPCONFOUTPUT=scsi
 MOUNT_POINT_DEBUGFS="/sys/kernel/debug"
 kernel_version_tmp=0
 
@@ -76,7 +77,7 @@ CONFIGFILES=" \
     /etc/ccwgroup.conf \
     /etc/chandev.conf \
     /etc/modules.conf \
-    /etc/modprobe.conf
+    /etc/modprobe.conf* \ 
     /etc/fstab \
     /etc/syslog.conf \
     /etc/sysconfig \
@@ -93,6 +94,11 @@ CONFIGFILES=" \
     /etc/zfcp.conf \
     "
 
+#sysfs files NOT to be collected
+SYSFSFILEEXCLUDES="\
+	trace_pipe\
+	"
+
 # collect output of following commands;
 # commands are separated by ':'
 CMDS="uname -a\
@@ -113,12 +119,14 @@ CMDS="uname -a\
     :dmsetup ls\
     :dmsetup ls --tree\
     :dmsetup table\
+    :dmsetup table --target multipath\
     :dmsetup status\
     :multipath -v6 -ll\
-    :multipath -d\	
+    :multipath -d\
     :lsqeth\
     :lscss\
     :lsdasd\
+    :ziorep_config -ADM\
     :lsmod\
     :lsdev\
     :lsscsi\
@@ -194,8 +202,8 @@ VM_CMDS="q userid\
 printversion()
 {
     cat <<EOF
-$SCRIPTNAME: Debug information script version %S390_TOOLS_VERSION%.
-Copyright IBM Corp. 2002, 2006.
+$SCRIPTNAME: Debug information script version %S390_TOOLS_VERSION%
+Copyright IBM Corp. 2002, 2006
 EOF
 }
 
@@ -256,7 +264,19 @@ collect_file_contents()
 # append output of command $1 to file $2
 collect_cmd_output()
 {
+    local raw_cmd=`echo $1 | awk '{ print $1 }'`;
+
     echo "#######################################################">>$2
+
+    # check if command exists
+    which $raw_cmd >/dev/null 2>&1;
+    if [ $? -ne 0 ]
+    then
+        # check if command is a builtin
+        command -v $raw_cmd >/dev/null;
+        [ $? -ne 0 ] && echo "command '$raw_cmd' not available">>$2 && return 1;
+    fi
+
     echo "$USER@$HOST> $1">>$2
     $1 1>>$2 2>&1
     echo "" >>$2
@@ -362,6 +382,19 @@ collect_procfs_scsi()
     fi
 }
 
+#check for excluded files in sysfs
+check_for_excludes()
+{
+	for filename in ${SYSFSFILEEXCLUDES[@]}
+	do
+		if [ `basename $1` = $filename ]
+		then
+			return 1
+		fi
+	done
+	return 0
+}
+
 # collect sysfs entries
 collect_sysfs()
 {
@@ -380,8 +413,11 @@ collect_sysfs()
     for i in `find /sys -noleaf -type f -perm +444`
     	do
     		if [ -e $i ]
-    		then
-	    		collect_file_contents $i
+		then
+			if check_for_excludes $i
+			then
+		    		collect_file_contents $i
+			fi
 		else
 			echo "  WARNING: $i not found" | tee -a $LOGFILE
     		fi
@@ -448,8 +484,17 @@ check_zvm()
 	which vmcp > /dev/null 2>&1
     	if [ $? -eq 1 ] 
     	then
-		echo " No cp tool installed" | tee -a $LOGFILE
-		return 0
+		# is hcp installed
+		which hcp > /dev/null 2>&1
+		if [ $? -eq 1 ]
+ 		then
+			echo " No cp tool installed" | tee -a $LOGFILE 
+			return 0
+		else
+			cp_tool=hcp
+			echo " Installed CP tool: $cp_tool" | tee -a $LOGFILE 
+			return 1
+		fi
 	else
 		cp_tool=vmcp
 		echo " Installed CP tool: $cp_tool" | tee -a $LOGFILE 
@@ -464,15 +509,31 @@ get_zvm_data()
 	lsmod | grep -q $cp_tool
 	rc_lsmod=$?
    	if [ $rc_lsmod -eq 1 ]; then
-		modprobe $cp_tool
-		sleep 2
+                if [ $cp_tool = "hcp" ]; then
+                        modprobe cpint
+                        sleep 2
+                else
+                        modprobe $cp_tool
+                        sleep 2
+                fi
         fi
         collect_cmdsout "$VM_CMDS" "$VM_CMDOUTPUT"
         if [ $rc_lsmod -eq 1 ]; then
-		rmmod $cp_tool
+                if [ $cp_tool = "hcp" ]; then
+                        rmmod cpint
+                else
+                        rmmod $cp_tool
+                fi
         fi
 }
 
+# Caputure FCP configuration data if possible
+get_fcp_data()
+{
+    which ziomon_fcpconf >/dev/null 2>&1;
+    [ $? -eq 0 ] && ziomon_fcpconf -o $FCPCONFOUTPUT;
+}
+
 # log files
 collect_log()
 {
@@ -487,16 +548,30 @@ collect_log()
 create_package()
 {
     cd $WORKPATH/..
-    tar -czf $WORKDIR.tgz $WORKDIR 2>/dev/null && rm -rf $WORKPATH
+    tar -czf $WORKDIR.tgz $WORKDIR 2>/dev/null
+    cleanup;
     echo
     echo "Collected data was saved to:"
     echo "  $WORKPFX/$WORKDIR.tgz"
 }
 
+cleanup()
+{
+    [ -d $WORKPATH ] && rm -rf $WORKPATH;
+}
+
+emergency_exit()
+{
+    cleanup;
+    exit;
+}
+
 #
 # start of script
 #
 
+trap emergency_exit SIGHUP SIGTERM SIGINT
+
 kernel_version=`uname -r`
 kernel_version_tmp=`echo ${kernel_version:4:2} | sed s/[^0-9]//g`
 check_cmdline $*
@@ -520,6 +595,7 @@ rc_check_zvm=$?
 if [ $rc_check_zvm -eq 1 ]; then
 	get_zvm_data
 fi
+get_fcp_data
 collect_config
 collect_log
 create_package
Index: s390-tools-sles11/cpuplugd/man/cpuplugd.conf.5
===================================================================
--- s390-tools-sles11.orig/cpuplugd/man/cpuplugd.conf.5
+++ s390-tools-sles11/cpuplugd/man/cpuplugd.conf.5
@@ -147,6 +147,9 @@ output of the vmstat  command) is greate
 megabyte) plus 10. Furthermore the sum of the free memory (in megabyte) plus 10 
 has to be less than the current amount of page cache reads (apcr).
 
+Please keep in mind that the defined memplug and memunplug rules in the
+example above are only used to illustrate the syntax of the rules. They are
+not suitable for any production system and make semantically no sense.
 
 .SH SEE ALSO
 .nf
Index: s390-tools-sles11/dasdinfo/dasdinfo.c
===================================================================
--- s390-tools-sles11.orig/dasdinfo/dasdinfo.c
+++ s390-tools-sles11/dasdinfo/dasdinfo.c
@@ -108,8 +108,8 @@ struct dasd_data
 
 static void dinfo_print_version (void)
 {
-	printf ("%s version %s.\n", tool_name, RELEASE_STRING);
-	printf ("%s.\n", copyright_notice);
+	printf ("%s version %s\n", tool_name, RELEASE_STRING);
+	printf ("%s\n", copyright_notice);
 }
 
 static void dinfo_print_usage(char *cmd)
Index: s390-tools-sles11/dasdview/dasdview.c
===================================================================
--- s390-tools-sles11.orig/dasdview/dasdview.c
+++ s390-tools-sles11/dasdview/dasdview.c
@@ -64,8 +64,8 @@ zt_error_print (const char* fmt, ...)
 static void
 print_version (void)
 {
-	printf ("%s version %s.\n", tool_name, RELEASE_STRING);
-	printf ("%s.\n", copyright_notice);
+	printf ("%s version %s\n", tool_name, RELEASE_STRING);
+	printf ("%s\n", copyright_notice);
 }
 
 static void
@@ -73,10 +73,10 @@ dasdview_usage(void)
 {
 	printf("\nprints DASD information:\n\n");
 	printf("dasdview [-b begin] [-s size] [-1|-2] \n"
-	       "         [-i] [-x] [-j]\n"
+	       "         [-i] [-x] [-j] [-c]\n"
 	       "         [-l] [-t {info|f1|f4|f5|f7|f8|f9|all}] \n"
 	       "         [-h] [-v] \n"
-	       "         {-n devno|-f node}\n"
+	       "         {-n devno|-f node} device\n"
 	       "\nwhere:\n"
 	       "-b: prints a DASD dump from 'begin'\n"
 	       "-s: prints a DASD dump with size 'size'\n"
@@ -202,7 +202,7 @@ dasdview_get_info(dasdview_info_t *info)
 	}
 
 	if (ioctl(fd, BLKGETSIZE64, &device_size) != 0) {
-	        close(fd);
+		close(fd);
 		zt_error_print("dasdview: ioctl error\n" \
 			"Could not retrieve device size information.\n");
 		exit(-1);
@@ -362,7 +362,7 @@ dasdview_dump_array(char *name, int size
 static void
 dasdview_print_extended_info(dasdview_info_t *info)
 {
-	int i;
+	unsigned int i;
 	struct dasd_information2_t *dasd_info;
 	struct {
 		unsigned int mask;
@@ -634,15 +634,15 @@ dasdview_read_vtoc(dasdview_info_t *info
 
 	vtocblk = (u_int64_t) vtoc_get_cyl_from_cchhb(&vlabel.vtoc) *
 		info->geo.heads * info->geo.sectors +
-                vtoc_get_head_from_cchhb(&vlabel.vtoc) * info->geo.sectors +
-                vlabel.vtoc.b;
+		vtoc_get_head_from_cchhb(&vlabel.vtoc) * info->geo.sectors +
+		vlabel.vtoc.b;
 
 	/*
 	 * geo.cylinders is the minimum of hw_cylinders and LV_COMPAT_CYL
 	 * Actually the vtoc should be located in in the first 65k-1 tracks
-         * so this check could be even more restrictive, but it doesn't
-         * hurt the way it is. Linux cdl format restricts the vtoc to
-         * the first two tracks anyway.
+	 * so this check could be even more restrictive, but it doesn't
+	 * hurt the way it is. Linux cdl format restricts the vtoc to
+	 * the first two tracks anyway.
 	 */
 	maxblk = info->geo.cylinders * info->geo.heads * info->geo.sectors;
 
@@ -982,7 +982,7 @@ static void dasdview_print_format1_8_ful
 
 static void dasdview_print_vtoc_f1(dasdview_info_t *info)
 {
-        int j;
+	int j;
 
 	printf("--- VTOC format 1 labels ----------------------" \
 	       "---------------------------------\n");
@@ -1001,14 +1001,14 @@ static void dasdview_print_vtoc_f1(dasdv
 
 static void dasdview_print_vtoc_f8(dasdview_info_t *info)
 {
-        int j;
+	int j;
 
 	printf("--- VTOC format 8 labels ----------------------" \
 	       "---------------------------------\n");
 
 	if (info->f8c < 1)
 	{
-	        printf("This VTOC doesn't contain a format 8 label.\n");
+		printf("This VTOC doesn't contain a format 8 label.\n");
 		return;
 	}
 
@@ -1229,13 +1229,13 @@ dasdview_print_vtoc_f7(dasdview_info_t *
 static void
 dasdview_print_vtoc_f9(dasdview_info_t *info)
 {
-        int i,j;
+	unsigned int i;
+	int j;
 
 	printf("\n--- VTOC format 9 label ----------------------" \
 	       "---------------------------------\n");
 
-	if (info->f9c < 1)
-	{
+	if (info->f9c < 1) {
 	        printf("This VTOC doesn't contain a format 9 label.\n");
 		return;
 	}
@@ -1251,10 +1251,10 @@ dasdview_print_vtoc_f9(dasdview_info_t *
 
 		printf("res1        : hex ");
 		for (i=0; i < sizeof(info->f9[j].res1); i++) {
-			if ( (i > 0) && (i % 16 == 0) )
+			if ((i > 0) && (i % 16 == 0))
 				printf("\n                  ");
 			printf("%02x", info->f9[j].res1[i]);
-			if ( (i+9) % 16 == 0 )
+			if ((i+9) % 16 == 0)
 				printf(" ");
 		}
 		printf("\n");
@@ -1264,10 +1264,10 @@ dasdview_print_vtoc_f9(dasdview_info_t *
 
 		printf("res2        : hex ");
 		for (i=0; i < sizeof(info->f9[j].res2); i++) {
-			if ( (i > 0) && (i % 16 == 0) )
+			if ((i > 0) && (i % 16 == 0))
 				printf("\n                  ");
 			printf("%02x", info->f9[j].res2[i]);
-			if ( (i+9) % 16 == 0 )
+			if ((i+9) % 16 == 0)
 				printf(" ");
 		}
 		printf("\n");
@@ -1449,7 +1449,7 @@ dasdview_view(dasdview_info_t *info)
 	{
 		bzero(dumpstr, DUMP_STRING_SIZE);
 		rc = read(fd, &dumpstr, k);
-		if (rc != k)
+		if (rc != (int) k)
 		{
 			close(fd);
 			zt_error_print("dasdview: read error\n" \
@@ -1484,13 +1484,14 @@ dasdview_view(dasdview_info_t *info)
 static void
 dasdview_print_characteristic(dasdview_info_t *info)
 {
-		 dasd_information2_t dasd_info;
-		 dasd_info = info->dasd_info;
-		 printf("encrypted disk         : %s\n",
-			(dasd_info.characteristics[46]&0x80) ? "yes" : "no");
+	dasd_information2_t dasd_info;
+	dasd_info = info->dasd_info;
+	printf("encrypted disk         : %s\n",
+	       (dasd_info.characteristics[46]&0x80)?"yes":"no");
+	printf("solid state device     : %s\n",
+	       (dasd_info.characteristics[46]&0x40)?"yes":"no");
 }
 
-
 int main(int argc, char * argv[]) {
 
 	dasdview_info_t info;
@@ -1569,10 +1570,10 @@ int main(int argc, char * argv[]) {
 		        else if (strncmp(optarg,"f7",2)==0)
 		                info.vtoc_f7 = 1;
 		        else if (strncmp(optarg,"f8",2)==0)
-		                info.vtoc_f8 = 1;
-		        else if (strncmp(optarg,"f9",2)==0)
-		                info.vtoc_f9 = 1;
-		        else if (strncmp(optarg,"all",3)==0)
+				info.vtoc_f8 = 1;
+			else if (strncmp(optarg,"f9",2)==0)
+				info.vtoc_f9 = 1;
+			else if (strncmp(optarg,"all",3)==0)
 		                info.vtoc_all = 1;
 		        else
 		        {
@@ -1584,14 +1585,14 @@ int main(int argc, char * argv[]) {
 		        info.vtoc = 1;
 			info.action_specified = 1;
 			break;
-		case 'c':
-			info.action_specified = 1;
-			info.characteristic_specified = 1;
-			break;
 		case 'l':
 			info.action_specified = 1;
 			info.vlabel_info = 1;
 			break;
+		case 'c':
+			info.action_specified = 1;
+			info.characteristic_specified = 1;
+			break;
 		case -1:
 			/* End of options string - start of devices list */
 			info.device_id = optind;
@@ -1745,12 +1746,12 @@ int main(int argc, char * argv[]) {
 
 	if (info.vtoc_f8 || info.vtoc_all)
 	{
-	        dasdview_print_vtoc_f8(&info);
+		dasdview_print_vtoc_f8(&info);
 	}
 
 	if (info.vtoc_f9 || info.vtoc_all)
 	{
-	        dasdview_print_vtoc_f9(&info);
+		dasdview_print_vtoc_f9(&info);
 	}
 
 	if (!info.action_specified)
Index: s390-tools-sles11/dasdview/dasdview.h
===================================================================
--- s390-tools-sles11.orig/dasdview/dasdview.h
+++ s390-tools-sles11/dasdview/dasdview.h
@@ -101,7 +101,8 @@ typedef struct dasd_information2_t {
  *******************************************************************************/
 /* get block device sector size */
 #define BLKSSZGET  _IO(0x12,104)
-#define BLKGETSIZE64 _IOR(0x12,114,size_t) /* return device size in bytes (u64 *arg) */
+/* return device size in bytes (u64 *arg) */
+#define BLKGETSIZE64 _IOR(0x12,114,size_t)
 
 /* get device geometry */
 #define HDIO_GETGEO		0x0301
@@ -110,8 +111,6 @@ typedef struct dasd_information2_t {
  * SECTION: DASDVIEW internal types
  *******************************************************************************/
 
-#define DASDVIEW_VERSION "1.02"
-
 #define LINE_LENGTH 80
 #define DASDVIEW_ERROR "dasdview:"
 #define DEFAULT_BEGIN 0
Index: s390-tools-sles11/fdasd/fdasd.c
===================================================================
--- s390-tools-sles11.orig/fdasd/fdasd.c
+++ s390-tools-sles11/fdasd/fdasd.c
@@ -29,8 +29,8 @@ static const char copyright_notice[] = "
 static void
 print_version (void)
 {
-	printf ("%s version %s.\n", tool_name, RELEASE_STRING);
-	printf ("%s.\n", copyright_notice);
+	printf ("%s version %s\n", tool_name, RELEASE_STRING);
+	printf ("%s\n", copyright_notice);
 }
 
 static int
@@ -95,7 +95,7 @@ static void get_addr_of_highest_f1_f8_la
 		record++;
 	if (anc->formatted_cylinders > LV_COMPAT_CYL)
 		record += anc->used_partitions - 1;
-        vtoc_set_cchhb(addr, VTOC_START_CC, VTOC_START_HH, record);
+	vtoc_set_cchhb(addr, VTOC_START_CC, VTOC_START_HH, record);
 }
 
 /* 
@@ -288,10 +288,12 @@ static int
 yes_no(char *question_str) 
 {
 	char answer;
-	
+	int rc;
 	while (1) {
 		printf("%s (y/n): ", question_str);
-		scanf("%c", &answer);
+		rc = scanf("%c", &answer);
+		if (rc != 1)
+			return -1;
 		if (answer == 'y') return 0;
 		if (answer == 'n') return 1;
 	}
@@ -541,7 +543,8 @@ fdasd_parse_conffile(fdasd_anchor_t *anc
 {
 	char buffer[USABLE_PARTITIONS * LINE_LENGTH];
 	char err_str[ERROR_STRING_SIZE], *c1, *c2;
-	int fd, i=0;
+	int fd, rc;
+	unsigned i=0;
 
 	/* if name of config file was not specified, select the default */
 	if (options->conffile == NULL)
@@ -558,7 +561,9 @@ fdasd_parse_conffile(fdasd_anchor_t *anc
 	}
 
 	bzero(buffer, sizeof(buffer));
-	read(fd, buffer, sizeof(buffer));
+	rc = read(fd, buffer, sizeof(buffer));
+	if (rc < 0)
+		return -1;
 	close(fd);
 
 
@@ -1080,7 +1085,7 @@ fdasd_write_vtoc_labels (fdasd_anchor_t 
 	/* write FMT7 DSCB */
 	if (anc->big_disk) {
 		vtoc_write_label(options.device, blk,  NULL, NULL,
-				 NULL,anc->f7, NULL);
+				 NULL, anc->f7, NULL);
 		if (anc->verbose) printf("f7 ");
 		blk += anc->blksize;
 	}
@@ -1148,7 +1153,7 @@ fdasd_write_vtoc_labels (fdasd_anchor_t 
 		vtoc_ebcdic_enc(ch, ch, 44);
 		if (anc->verbose) printf("%2x ", part_info->f1->DS1FMTID);
 
-		if (part_info->f1->DS1FMTID == 0xf8 ) {
+		if (part_info->f1->DS1FMTID == 0xf8) {
 			/* Now as we know where which label will be written, we
 			 * can add the address of the format 9 label to the
 			 * format 8 label. The f9 record will be written to the
@@ -1156,7 +1161,8 @@ fdasd_write_vtoc_labels (fdasd_anchor_t 
 			 * by one, so we have to add 2 and not just one.
 			 */
 			vtoc_set_cchhb(&f9addr, VTOC_START_CC, VTOC_START_HH,
-				       ((blk / anc->blksize) % geo.sectors) + 2);
+				       ((blk / anc->blksize) % geo.sectors)
+				       + 2);
 			vtoc_update_format8_label(&f9addr, part_info->f1);
 			vtoc_write_label(options.device, blk, part_info->f1,
 					 NULL, NULL, NULL, NULL);
@@ -1324,12 +1330,14 @@ fdasd_reuse_vtoc(fdasd_anchor_t *anc)
 			continue;
 		}
 
-		if (anc->formatted_cylinders > LV_COMPAT_CYL) {
-		    vtoc_init_format8_label(anc->vlabel->volid, anc->blksize,
-					    &part_info->f1->DS1EXT1, &f1);
-		} else
-		    vtoc_init_format1_label(anc->vlabel->volid, anc->blksize,
-					    &part_info->f1->DS1EXT1, &f1);
+		if (anc->formatted_cylinders > LV_COMPAT_CYL)
+			vtoc_init_format8_label(anc->vlabel->volid,
+						anc->blksize,
+						&part_info->f1->DS1EXT1, &f1);
+		else
+			vtoc_init_format1_label(anc->vlabel->volid,
+						anc->blksize,
+						&part_info->f1->DS1EXT1, &f1);
 
 
 		strncpy(f1.DS1DSNAM, part_info->f1->DS1DSNAM, 44);
@@ -1390,8 +1398,7 @@ fdasd_change_volser (fdasd_anchor_t *anc
 static void
 fdasd_change_part_type (fdasd_anchor_t *anc)
 {
-        int i;
-        unsigned int part_id, part_type;
+        unsigned int part_id, part_type, i;
 	char str[20], *ch;
         partition_info_t *part_info;
 
@@ -1406,7 +1413,7 @@ fdasd_change_part_type (fdasd_anchor_t *
 	printf("\n");
         if (part_id == 0) 
 		return;
-        if ((part_id < 0) || (part_id > anc->used_partitions)) {
+        if (part_id > anc->used_partitions) {
                 printf("'%d' is not a valid partition id!\n", part_id);
                 return;
         }
@@ -1510,7 +1517,7 @@ fdasd_update_partition_info (fdasd_ancho
 	anc->used_partitions = geo.sectors - 2 - anc->f4->DS4DSREC;
 
         for (i=1; i<=USABLE_PARTITIONS; i++) {
-	        if (part_info->f1->DS1FMTID != 0xf1 &&
+		if (part_info->f1->DS1FMTID != 0xf1 &&
 		    part_info->f1->DS1FMTID != 0xf8) {
 		        if (i == 1)
 				/* there is no partition at all */
@@ -1653,7 +1660,8 @@ fdasd_process_valid_vtoc(fdasd_anchor_t 
 			if (anc->verbose)
 				printf("%s ",
 				       f1_label.DS1FMTID == 0xf1 ? "f1" : "f8");
-			if (part_info == NULL) break;
+			if (part_info == NULL)
+				break;
 			memcpy(part_info->f1, &f1_label, f1_size);
 
 			part_no = -1;
@@ -1694,7 +1702,7 @@ fdasd_process_valid_vtoc(fdasd_anchor_t 
 			break;
 		case 0xf9:
 			/* each format 8 lable has an associated format 9 lable,
-                         * but they are of no further use to us.
+			 * but they are of no further use to us.
 			 */
 			if (anc->verbose) printf("f9 ");
 			break;
@@ -1725,8 +1733,6 @@ fdasd_process_valid_vtoc(fdasd_anchor_t 
 static int
 fdasd_valid_vtoc_pointer(fdasd_anchor_t *anc, unsigned long blk)
 {
-	char str[INPUT_BUF_SIZE];
-
 	/* VOL1 label contains valid VTOC pointer */
 	if (!anc->silent)
 		printf("reading vtoc ..........:");
@@ -1739,8 +1745,7 @@ fdasd_valid_vtoc_pointer(fdasd_anchor_t 
 			return -1;
 		}
 		fdasd_process_invalid_vtoc(anc);
-	}
-	else
+	} else
 		fdasd_process_valid_vtoc(anc, blk);
 
 	return 0;
@@ -1798,9 +1803,10 @@ static int
 fdasd_check_volume (fdasd_anchor_t *anc) 
 {
 	volume_label_t *vlabel = anc->vlabel;
-        long long blk = -1;
+	long long blk = -1;
 	char str[LINE_LENGTH];
 	char inp_buf[INPUT_BUF_SIZE];
+	int rc = 1;
 
 	if (!anc->silent)
 		printf("reading volume label ..:");
@@ -1830,8 +1836,9 @@ fdasd_check_volume (fdasd_anchor_t *anc)
 	} else {
 	        /* didn't find VOL1 volume label */
 
-		if (anc->print_table) {
-			printf("\nCould not find VOL1 volume label.\n");
+		if (anc->print_table || anc->print_volser) {
+			printf("\nCannot show requested information because "
+			       "the disk label block is invalid\n");
 			return -1;
 		}
 
@@ -1844,12 +1851,12 @@ fdasd_check_volume (fdasd_anchor_t *anc)
 		else {
 			if (!anc->silent)
 				printf(" no known label\n");
-			strcpy(inp_buf,"Should I create a new one?");
+			if (!anc->auto_partition)
+				rc = yes_no("Should I create a new one?");
 		}
-                if ((!anc->print_volser) && (!anc->print_table) && 
-		    (yes_no(inp_buf) == 1)) {
-		        printf("You need a VOL1 volume label for " \
-		               "partitioning\nexiting...\n");
+                if ((!anc->print_volser) && (!anc->print_table) && (rc == 1)) {
+			printf("Disc does not contain a VOL1 label, cannot "
+			       "create partitions.\nexiting... \n");
 			fdasd_exit(anc, -1);
                 }
 
@@ -1863,7 +1870,8 @@ fdasd_check_volume (fdasd_anchor_t *anc)
 			}
 		}
 		anc->formatted_cylinders = anc->hw_cylinders;
-		anc->fspace_trk = anc->formatted_cylinders * geo.heads - FIRST_USABLE_TRK;
+		anc->fspace_trk = anc->formatted_cylinders * geo.heads
+				  - FIRST_USABLE_TRK;
 
 		fdasd_init_volume_label(anc);
 
@@ -1977,8 +1985,8 @@ fdasd_get_geometry (fdasd_anchor_t *anc)
 	}
 
 	if (ioctl(fd, BLKGETSIZE64, &device_size) != 0) {
-	        close(fd);
-	        fdasd_error(anc, unable_to_ioctl,
+		close(fd);
+		fdasd_error(anc, unable_to_ioctl,
 			    "Could not retrieve device size information.");
 	}
 
@@ -2174,7 +2182,7 @@ fdasd_get_partition_data (fdasd_anchor_t
 
 	start = FIRST_USABLE_TRK;
 
- 	cyl = get_usable_cylinders(anc);
+	cyl = get_usable_cylinders(anc);
 	head = anc->f4->DS4DEVCT.DS4DSTRK;
 	limit = (head * cyl - 1);
 
@@ -2430,8 +2438,7 @@ static void
 fdasd_remove_partition (fdasd_anchor_t *anc) 
 {
 	cchhb_t hf1;
-        int i;
-        unsigned int part_id;
+        unsigned int part_id, i;
 	unsigned long start, stop;
 	partition_info_t *part_info = anc->first;
 
@@ -2444,7 +2451,7 @@ fdasd_remove_partition (fdasd_anchor_t *
 	printf("\n");
 	part_id -= 48;
 	if (part_id == 0) return;
-        if ((part_id < 0) || (part_id > anc->used_partitions)) {
+        if (part_id > anc->used_partitions) {
                 printf("'%d' is not a valid partition id!\n", part_id);
                 return;
         }
@@ -2590,7 +2597,7 @@ fdasd_auto_partition_conffile(fdasd_anch
 		}
 	}
 	else {
-		if (options.volser == NULL) 
+		if (options.volser == NULL)
 			sprintf(volser, "0X%04x", anc->devno);
 		else {
 			bzero(volser, VOLSER_LENGTH + 1);
@@ -2598,7 +2605,6 @@ fdasd_auto_partition_conffile(fdasd_anch
 			fdasd_check_volser(volser, anc->devno);
 		}
 		vtoc_volume_label_set_volser(vlabel, volser);
-
 	}
 
 	vtoc_set_cchhb(&vlabel->vtoc, VTOC_START_CC, VTOC_START_HH, 0x01);
Index: s390-tools-sles11/fdasd/fdasd.h
===================================================================
--- s390-tools-sles11.orig/fdasd/fdasd.h
+++ s390-tools-sles11/fdasd/fdasd.h
@@ -109,7 +109,7 @@ typedef struct partition_info {
         unsigned long      end_trk;
         unsigned long      len_trk;
         unsigned long      fspace_trk;
-        format1_label_t  * f1;
+        format1_label_t    *f1;
         struct partition_info *next;
         struct partition_info *prev;
 } partition_info_t;
Index: s390-tools-sles11/ipl_tools/man/chreipl.8
===================================================================
--- s390-tools-sles11.orig/ipl_tools/man/chreipl.8
+++ s390-tools-sles11/ipl_tools/man/chreipl.8
@@ -8,12 +8,12 @@ chreipl \- Change the re-ipl configurati
 
 .SH DESCRIPTION
 \fBchreipl\fR is a tool that can be used to simplify the re-ipl configuration
-for Linux on System z. Using this tool you can configure a certain disk as well 
+for Linux on System z. Using this tool you can configure a certain disk as well
 as an optional entry in the bootmenu you can boot from during the next
 reboot cycle.
 
 IPL (Initial Program Load) is the mainframe synonym for what is called
-"boot" in Linux. Accordingly re-IPL can be translated to "reboot" in the non 
+"boot" in Linux. Accordingly re-IPL can be translated to "reboot" in the non
 mainframe context.
 
 .SH ACTION
@@ -55,7 +55,7 @@ The LUN is a \fBhex\fR value.
 \fB-L\fR or \fB--loadparm\fR
 
 Specify an optional entry in the boot menu to use for the next reboot. This
-option requires an alphanumeric or blank (" ") argument and only works if a 
+option requires an alphanumeric or blank (" ") argument and only works if a
 valid zipl bootmenu is present.
 The Loadparm parameter only works in a DASD environment.
 
@@ -84,7 +84,7 @@ start.
 
 \fBchreipl ccw -d 0.0.7e78 -L 1\fR
 
-After reboot, ipl from the ccw device with the number 0.0.7e78 using 
+After reboot, ipl from the ccw device with the number 0.0.7e78 using
 the first entry of the boot menu.
 
 \fBchreipl fcp --wwpn 0x500507630300c562 --lun 0x401040B300000000 \\\fR
@@ -94,7 +94,7 @@ or
 
 \fBchreipl fcp 0.0.1700 0x500507630300c562 0x401040B300000000\fR
 
-Re-ipl from the fcp device number 0.0.1700 using WWPN 0x500507630300c562 
+Re-ipl from the fcp device number 0.0.1700 using WWPN 0x500507630300c562
 and LUN 0x401040B300000000.
 
 \fBchreipl node /dev/sda\fR
Index: s390-tools-sles11/ipl_tools/man/chshut.8
===================================================================
--- s390-tools-sles11.orig/ipl_tools/man/chshut.8
+++ s390-tools-sles11/ipl_tools/man/chshut.8
@@ -4,7 +4,7 @@
 chshut \- Change the shutdown actions for Linux on System z
 
 .SH SYNOPSIS
-\fBchshut\fR [halt | poff | reboot |] [ipl | reipl || stop | vmcmd] [VM Command]
+\fBchshut\fR [halt | poff | reboot] [ipl | reipl | stop | vmcmd] [VM Command]
 
 .SH DESCRIPTION
 \fBchshut\fR is a tool that can be used to configure the Linux on System z
@@ -46,6 +46,10 @@ Log off the z/VM guest if the Linux halt
 If the Linux poweroff command is executed, send a message to guest MASTER and
 automatically log off the guest.
 
+.SH NOTES
+
+In some Linux distributions, "halt" might be mapped by default
+to "power off". In this case you have to set "poff" instead of "halt".
 
 .SH ENVIRONMENT
 
Index: s390-tools-sles11/ipl_tools/man/lsreipl.8
===================================================================
--- s390-tools-sles11.orig/ipl_tools/man/lsreipl.8
+++ s390-tools-sles11/ipl_tools/man/lsreipl.8
@@ -7,9 +7,9 @@ lsreipl \- List the re-ipl configuration
 \fBlsreipl\fR [OPTION]
 
 .SH DESCRIPTION
-\fBlsreipl\fR lists the re-ipl (and ipl) configuration for Linux on System z. 
+\fBlsreipl\fR lists the re-ipl (and ipl) configuration for Linux on System z.
 
-Using this tool you can see from which device your system will boot after you 
+Using this tool you can see from which device your system will boot after you
 issue the reboot command. Furthermore you can query the system for information
 about the current boot device.
 
Index: s390-tools-sles11/ipl_tools/man/lsshut.8
===================================================================
--- s390-tools-sles11.orig/ipl_tools/man/lsshut.8
+++ s390-tools-sles11/ipl_tools/man/lsshut.8
@@ -8,7 +8,7 @@ lsshut \- Print the shutdown action conf
 
 .SH DESCRIPTION
 The \fBlsshut\fR command lists the Linux on System z shutdown action configuration.
-This configuration handles what the system should do in the following system 
+This configuration handles what the system should do in the following system
 states: halt, panic, power off and reboot.
 
 .SH OPTIONS
Index: s390-tools-sles11/ip_watcher/start_hsnc.sh
===================================================================
--- s390-tools-sles11.orig/ip_watcher/start_hsnc.sh
+++ s390-tools-sles11/ip_watcher/start_hsnc.sh
@@ -36,14 +36,13 @@ function __usage
 
 function PrintVersion
 {
-        echo "$script_name version %S390_TOOLS_VERSION%($version)."
-        echo "Copyright IBM Corp. 2003, 2006."
+        echo "$script_name version %S390_TOOLS_VERSION%"
+        echo "Copyright IBM Corp. 2003, 2006"
 }
 #
 # main
 #
 
-version="2.0"
 script_name="HiperSocket Network Concentrator"      # name of this script
 #
 # what is the kernel version we are on ?
Index: s390-tools-sles11/scripts/scsi_logging_level
===================================================================
--- s390-tools-sles11.orig/scripts/scsi_logging_level
+++ s390-tools-sles11/scripts/scsi_logging_level
@@ -47,8 +47,8 @@ eval set -- "$OPTS"
 printversion()
 {
     cat <<EOF
-$SCRIPTNAME: version %S390_TOOLS_VERSION%.
-Copyright IBM Corp. 2006.
+$SCRIPTNAME: version %S390_TOOLS_VERSION%
+Copyright IBM Corp. 2006
 EOF
 }
 
Index: s390-tools-sles11/tunedasd/src/tunedasd.c
===================================================================
--- s390-tools-sles11.orig/tunedasd/src/tunedasd.c
+++ s390-tools-sles11/tunedasd/src/tunedasd.c
@@ -190,8 +190,8 @@ print_usage (void)
 static void
 print_version (void)
 {
-	printf ("%s version %s.\n", tool_name, RELEASE_STRING);
-	printf ("%s.\n", copyright_notice);
+	printf ("%s version %s\n", tool_name, RELEASE_STRING);
+	printf ("%s\n", copyright_notice);
 }
 
 
Index: s390-tools-sles11/zconf/chzcrypt
===================================================================
--- s390-tools-sles11.orig/zconf/chzcrypt
+++ s390-tools-sles11/zconf/chzcrypt
@@ -67,7 +67,7 @@ function print_usage() {
 function print_version() {
     cat <<-EOF
 	$CMD: version %S390_TOOLS_VERSION%
-	Copyright IBM Corp. 2007.
+	Copyright IBM Corp. 2007
 	EOF
 }
 
@@ -253,5 +253,4 @@ for DEV in $DEV_LIST ; do
              "$ONLINE_TEXT."
 	exit 1
     fi
-    shift
 done
Index: s390-tools-sles11/zconf/chzcrypt.8
===================================================================
--- s390-tools-sles11.orig/zconf/chzcrypt.8
+++ s390-tools-sles11/zconf/chzcrypt.8
@@ -23,7 +23,8 @@ chzcrypt \- modify zcrypt configuration
 The
 .B chzcrypt
 command is used to configure cryptographic adapters managed by zcrypt and
-modify zcrypt's AP bus attributes.
+modify zcrypt's AP bus attributes. Attributes may vary depending on the kernel
+version.
 .B chzcrypt
 requires that the sysfs filesystem is mounted.
 .SH OPTIONS
Index: s390-tools-sles11/zconf/lschp
===================================================================
--- s390-tools-sles11.orig/zconf/lschp
+++ s390-tools-sles11/zconf/lschp
@@ -48,7 +48,7 @@ EOF
 function print_version()
 {
 	cat <<EOF
-${TOOLNAME}: version ${VERSION}.
+${TOOLNAME}: version ${VERSION}
 Copyright IBM Corp. 2007
 EOF
 }
Index: s390-tools-sles11/zconf/lscss.8
===================================================================
--- s390-tools-sles11.orig/zconf/lscss.8
+++ s390-tools-sles11/zconf/lscss.8
@@ -1,4 +1,4 @@
-.TH LSCSS 8 "Jul 2008" "s390-tools"
+.TH LSCSS 8 "Mar 2009" "s390-tools"
 
 .SH NAME
 lscss \- list channel subsystem devices.
@@ -9,7 +9,7 @@ lscss \- list channel subsystem devices.
 
 .SH DESCRIPTION
 The lscss command is used to list all or a subset of devices that are managed
-by to common I/O subsystem.
+by the common I/O subsystem.
 
 .SH [RANGE]
 Limit output to a range of subchannels by specifying
@@ -41,7 +41,7 @@ Indicate that RANGE refers to device ide
 Show availability attribute of IO devices.
 
 .TP 8
-.BR --version
+.BR -v | --version
 Print the version of the s390-tools package and the command.
 
 .TP 8
@@ -76,6 +76,11 @@ List all devices that are managed by the
 Same as above but shows only 3390 devices.
 .RE
 
+.SH NOTES
+In rare situations a device might temporarily not be accessible to
+the subchannel. Then "none" is displayed as the device identifier and the
+other device attributes are empty.
+
 .SH AUTHOR
 .nf
 This man-page was written by Stefan Bader <shbader@de.ibm.com>.
Index: s390-tools-sles11/zconf/lszcrypt.8
===================================================================
--- s390-tools-sles11.orig/zconf/lszcrypt.8
+++ s390-tools-sles11/zconf/lszcrypt.8
@@ -18,14 +18,15 @@ lszcrypt \- display zcrypt device and co
 The
 .B lszcrypt
 command is used to display information about cryptographic adapters managed by
-zcrypt and zcrypt's AP bus attributes.
+zcrypt and zcrypt's AP bus attributes. Displayed information depends on the
+kernel version.
 .B lszcrypt
 requires that the sysfs filesystem is mounted.
 .P
 The following information can be displayed for each cryptographic adapter: card
 type, online status, hardware card type, hardware queue depth, and request
 count. The following AP bus attributes can be displayed: AP domain,
-configuration timer, poll thread status, and poll timeout.
+configuration timer, poll thread status, poll timeout, and AP interrupt status.
 .SH OPTIONS
 .TP 8
 .B -V, --verbose
Index: s390-tools-sles11/zfcpdump/kernel/dump.c
===================================================================
--- s390-tools-sles11.orig/zfcpdump/kernel/dump.c
+++ s390-tools-sles11/zfcpdump/kernel/dump.c
@@ -24,6 +24,7 @@
 #include <asm/sigp.h>
 #include <asm/lowcore.h>
 #include <asm/debug.h>
+#include <asm/checksum.h>
 #include "dump.h"
 
 /*******************************************************************
@@ -35,6 +36,7 @@
 #define DUMP_SAVE_AREA_BASE_ESAME 4608
 #define DUMP_SAVE_AREA_BASE_ESA   212
 
+#define DUMP_LC_DUMP_REIPL      0xe00 /* ipib address and checksum */
 #define DUMP_LC_ARCH_MODE_ADDR  0xa3  /* dec. 163: Address of arch id tag */
 #define DUMP_LC_ARCH_MODE_ESAME 1     /* esame mode id tag */
 #define DUMP_LC_ARCH_MODE_ESA   0     /* esa mode id tag */
@@ -167,11 +169,30 @@ static struct {
 } dump;
 
 struct ipl_block_fcp *fcp_data;
+static struct ipl_parameter_block *ipl_block;
+
+struct ipib_info {
+	unsigned long	ipib;
+	u32		checksum;
+} __attribute__((packed));
 
 /*******************************************************************
  * functions
  *******************************************************************/
 
+int diag308(unsigned long subcode, void *addr)
+{
+	register unsigned long _addr asm("0") = (unsigned long) addr;
+	register unsigned long _rc asm("1") = 0;
+
+	asm volatile(
+		"	diag	%0,%2,0x308\n"
+		"0:\n"
+		: "+d" (_addr), "+d" (_rc)
+		: "d" (subcode) : "cc", "memory");
+	return _rc;
+}
+
 /*
  * Get the debug level
  */
@@ -575,6 +596,50 @@ void setup_dump_base(void)
 }
 
 /*
+ * Provide IPL parameter information block from either HSA or memory
+ * for future reipl
+ */
+static int __init zcore_reipl_init(void)
+{
+	struct ipib_info ipib_info;
+	int rc;
+
+	rc = sdias_memcpy((char *) &ipib_info, (void *) DUMP_LC_DUMP_REIPL,
+			  sizeof(ipib_info));
+	if (rc) {
+		DUMP_PRINT_ERR("sdias memcpy of ipib address and checksum "
+			       "failed\n");
+		return rc;
+	}
+	if (ipib_info.ipib == 0)
+		return 0;
+	ipl_block = (void *) __get_free_page(GFP_KERNEL);
+	if (!ipl_block)
+		return -ENOMEM;
+	if (ipib_info.ipib < dump.sa_mem_size)
+		rc = sdias_memcpy((char *) ipl_block, (void *) ipib_info.ipib,
+				  PAGE_SIZE);
+	else {
+		memcpy_absolute(ipl_block, (void *) ipib_info.ipib,
+				PAGE_SIZE);
+		rc = 0;
+	}
+	if (rc) {
+		DUMP_PRINT_ERR("Copy of IPL parameter information block "
+			       "failed\n");
+		free_page((unsigned long) ipl_block);
+		return rc;
+	}
+	if (csum_partial((char *) ipl_block, ipl_block->header.length, 0) !=
+	    ipib_info.checksum) {
+		DUMP_PRINT_ERR("Checksum does not match\n");
+		free_page((unsigned long) ipl_block);
+		ipl_block = NULL;
+	}
+	return 0;
+}
+
+/*
  * Initialize dump globals for a given architecture
  */
 
@@ -601,7 +666,7 @@ dump_init(void)
 	DUMP_PRINT_TRACE("DUMP init\n");
 
 	if(sdias_init()){
-		DUMP_PRINT_ERR("could initialize sclp\n");
+		DUMP_PRINT_ERR("could not initialize sclp\n");
 		rc = -1; goto out;
 	}
 	hsa_nr_of_blocks = sdias_get_nr_blocks();
@@ -630,7 +695,7 @@ dump_init(void)
 
 	DUMP_PRINT_TRACE("64 bit System dumper\n");
 	if(sdias_memcpy(&arch_id,(void*)(DUMP_LC_ARCH_MODE_ADDR),1) < 0){
-		DUMP_PRINT_ERR("sdial memcpy for arch id failed\n");
+		DUMP_PRINT_ERR("sdias memcpy for arch id failed\n");
 		dump.error_code = ZCORE_ERR_HSA_FEATURE;
 		rc = -1; goto out;
 	}
@@ -687,6 +752,12 @@ dump_init(void)
 	}
 	dump.mem_size = memory_size;
 	dump_print_glob_info();
+	if (zcore_reipl_init()) {
+		DUMP_PRINT_ERR("zcore_reipl_init failed\n");
+		dump.error_code = ZCORE_ERR_REIPL;
+		rc = -1;
+		goto out;
+	}
 	if(zcore_init() < 0){
 		DUMP_PRINT_ERR("zcore init failed\n");
 		dump.error_code = ZCORE_ERR_OTHER;
@@ -703,6 +774,7 @@ out:
 void __exit
 dump_exit(void)
 {
+	free_page((unsigned long) ipl_block);
 	zcore_exit();
 	kfree(dump.arch_info.cpu_info);
 }
@@ -977,7 +1049,6 @@ zcore_ioctl(struct inode *inode, struct 
 		case ZCORE_IOCTL_RELEASE_HSA:
 		{
 			uint32_t* psw;
-			unsigned long r1,r2;
 
 			/* set disabled wait psw in lowcore */
 			smp_ctl_clear_bit(0,28); /* disable lc protection */
@@ -995,13 +1066,7 @@ zcore_ioctl(struct inode *inode, struct 
 			       : "cc"
 			);
 #else
-			r1 = 0x0;
-			r2 = 0x2;
-			asm volatile ("   diag  %0,%1,0x308\n"
-				: 
-				: "d" (r1), "d" (r2)
-				: "cc"
-                        );
+			diag308(DIAG308_REL_HSA, NULL);
 #endif
 			break;
 		}
@@ -1013,6 +1078,12 @@ zcore_ioctl(struct inode *inode, struct 
 				rc = -EFAULT;
 			}
 			break;
+		case ZCORE_IOCTL_REIPL:
+			if (ipl_block) {
+				diag308(DIAG308_SET, ipl_block);
+				diag308(DIAG308_IPL, NULL);
+			}
+			break;
 		default:
 			DUMP_PRINT_ERR("invalid zcore ioctl: %x\n",cmd);
 			rc = -EINVAL;
Index: s390-tools-sles11/zfcpdump/kernel/dump.h
===================================================================
--- s390-tools-sles11.orig/zfcpdump/kernel/dump.h
+++ s390-tools-sles11/zfcpdump/kernel/dump.h
@@ -12,15 +12,23 @@
 #define ZCORE_IOCTL_RELEASE_HSA	0x2
 #define ZCORE_IOCTL_GET_ERROR	0x3
 #define ZCORE_IOCTL_HSASIZE	0x4
+#define ZCORE_IOCTL_REIPL	0x5
 
 #define ZCORE_ERR_OK		0x0
 #define ZCORE_ERR_HSA_FEATURE	0x1
 #define ZCORE_ERR_CPU_INFO	0x2
 #define ZCORE_ERR_OTHER		0x3
+#define ZCORE_ERR_REIPL		0x4
 
 #define BOOT_TYPE_IPL		0x10
 #define BOOT_TYPE_DUMP		0x20
 
+enum diag308_subcode  {
+	DIAG308_REL_HSA	= 2,
+	DIAG308_IPL	= 3,
+	DIAG308_SET	= 5,
+};
+
 void setup_dump_base(void);
 void setup_dump_devnos(char *cmdline, unsigned int init_devno,
 		       unsigned int console_devno);
Index: s390-tools-sles11/zfcpdump/ramdisk/zfcp_dumper.c
===================================================================
--- s390-tools-sles11.orig/zfcpdump/ramdisk/zfcp_dumper.c
+++ s390-tools-sles11/zfcpdump/ramdisk/zfcp_dumper.c
@@ -19,6 +19,7 @@
 #include <string.h>
 #include <zlib.h>
 #include <sys/stat.h>
+#include <sys/wait.h>
 #include <unistd.h>
 #include <stdio.h>
 #include <stdint.h>
@@ -410,7 +411,7 @@ static int parse_parmline(void){
 	PRINT_TRACE("dump part : %s\n",g.parm_dump_part);
 	PRINT_TRACE("dump comp : %s\n",g.parm_dump_compress);
 	PRINT_TRACE("dump debug: %d\n",g.parm_dump_debug); 
-	PRINT_TRACE("dump mem:   %llx\n",g.parm_dump_mem); 
+	PRINT_TRACE("dump mem:   %llx\n", (unsigned long long) g.parm_dump_mem);
 		
 	if(g.parm_dump_mode == PARM_DUMP_MODE_AUTO_NUM){
 		PRINT_TRACE("dump mode : %s\n",PARM_DUMP_MODE_AUTO);
@@ -552,8 +553,6 @@ out:
  */
 int enable_zfcp_device(struct ipl_block_fcp *fcp_info)
 {
-	int fh = -1, fh_check;
-	int rc = 0;
 	char command_string[1024] = {0};
 	char fcp_file[1024] = {0};
 
@@ -563,14 +562,17 @@ int enable_zfcp_device(struct ipl_block_
 	PRINT_TRACE("online: %s %s\n",command_string,fcp_file);
 	if(write_to_file(fcp_file, command_string))
 		return -1;
-	sprintf(command_string, "0x%016llx\n",fcp_info->wwpn);
+	sprintf(command_string, "0x%016llx\n",
+		(unsigned long long) fcp_info->wwpn);
 	sprintf(fcp_file,"/sys/bus/ccw/drivers/zfcp/0.0.%04x/port_add",
 		fcp_info->devno);
 	if(write_to_file(fcp_file, command_string))
 		return -1;
-	sprintf(command_string, "0x%016llx\n",fcp_info->lun);
+	sprintf(command_string, "0x%016llx\n",
+		(unsigned long long) fcp_info->lun);
 	sprintf(fcp_file,"/sys/bus/ccw/drivers/zfcp/0.0.%04x/0x%016llx/"
-		"unit_add",fcp_info->devno,fcp_info->wwpn);
+		"unit_add", fcp_info->devno,
+		(unsigned long long) fcp_info->wwpn);
 	if(write_to_file(fcp_file, command_string))
 		return -1;
 	return 0;
@@ -639,7 +641,7 @@ out:
  */
 static void release_hsa(void)
 {
-	int fh;
+	int fh = -1;
 
 	if(g.hsa_released){
 		goto out;
@@ -726,8 +728,8 @@ int main(int argc, char* argv[])
 	PRINT("DUMP PARAMETERS:\n");
 	PRINT("================\n");
 	PRINT("devno    : %x\n",fcp_info.devno);
-	PRINT("wwpn     : %016llx\n",fcp_info.wwpn);
-	PRINT("lun      : %016llx\n",fcp_info.lun);
+	PRINT("wwpn     : %016llx\n", (unsigned long long) fcp_info.wwpn);
+	PRINT("lun      : %016llx\n", (unsigned long long) fcp_info.lun);
 	PRINT("conf     : %i\n",fcp_info.bootprog);
 	PRINT("partition: %s\n",g.parm_dump_part);
 	PRINT("directory: %s\n",g.parm_dump_dir);
@@ -771,6 +773,29 @@ out:
 	}
 	fflush(stdout);
 	dump_terminate();
+	return rc;
+}
+
+
+/*
+ * trigger_reipl()
+ *
+ * Issue ioctl system call to trigger reipl. The zcore device driver
+ * issues the necessary diag308 calls only if valid ipib address and checksum
+ * were found in lowcore. Otherwise the ZCORE_IOCTL_REIPL ioctl won't do
+ * anything at all.
+ */
+void trigger_reipl(void)
+{
+	int fh;
+
+	fh = open(DEV_ZCORE, O_RDWR);
+	if (fh == -1) {
+		PRINT_PERR("open %s failed", DEV_ZCORE);
+		return;
+	}
+	ioctl(fh, ZCORE_IOCTL_REIPL, 0);
+	close(fh);
 }
 
 /*
@@ -783,6 +808,7 @@ dump_terminate(void)
 {
 	release_hsa();
 	sleep(SLEEP_TIME_END); /* give the messages time to be displayed */
+	trigger_reipl();
 	reboot(LINUX_REBOOT_CMD_POWER_OFF);
 }
 
@@ -857,7 +883,7 @@ dump_tune_vm(void)
 				"/proc/sys/vm/lowmem_reserve_ratio",
 				NULL};
 	char* sysctl_values[] = {"2","5","50","50","500","32",NULL};
-	int fh, i=0, rc=0;
+	int fh = -1, i=0, rc=0;
 
 	while(sysctl_names[i]){
 		fh = open(sysctl_names[i],O_RDWR);
@@ -1182,7 +1208,7 @@ dump_create_s390sa(char* sourcedev, char
 	char dump_file_name[1024];
 	uint64_t mem_loc;
 	uint32_t buf_loc = 0;
-	int size,fp_src, fp_dump;
+	int size, fp_src = 0, fp_dump = 0;
 	uint32_t dp_size,dp_flags;
 	int rc = 0;
 
Index: s390-tools-sles11/scripts/zfcpdbf
===================================================================
--- s390-tools-sles11.orig/scripts/zfcpdbf
+++ s390-tools-sles11/scripts/zfcpdbf
@@ -1,19 +1,20 @@
 #!/usr/bin/perl
 #==============================================================================
-# Copyright IBM Corp. 2005, 2006.
+# Copyright IBM Corp. 2005, 2009.
 #
 # zfcpdbf
 #
 # Script to analyse trace data of ZFCP module logged in DBF.
 #
 # Author(s): Maxim Shchetynin <maxim@de.ibm.com>
+#  	     Teresa Gamez Zerban <gamezt@de.ibm.com>
 #
 # This file is part of s390-tools
 #
 # s390-tools 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.
+# (at your option) any later version.   
 #
 # s390-tools is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -25,1068 +26,614 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 #==============================================================================
 
-@PARAM_HELP				= qw(-h --help);
-@PARAM_DEVICE				= qw(-d --device);
-@PARAM_PATH				= qw(-p --path);
-@PARAM_DATES				= qw(-D --dates);
-@PARAM_SINGLELINE			= qw(-s --singleline);
-@PARAM_COLOR				= qw(-c --color);
-$PARAM_DEBUG_CT				= 'ct';
-$PARAM_DEBUG_ELS			= 'els';
-$PARAM_DEBUG_BAD			= 'bad';
-@PARAM_VERBOSE				= qw(-V --verbose);
-@PARAM_VERSION				= qw(-v --version);
-$OFF					= 'off';
-$ON					= 'on';
-$TRACE_HBA				= 'hba';
-$TRACE_SAN				= 'san';
-$TRACE_SCSI				= 'scsi';
-
-$DBF_PATH_PROCFS			= '/proc/s390dbf';
-$DBF_PATH_DEBUGFS			= '/sys/kernel/debug/s390dbf';
-$DBF_PREFIX				= 'zfcp_';
-$DBF_FILE				= 'structured';
-
-$MIN_KERNEL_VERSION			= "2.4.21";
-
-$TAG_SIZE				= 4;
-
-$DEVICE					= 'device';
-$TIMESTAMP				= 'timestamp';
-$TAG					= 'tag';
-$SUBTAG					= 'tag2';
-$FSF_REQ_ID				= 'fsf_reqid';
-$FSF_REQ_SEQNO				= 'fsf_seqno';
-$ABORT_FSF_REQ_ID			= 'abort_fsf_reqid';
-$ABORT_FSF_REQ_SEQNO			= 'abort_fsf_seqno';
-$NEW_FSF_REQ_ID				= 'new_fsf_reqid';
-$NEW_FSF_REQ_SEQNO			= 'new_fsf_seqno';
-$FSF_COMMAND				= 'fsf_command';
-$PROT_STATUS				= 'fsf_prot_status';
-$PROT_STATUS_QUAL			= 'fsf_prot_status_qual';
-$FSF_STATUS				= 'fsf_status';
-$FSF_STATUS_QUAL			= 'fsf_status_qual';
-$FSF_REQUEST_STATUS			= 'fsf_req_status';
-$FIRST_SBAL				= 'sbal_first';
-$CURRENT_SBAL				= 'sbal_curr';
-$LAST_SBAL				= 'sbal_last';
-$LS_CODE				= 'ls_code';
-$S_ID					= 's_id';
-$D_ID					= 'd_id';
-$WWPN					= 'wwpn';
-$FCP_LUN				= 'fcp_lun';
-$PORT_HANDLE				= 'port_handle';
-$LUN_HANDLE				= 'lun_handle';
-$SCSI_COMMAND				= 'scsi_cmnd';
-$SCSI_SERIAL				= 'scsi_serial';
-$SCSI_ID				= 'scsi_id';
-$SCSI_LUN				= 'scsi_lun';
-$SCSI_OPCODE				= 'scsi_opcode';
-$SCSI_RETRIES				= 'scsi_retries';
-$SCSI_ALLOWED				= 'scsi_allowed';
-$FCP_RSP_VALIDITY			= 'fcp_rsp_validity';
-$FCP_RSP_SCSI_STATUS			= 'fcp_rsp_scsi_status';
-$FCP_RSP_RESIDUAL			= 'fcp_rsp_resid';
-$FCP_RSP_CODE				= 'fcp_rsp_code';
-$FCP_SNS_INFO_LEN			= 'fcp_sns_info_len';
-$FCP_SNS_INFO				= 'fcp_sns_info';
-$FAILED					= 'failed';
-$STATUS_TYPE				= 'status_type';
-$STATUS_SUBTYPE				= 'status_subtype';
-$QUEUE_DESIGNATOR			= 'queue_designator';
-$PAYLOAD				= 'payload';
-$UNKNOWN				= 'unknown';
-
-$TAG_CT_REQUEST				= 'octc';
-$TAG_CT_RESPONSE			= 'rctc';
-$TAG_ELS_REQUEST			= 'oels';
-$TAG_ELS_RESPONSE			= 'rels';
-$TAG_INCOMING_ELS			= 'iels';
-$TAG_UNSOLICITED_STATUS			= 'stat';
-$TAG_STATUS_READ			= 'read';
-$TAG_DISMISSED				= 'dism';
-$TAG_FAILED				= 'fail';
-$TAG_QDIO				= 'qdio';
-$TAG_FSF_REQ_RESPONSE			= 'resp';
-$TAG_PROT_STATUS_ERROR			= 'perr';
-$TAG_FSF_STATUS_ERROR			= 'ferr';
-$TAG_STATUS_QUAL_AVAILABLE		= 'qual';
-$TAG_FSF_REQUEST_TRACE			= 'norm';
-$TAG_SCSI_COMPLETION			= 'rslt';
-$TAG_SCSI_ABORT				= 'abrt';
-$TAG_SCSI_TARGET_RESET			= 'trst';
-$TAG_SCSI_RESET				= 'lrst';
-
-my(%fsf_req_status) = (
-	0x00000000,			'',
-	0x00000001,			'',
-	0x00000002,			'task management',
-	0x00000004,			'completed',
-	0x00000008,			'error',
-	0x00000010,			'cleanup',
-	0x00000020,			'aborting',
-	0x00000040,			'abort succeeded',
-	0x00000080,			'abort not needed',
-	0x00000100,			'aborted',
-	0x00000200,			'tm func failed',
-	0x00000400,			'tm func not supported',
-	0x00000800,			'retry',
-	0x00001000,			'dismissed',
-);
-
-$QTCB_SEND_FCP_COMMAND			= 0x00000001;
-$QTCB_ABORT_FCP_COMMAND			= 0x00000002;
-$QTCB_OPEN_PORT				= 0x00000005;
-$QTCB_OPEN_LUN				= 0x00000006;
-$QTCB_CLOSE_LUN				= 0x00000007;
-$QTCB_CLOSE_PORT			= 0x00000008;
-$QTCB_CLOSE_PHYSICAL_PORT		= 0x00000009;
-$QTCB_SEND_ELS				= 0x0000000B;
-$QTCB_SEND_GENERIC			= 0x0000000C;
-$QTCB_EXCHANGE_CONFIG_DATA		= 0x0000000D;
-$QTCB_EXCHANGE_PORT_DATA		= 0x0000000E;
-$QTCB_DOWNLOAD_CONTROL_FILE		= 0x00000012;
-$QTCB_UPLOAD_CONTROL_FILE		= 0x00000013;
+use strict;
+use warnings;
+use Getopt::Long;
+use File::Basename;
 
 my(%fsf_command) = (
-	$QTCB_SEND_FCP_COMMAND,		'send FCP command',
-	$QTCB_ABORT_FCP_COMMAND,	'abort FCP command',
-	$QTCB_OPEN_PORT,		'open port',
-	$QTCB_OPEN_LUN,			'open unit',
-	$QTCB_CLOSE_LUN,		'close unit',
-	$QTCB_CLOSE_PORT,		'close port',
-	$QTCB_CLOSE_PHYSICAL_PORT,	'close port physical',
-	$QTCB_SEND_ELS,			'send ELS',
-	$QTCB_SEND_GENERIC,		'send generic',
-	$QTCB_EXCHANGE_CONFIG_DATA,	'exchange config data',
-	$QTCB_EXCHANGE_PORT_DATA,	'exchange port data',
-	$QTCB_DOWNLOAD_CONTROL_FILE,	'download control file',
-	$QTCB_UPLOAD_CONTROL_FILE,	'upload control file'
+	'0x00000001' =>	'send FCP command',
+	'0x00000002' =>	'abort FCP command',
+	'0x00000005' =>	'open port',
+	'0x00000006' =>	'open unit',
+	'0x00000007' =>	'close unit',
+	'0x00000008' =>	'close port',
+	'0x00000009' =>	'close port physical',
+	'0x0000000b' =>	'send ELS',
+	'0x0000000c' =>	'send generic',
+	'0x0000000d' =>	'exchange config data',
+	'0x0000000e' =>	'exchange port data',
+	'0x00000012' =>	'download control file',
+	'0x00000013' =>	'upload control file'
 );
 
-$FSF_PROT_GOOD				= 0x00000001;
-$FSF_PROT_QTCB_VERSION_ERROR		= 0x00000010;
-$FSF_PROT_SEQ_NUMB_ERROR		= 0x00000020;
-$FSF_PROT_UNSUPP_QTCB_TYPE		= 0x00000040;
-$FSF_PROT_HOST_CONNECTION_INITIALIZING	= 0x00000080;
-$FSF_PROT_FSF_STATUS_PRESENTED		= 0x00000100;
-$FSF_PROT_DUPLICATE_REQUEST_ID		= 0x00000200;
-$FSF_PROT_LINK_DOWN			= 0x00000400;
-$FSF_PROT_REEST_QUEUE			= 0x00000800;
-$FSF_PROT_ERROR_STATE			= 0x01000000;
-
 my(%protocol_status) = (
-	$FSF_PROT_GOOD,			'good',
-	$FSF_PROT_QTCB_VERSION_ERROR,	'QTCB version error',
-	$FSF_PROT_SEQ_NUMB_ERROR,	'sequence number error',
-	$FSF_PROT_UNSUPP_QTCB_TYPE,	'unsupported QTCB type',
-	$FSF_PROT_HOST_CONNECTION_INITIALIZING, 'host connection initializing',
-	$FSF_PROT_FSF_STATUS_PRESENTED,	'FSF status presented',
-	$FSF_PROT_DUPLICATE_REQUEST_ID,	'duplicate request ID',
-	$FSF_PROT_LINK_DOWN,		'link down',
-	$FSF_PROT_REEST_QUEUE,		'reestablished queue',
-	$FSF_PROT_ERROR_STATE,		'error state'
+	'0x00000001' =>	'good',
+	'0x00000010' =>	'QTCB version error',
+	'0x00000020' =>	'sequence number error',
+	'0x00000040' =>	'unsupported QTCB type',
+	'0x00000080' => 'host connection initializing',
+	'0x00000100' =>	'FSF status presented',
+	'0x00000200' =>	'duplicate request ID',
+	'0x00000400' =>	'link down',
+	'0x00000800' =>	'reestablished queue',
+	'0x01000000' =>	'error state'
 );
 
-$FSF_GOOD				= 0x00000000;
-$FSF_PORT_ALREADY_OPEN			= 0x00000001;
-$FSF_LUN_ALREADY_OPEN			= 0x00000002;
-$FSF_PORT_HANDLE_NOT_VALID		= 0x00000003;
-$FSF_LUN_HANDLE_NOT_VALID		= 0x00000004;
-$FSF_HANDLE_MISMATCH			= 0x00000005;
-$FSF_SERVICE_CLASS_NOT_SUPPORTED	= 0x00000006;
-$FSF_FCPLUN_NOT_VALID			= 0x00000009;
-$FSF_ACCESS_DENIED			= 0x00000010;
-$FSF_ACCESS_TYPE_NOT_VALID		= 0x00000011;
-$FSF_LUN_SHARING_VIOLATION		= 0x00000012;
-$FSF_FCP_COMMAND_DOES_NOT_EXIST		= 0x00000022;
-$FSF_DIRECTION_INDICATOR_NOT_VALID	= 0x00000030;
-$FSF_CMND_LENGTH_NOT_VALID		= 0x00000033;
-$FSF_MAXIMUM_NUMBER_OF_PORTS_EXCEEDED	= 0x00000040;
-$FSF_MAXIMUM_NUMBER_OF_LUNS_EXCEEDED	= 0x00000041;
-$FSF_ELS_COMMAND_REJECTED		= 0x00000050;
-$FSF_GENERIC_COMMAND_REJECTED		= 0x00000051;
-$FSF_OPERATION_PARTIALLY_SUCCESSFUL	= 0x00000052;
-$FSF_AUTHORIZATION_FAILURE		= 0x00000053;
-$FSF_ACT_ERROR_DETECTED			= 0x00000054;
-$FSF_CONTROL_FILE_UPDATE_ERROR		= 0x00000055;
-$FSF_CONTROL_FILE_TOO_LARGE		= 0x00000056;
-$FSF_ACCESS_CONFLICT_DETECTED		= 0x00000057;
-$FSF_CONFLICTS_OVERRULED		= 0x00000058;
-$FSF_PORT_BOXED				= 0x00000059;
-$FSF_LUN_BOXED				= 0x0000005A;
-$FSF_EXCHANGE_CONFIG_DATA_INCOMPLETE	= 0x0000005B;
-$FSF_PAYLOAD_SIZE_MISMATCH		= 0x00000060;
-$FSF_REQUEST_SIZE_TOO_LARGE		= 0x00000061;
-$FSF_RESPONSE_SIZE_TOO_LARGE		= 0x00000062;
-$FSF_SBAL_MISMATCH			= 0x00000063;
-$FSF_OPEN_PORT_WITHOUT_PRLI		= 0x00000064;
-$FSF_ADAPTER_STATUS_AVAILABLE		= 0x000000AD;
-$FSF_FCP_RSP_AVAILABLE			= 0x000000AF;
-$FSF_UNKNOWN_COMMAND			= 0x000000E2;
-$FSF_UNKNOWN_OP_SUBTYPE			= 0x000000E3;
-$FSF_INVALID_COMMAND_OPTION		= 0x000000E5;
-
 my(%fsf_status) = (
-	$FSF_GOOD,
-			'good',
-	$FSF_PORT_ALREADY_OPEN,
-			'port already open',
-	$FSF_LUN_ALREADY_OPEN,
-			'unit already open',
-	$FSF_PORT_HANDLE_NOT_VALID,
-			'port handle not valid',
-	$FSF_LUN_HANDLE_NOT_VALID,
-			'unit handle not valid',
-	$FSF_HANDLE_MISMATCH,
-			'handle mismatch',
-	$FSF_SERVICE_CLASS_NOT_SUPPORTED,
-			'service class not supported',
-	$FSF_FCPLUN_NOT_VALID,
-			'FCP LUN not valid',
-	$FSF_ACCESS_DENIED,
-			'access denied',
-	$FSF_ACCESS_TYPE_NOT_VALID,
-			'access type not valid',
-	$FSF_LUN_SHARING_VIOLATION,
-			'LUN sharing violation',
-	$FSF_FCP_COMMAND_DOES_NOT_EXIST,
-			'command does not exist',
-	$FSF_DIRECTION_INDICATOR_NOT_VALID,
-			'direction indicator not valid',
-	$FSF_CMND_LENGTH_NOT_VALID,
-			'command length not valid',
-	$FSF_MAXIMUM_NUMBER_OF_PORTS_EXCEEDED,
-			'max number of ports exceeded',
-	$FSF_MAXIMUM_NUMBER_OF_LUNS_EXCEEDED,
-			'max number of units exceeded',
-	$FSF_ELS_COMMAND_REJECTED,
-			'ELS rejected',
-	$FSF_GENERIC_COMMAND_REJECTED,
-			'generic command rejected',
-	$FSF_OPERATION_PARTIALLY_SUCCESSFUL,
-			'partially successful',
-	$FSF_AUTHORIZATION_FAILURE,
-			'authorization failure',
-	$FSF_ACT_ERROR_DETECTED,
-			'ACT error detected',
-	$FSF_CONTROL_FILE_UPDATE_ERROR,
-			'control file update error',
-	$FSF_CONTROL_FILE_TOO_LARGE,
-			'control file too large',
-	$FSF_ACCESS_CONFLICT_DETECTED,
-			'access conflict detected',
-	$FSF_CONFLICTS_OVERRULED,
-			'conflicts overruled',
-	$FSF_PORT_BOXED,
-			'port boxed',
-	$FSF_LUN_BOXED,
-			'unit boxed',
-	$FSF_EXCHANGE_CONFIG_DATA_INCOMPLETE,
-			'exchange config/port data incomplete',
-	$FSF_PAYLOAD_SIZE_MISMATCH,
-			'payload size mismatch',
-	$FSF_REQUEST_SIZE_TOO_LARGE,
-			'request too large',
-	$FSF_RESPONSE_SIZE_TOO_LARGE,
-			'response too large',
-	$FSF_SBAL_MISMATCH,
-			'SBAL mismatch',
-	$FSF_OPEN_PORT_WITHOUT_PRLI,
-			'open port without PRLI',
-	$FSF_ADAPTER_STATUS_AVAILABLE,
-			'adapter status available',
-	$FSF_FCP_RSP_AVAILABLE,
-			'FCP RSP available',
-	$FSF_UNKNOWN_COMMAND,
-			'unknown command',
-	$FSF_UNKNOWN_OP_SUBTYPE,
-			'unknown op subtype',
-	$FSF_INVALID_COMMAND_OPTION,
-			'invalid command option'
+	'0x00000000' =>	'good',
+	'0x00000001' =>	'port already open',
+	'0x00000002' => 'unit already open',
+	'0x00000003' => 'port handle not valid',
+	'0x00000004' => 'unit handle not valid',
+	'0x00000005' =>	'handle mismatch',
+	'0x00000006' => 'service class not supported',
+	'0x00000009' => 'FCP LUN not valid',
+	'0x00000010' => 'access denied',
+	'0x00000011' => 'access type not valid',
+	'0x00000012' =>	'LUN sharing violation',
+	'0x00000022' =>	'command does not exist',
+	'0x00000030' => 'direction indicator not valid',
+	'0x00000033' => 'command length not valid',
+	'0x00000040' =>	'max number of ports exceeded',
+	'0x00000041' => 'max number of units exceeded',
+	'0x00000050' => 'ELS rejected',
+	'0x00000051' =>	'generic command rejected',
+	'0x00000052' => 'partially successful',
+	'0x00000053' => 'authorization failure',
+	'0x00000054' =>	'ACT error detected',
+	'0x00000055' => 'control file update error',
+	'0x00000056' => 'control file too large',
+	'0x00000057' => 'access conflict detected',
+	'0x00000058' => 'conflicts overruled',
+	'0x00000059' => 'port boxed',
+	'0x0000005a' => 'unit boxed',
+	'0x0000005b' => 'exchange config/port data incomplete',
+	'0x00000060' =>	'payload size mismatch',
+	'0x00000061' =>	'request too large',
+	'0x00000062' => 'response too large',
+	'0x00000063' => 'SBAL mismatch',
+	'0x00000064' => 'open port without PRLI',
+	'0x000000ad' => 'adapter status available',
+	'0x000000af' => 'FCP RSP available',
+	'0x000000e2' => 'unknown command',
+	'0x000000e3' => 'unknown op subtype',
+	'0x000000e5' =>	'invalid command option'
 );
 
 my(%unsolicited_status) = (
-	0x00000001,			'port closed',
-	0x00000002,			'incoming ELS',
-	0x00000003,			'sense data available',
-	0x00000004,			'bit error threshold',
-	0x00000005,			'link down',
-	0x00000006,			'link up',
-	0x00000009,			'notification lost',
-	0x0000000A,			'ACT updated',
-	0x0000000B,			'ACT hardened'
+	'0x00000001' =>	'port closed',
+	'0x00000002' =>	'incoming ELS',
+	'0x00000003' => 'sense data available',
+	'0x00000004' =>	'bit error threshold',
+	'0x00000005' =>	'link down',
+	'0x00000006' =>	'link up',
+	'0x00000009' =>	'notification lost',
+	'0x0000000a' =>	'ACT updated',
+	'0x0000000b' =>	'ACT hardened'
 );
 
-my(%els) = (
-	0x01,				'RJT',
-	0x02,				'ACC',
-	0x03,				'PLOGI',
-	0x05,				'LOGO',
-	0x0E,				'RTV',
-	0x0F,				'RLS',
-	0x50,				'PDISC',
-	0x52,				'ADISC',
-	0x61,				'RSCN',
-	0x78,				'RNID',
-	0x7A,				'RLIR'
-);
-
-$COLOR_DEFAULT				= "\033[m\017";
-$COLOR_GREEN				= "\033[32m";
-$COLOR_RED				= "\033[31m";
-
-my(%color);
-
-$NOTABOOL	= -1;
-$FALSE		= 0;
-$TRUE		= 1;
-
-my($path, $device, $trace) =
-	('', '*', '');
-my($dates, $single_line, $color, $verbose) =
-	($TRUE, $FALSE, $FALSE, $FALSE);
-my($debug_ct, $debug_els, $debug_bad, $debug_unsol) =
-	($TRUE, $FALSE, $TRUE, $TRUE);
-my($from_year, $from_mon, $from_mday, $from_hour, $from_min, $from_sec) =
-	(-1, -1, -1, -1, -1, -1);
-my($to_year, $to_mon, $to_mday, $to_hour, $to_min, $to_sec) =
-	(-1, -1, -1, -1, -1, -1);
-
-my(@dbf_files, $single_device, %event_list, @filter);
-
-sub fetch_parameters
-{
-	my($linux_release) = &kernel_version(`uname --release`);
-
-	if ($linux_release < &kernel_version($MIN_KERNEL_VERSION)) {
-		printf "zfcpdbf works only with kernel version %s or higher\n",
-				$MIN_KERNEL_VERSION;
-		exit;
-	}
+#COMMAND LINE OPTIONS
 
-	for (my $index = 0; $index <= $#ARGV; $index++) {
-		my($parameter, $value);
-		if ((index $ARGV[$index], '=') != -1) {
-			($parameter, $value) = split /\=/, $ARGV[$index];
-		} elsif ($index < $#ARGV) {
-			($parameter, $value) = ($ARGV[$index], $ARGV[$index + 1]);
-		} else {
-			($parameter, $value) = ($ARGV[$index], $TRUE);
-		}
+my $OPT_HBA	= 0;
+my $OPT_SAN	= 0;
+my $OPT_SCSI	= 0;
+my $OPT_REC	= 0;
+my $OPT_DEVICE	= "";
+my $OPT_PATH	= "";
+my $OPT_VERBOSE	= 0;
+my $OPT_HELP	= 0;
+my $OPT_VERSION	= 0;
+my $OPT_DATE 	= "on";
+my $OPT_SINGLELINE =0;
 
-		my($switch);
-		if ((($value cmp $OFF) == 0) || (($value cmp '0') == 0)) {
-			$switch = $FALSE;
-		} elsif ((($value cmp $ON) == 0) || (($value cmp '1') == 0)) {
-			$switch = $TRUE;
-		} else {
-			$switch = $NOTABOOL;
-		}
+#string for the singleline option
+my $endl	="\n\t";
 
-		if (($parameter cmp $PARAM_HELP[0]) == 0 ||
-		         ($parameter cmp $PARAM_HELP[1]) == 0) {
-			&print_help();
-		} elsif (($parameter cmp $PARAM_VERSION[0]) == 0 ||
-		         ($parameter cmp $PARAM_VERSION[1]) == 0) {
-			&print_version();
-		} elsif (($parameter cmp $PARAM_DEVICE[0]) == 0 ||
-		         ($parameter cmp $PARAM_DEVICE[1]) == 0) {
-			$device = $value;
-		} elsif (($parameter cmp $PARAM_PATH[0]) == 0 ||
-		         ($parameter cmp $PARAM_PATH[1]) == 0) {
-			$path = $value;
-		} elsif (($parameter cmp $TRACE_HBA) == 0 ||
-		         ($parameter cmp $TRACE_SAN) == 0 ||
-		         ($parameter cmp $TRACE_SCSI) == 0) {
-			&print_help() unless length($trace) == 0;
-			$trace = $parameter;
-		} elsif (($parameter cmp $PARAM_DATES[0]) == 0 ||
-		         ($parameter cmp $PARAM_DATES[1]) == 0) {
-			&print_help() if $switch == $NOTABOOL;
-			$dates = $switch;
-		} elsif (($parameter cmp $PARAM_SINGLELINE[0]) == 0 ||
-		         ($parameter cmp $PARAM_SINGLELINE[1]) == 0) {
-			$single_line = $TRUE;
-		} elsif (($parameter cmp $PARAM_COLOR[0]) == 0 ||
-		         ($parameter cmp $PARAM_COLOR[1]) == 0) {
-			$color = $TRUE;
-		} elsif (($parameter cmp $PARAM_DEBUG_CT) == 0) {
-			&print_help() if $switch == $NOTABOOL;
-			$debug_ct = $switch;
-		} elsif (($parameter cmp $PARAM_DEBUG_ELS) == 0) {
-			&print_help() if $switch == $NOTABOOL;
-			$debug_els = $switch;
-		} elsif (($parameter cmp $PARAM_DEBUG_BAD) == 0) {
-			&print_help() if $switch == $NOTABOOL;
-			$debug_bad = $switch;
-		} elsif (($parameter cmp $PARAM_VERBOSE[0]) == 0 ||
-		         ($parameter cmp $PARAM_VERBOSE[1]) == 0) {
-			$verbose = $TRUE;
-		} else {
-			push @filter, $parameter . '=' . $value;
-		}
-	}
+#PARSE COMMAND LINE OPTIONS
+Getopt::Long::Configure('bundling');
 
-	$trace = $TRACE_SAN if length($trace) == 0;
+GetOptions(
+	'd|device=s'	=> \$OPT_DEVICE,
+	'p|path=s'	=> \$OPT_PATH,
+	'V|verbose'	=> \$OPT_VERBOSE,
+	'h|help'	=> \$OPT_HELP,
+	'v|version'	=> \$OPT_VERSION,
+	'D|date=s'	=> \$OPT_DATE,
+	's|singleline'	=> \$OPT_SINGLELINE
+) or print_usage();
 
-	if (length($path) > 0) {
-		while (((substr $path, length($path) - 1, 1) cmp '/') == 0) {
-			substr ($path, length($path) - 1, 1) = '';
-		}
-	} else {
-		if ( -d $DBF_PATH_PROCFS) {
-			$path = $DBF_PATH_PROCFS;
-		} elsif ( -d $DBF_PATH_DEBUGFS) {
-			$path = $DBF_PATH_DEBUGFS;
-		}
+foreach(@ARGV) { 
+	if($_ eq 'hba') {
+		$OPT_HBA = 1;
 	}
-
-	if (($device cmp '*') != 0) {
-		while (length($device) < 4) {
-			$device = '0' . $device;
-		}
+	elsif( $_ eq 'scsi') {
+		$OPT_SCSI = 1;
 	}
-
-	if ( ! -d glob sprintf "%s/%s%s_*", $path, $DBF_PREFIX, $device) {
-		if (($device cmp '*') != 0) {
-			printf "No DBF files found for FCP adapter %s\n",
-					$device;
-		} else {
-			print "No DBF files found\n";
-		}
-		exit;
+	elsif($_ eq 'rec') {
+		$OPT_REC = 1;
 	}
-
-#	push @dbf_files, glob(sprintf "%s/%s%s_erp/%s",
-#			$path, $DBF_PREFIX, $device, $DBF_FILE);
-	push @dbf_files, glob(sprintf "%s/%s%s_hba/%s",
-			$path, $DBF_PREFIX, $device, $DBF_FILE);
-	push @dbf_files, glob(sprintf "%s/%s%s_san/%s",
-			$path, $DBF_PREFIX, $device, $DBF_FILE);
-	push @dbf_files, glob(sprintf "%s/%s%s_scsi/%s",
-			$path, $DBF_PREFIX, $device, $DBF_FILE);
-
-	if ($#dbf_files < 0) {
-		print "No DBF files found\n";
-		exit;
+	elsif($_ eq 'san') {
+		$OPT_SAN = 1;
 	}
+};
 
-	$single_device = $#dbf_files == 2;
+#MAIN PROGRAM
 
-	$from_year += 1900 if ($from_year != -1) && ($from_year < 100);
-	$to_year   += 1900 if ($to_year   != -1) && ($to_year   < 100);
+if($OPT_HELP) {
+	print_usage();
+}
+ 
+if($OPT_VERSION) {
+	print_version();
 }
 
-sub print_help
-{
-	printf "\n" .
-"Usage: zfcpdbf [COMMAND] [OPTIONS]\n" .
-"\n" .
-"Sort debug data of all active or specified FCP adapter(s).\n" .
-"  -h, --help                display this help and exit\n" .
-"  -v, --version             display version information and exit\n" .
-"commands:\n" .
-"  hba                       trace all FSF requests\n" .
-"  san                       trace SAN activity (default)\n" .
-"  scsi                      trace SCSI- and corresponding FCP-commands\n" .
-"options:\n" .
-"  -d, --device=<device>     FCP adapter device number\n" .
-"  -p, --path=<path>         specifiy path to DBF files\n" .
-"  -D, --dates={off|on}      show date as well as time (default: %s)\n" .
-#"  --ct={off|on}             trace send CT commands (default: %s)\n" .
-#"  --els={off|on}            trace ELS commands and incoming ELS (default: %s)\n" .
-#"  --baf={off|on}            trace all FSF commands with bad response (default: %s)\n" .
-"  -s, --singleline          output in one line per event\n" .
-"  -c, --color               colored output\n" .
-"  -V, --verbose             verbose output\n" .
-$dates; # $debug_ct, $debug_unsol, $debug_bad;
-	exit;
+if($OPT_SINGLELINE) {
+	$endl = "; ";
 }
 
-sub print_version
-{
-	my($s390tools_version) = '%S390_TOOLS_VERSION%';
-	printf "zfcpdbf: version %s.\n", $s390tools_version;
-	printf "Copyright IBM Corp. 2005, 2006.\n";
+if($OPT_DATE ne "" && $OPT_DATE ne "on" and  $OPT_DATE ne "off") {
+	print "Date has to be set 'on'(default) or 'off'" . 
+		" and not '$OPT_DATE'.\n";
 	exit;
 }
-
-sub init
-{
-	&fetch_parameters();
-
-	if ($color) {
-		$color{'default'}   = $COLOR_DEFAULT;
-		$color{'timestamp'} = $COLOR_GREEN;
-		$color{'error'}     = $COLOR_RED;
-	}
+	 
+if($OPT_DEVICE eq "") {
+	$OPT_DEVICE = "*";
 }
-
-sub load
-{
-	foreach my $dbf_file (@dbf_files) {
-		&die("Cannot open a DBF file $dbf_file!\n")
-			unless open DBF, $dbf_file;
-		while (<DBF>) {
-			chomp;
-			my($label, $timestamp) = split;
-			my($tm, $ms) = split /\:/, $timestamp;
-			my($sec, $min, $hour, $mday, $mon, $year, $wday, $yday) =
-				gmtime($tm);
-			$year += 1900;
-
-			next if (($from_year != -1) && ($from_year > $year)) ||
-			        (($to_year   != -1) && ($to_year   < $year));
-			next if (($from_mon  != -1) && ($from_mon  > $mon )) ||
-			        (($to_mon    != -1) && ($to_mon    < $mon ));
-			next if (($from_mday != -1) && ($from_mday > $mday)) ||
-			        (($to_mday   != -1) && ($to_mday   < $mday));
-			next if (($from_hour != -1) && ($from_hour > $hour)) ||
-			        (($to_hour   != -1) && ($to_hour   < $hour));
-			next if (($from_min  != -1) && ($from_min  > $min )) ||
-			        (($to_min    != -1) && ($to_min    < $min ));
-			next if (($from_sec  != -1) && ($from_sec  > $sec )) ||
-			        (($to_sec    != -1) && ($to_sec    < $sec ));
-
-			my($event);
-			if (!$single_device) {
-				my($offset, $length);
-				$offset  = length($path) + 1;
-				$offset += index(substr($dbf_file, $offset), '_');
-				$offset++;
-				$length  = index(substr($dbf_file, $offset), '_');
-				$event = $DEVICE . '=' . substr
-						$dbf_file, $offset, $length;
-			}
-
-			my($tag_label) = $TAG;
-			while (<DBF>) {
-				chomp;
-				my($string) = $_;
-				last if length($string) == 0;
-
-				my($label, $value);
-				my($pos) = 0;
-				$pos++ while (((substr $string, $pos, 1) cmp ' ') == 0);
-				$label = substr($string, $pos, index(substr($string, $pos), ' '));
-				$pos += length $label;
-				$pos++ while (((substr $string, $pos, 1) cmp ' ') == 0);
-				$value = substr($string, $pos);
-				if (($label cmp $TAG) == 0) {
-					$label = $tag_label;
-					$tag_label = $SUBTAG;
-				}
-				$event .= ';' unless length $event == 0;
-				$event .= $label . '=' . $value;
-			}
-
-			$event_list{$timestamp} = $event;
-		}
+#Check if the adapter is set correct
+else {
+	while(length($OPT_DEVICE) < 4) {
+		$OPT_DEVICE = '0' . $OPT_DEVICE;
 	}
-}
 
-sub main
-{
-	if (($trace cmp $TRACE_HBA) == 0) {
-		&trace_hba();
-	} elsif (($trace cmp $TRACE_SAN) == 0) {
-		&trace_san();
-	} elsif (($trace cmp $TRACE_SCSI) == 0) {
-		&trace_scsi();
+	if(length($OPT_DEVICE) == 4) {
+		$OPT_DEVICE = "0.0." . $OPT_DEVICE;
 	}
-}
 
-sub done
-{
+	if(length($OPT_DEVICE) != 8 or $OPT_DEVICE !~ /^0\.0\./) {
+		printf "'$OPT_DEVICE' does not look like a FCP adapter.\n";
+		exit;
+	}
 }
 
-sub die
-{
-	printf "%s%s%s", $color{'error'}, @_, $color{'default'};
-	exit -1;
+if($OPT_PATH eq "") {
+	$OPT_PATH = '/sys/kernel/debug/s390dbf';
 }
 
-sub print_label
-{
-	my($timestamp) = @_;
+#Check if path exist
+if(! -d $OPT_PATH) {
+	printf $OPT_PATH . " does not exist. Is debugfs mounted?\n";
+	exit;
+} 
 
-	if ($single_device) {
-		return sprintf "%s%s%s",
-				$color{'timestamp'},
-				&print_time($timestamp),
-				$color{'default'};
-	} else {
-		return sprintf "%s%s %s%s",
-				$color{'timestamp'},
-				&grep($event_list{$timestamp}, $DEVICE),
-				&print_time($timestamp),
-				$color{'default'};
+my @paths  = glob($OPT_PATH . "/zfcp_" . $OPT_DEVICE . "_*"); 
+unless(@paths) {
+	if($OPT_DEVICE ne "*") {
+		printf "No DBF files found for FCP adapter %s.\n",
+			$OPT_DEVICE;
+	} 
+	else {
+		printf "No DBF files found at %s.\n",$OPT_PATH;
 	}
+	exit;
+}	 
+
+if($OPT_HBA) {
+	my @hba_paths = @{filter_paths("hba",@paths)};
+	trace_hba(@hba_paths);
+}
+elsif($OPT_SCSI) {
+	my @scsi_paths = @{filter_paths("scsi",@paths)};
+	trace_scsi(@scsi_paths);
+}
+elsif($OPT_REC) {
+	my @rec_paths = @{filter_paths("rec",@paths)};
+	trace_rec(@rec_paths);
+}
+else {
+	my @san_paths = @{filter_paths("san",@paths)};
+	trace_san(@san_paths);
 }
 
-sub print_time
-{
-	my($timestamp) = @_;
-	my($tm, $ms) = split /\:/, $timestamp;
-	my($sec, $min, $hour, $mday, $mon, $year, $wday, $yday) = gmtime($tm);
+#END MAIN PROGRAMM
 
-	if ($dates) {
-		$year += 1900;
-		$mon += 1;
-		return sprintf "%4d-%02d-%02d %02d:%02d:%02d.%09d",
-				$year, $mon, $mday, $hour, $min, $sec, $ms;
-	} else {
-		return sprintf "%02d:%02d:%02d.%09d",
-				$hour, $min, $sec, $ms;
-	}
-}
 
+#SUBS
 
-sub dbfprintf
-{
-	my(@argv) = @_;
-
-	if ($single_line) {
-		my($index);
-		while (($index = index($argv[0], "\t")) != -1) {
-			substr($argv[0], $index, 1) = "";
-		}
-		while (($index = index($argv[0], "\n")) != -1) {
-			substr($argv[0], $index, 1) = "; ";
-		}
-		while (($index = index($argv[0], ",")) != -1) {
-			substr($argv[0], $index, 1) = ";";
+#
+# Filters the scsi trace for the specified ports
+#
+# \param	Path to the traces
+#
+sub trace_scsi {
+	my(@scsi_paths) = @_;
+	
+	foreach my $scsi_path (@scsi_paths) {
+		open(DBF,$scsi_path . "/structured") or 
+		die("Cannot open DBF file " . $scsi_path . "/structured");
+		$scsi_path =~/(0\.0\.\w+)_\w+/;
+		my $adapter = $1;
+		my %scsi_hash;
+		while(<DBF>) {
+			if($_=~ /timestamp\s+([:\d]+)/) {
+				print_scsi($adapter,%scsi_hash);
+				%scsi_hash = ();
+				$scsi_hash{'timestamp'} = convert_time($1);
+			}
+			elsif ($_ =~ /(\w+)\s+(\w+)/) {
+				$scsi_hash{$1} = $2;;
+			}
 		}
+		print_scsi($adapter,%scsi_hash);
+		close(DBF);
 	}
+}
 
-	printf @argv;
+#
+# Print the scsi trace 
+#
+# \param	Adapter which is traced
+# \param	Data of the scsi trace
+#
+sub print_scsi {
+	my($adapter,%scsi_hash) = @_;
+	if(defined($scsi_hash{'timestamp'}) && defined($scsi_hash{'tag'}) && 
+		($scsi_hash{'tag'} eq 'rslt' || $scsi_hash{'tag'} eq 'abrt' ||
+		 $scsi_hash{'tag'} eq 'lrst' || $scsi_hash{'tag'} eq 'trst')) {
+		print "$adapter $scsi_hash{'timestamp'} " . 
+			"SCSI serial=$scsi_hash{'scsi_serial'}" . $endl .
+			"id=$scsi_hash{'scsi_id'} lun=$scsi_hash{'scsi_lun'} " .
+			"command=$scsi_hash{'scsi_cmnd'}" . $endl;
+		if($OPT_VERBOSE && $scsi_hash{'scsi_retries'}  ne hex 0) {
+			print "retry $scsi_hash{'scsi_retries'} ".
+				"from $scsi_hash{'scsi_allowed'}"; 
+		}
+	
+		if($scsi_hash{'fcp_rsp_validity'} ne '0x00') {
+			print "FCP_RSP validity=" .
+			      "$scsi_hash{'fcp_rsp_validity'} ";
+			if($OPT_VERBOSE) {
+				print "scsi_status=" .
+				      "$scsi_hash{'fcp_rsp_scsi_status'} " . 
+				      $endl . "residual=" .
+				      "$scsi_hash{'fcp_rsp_resid'} " .
+				      "code=0x$scsi_hash{'fcp_rsp_code'} ";
+			} 
+		}
+	
+		if($OPT_VERBOSE && $scsi_hash{'fcp_sns_info_len'} ne hex 0) {
+			print "FCP_SNS info=$scsi_hash{'fcp_sns_info'}";
+		}
+		print "\n";
+	}	 
 }
 
+#
+# Filters the hba trace for the specified ports
+#
+# \param	Path to the traces
+#
+sub trace_hba {
+	my(@hba_paths) = @_;
 
-sub dbfprintcr
-{
-	print "\n" if $single_line;
-}
-
-sub trace_hba
-{
-	foreach my $timestamp (sort keys %event_list) {
-		my($event) = $event_list{$timestamp};
-		my($tag) = &tag($event);
-
-		if (($debug_unsol) &&
-		    ($tag cmp $TAG_UNSOLICITED_STATUS) == 0) {
-			&dbfprintf("%s ", &print_label($timestamp));
-
-			my($subtag) = &subtag($event);
-			if (($subtag cmp $TAG_STATUS_READ) == 0) {
-				my($status_type, $status_subtype) = (
-					hex &grep($event, $STATUS_TYPE),
-					hex &grep($event, $STATUS_SUBTYPE)
-				);
-				my($queue_designator) =
-					&grep($event, $QUEUE_DESIGNATOR);
-
-				&dbfprintf("unsolicited status '%s'",
-						$unsolicited_status{$status_type});
-				&dbfprintf(" subtype=0x%08X",
-						$status_subtype)
-					unless !$verbose && $status_subtype == 0;
-
-				&dbfprintf("\n\tqueue designator='%s'",
-						$queue_designator)
-					unless !$verbose && &zarro($queue_designator);
-			} elsif (($subtag cmp $TAG_DISMISSED) == 0) {
-				&dbfprintf("status read request dismissed");
-			} elsif (($subtag cmp $TAG_FAILED) == 0) {
-				&dbfprintf("status read request failed");
-				&dbfprintf("\n\t%d status read requests " .
-						"failed on adapter",
-						hex &grep($event, $FAILED));
+	foreach my $hba_path (@hba_paths) {
+		open(DBF,$hba_path . "/structured") or 
+		die("Cannot open DBF file " . $hba_path . "/structured");
+		$hba_path =~/(0\.0\.\w+)_\w+/;
+		my $adapter = $1;
+		my %hba_hash;
+		while(<DBF>) {
+			if($_ =~ /timestamp\s+([:\d]+)/) {
+				print_hba($adapter, %hba_hash);
+				%hba_hash = ();
+				$hba_hash{'timestamp'} = convert_time($1);
 			}
-
-			my($payload) = &grep($event, $PAYLOAD);
-			&dbfprintf("\n\tpayload='%s'",
-					$payload)
-				unless !$verbose && &zarro($payload);
-
-			&dbfprintf("\n");
-			&dbfprintcr;
-			next;
-		} elsif (($debug_bad) && (
-		         (($tag cmp $TAG_PROT_STATUS_ERROR) == 0) ||
-		         (($tag cmp $TAG_FSF_STATUS_ERROR) == 0) ||
-		         (($tag cmp $TAG_STATUS_QUAL_AVAILABLE) == 0))) {
-			my($fsf_command) = hex &grep($event, $FSF_COMMAND);
-			my($prot_status, $prot_status_qual) = (
-				hex &grep($event, $PROT_STATUS),
-				    &grep($event, $PROT_STATUS_QUAL)
-			);
-			my($fsf_status, $fsf_status_qual) = (
-				hex &grep($event, $FSF_STATUS),
-				    &grep($event, $FSF_STATUS_QUAL)
-			);
-
-			&dbfprintf("%s response to '%s'\n",
-					&print_label($timestamp),
-					$fsf_command{$fsf_command});
-
-			&dbfprintf("\tprotocol status='%s' FSF status='%s'\n",
-					$protocol_status{$prot_status},
-					$fsf_status{$fsf_status})
-				unless !$verbose &&
-				       $prot_status == $FSF_PROT_GOOD &&
-				       $fsf_status == $FSF_GOOD;
-
-			&dbfprintf("\tprotocol status qualifier='%s'\n",
-					$prot_status_qual)
-				unless !$verbose && &zarro($prot_status_qual);
-
-			&dbfprintf("\tfsf status qualifier='%s'\n",
-					$fsf_status_qual)
-				unless !$verbose && &zarro($fsf_status_qual);
-
-			&dbfprintcr;
-			next;
-		} elsif (($tag cmp $TAG_FSF_REQ_RESPONSE) != 0) {
-			next;
-		}
-
-		my($fsf_req_id, $fsf_req_seqno, $fsf_command, $fsf_req_status) = (
-			hex &grep($event, $FSF_REQ_ID),
-			hex &grep($event, $FSF_REQ_SEQNO),
-			hex &grep($event, $FSF_COMMAND),
-			hex &grep($event, $FSF_REQUEST_STATUS)
-		);
-		my($prot_status, $prot_status_qual) = (
-			hex &grep($event, $PROT_STATUS),
-			    &grep($event, $PROT_STATUS_QUAL)
-		);
-		my($fsf_status, $fsf_status_qual) = (
-			hex &grep($event, $FSF_STATUS),
-			    &grep($event, $FSF_STATUS_QUAL)
-		);
-		my(@sbals) = (
-			hex &grep($event, $FIRST_SBAL),
-			hex &grep($event, $CURRENT_SBAL),
-			hex &grep($event, $LAST_SBAL)
-		);
-
-		&dbfprintf("%s %s\n",
-				&print_label($timestamp),
-				$fsf_command{$fsf_command});
-
-		&dbfprintf("\tprotocol status='%s' FSF status='%s'\n",
-				$protocol_status{$prot_status},
-				$fsf_status{$fsf_status})
-			unless !$verbose &&
-			       $prot_status == $FSF_PROT_GOOD &&
-			       $fsf_status == $FSF_GOOD;
-
-		&dbfprintf("\tprotocol status qualifier='%s'\n",
-				$prot_status_qual)
-			unless !$verbose && &zarro($prot_status_qual);
-
-		&dbfprintf("\tFSF status qualifier='%s'\n",
-				$fsf_status_qual)
-			unless !$verbose && &zarro($fsf_status_qual);
-
-		if ($verbose && $fsf_req_status != 0) {
-			&dbfprintf("\tFSF request status");
-			for (my($bit) = 1 << 31; $bit > 0; $bit >>= 1) {
-				my($value) = $fsf_req_status & $bit;
-				&dbfprintf(" '%s'", $fsf_req_status{$value})
-					unless $value == 0;
+			elsif ($_ =~ /^(\w+)\s+(\w+)$/) {
+				$hba_hash{$1} = $2;
+			}
+			elsif ($_ =~ /^(\w+)\s+(\w+\s\w+\s\w+\s\w+)$/) {
+				$hba_hash{$1} = $2;
+			}
+			elsif ($_ =~ /^(\w+)\s+(\w+\s\w+)$/) {
+				$hba_hash{$1} = $2;
 			}
-			&dbfprintf("\n");
-		}
-		&dbfprintf("\tSBAL=%d/%d/%d (first/current/last)\n",
-				$sbals[0], $sbals[1], $sbals[2])
-			unless !$verbose;
-
-		if ($fsf_command == $QTCB_ABORT_FCP_COMMAND) {
-			&dbfprintf("\tabort FSF request ID=%s seqno=%d\n",
-					&grep($event, $ABORT_FSF_REQ_ID),
-					hex &grep($event, $ABORT_FSF_REQ_SEQNO));
-		} elsif (($fsf_command == $QTCB_OPEN_PORT) ||
-		         ($fsf_command == $QTCB_CLOSE_PORT) ||
-		         ($fsf_command == $QTCB_CLOSE_PHYSICAL_PORT)) {
-			&dbfprintf("\tWWPN=%s D_ID=%s\n",
-					&grep($event, $WWPN),
-					&grep($event, $D_ID));
-			&dbfprintf("\tport handle=%s\n",
-					&grep($event, $PORT_HANDLE));
-		} elsif (($fsf_command == $QTCB_OPEN_LUN) ||
-		         ($fsf_command == $QTCB_CLOSE_LUN)) {
-			&dbfprintf("\tWWPN=%s LUN=%s\n",
-					&grep($event, $WWPN),
-					&grep($event, $FCP_LUN));
-			&dbfprintf("\tport handle=%s LUN handle=%s\n",
-					&grep($event, $PORT_HANDLE),
-					&grep($event, $LUN_HANDLE));
-		} elsif ($fsf_command == $QTCB_SEND_ELS) {
-			&dbfprintf("\tD_ID=%s LS code=%s\n",
-					&grep($event, $D_ID),
-					&grep($event, $PORT_HANDLE));
 		}
-
-		&dbfprintcr;
+		print_hba($adapter,%hba_hash);
+		close DBF;
 	}
 }
 
-sub trace_san
-{
-	foreach my $timestamp (sort keys %event_list) {
-		my($event) = $event_list{$timestamp};
-		my($tag) = &tag($event);
-
-		if (($debug_ct) && (
-		    (($tag cmp $TAG_CT_REQUEST) == 0) ||
-		    (($tag cmp $TAG_CT_RESPONSE) == 0))) {
-			my($s_id, $d_id) = (
-				&grep($event, $S_ID),
-				&grep($event, $D_ID)
-			);
-
-			&dbfprintf("%s %s -> %s CT %s\n",
-					&print_label($timestamp),
-					$s_id, $d_id,
-					($tag cmp $TAG_CT_REQUEST) == 0 ?
-					"request" : "response");
-
-			&dbfprintf("\tFSF request=0x%x, seqno=%d\n",
-					hex &grep($event, $FSF_REQ_ID),
-					hex &grep($event, $FSF_REQ_SEQNO))
-						if $verbose;
-			&dbfprintcr;
-		} elsif (($debug_els) && (
-		         (($tag cmp $TAG_ELS_REQUEST) == 0) ||
-		         (($tag cmp $TAG_ELS_RESPONSE) == 0))) {
-			my($s_id, $d_id, $ls_code) = (
-				    &grep($event, $S_ID),
-				    &grep($event, $D_ID),
-				hex &grep($event, $LS_CODE)
-			);
-
-			&dbfprintf("%s %s -> %s %s %s\n",
-					&print_label($timestamp),
-					$s_id, $d_id, $els{$ls_code},
-					($tag cmp $TAG_ELS_REQUEST) == 0 ?
-					"request" : "response");
-			&dbfprintcr;
-		} elsif (($debug_els) && (
-		         ($tag cmp $TAG_INCOMING_ELS) == 0)) {
-			my($s_id, $d_id, $ls_code) = (
-				    &grep($event, $S_ID),
-				    &grep($event, $D_ID),
-				hex &grep($event, $LS_CODE)
-			);
-
-			&dbfprintf("%s %s -> %s incoming %s\n",
-					&print_label($timestamp),
-					$s_id, $d_id, $els{$ls_code});
-			&dbfprintcr;
+#
+# Print the hba trace 
+#
+# \param	Adapter which is traced
+# \param	Data of the hba trace
+#
+sub print_hba {
+	my($adapter,%hba_hash) = @_;	
+	if(defined($hba_hash{'timestamp'})) { 
+		#Unsolicited status
+		if(defined($hba_hash{'tag'}) && $hba_hash{'tag'} eq "stat") {
+			if(defined($hba_hash{'tag2'}) && 
+			$hba_hash{'tag2'} eq "read") { 
+			    	if(defined($hba_hash{'timestamp'}) && 
+				 defined($hba_hash{'status_type'}) && 
+				 defined($hba_hash{'status_subtype'}) && 
+				 defined($hba_hash{'queue_designator'})) {
+					print "$adapter $hba_hash{
+					'timestamp'} " .
+					"unsolicited status" .
+					" '$unsolicited_status{
+						$hba_hash{'status_type'}}'"
+					. $endl .
+					"subtype= $hba_hash{'status_subtype'}"
+					. $endl .
+					"queue designator= $hba_hash{
+					'queue_designator'}" . $endl ;
+			  	  }
+			}
+			elsif(defined($hba_hash{'tag2'}) && 
+				$hba_hash{'tag2'} eq "dism") {
+				print "status read request dissmissed";
+			}
+			elsif(defined($hba_hash{'tag2'}) && 
+				$hba_hash{'tag2'} eq "fail") {
+				print "status read request failed";
+			}
+		}		
+		elsif(defined($hba_hash{'tag'}) && $hba_hash{'tag'} eq "resp") {
+			if(defined($hba_hash{'tag2'}) && 
+			($hba_hash{'tag2'} eq "perr" || 
+			 $hba_hash{'tag2'} eq "ferr" || 
+			 $hba_hash{'tag2'} eq "open" || 
+			 $hba_hash{'tag2'} eq "qtcb")) {
+				print "$adapter $hba_hash{'timestamp'} " .
+				"response to '$fsf_command{
+					$hba_hash{'fsf_command'}}'" . $endl;
+				print "protocol status='$protocol_status{
+					$hba_hash{'fsf_prot_status'}}'" . 
+					"FSF status='$fsf_status{
+					$hba_hash{'fsf_status'}}'" . $endl ; 
+			}  
+		}	
+		else {
+			next;
 		}
+		
+		if($OPT_VERBOSE) {
+			print "protocol status qualifier=" .
+				"'$hba_hash{'fsf_prot_status_qual'}'" . $endl .
+				"FSF status qualifier=" .
+				"'$hba_hash{'fsf_status_qual'}'" . $endl .
+				"FSF request status " .
+				"'$hba_hash{'fsf_req_status'}'" . $endl .
+				"SBAL=$hba_hash{'sbal_first'}/$hba_hash{
+				'sbal_last'}/$hba_hash{'sbal_response'} " .
+				"(fist/last/response)" . $endl; 
+		}
+
+		if($hba_hash{'fsf_command'} eq '0x00000002') {
+			print "Abort FSF request " .
+				"ID=$hba_hash{'abort_fsf_reqid'} " .
+				"seqno=$hba_hash{'abort_fsf_seqno'}";
+		}
+		elsif($hba_hash{'fsf_command'} eq '0x00000005' || 
+			$hba_hash{'fsf_command'} eq '0x00000008' ||
+		$hba_hash{'fsf_command'} eq '0x00000009') {
+			print "WWPN=$hba_hash{'wwpn'} D_ID=$hba_hash{'d_id'} ";
+			print "port handle=$hba_hash{'port_handle'}";
+		}
+		elsif($hba_hash{'fsf_command'} eq '0x00000006' || 
+			$hba_hash{'fsf_command'} eq '0x00000007') {
+			print "WWPN=$hba_hash{'wwpn'} " .
+				"LUN=$hba_hash{'fcp_lun'}" . $endl;
+			print "port handle=$hba_hash{'port_handle'}" .
+				" LUN handle=$hba_hash{'lun_handle'}"; 
+		}
+		elsif($hba_hash{'fsf_command'} eq '0x0000000b' ) {
+			print "D_ID=$hba_hash{'d_id'} LS " .
+				"code=$hba_hash{'port_handle'}";
+		}
+		print"\n";
 	}
 }
 
-sub trace_scsi
-{
-	foreach my $scsi_timestamp (sort keys %event_list) {
-		my($scsi_event, $fsf_event) =
-			($event_list{$scsi_timestamp}, "");
-
-		my($tag) = &grep($scsi_event, $TAG);
-		next unless ($tag cmp $TAG_SCSI_COMPLETION) == 0 ||
-		            ($tag cmp $TAG_SCSI_ABORT) == 0 ||
-		            ($tag cmp $TAG_SCSI_TARGET_RESET) == 0 ||
-		            ($tag cmp $TAG_SCSI_RESET) == 0;
-
-		my($fsf_req_id, $fsf_req_seqno) = (
-			hex &grep($scsi_event, $FSF_REQ_ID),
-			hex &grep($scsi_event, $FSF_REQ_SEQNO)
-		);
-
-		foreach my $fsf_timestamp (sort keys %event_list) {
-			my($sub_event) = $event_list{$fsf_timestamp};
-			my($sub_fsf_req_id, $sub_fsf_req_seqno) = (
-				hex &grep($sub_event, $FSF_REQ_ID),
-				hex &grep($sub_event, $FSF_REQ_SEQNO)
-			);
-			if (($sub_fsf_req_id == $fsf_req_id) &&
-		            ($sub_fsf_req_seqno == $fsf_req_seqno)) {
-				$fsf_event = $sub_event;
-				last;
+#
+# Filters the rec trace for the specified ports
+#
+# \param	Path to the traces
+#
+sub trace_rec {
+	my(@rec_paths) = @_;
+
+	foreach my $rec_path ( @rec_paths ) {
+		open(DBF,$rec_path . "/structured") or 
+		die("Cannot open DBF file " . $rec_path . "/structured");
+		$rec_path =~/(0\.0\.\w+)_\w+/;  
+		my $adapter = $1;
+		my %rec_hash;
+		while(<DBF>) {
+			if($_ =~ /timestamp\s+([:\d]+)/) {
+				print_rec($adapter,%rec_hash);
+				%rec_hash = ();
+				$rec_hash{'timestamp'} = convert_time($1);
+				print "\n";
+			}
+			elsif ($_ =~ /(\w+)\s+(\w+)/) {
+				$rec_hash{$1} = $2;
 			}
 		}
+		print_rec($adapter,%rec_hash);
+		print "\n";
+		close DBF;  
+	}
+}
 
-		my($scsi_command, $scsi_serial, $scsi_id, $scsi_lun) = (
-			hex &grep($scsi_event, $SCSI_COMMAND),
-			hex &grep($scsi_event, $SCSI_SERIAL),
-			hex &grep($scsi_event, $SCSI_ID),
-			hex &grep($scsi_event, $SCSI_LUN)
-		);
-		my($scsi_retries, $scsi_allowed) = (
-			hex &grep($scsi_event, $SCSI_RETRIES),
-			hex &grep($scsi_event, $SCSI_ALLOWED)
-		);
-		my($rsp_validity, $rsp_scsi_status, $rsp_reidual, $rsp_code) = (
-			hex &grep($scsi_event, $FCP_RSP_VALIDITY),
-			hex &grep($scsi_event, $FCP_RSP_SCSI_STATUS),
-			hex &grep($scsi_event, $FCP_RSP_RESIDUAL),
-			hex &grep($scsi_event, $FCP_RSP_CODE)
-		);
-		my($sns_info, $sns_info_len) = (
-			hex &grep($scsi_event, $FCP_SNS_INFO),
-			hex &grep($scsi_event, $FCP_SNS_INFO_LEN)
-		);
-		my($fsf_command, $fsf_req_status) = (
-			hex &grep($fsf_event, $FSF_COMMAND),
-			hex &grep($fsf_event, $FSF_REQUEST_STATUS)
-		);
-		my($prot_status, $prot_status_qual) = (
-			hex &grep($fsf_event, $PROT_STATUS),
-			    &grep($fsf_event, $PROT_STATUS_QUAL)
-		);
-		my($fsf_status, $fsf_status_qual) = (
-			hex &grep($fsf_event, $FSF_STATUS),
-			    &grep($fsf_event, $FSF_STATUS_QUAL)
-		);
-		my(@sbals) = (
-			hex &grep($fsf_event, $FIRST_SBAL),
-			hex &grep($fsf_event, $CURRENT_SBAL),
-			hex &grep($fsf_event, $LAST_SBAL)
-		);
-
-		&dbfprintf("%s SCSI serial=%d id=%d lun=%d command=0x%lx",
-				&print_label($scsi_timestamp),
-				$scsi_serial,
-				$scsi_id,
-				$scsi_lun,
-				$scsi_command);
-		&dbfprintf(" retry %d from %d",
-				$scsi_retries,
-				$scsi_allowed)
-			unless !$verbose && $scsi_retries == 0;
-		&dbfprintf("\n");
-
-
-		if ($rsp_validity != 0) {
-			&dbfprintf("\tFCP_RSP validity=0x%02X",
-					$rsp_validity);
-			&dbfprintf(" scsi_status=0x%02X",
-					$rsp_scsi_status)
-				unless !$verbose && $rsp_scsi_status == 0;
-			&dbfprintf(" residual=%d",
-					$rsp_reidual)
-				unless !$verbose && $rsp_reidual == 0;
-			&dbfprintf(" code=0x%08X",
-					$rsp_code)
-				unless !$verbose && $rsp_code == 0;
-			&dbfprintf("\n");
-		}
+#
+# Prints the rec traces 
+#
+# \param	Adapter which is traced
+# \param	Data of the rec trace
+#
+sub print_rec {
+	my($adapter,%rec_hash) = @_;
+	if(defined($rec_hash{'timestamp'}) && defined($rec_hash{'tag'}) && 
+		defined($rec_hash{'hint'}) && defined($rec_hash{'wwpn'}) &&
+		defined($rec_hash{'fcp_lun'})) {
+		print "$adapter $rec_hash{'timestamp'}\ttag=$rec_hash{'tag'} " .
+		  	"hint=$rec_hash{'hint'}" . $endl .
+			"WWPN='$rec_hash{'wwpn'}' lun='$rec_hash{'fcp_lun'}'";
+	} 
+}
 
-		&dbfprintf("\tFCP_SNS info=%s\n",
-				$sns_info)
-			unless !$verbose && $sns_info_len == 0;
-
-		&dbfprintf("\tprotocol status='%s' FSF status='%s'\n",
-				$protocol_status{$prot_status},
-				$fsf_status{$fsf_status})
-			unless !$verbose &&
-			       $prot_status == $FSF_PROT_GOOD &&
-			       $fsf_status == $FSF_GOOD;
-
-		&dbfprintf("\tprotocol status qualifier='%s'\n",
-				$prot_status_qual)
-			unless !$verbose && &zarro($prot_status_qual);
-
-		&dbfprintf("\tfsf status qualifier='%s'\n",
-				$fsf_status_qual)
-			unless !$verbose && &zarro($fsf_status_qual);
-
-		if ($verbose && $fsf_req_status != 0) {
-			&dbfprintf("\tfsf request status");
-			for (my($bit) = 1 << 31; $bit > 0; $bit >>= 1) {
-				my($value) = $fsf_req_status & $bit;
-				&dbfprintf(" '%s'", $fsf_req_status{$value})
-					unless $value == 0;
+# 
+# Filters the san trace for the specified ports
+#
+# \param	Path to the traces
+#
+sub trace_san {
+	my(@san_paths) = @_;
+		
+	foreach my $san_path (@san_paths) {
+		open(DBF,$san_path . "/structured") or 
+		die("Cannnot open DBF file " . $san_path . "/structured");
+		$san_path =~ /(0\.0\.\w+)_\w+/;
+		my $adapter = $1;
+		my %san_hash;
+		while(<DBF>) {
+			if($_ =~ /timestamp\s+([:\d]+)/) {
+				#Every new block starts with a timestamp and 
+				#since we cannot be sure that a block ends with 
+				#a blank line we check for the next timestamp
+				print_san($adapter,%san_hash);
+				%san_hash = ();
+				$san_hash{'timestamp'} = convert_time($1);
+			}
+			elsif ($_ =~ /(\w+)\s+(\w+)/) {
+				$san_hash{$1} = $2;
 			}
-			&dbfprintf("\n");
 		}
+		print_san($adapter,%san_hash);
+		print"\n";
+		close DBF;
+	}
+	return;
+}
 
-		&dbfprintf("\tSBAL=%d/%d/%d (first/current/last)\n",
-				$sbals[0], $sbals[1], $sbals[2])
-					if $verbose;
-
-		if ($fsf_command == $QTCB_ABORT_FCP_COMMAND) {
-			&dbfprintf("\tabort fsf request id=%s seqno=%d\n",
-					&grep($event, $ABORT_FSF_REQ_ID),
-					hex &grep($event, $ABORT_FSF_REQ_SEQNO));
-		}
+#
+# Prints the san traces 
+#
+# \param	Adapter which is traced
+# \param	Data of the san trace
+#
+sub print_san {
+	my($adapter,%san_hash) = @_;
 
-		&dbfprintcr;
+	if(defined($san_hash{'timestamp'}) && defined($san_hash{'s_id'}) && 
+		defined($san_hash{'d_id'}) && defined($san_hash{'tag'})) {
+		my $tag;
+		if($san_hash{'tag'} eq "octc") { 
+			$tag = "CT request";
+		}
+		elsif($san_hash{'tag'} eq "rctc") {
+			$tag = "CT response";
+		}
+		elsif($san_hash{'tag'} eq "oels") {
+			$tag = "ELS request";
+		}
+		elsif($san_hash{'tag'} eq "rels") {
+			$tag = "ELS respsone";
+		}
+		elsif($san_hash{'tag'} eq "iels") {
+			$tag = "ELS incoming";
+		} 	
+		print "$adapter $san_hash{'timestamp'}\t$san_hash{'s_id'} " .
+			" -> $san_hash{'d_id'} $tag \n";
 	}
 }
 
-sub tag
-{
-	my($event) = @_;
-	return &grep($event, $TAG);
-}
-
-sub subtag
-{
-	my($event) = @_;
-	return &grep($event, $SUBTAG);
-}
-
-sub is
-{
-	my($event, $field_name) = @_;
-	my(@field_list) = split /\;/, $event;
-	my($label, $value);
-
-	foreach my $field (@field_list) {
-		($label, $value) = split /\=/, $field;
-		return 1 if ($label cmp $field_name) == 0;
-	}
-	return 0;
+#
+# Converts the Unix time to localtime an returns it 
+# depending on the --date option.
+#
+# \param	UNIX Timestamp to convert
+# \return 	Formated Localtime
+#
+sub convert_time {
+	my($timestamp) = @_;
+	
+	my @conv_time = split(/:/,$timestamp);
+	my @local_t = localtime($conv_time[0]);
+	if($OPT_DATE eq "on") {
+		return (sprintf "%04d-%02d-%02d %02d:%02d:%02d.%d", 
+			($local_t[5]+1900) ,$local_t[4],$local_t[3],$local_t[2],
+			$local_t[1],$local_t[0], $conv_time[1]);
+	}
+	else {
+		return (sprintf "%02d:%02d:%02d.%d",$local_t[2],
+			$local_t[1],$local_t[0], $conv_time[1]);
+	} 
 }
 
-sub grep
-{
-	my($event, $field_name) = @_;
-	my(@field_list) = split /\;/, $event;
-	my($label, $value);
-
-	foreach my $field (@field_list) {
-		($label, $value) = split /\=/, $field;
-		last if ($label cmp $field_name) == 0;
+#
+# Filters the path to trace 
+#
+#\param		The filter for the paths
+#\param		Path to the traces
+#\return	The filtered pathes
+#
+sub filter_paths {
+	my($filter,@paths) = @_;
+	
+	my @filtered_paths;
+	
+	foreach my $path (@paths) {
+		if($path =~ /_$filter$/) {
+			push(@filtered_paths,$path);
+		}
+	}
+	unless(@filtered_paths) {
+		print "No traces for '$filter' found\n";
+		exit;
 	}
-	return (($label cmp $field_name) == 0) ? $value : $UNKNOWN;
+	return \@filtered_paths;
 }
 
-sub zarro
-{
-	my($field) = @_;
+#
+# Prints the version
+#
+sub print_version {
 
-	for (my $index = 0; $index < length($field); $index++) {
-		my($char) = substr($field, $index, 1);
-		return $FALSE if (($char != '0') && ($char != ' '));
-	}
-	return $TRUE;
+	my ($s390tools_version) = '%S390_TOOLS_VERSION%';
+	printf "zfcpdbf: version %s\n", $s390tools_version;
+	printf "Copyright IBM Corp. 2005,2009\n";
+	exit;
 }
 
-sub kernel_version
-{
-	my($release) = @_;
-	my($version, $patchlevel, $sublevel) = split /\./, $release;
-	return (int $version << 16) + (int $patchlevel << 8) + (int $sublevel);
+#
+# Prints the usage
+#
+sub print_usage {
+print 
+"
+Usage: zfcpdbf [COMMAND] [OPTIONS]
+
+Sort debug data of all active or specified FCP adapter(s).
+	-h, --help                display this help and exit
+ 	-v, --version             display version information and exit
+commands:
+	hba                     trace all FSF requests
+	san                     trace SAN activity (default)
+  	scsi                    trace SCSI- and corresponding FCP-commands
+	rec			  trace REC records
+	options:
+	  -d, --device=<device>   FCP adapter device number
+	  -p, --path=<path>       specifiy path to DBF files
+	  -D, --dates={off|on}    show date as well as time 
+	  -s, --singleline        output in one line per event
+	  -V, --verbose           verbose output
+	
+";
+	exit;
 }
-
-&init;
-&load;
-&main;
-&done;
Index: s390-tools-sles11/scripts/zfcpdbf.1
===================================================================
--- s390-tools-sles11.orig/scripts/zfcpdbf.1
+++ s390-tools-sles11/scripts/zfcpdbf.1
@@ -1,11 +1,11 @@
-.TH ZFCPDBF 1 "Apr 2006" "s390-tools"
+.TH ZFCPDBF 1 "Aug 2009" "s390-tools"
 
 .SH NAME
 zfcpdbf \- zfcp debug data sort/analyse tool.
 
 .SH SYNOPSIS
 .br
-\fBzfcpdbf\fR [hba|san|scsi] [-d \fIdevice\fR] [-p \fIpath\fR] [-D off|on] [-s] [-c] [-V]
+\fBzfcpdbf\fR [hba|san|scsi|rec] [-d \fIdevice\fR] [-p \fIpath\fR] [-D off|on] [-s] [-V]
 .br
 \fBzfcpdbf\fR {-h|-v}
 
@@ -25,6 +25,10 @@ Trace SAN activity (default).
 \fBscsi\fR
 Trace SCSI- and corresponding FCP-commands.
 
+.TP
+\fBrec\fR
+Trace error recovery.
+
 .SH OPTIONS
 .TP
 \fB-h\fR or \fB--help\fR
@@ -40,10 +44,10 @@ Specify bus ID of the FCP adapter (defau
 
 .TP
 \fB-p <path>\fR or \fB--path=<path>\fR
-Specifiy path to DBF files (default: /proc/s390dbf in Linux 2.4 or mount point of the debugfs in Linux 2.6)
+Specifiy path to DBF files (default: mount point of the debugfs in Linux 2.6)
 
 .TP
-\fB-D {0|1}\fR or \fB--dates={off|on}\fR
+\fB-D {off|on}\fR or \fB--dates={off|on}\fR
 Show date as well as time in timestamp per event (default: on).
 
 .TP
@@ -51,9 +55,5 @@ Show date as well as time in timestamp p
 Print one line per event. Usefull for piping the output to some other tool (grep, wc, ...).
 
 .TP
-\fB-c\fR or \fB--color\fR
-Colored output.
-
-.TP
 \fB-V\fR or \fB--verbose\fR
 Provide more verbose output.
Index: s390-tools-sles11/libvtoc/vtoc.c
===================================================================
--- s390-tools-sles11.orig/libvtoc/vtoc.c
+++ s390-tools-sles11/libvtoc/vtoc.c
@@ -326,7 +326,7 @@ void vtoc_volume_label_init (volume_labe
 {
 	sprintf(buffer, "%84s", " ");
 	vtoc_ebcdic_enc(buffer, buffer, 84);	
-	strncpy(vlabel->volkey, buffer, 84);
+	memcpy(vlabel, buffer, 84);
 }
 
 
Index: s390-tools-sles11/ipl_tools/ccw.c
===================================================================
--- s390-tools-sles11.orig/ipl_tools/ccw.c
+++ s390-tools-sles11/ipl_tools/ccw.c
@@ -51,33 +51,22 @@ int isccwdev(const char *devno)
 	return -1;
 }
 
-/*
- * return the device number for a device
- * dasda can be found in /sys/block/dasda/uevent or in a
- * symbolic link in the same directory. the first file only
- * contains the relevant information if we run on a kernel with
- * has the following kernel option enabled:
- * CONFIG_SYSFS_DEPRECATED
- *
- * This does not work when booting from tape
- */
-int get_ccw_devno(char *device, char *devno)
+
+int get_ccw_devno_old_sysfs(char *device, char *devno)
 {
 	FILE *filp;
 	int len, errorpath, rc;
 	char path1[4096];
-	char path2[4096];
 	char buf[4096];
 	char *match, *s1, *s2;
-	size_t linksize;
 
 	errorpath = 1;
+	rc = 0;
 	sprintf(path1, "/sys/block/%s/uevent", device);
 	filp = fopen(path1, "r");
 	if (!filp) {
-		errorpath = 1;
 		rc = -1;
-		goto out;
+		return rc;
 	}
 	/*
 	 * the uevent file contains an entry like this:
@@ -91,49 +80,72 @@ int get_ccw_devno(char *device, char *de
 	s1 =  strchr(buf, '/');
 	s2 =  strrchr(buf, '/');
 	len = s2-s1;
-	if (s1 == NULL || s2 == NULL || len <= 0) {
+	strncpy(devno, s2 + 1, sizeof(devno));
+	devno[len] = '\0';
+	fclose(filp);
+	return 0;
+}
+
+int get_ccw_devno_new_sysfs(char *device, char *devno)
+{
+	int len, errorpath, rc;
+	char path2[4096];
+	char buf[4096];
+	char *s1, *s2;
+	ssize_t linksize;
+
+	errorpath = 1;
+	s1 = NULL;
+	s2 = NULL;
+	len = 0;
+	sprintf(path2, "/sys/block/%s/device", device);
+	linksize = readlink(path2, buf, sizeof(buf)-1);
+	if (linksize == -1) {
+		errorpath = 2;
+		rc = -1;
+		return rc;
+	} else {
 		/*
-		 * now we try to find the information in the second file
+		 * the output has the following format:
+		 *  ../../../0.0.4e13
 		 */
-		sprintf(path2, "/sys/block/%s/device", device);
-		linksize = readlink(path2, buf, sizeof(buf)-1);
-		if (linksize == -1) {
-			errorpath = 2;
+		s1 = strchr(buf, '/');
+		s2 = strrchr(buf, '/');
+		len = s2 - s1 + 2;
+		if (s1 == NULL || s2 == NULL || len <= 0) {
 			rc = -1;
-			goto out;
-		} else {
-			/*
-			 * the output has the following format:
-			 *  ../../../0.0.4e13
-			 */
-			s1 =  strchr(buf, '/');
-			s2 =  strrchr(buf, '/');
-			len = s2-s1+2;
-			if (s1 == NULL || s2 == NULL || len <= 0) {
-				rc = -1;
-				goto out;
-			}
-			strncpy(devno, s2+1, sizeof(devno));
-			devno[len] = '\0';
-			return 0;
+			fprintf(stderr, "%s: Can not open %s: %s\n",
+					 name, path2, strerror(errno));
+			return rc;
 		}
-
 	}
-	strncpy(devno, s2+1, sizeof(devno));
+	strncpy(devno, s2 + 1, sizeof(devno));
 	devno[len] = '\0';
-	fclose(filp);
 	return 0;
-out:
-	if (errorpath == 1 && rc == -1) {
-		 fprintf(stderr, "%s: Can not open %s: %s\n", name,
-			path1, strerror(errno));
-	}
-	if (errorpath == 2 && rc == -1) {
-		 fprintf(stderr, "%s: Can not open %s: %s\n",
-				 name, path2, strerror(errno));
+}
+
+/*
+ * return the device number for a device
+ * dasda can be found in /sys/block/dasda/uevent or in a
+ * symbolic link in the same directory. the first file only
+ * contains the relevant information if we run on a kernel with
+ * has the following kernel option enabled:
+ * CONFIG_SYSFS_DEPRECATED
+ *
+ * This does not work when booting from tape
+ */
+int get_ccw_devno(char *device, char *devno)
+{
+    if (get_ccw_devno_old_sysfs(device, devno) != 0) {
+	if (get_ccw_devno_new_sysfs(device, devno) != 0) {
+		fprintf(stderr, "%s: Failed to lookup the device number\n",
+			name);
+		return -1;
 	}
-	return rc;
+    }
+    return 0;
 }
+
 int get_ccw_dev(char *partition, char *device)
 {
 	char   *stop;
Index: s390-tools-sles11/ipl_tools/chreipl.h
===================================================================
--- s390-tools-sles11.orig/ipl_tools/chreipl.h
+++ s390-tools-sles11/ipl_tools/chreipl.h
@@ -14,9 +14,6 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  */
 
-#define ZSA_VERSION "1.0"
-
-
 extern int use_ccw;	/* ccw or fcp */
 extern int verbose;
 extern int bootprog;
Index: s390-tools-sles11/ipl_tools/getopt.c
===================================================================
--- s390-tools-sles11.orig/ipl_tools/getopt.c
+++ s390-tools-sles11/ipl_tools/getopt.c
@@ -29,27 +29,27 @@
 #include "zt_common.h"
 #include "chreipl.h"
 
-const char *version = ZSA_VERSION;
-
 const char *const usage_ripl =
 "Usage: %s TYPE ARGS [OPTIONS]\n"
 "\n"
-"TYPE specifies the IPL device type:\n"
+" chreipl ccw -d <DEVICE> [-L <LPARM>]\n"
+" chreipl fcp -d <DEVICE> -l <LUN> -w <WWPN> [-b <BPROG>]\n"
+" chreipl node <NODE>\n"
+" chreipl [-h] [-v]\n"
+"\n"
+"The types specify the IPL device type:\n"
 "  ccw      IPL from CCW device (e.g. DASD)\n"
 "  fcp      IPL from FCP device (e.g. SCSI)\n"
 "  node     IPL from device specified by device node (e.g. /dev/dasda)\n"
 "\n"
-"ARGS specifies IPL arguments:\n"
-"  -d, --device DEVICE Device number of the IPL device (ccw) or adapter (fcp)\n"
-"  -l  --lun LUN       Logical unit number of the IPL device (fcp)\n"
-"  -w  --wwpn WWPN     World Wide Port Name of the IPL device (fcp)\n"
-"  NODE                Device node of the IPL device, e.g. /dev/dasda (node)\n"
-"\n"
 "OPTIONS:\n"
-"  -b, --bootprog PARM   bootprog specification (fcp only)\n"
-"  -L, --loadparm PARM   Loadparm specification (dasd only)\n"
-"  -h, --help            Print this help, then exit\n"
-"  -v, --version         Print version information, then exit\n";
+"  -d, --device <DEVICE>  Number of the IPL device (ccw) or adapter (fcp)\n"
+"  -l  --lun <LUN>        Logical unit number of the IPL device\n"
+"  -w  --wwpn <WWPN>>      World Wide Port Name of the IPL device\n"
+"  -b, --bootprog <BPROG> Bootprog specification\n"
+"  -L, --loadparm <PARM> Loadparm specification\n"
+"  -h, --help             Print this help, then exit\n"
+"  -v, --version          Print version information, then exit\n";
 
 const char *const usage_sa =
 "Usage: %s TRIGGER ACTION [COMMAND] [OPTIONS]\n"
@@ -57,10 +57,11 @@ const char *const usage_sa =
 "Change action to be performed after shutdown.\n"
 "\n"
 "TRIGGER specifies when the action is performed:\n"
-"  halt      System has been shut down (e.g. shutdown -h)\n"
-"  poff      System has been shut down for power off (e.g. shutdown -p)\n"
+"  halt      System has been shut down (e.g. shutdown -h -H now)\n"
+"  poff      System has been shut down for power off (e.g. shutdown -h -P now)\n"
 "  reboot    System has been shut down for reboot (e.g. shutdown -r)\n"
 "  panic     System has been shut down after a kernel panic\n"
+"  Note: Depending on the distribution, \"halt\" might be mapped to \"poff\".\n"
 "\n"
 "ACTION specifies the action to be performed:\n"
 "  ipl       IPL with previous settings\n"
@@ -120,9 +121,9 @@ void print_usage_ripl(char program_name[
 
 void print_version()
 {
-	printf("%s: Linux on System z shutdown actions version  %s (%s)\n",
-		name, RELEASE_STRING, version);
-	printf("Copyright IBM Corp. 2008.\n");
+	printf("%s: Linux on System z shutdown actions version %s\n",
+		name, RELEASE_STRING);
+	printf("Copyright IBM Corp. 2008\n");
 	exit(0);
 }
 
@@ -263,7 +264,7 @@ static void check_blank(char *optarg1, c
 	 * this prevents e.g. -d4711 and enforces the
 	 * user to specify -d 4711
 	 */
-	if (optarg1 != optarg2) {
+	if (strcmp(optarg1, optarg2) != 0) {
 		fprintf(stderr, "%s: Unrecognized option: %s\n", name, optarg);
 		exit(1);
 	}
@@ -324,7 +325,7 @@ static void parse_node_args(char *nargv[
 	}
 
 	/* a valid entry has to start with /dev/ */
-	// XXX no valid assumption to check only strings...
+	/* XXX no valid assumption to check only strings... */
 	if (strlen(nargv[0]) < 8) {
 		fprintf(stderr, "%s: Invalid device node specified\n", name);
 		exit(1);
@@ -506,7 +507,6 @@ void parse_options(int argc, char **argv
 		fprintf(stderr, "%s: No valid action specified\n", name);
 		exit(1);
 	}
-		
 	/*
 	 * optind is a index which points to the first unrecognised
 	 * command line argument
@@ -575,11 +575,6 @@ void parse_shutdown_options(int argc, ch
 			printf("Try '%s' --help' for more information.\n",
 				argv[0]);
 			break;
-		case -1:
-			/*
-			 * we also run in this case if no argument was specified
-			 */
-			break;
 		default:
 			print_usage_sa(argv[0]);
 		}
@@ -647,6 +642,8 @@ void parse_shutdown_options(int argc, ch
 			rc = strwrt(argv[2],
 				"/sys/firmware/shutdown_actions/on_panic");
 			if (action == 4 && rc == 0) {
+				/*rc = ustrwrt(argv[3],
+					"/sys/firmware/vmcmd/on_reboot"); */
 				rc = ustrwrt(argv[3],
 					"/sys/firmware/vmcmd/on_panic");
 			}
Index: s390-tools-sles11/ipl_tools/ipl.c
===================================================================
--- s390-tools-sles11.orig/ipl_tools/ipl.c
+++ s390-tools-sles11/ipl_tools/ipl.c
@@ -124,7 +124,7 @@ void print_ipl_settings(void)
 	rc = strrd(devno, "/sys/firmware/ipl/device");
 	if (rc != 0)
 		exit(1) /* the error msg comes from get_ipl_device */;
-	if (devno != NULL)
+	if (strlen(devno) > 0)
 		printf("Device:        %s\n", devno);
 	if (type == 1) {
 		rc = get_ipl_loadparam();
@@ -136,10 +136,10 @@ void print_ipl_settings(void)
 	if (type == 0) {
 		/* these settings are only available for fcp */
 		rc = strrd(wwpn, "/sys/firmware/reipl/fcp/wwpn");
-		if (rc != -1 && wwpn != NULL)
+		if (rc != -1 && strlen(wwpn) > 0)
 			printf("WWPN:          %s\n", wwpn);
 		rc = strrd(lun, "/sys/firmware/ipl/lun");
-		if (rc != -1 && lun != NULL)
+		if (rc != -1 && strlen(lun) > 0)
 			printf("LUN:           %s\n", lun);
 		rc = strrd(bootprog, "/sys/firmware/reipl/fcp/bootprog");
 		if (rc != -1 && strlen(bootprog) > 0)
Index: s390-tools-sles11/ipl_tools/main.c
===================================================================
--- s390-tools-sles11.orig/ipl_tools/main.c
+++ s390-tools-sles11/ipl_tools/main.c
@@ -80,23 +80,23 @@ int lsreipl(int argc, char *argv[])
 		rc = strrd(lba, "/sys/firmware/reipl/fcp/br_lba");
 		if (rc != 0)
 			exit(1);
-	if (wwpn != NULL)
-		printf("WWPN:        %s\n", wwpn);
-	if (lun != NULL)
-		printf("LUN:         %s\n", lun);
-	if (devno != NULL)
-		printf("Device:      %s\n", devno);
-	if (bootprog != NULL)
-		printf("bootprog:    %s\n", bootprog);
-	if (lba != NULL)
-		printf("br_lba:      %s\n", lba);
+		if (strlen(wwpn) > 0)
+			printf("WWPN:        %s\n", wwpn);
+		if (strlen(lun) > 0)
+			printf("LUN:         %s\n", lun);
+		if (strlen(devno) > 0)
+			printf("Device:      %s\n", devno);
+		if (strlen(bootprog) > 0)
+			printf("bootprog:    %s\n", bootprog);
+		if (strlen(lba) > 0)
+			printf("br_lba:      %s\n", lba);
 	}
 	if (rc == 1) {
 		printf("Re-IPL type:   ccw\n");
 		rc = strrd(devno, "/sys/firmware/reipl/ccw/device");
 		if (rc != 0)
 			exit(1);
-		if (devno != NULL && strlen(devno) > 0)
+		if (strlen(devno) > 0)
 			printf("Device:        %s\n", devno);
 		/*
 		 * check if we can read the load parameter (Loadparm)
Index: s390-tools-sles11/README
===================================================================
--- s390-tools-sles11.orig/README
+++ s390-tools-sles11/README
@@ -6,7 +6,7 @@ s390-tools (1.8.0)
    The package contains:
 
    * dasdfmt:
-     Low-level format ECKD DASDs with the classical linux disk layout or the new
+     Low-level format ECKD DASDs with the classical Linux disk layout or the new
      z/OS compatible disk layout.
 
    * fdasd:
@@ -96,20 +96,20 @@ s390-tools (1.8.0)
      Set of scripts to configure and list status information of Linux for
      zSeries IO devices.
      - chccwdev: Modify generic attributes of channel attached devices.
-     - lscss:    List channel subsystem devices.
-     - lsdasd:   List channel attached direct access storage devices (DASD).
-     - lsqeth:   List all qeth-based network devices with their corresponding
-                 settings.
-     - lstape:   List tape devices, both channel and FCP attached.
-     - lszfcp:   Shows information contained in sysfs about zfcp adapters, ports
-                 and units that are online.
-     - lschp:    List information about available channel-paths.
-     - chchp:    Modify channel-path state.
-     - lsluns:   List available SCSI LUNs depending on adapter or port.
-     - lszcrypt: Show Information about zcrypt devices and configuration.
-     - chzcrypt: Modify zcrypt configuration.
-     - znetconf: List and configure network devices for System z network
-                 adapters.
+     - lscss:      List channel subsystem devices.
+     - lsdasd:     List channel attached direct access storage devices (DASD).
+     - lsqeth:     List all qeth-based network devices with their corresponding
+                   settings.
+     - lstape:     List tape devices, both channel and FCP attached.
+     - lszfcp:     Shows information contained in sysfs about zfcp adapters,
+                   ports and units that are online.
+     - lschp:      List information about available channel-paths.
+     - chchp:      Modify channel-path state.
+     - lsluns:     List available SCSI LUNs depending on adapter or port.
+     - lszcrypt:   Show Information about zcrypt devices and configuration.
+     - chzcrypt:   Modify zcrypt configuration.
+     - znetconf:   List and configure network devices for System z network
+                   adapters.
 
    * dumpconf:
      Allows to configure the dump device used for system dump in case a kernel
@@ -132,7 +132,7 @@ s390-tools (1.8.0)
      memory can be increased or decreased exploiting the CMM1 feature.
 
    * ipl_tools:
-     Tools set to configure and list reipl and shutdown actions.
+     Tool set to configure and list reipl and shutdown actions.
      - lsreipl: List information of reipl device.
      - chreipl: Change reipl device settings.
      - lsshut:  List actions which will be done in case of halt, poff, reboot
@@ -141,18 +141,17 @@ s390-tools (1.8.0)
                 reboot or panic.
 
    * ziomon tools:
-     Tool set to collect data for zfcp performance analysis and generate
-     reports.
+     Tool set to collect data for zfcp performance analysis and report.
 
    * iucvterm:
      z/VM IUCV terminal applications.
 
-     A set of applications to provide terminal access over the z/VM Inter-User
+     A set of applications to provide terminal access via the z/VM Inter-User
      Communication Vehicle (IUCV). The terminal access does not require an
-     active IP network connection between two Linux guest operating systems.
+     active TCP/IP connection between two Linux guest operating systems.
 
-     - iucvconn:  Start terminal connection over z/VM IUCV.
-     - iucvtty:   Allow remote logins over z/VM IUCV.
+     - iucvconn:  Application to establish a terminal connection via z/VM IUCV.
+     - iucvtty:   Application to provide terminal access via z/VM IUCV.
      - ts-shell:  Terminal server shell to authorize and control IUCV terminal
                   connections for individual Linux users.
 
@@ -160,7 +159,6 @@ s390-tools (1.8.0)
 For more information refer to the following publications:
    * "Device Drivers, Features, and Commands" chapter "Useful Linux commands"
    * "Using the dump tools"
-   * "How to Set up a Terminal Server Environment"
 
 Dependencies:
 =============
@@ -278,7 +276,7 @@ Release History:
 
     - dumpconf: Add VMCMD support
          The dumpconf init script now exploits the new "shutdown actions
-         interface" introduced with vanilla linux kernel 2.6.25. Up to
+         interface" introduced with vanilla Linux kernel 2.6.25. Up to
          five VM commands can be specified to be triggered in case of
          a kernel panic.
 
@@ -412,7 +410,7 @@ Release History:
 
      Added new features for existing tools:
      - zipl: multi boot, IPL from tape, custom dump size limit
-     - dbginfo.sh: adaptions for linux 2.6
+     - dbginfo.sh: adaptions for Linux 2.6
 
 1.2.2: Added new tool:
      - ip_watcher/start_hsnc
Index: s390-tools-sles11/etc/init.d/cpuplugd
===================================================================
--- s390-tools-sles11.orig/etc/init.d/cpuplugd
+++ s390-tools-sles11/etc/init.d/cpuplugd
@@ -1,8 +1,10 @@
 #!/bin/bash
 ### BEGIN INIT INFO
 # Provides: cpuplugd
-# Required-Start: $remote_fs
-# Required-Stop: $remote_fs
+# Required-Start: $local_fs $remote_fs
+# Required-Stop: $local_fs $remote_fs
+# Should-Start: 
+# Should-Stop: 
 # Default-Start: 2 3 4 5
 # Default-Stop: 0 1 6
 # Short-Description: Start the cpu hotplug daemon for Linux on System z
@@ -26,7 +28,13 @@ start()
 {
 	if [ ! -f $RUN_PID_FILE ]; then
 		echo -n $"Starting $DAEMON:"
-		$DAEMON_PATH $OPTIONS && log_success_msg || log_failure_msg
+		$DAEMON_PATH $OPTIONS
+		if [ $? == "0" ]; then
+			touch /var/lock/subsys/cpuplugd
+			log_success_msg
+		else
+			log_failure_msg
+		fi
 		echo
 	else
 		echo "$DAEMON (pid $(cat $RUN_PID_FILE)) is already running..."
@@ -41,6 +49,7 @@ stop()
 		killproc $DAEMON_PATH -TERM
 		log_success_msg
 		rm -f $RUN_PID_FILE
+		rm -f /var/lock/subsys/cpuplugd
 	else
 		log_failure_msg
 	fi
Index: s390-tools-sles11/etc/init.d/dumpconf
===================================================================
--- s390-tools-sles11.orig/etc/init.d/dumpconf
+++ s390-tools-sles11/etc/init.d/dumpconf
@@ -3,14 +3,16 @@
 # Provides: dumpconf
 # Required-Start: $local_fs
 # Required-Stop: $local_fs
-# Default-Start:  1 2 3 4 5
-# Default-Stop: 0 6
+# Should-Start:
+# Should-Stop:
+# Default-Start: 0 1 2 3 4 5 6
+# Default-Stop:
 # Short-Description: Configure s390 dump feature
 # Description: Configures the s390 dump feature. It uses the configuration file
 #              /etc/sysconfig/dumpconf
 ### END INIT INFO
 
-# chkconfig: 12345 01 99
+# chkconfig: 0123456 01 99
 
 DUMP_CONFIG_FILE=/etc/sysconfig/dumpconf
 ERRMSG="Check $DUMP_CONFIG_FILE!"
Index: s390-tools-sles11/etc/init.d/mon_statd
===================================================================
--- s390-tools-sles11.orig/etc/init.d/mon_statd
+++ s390-tools-sles11/etc/init.d/mon_statd
@@ -1,8 +1,10 @@
 #!/bin/bash
 ### BEGIN INIT INFO
 # Provides: mon_statd
-# Required-Start: $remote_fs
-# Required-Stop: $remote_fs
+# Required-Start: $local_fs $remote_fs
+# Required-Stop: $local_fs $remote_fs
+# Should-Start: 
+# Should-Stop: 
 # Default-Start: 2 3 4 5
 # Default-Stop: 0 1 6
 # Short-Description: Configure the mon_fsstatd and mon_procd daemons.
@@ -45,16 +47,26 @@ start()
 
 	if [ ! -f $FSSTATD_PID_FILE -a "$FSSTAT" = "yes" ]; then
 		echo -n $"Starting $FSSTATD:"
-		$FSSTATD_PATH -i $FSSTAT_INTERVAL && log_success_msg ||
-						     log_failure_msg
+		$FSSTATD_PATH -i $FSSTAT_INTERVAL
+		if [ $? == 0 ]; then
+			touch /var/lock/subsys/mon_statd
+			log_success_msg
+		else
+			log_failure_msg
+		fi
 	elif [ "$FSSTAT" = "yes" ]; then
 		echo "$FSSTATD (pid $(cat $FSSTATD_PID_FILE)) is already running..."
 	fi
 
 	if [ ! -f $PROCD_PID_FILE -a "$PROC" = "yes" ]; then
 		echo -n $"Starting $PROCD:"
-		$PROCD_PATH -i $PROC_INTERVAL && log_success_msg ||
-						 log_failure_msg
+		$PROCD_PATH -i $PROC_INTERVAL
+		if [ $? == 0 ]; then
+			touch /var/lock/subsys/mon_statd
+			log_success_msg
+		else
+			log_failure_msg
+		fi
 	elif [ "$PROC" = "yes" ]; then
 		echo "$PROCD (pid $(cat $PROCD_PID_FILE)) is already running..."
 	fi
@@ -80,6 +92,7 @@ stop()
 	else
 		log_failure_msg
 	fi
+	rm -f /var/lock/subsys/mon_statd
 	echo
 }
 
Index: s390-tools-sles11/ip_watcher/Makefile
===================================================================
--- s390-tools-sles11.orig/ip_watcher/Makefile
+++ s390-tools-sles11/ip_watcher/Makefile
@@ -1,6 +1,7 @@
 # Include common definitions
 include ../common.mak
 
+CFLAGS += -I../include
 all: xcec-bridge
 
 clean:
Index: s390-tools-sles11/ip_watcher/xcec-bridge.c
===================================================================
--- s390-tools-sles11.orig/ip_watcher/xcec-bridge.c
+++ s390-tools-sles11/ip_watcher/xcec-bridge.c
@@ -32,6 +32,7 @@
 #include <string.h>
 #include <dirent.h>
 #include <sys/stat.h>
+#include "zt_common.h"
 
 /* a signal causes the interfaces to be re-checked */
 
@@ -575,7 +576,7 @@ void process_packet(struct int_sock *i_s
 	}
 }
 
-void action_handler(int s)
+void action_handler(int UNUSED(s))
 {
 	update_interface_trigger=1;
 	syslog(LOG_DEBUG,"signal caught");
Index: s390-tools-sles11/qethconf/qethconf.8
===================================================================
--- s390-tools-sles11.orig/qethconf/qethconf.8
+++ s390-tools-sles11/qethconf/qethconf.8
@@ -20,7 +20,7 @@ vipa \- Virtual IP address (VIPA)
 parp|rxip \- Proxy ARP
 .br 
 list_all \- List all available IPA, VIPA and Proxy ARP entries 
-from the /proc\-filesystem (kernel 2.4) or from the sysfs (kernel 2.6)
+from the sysfs
 .TP 
 \fICMD\fR 
 <add/del/inv4/inv6/list>           
@@ -35,7 +35,7 @@ inv4 \- Invert the selection of address 
 .br 
 inv6 \- Invert the selection of address ranges for IPv6 (only IPA).
 .br 
-list \- List TYPE specific entries from the /proc\-filesystem (kernel 2.4) or from the sysfs (kernel 2.6) 
+list \- List TYPE specific entries from the sysfs 
 
 .TP 
 \fIIPADDR\fR
@@ -56,9 +56,8 @@ This subparameter is only valid for func
 .TP 
 \fIINTERFACE\fR
 Interface name to which the address or address range is 
-bound, e.g. eth0. This parameter is required for add and
-del commands. For Linux systems with a 2.6 kernel it is also 
-required for the inv4 and inv6 command. 
+bound, e.g. eth0. This parameter is required for add, 
+del and the inv4 and inv6 command. 
 
 
 .SH "RESTRICTIONS"
Index: s390-tools-sles11/zconf/chccwdev
===================================================================
--- s390-tools-sles11.orig/zconf/chccwdev
+++ s390-tools-sles11/zconf/chccwdev
@@ -1,6 +1,6 @@
 #!/bin/sh
 #==============================================================================
-# Copyright IBM Corp. 2003, 2006.
+# Copyright IBM Corp. 2003, 2009.
 #
 # chccwdev
 #
@@ -8,6 +8,7 @@
 # only support for kernels with sysfs support and the only attribute is online.
 #
 # Author(s): S. Bader <shbader@de.ibm.com>
+#            Sebastian Ott <sebott@linux.vnet.ibm.com>
 #
 # This file is part of s390-tools
 #
@@ -26,6 +27,7 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 #==============================================================================
 CMD=$(basename $0)
+MAX_RETRIES=5
 
 if [ "$(cat /proc/filesystems|grep sysfs)" = "" ]; then
 	echo "ERROR: $CMD requires sysfs support!" >&2
@@ -49,7 +51,7 @@ function PrintUsage() {
 		 		driver supports this.
 		  	-d|--offline
 		  		Tries to set the given device offline.
-		 	--version
+		 	-v|--version
 		 		Show tools and command version.
 
 		<devices>
@@ -59,10 +61,9 @@ function PrintUsage() {
 
 function PrintVersion()
 {
-	local TVER="1.18"
 	cat <<-EOD
-	$CMD: version %S390_TOOLS_VERSION% ($TVER).
-	Copyright IBM Corp. 2003, 2006.
+	$CMD: version %S390_TOOLS_VERSION%
+	Copyright IBM Corp. 2003, 2009
 	EOD
 }
 
@@ -138,7 +139,7 @@ while [ $# -gt 0 ]; do
 				ONLINE=0
 				ACTIONSET=true
 				;;
-		--version)
+		-v|--version)
 				PrintVersion
 				exit 0
 				;;
@@ -244,14 +245,23 @@ BUSIDLIST=$(
 			print "Invalid range order" >err
 			return -1
 		}
+		found = 0
 		for (i = from; i <= to; i++) {
 			# Expand ranges only to valid entries.
 			busid = parts1[1] "." parts1[2] "." dec2hex(i)
 			filen = SYSFSBASE busid "/devtype"
-			if ((getline x <filen) > 0)
+			if ((getline x <filen) > 0) {
+				found = 1
 				print busid
+			}
 			close(filen)
 		}
+		if (!found) {
+			print "No Device in range (" parts1[1] "." parts1[2] \
+				"." parts1[3] "-" parts2[1] "." parts2[2]    \
+				"." parts2[3] ") found" >err
+			return -1
+		}
 	}
 	BEGIN{
 		SYSFSBASE = "'$SYSFSDIR'/bus/ccw/devices/"
@@ -296,13 +306,14 @@ if ! $ACTIONSET; then
 fi
 
 function IsOnline() {
-	if [ ! -f "$1/online" ]; then
+	local ONLINE=$(cat $1/online 2>/dev/null)
+	if [ -z $ONLINE ]; then
 		if [ $2 -eq 0 ]; then
 			return 0
 		fi
 		return 1
 	fi
-	if [ $(cat $1/online) -eq $2 ]; then
+	if [ $ONLINE -eq $2 ]; then
 		return 0
 	fi
 	return 1
@@ -354,7 +365,7 @@ SAVEDATTRS=("${ATTRVAL[@]}")
 for BUSID in $BUSIDLIST; do
 	SYSPATH=$SYSFSDIR/bus/ccw/devices/$BUSID
 	if [ ! -r $SYSPATH ]; then
-		echo "$BUSID is not a channel device"
+		echo "Device $BUSID not found"
 		exit 1
 	fi
 
@@ -377,7 +388,7 @@ for BUSID in $BUSIDLIST; do
 				echo "WARNING: Device[$BUSID] is already " \
 					"online" >&2
 			else
-				echo "Device already is offline" >&2
+				echo "Device is already offline" >&2
 			fi
 		else
 			if [ "$ONLINE" -eq 1 ]; then
@@ -390,14 +401,15 @@ for BUSID in $BUSIDLIST; do
 			else
 				echo $ONLINE >$SYSPATH/online 2>/dev/null
 			fi
-
-			if ! IsOnline $SYSPATH $ONLINE; then
-				sleep 1
-				if ! IsOnline $SYSPATH $ONLINE; then
+			RETRIES=0
+			while ! IsOnline $SYSPATH $ONLINE; do
+				if [ $RETRIES -eq $MAX_RETRIES ]; then
 					echo "Failed" >&2
 					exit 1
 				fi
-			fi
+				sleep 0.5
+				let "RETRIES++"
+			done
 		fi
 	fi
 
Index: s390-tools-sles11/zconf/chccwdev.8
===================================================================
--- s390-tools-sles11.orig/zconf/chccwdev.8
+++ s390-tools-sles11/zconf/chccwdev.8
@@ -17,7 +17,7 @@ chccwdev \- modify generic attributes of
 .RI "[, " "<range>" " [...]]"
 .TP
 .B chccwdev
-.B --version
+.B -v
 
 .SH DESCRIPTION
 The chccwdev command is used to set generic attributes for devices that
@@ -55,7 +55,7 @@ rollback. All attributes that already ha
 Print help text.
 
 .TP 8
-.BR --version
+.BR -v | --version
 Print the version of the s390-tools package and the command.
 
 .TP
@@ -81,6 +81,10 @@ option are exclusive.
 \fB<range>\fR = <bus ID>\fB[-\fR<bus ID>\fB]\fR
 .TP
 \fB<bus ID>\fR = ([0-9]+\\.[0-9]+\\.)?[0-9a-f]{1,4}
+Note that bus IDs specified in short form (i.e. without leading "0.<n>.")
+will be interpreted as "0.0.<bus ID>".
+
+Example: "0192" becomes "0.0.0192".
 
 .SH EXAMPLES
 \fBchccwdev --online 0.0.0192,0.0.0195-0.0.0198\fR
Index: s390-tools-sles11/zconf/chchp
===================================================================
--- s390-tools-sles11.orig/zconf/chchp
+++ s390-tools-sles11/zconf/chchp
@@ -1,6 +1,6 @@
 #!/bin/bash
 #==============================================================================
-# Copyright IBM Corp. 2007
+# Copyright IBM Corp. 2007, 2009
 #
 # chchp
 #
@@ -53,8 +53,8 @@ EOF
 function print_version()
 {
 	cat <<EOF
-${TOOLNAME}: version ${VERSION}.
-Copyright IBM Corp. 2007
+${TOOLNAME}: version ${VERSION}
+Copyright IBM Corp. 2007, 2009
 EOF
 }
 
@@ -182,6 +182,12 @@ function check_and_set_value()
 			exit 1
 		fi
 	fi
+	if [ \( "$COMMAND" == "vary" -o "$COMMAND" == "configure" \) -a \
+	     "$1" != "0" -a "$1" != "1" ] ; then
+		echo "$TOOLNAME: Invalid value for --${COMMAND} (only 0 or 1" \
+		    "allowed)" >&2
+		exit 1
+	fi
 	VALUE=$1
 }
 
Index: s390-tools-sles11/zconf/chchp.8
===================================================================
--- s390-tools-sles11.orig/zconf/chchp.8
+++ s390-tools-sles11/zconf/chchp.8
@@ -104,8 +104,6 @@ or attribute values are available in the
 Print a short help text, then exit.
 .RE
 
-.B \-v
-.br
 .B \-\-version
 .RS
 Print version number, then exit.
Index: s390-tools-sles11/zconf/lscss
===================================================================
--- s390-tools-sles11.orig/zconf/lscss
+++ s390-tools-sles11/zconf/lscss
@@ -1,6 +1,6 @@
 #!/bin/bash
 #==============================================================================
-# Copyright IBM Corp. 2003,2008
+# Copyright IBM Corp. 2003,2009
 #
 # lscss
 #
@@ -54,7 +54,7 @@ function print_usage() {
 		 		identifiers.
 		 	--avail
 		 		Show availability attribute of IO devices.
-		 	--version
+		 	-v|--version
 		 		Show tools and command version.
 		 	-u|--uppercase
 		 		Print values using uppercase.
@@ -70,7 +70,7 @@ function print_usage() {
 function print_version()
 {
     VERSION="%S390_TOOLS_VERSION%"
-    echo -ne "$CMD: version $VERSION\nCopyright IBM Corp. 2003, 2008.\n"
+    echo -ne "$CMD: version $VERSION\nCopyright IBM Corp. 2003, 2009\n"
 }
 
 
@@ -81,6 +81,7 @@ IDFORMAT=[[:xdigit:]]*.[0-3].[[:xdigit:]
 
 unset SCH_IO SCH_CHSC SHOW_AVAIL UPPERCASE SHORTID DEVTYPES DEVRANGE RANGE
 shopt -s nocasematch
+shopt -s nullglob
 
 function check_id() #return 0 if $1 has a valid format
 {
@@ -165,7 +166,7 @@ while [ $# -gt 0 ]; do
 	    parse_devtypes $DEVTYPES
 	    shift
 	    ;;
-	--version)
+	-v|--version)
 	    print_version
 	    exit 0
 	    ;;
Index: s390-tools-sles11/zconf/lsluns.8
===================================================================
--- s390-tools-sles11.orig/zconf/lsluns.8
+++ s390-tools-sles11/zconf/lsluns.8
@@ -36,7 +36,7 @@ Shows LUNs for a specific port.
 .TP
 .B -a, --active
 Shows all activated LUNs. In addition information is provided
-whether the LUN is encrypted or not. This is indicated with a bracketed X
+whether the LUN is encrypted or not. This is indicated with a bracketed X 
 right after the LUN number.
 
 .SH EXAMPLES
Index: s390-tools-sles11/zconf/znetconf.8
===================================================================
--- s390-tools-sles11.orig/zconf/znetconf.8
+++ s390-tools-sles11/zconf/znetconf.8
@@ -1,6 +1,6 @@
 .TH ZNETCONF 8 "Mar 2009" "s390-tools"
 
-.SH NAME
+.SH NAME 
 znetconf \- list and configure network devices for System z network adapters
 
 .SH SYNOPSIS
@@ -8,10 +8,10 @@ znetconf \- list and configure network d
 .B [-h|--help] [-v|--version]
 .br
 
+.br  
+.B znetconf -u | -c 
 .br
-.B znetconf -u | -c
-.br
-.B znetconf -a <device_bus_id>[,...]{2} [-o <ATTR>=<VALUE>]+ [-d <DRIVER>]
+.B znetconf -a <device_bus_id>[,...]{2} [-o <ATTR>=<VALUE>]+ [-d <DRIVER>] 
 .br
 .B znetconf -A [-o <ATTR>=<VALUE>]+ [-d <DRIVER>] [-e <device_bus_id>]+
 .br
@@ -27,12 +27,12 @@ Based on these lists, it automatically a
 For automatic configuration, znetconf builds a channel command word
 (CCW) group device from sensed CCW devices, configures any specified
 option through the sensed network device driver and sets the new
-network device online.
+network device online. 
 .P
 During automatic removal, znetconf sets the device offline and removes it.
 Be aware that removing all network devices leads to the
-complete loss of network connectivity. So a terminal session (e.g. 3270)
-might be required to restore.
+complete loss of network connectivity. So a terminal session (e.g. 3270) 
+might be required to restore. 
 
 .SH OPTIONS
 .TP 8
@@ -43,30 +43,30 @@ Print help text.
 .BR -v | --version
 Print the version of the s390-tools package and the znetconf command.
 
-.TP
-.BR -u | --unconfigured
+.TP 
+.BR -u | --unconfigured	
 List potential network devices that are not yet configured.
 For each device, the following data is provided:
 .RS
 .TP 4
-*
-Device IDs (device bus bus-IDs) of the CCW devices constituting the network
+* 
+Device IDs (device bus bus-IDs) of the CCW devices constituting the network 
 device
 .TP
-*
+* 
 Type of control unit (e.g. 1731/01)
 .TP
-*
+* 
 Network card type (e.g. OSA (QDIO))
 .TP
 *
-Channel path identifier (CHPID)
+Channel path identifier (CHPID) 
 .TP
 *
 Device driver (qeth, lcs, ctc, ctcm)
 .RE
-.TP
-.BR -c | --configured
+.TP 
+.BR -c | --configured 
 List configured network devices. For each device, the following data is
 provided:
 .RS
@@ -104,7 +104,7 @@ device_bus_id can be any of the device
 IDs listed as part of the potential network device list (argument
 .BR -u ")."
 For example, if znetconf
-.BR -u
+.BR -u 
 lists 0.0.f503,0.0.f504,0.0.f505 for a potential network device, device_bus_id
 may be 0.0.f503 or 0.0.f504 or 0.0.f505.
 If a device bus-ID begins with 0.0., you can abbreviate it to the final 4
@@ -115,11 +115,11 @@ If attribute value pairs are given with
 .BR -o ", "
 these pairs are configured for the created network device. The
 device is then set online regardless of whether the given attribute value pairs
-were applied successfully.
+were applied successfully. 
 .br
 Finally, the corresponding network interface name (e.g. eth1) is displayed.
 .br
-If more then one device_bus_id is given, the given set of devices is configured as a network device. znetconf tries to sense the required device driver
+If more then one device_bus_id is given, the given set of devices is configured as a network device. znetconf tries to sense the required device driver 
 automatically. If the device driver cannot be sensed, you must specify it with
 -d.
 .BR -d "."
@@ -145,7 +145,7 @@ znetconf continues with the next remaini
 
 .TP
 .BR -r | --remove " <device_bus_id> [-n | --non-interactive]"
-Remove the network device identified by device_bus_id. device_bus_id is one of
+Remove the network device identified by device_bus_id. device_bus_id is one of 
 the device IDs of the network device. They are listed as part of znetconf
 .BR -c "."
 znetconf sets the device offline and removes it. If
@@ -167,18 +167,18 @@ Specify a device option. The option must
 to be configured.
 
 .TP
-\fB<device_bus_id>\fR
+\fB<device_bus_id>\fR 
 Specify the device bus-ID of a CCW device. Device bus-IDs have the form
 ([A-Fa-f0-9].[A-Fa-f0-9].)[A-Fa-f0-9]{4}.
 
-If a device bus-ID begins with 0.0., you can abbreviate it to the final 4
+If a device bus-ID begins with 0.0., you can abbreviate it to the final 4 
 hexadecimal digits.
 
 For example, you can abbreviate 0.0.f503 to f503.
 
 .TP
 \fB<DRIVER>\fR
-Specify the device driver for the device. Valid values are qeth, lcs, ctc, or
+Specify the device driver for the device. Valid values are qeth, lcs, ctc, or 
 ctcm.
 
 .SH EXAMPLES
@@ -242,9 +242,9 @@ Shows the list of potential network devi
 Device IDs                 Type    Card Type  CHPID Drv.
 .br
 --------------------------------------------------------
-0.0.f500,0.0.f501,0.0.f502 1731/01 OSA (QDIO) 00    qeth
+0.0.f500,0.0.f501,0.0.f502 1731/01 OSA (QDIO) 00    qeth   
 .br
-0.0.f503,0.0.f504,0.0.f505 1731/01 OSA (QDIO) 01    qeth
+0.0.f503,0.0.f504,0.0.f505 1731/01 OSA (QDIO) 01    qeth 
 .RE
 .P
 \fBznetconf -a 0.0.f503\fR
@@ -258,13 +258,13 @@ lists the new network device.
 .P
 \fBznetconf -a f503\fR
 .RS
-This command is equivalent to \fBznetconf -a 0.0.f503\fR.
+This command is equivalent to \fBznetconf -a 0.0.f503\fR. 
 .RE
 .P
 \fBznetconf -a f503 -o layer2=0 -o portname=myname\fR
 .RS
-Adds the potential network device
-with 0.0.f503 as one of its device bus-IDs
+Adds the potential network device 
+with 0.0.f503 as one of its device bus-IDs  
 and configures the options layer2 with value 0 and
 portname with myname.
 .RE
@@ -288,9 +288,9 @@ Device IDs                 Type    Card 
 
 \fBznetconf -r 0.0.f503\fR
 .RS
-Removes the network device with 0.0.f503 as one of its device bus-IDs.
+Removes the network device with 0.0.f503 as one of its device bus-IDs. 
 You can only remove configured devices as listed by znetconf
-.BR -c "."
+.BR -c "." 
 After successfully running this command the corresponding device appears in the
 list of potential network devices as listed by znetconf
 .BR -u "."
