rpms/s390utils/F-12 0015-s390tools-1.8.2-zipl-dm.patch, NONE, 1.1 0016-s390tools-1.8.2-lsreipl-nss.patch, NONE, 1.1 s390utils.spec, 1.15, 1.16

Dan Horák sharkcz at fedoraproject.org
Thu Dec 10 17:48:03 UTC 2009


Author: sharkcz

Update of /cvs/pkgs/rpms/s390utils/F-12
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv17378

Modified Files:
	s390utils.spec 
Added Files:
	0015-s390tools-1.8.2-zipl-dm.patch 
	0016-s390tools-1.8.2-lsreipl-nss.patch 
Log Message:
- added device-mapper support into zipl (#546280)
- added missing check and print NSS name in case an NSS has been IPLed (#546297)


0015-s390tools-1.8.2-zipl-dm.patch:
 include/disk.h                |   25 +
 include/install.h             |    9 
 include/job.h                 |   17 
 include/scan.h                |   19 -
 man/zipl.8                    |   88 +++++
 man/zipl.conf.5               |   71 ++++
 src/Makefile                  |    1 
 src/bootmap.c                 |   70 +---
 src/disk.c                    |  242 +++++++++++---
 src/install.c                 |   11 
 src/job.c                     |  362 ++++++++++++++++++++-
 src/scan.c                    |  262 ++++++++++++++-
 src/zipl.c                    |   13 
 src/zipl_helper.device-mapper |  717 +++++++++++++++++++++++++++++++++++++++++-
 14 files changed, 1759 insertions(+), 148 deletions(-)

--- NEW FILE 0015-s390tools-1.8.2-zipl-dm.patch ---
>From e089f907d7ba7f18479eaff61852171842a219e2 Mon Sep 17 00:00:00 2001
From: =?utf-8?q?Dan=20Hor=C3=A1k?= <dan at danny.cz>
Date: Thu, 10 Dec 2009 18:27:58 +0100
Subject: [PATCH 15/16] s390tools-1.8.2-zipl-dm

device mapper support for zipl
---
 zipl/include/disk.h                |   25 ++-
 zipl/include/install.h             |    9 +-
 zipl/include/job.h                 |   17 +-
 zipl/include/scan.h                |   19 +-
 zipl/man/zipl.8                    |   88 +++++-
 zipl/man/zipl.conf.5               |   71 ++++-
 zipl/src/Makefile                  |    1 +
 zipl/src/bootmap.c                 |   70 ++---
 zipl/src/disk.c                    |  242 ++++++++++---
 zipl/src/install.c                 |   11 +-
 zipl/src/job.c                     |  362 +++++++++++++++++-
 zipl/src/scan.c                    |  262 ++++++++++++-
 zipl/src/zipl.c                    |   13 +-
 zipl/src/zipl_helper.device-mapper |  716 ++++++++++++++++++++++++++++++++++++
 14 files changed, 1759 insertions(+), 147 deletions(-)
 create mode 100644 zipl/src/zipl_helper.device-mapper

diff --git a/zipl/include/disk.h b/zipl/include/disk.h
index c5179b7..4b39698 100644
--- a/zipl/include/disk.h
+++ b/zipl/include/disk.h
@@ -2,7 +2,7 @@
  * s390-tools/zipl/include/disk.h
  *   Functions to handle disk layout specific operations.
  *
- * Copyright IBM Corp. 2001, 2006.
+ * Copyright IBM Corp. 2001, 2009.
  *
  * Author(s): Carsten Otte <cotte at de.ibm.com>
  *            Peter Oberparleiter <Peter.Oberparleiter at de.ibm.com>
@@ -59,6 +59,19 @@ struct hd_geometry {
 	unsigned long start;
 };
 
+/* Disk information source */
+typedef enum {
+	source_auto,
+	source_user,
+	source_script
+} source_t;
+
+/* targetbase definition */
+typedef enum {
+	defined_as_device,
+	defined_as_name
+} definition_t;
+
 /* Disk information type */
 struct disk_info {
 	disk_type_t type;
@@ -72,11 +85,17 @@ struct disk_info {
 	struct hd_geometry geo;
 	char* name;
 	char* drv_name;
+	source_t source;
+	definition_t targetbase;
 };
 
+struct job_target_data;
 
-int disk_get_info(const char* device, struct disk_info** info);
-int disk_get_info_from_file(const char* filename, struct disk_info** info);
+int disk_get_info(const char* device, struct job_target_data* target,
+		  struct disk_info** info);
+int disk_get_info_from_file(const char* filename,
+			    struct job_target_data* target,
+			    struct disk_info** info);
 void disk_free_info(struct disk_info* info);
 char* disk_get_type_name(disk_type_t type);
 int disk_is_large_volume(struct disk_info* info);
diff --git a/zipl/include/install.h b/zipl/include/install.h
index ba31bff..5504deb 100644
--- a/zipl/include/install.h
+++ b/zipl/include/install.h
@@ -2,7 +2,7 @@
  * s390-tools/zipl/include/install.h
  *   Functions handling the installation of the boot loader code onto disk.
  *
- * Copyright IBM Corp. 2001, 2006.
+ * Copyright IBM Corp. 2001, 2009.
  *
  * Author(s): Carsten Otte <cotte at de.ibm.com>
  *            Peter Oberparleiter <Peter.Oberparleiter at de.ibm.com>
@@ -24,8 +24,9 @@ int install_tapeloader(const char* device, const char* image,
 		       const char* parmline, const char* ramdisk,
 		       address_t image_addr, address_t parm_addr,
 		       address_t initrd_addr);
-int install_dump(const char* device, uint64_t mem);
-int install_mvdump(char* const device[], int device_count, uint64_t mem,
-		   uint8_t force);
+int install_dump(const char* device, struct job_target_data* target,
+		 uint64_t mem);
+int install_mvdump(char* const device[], struct job_target_data* target,
+		   int device_count, uint64_t mem, uint8_t force);
 
 #endif /* INSTALL_H */
diff --git a/zipl/include/job.h b/zipl/include/job.h
index 824ffc4..cf881db 100644
--- a/zipl/include/job.h
+++ b/zipl/include/job.h
@@ -3,7 +3,7 @@
  *   Functions and data structures representing the actual 'job' that the
  *   user wants us to execute.
  *
- * Copyright IBM Corp. 2001, 2006.
+ * Copyright IBM Corp. 2001, 2009.
  *
  * Author(s): Carsten Otte <cotte at de.ibm.com>
  *            Peter Oberparleiter <Peter.Oberparleiter at de.ibm.com>
@@ -13,6 +13,7 @@
 #define JOB_H
 
 #include "zipl.h"
+#include "disk.h"
 
 
 enum job_id {
@@ -27,6 +28,17 @@ enum job_id {
 	job_mvdump = 9,
 };
 
+struct job_target_data {
+	char* bootmap_dir;
+	char* targetbase;
+	disk_type_t targettype;
+	int targetcylinders;
+	int targetheads;
+	int targetsectors;
+	int targetblocksize;
+	blocknum_t targetoffset;
+};
+
 struct job_ipl_data {
 	char* image;
 	char* parmline;
@@ -94,7 +106,7 @@ struct job_menu_data {
 
 struct job_data {
 	enum job_id id;
-	char* bootmap_dir;
+	struct job_target_data target;
 	char* name;
 	union {
 		struct job_ipl_data ipl;
@@ -115,5 +127,6 @@ struct job_data {
 
 int job_get(int argc, char* argv[], struct job_data** data);
 void job_free(struct job_data* job);
+int type_from_target(char *target, disk_type_t *type);
 
 #endif /* not JOB_H */
diff --git a/zipl/include/scan.h b/zipl/include/scan.h
index b1c0e3a..ed5714e 100644
--- a/zipl/include/scan.h
+++ b/zipl/include/scan.h
@@ -2,7 +2,7 @@
  * s390-tools/zipl/include/scan.h
  *   Scanner for zipl.conf configuration files
  *
- * Copyright IBM Corp. 2001, 2006.
+ * Copyright IBM Corp. 2001, 2009.
  *
  * Author(s): Carsten Otte <cotte at de.ibm.com>
  *            Peter Oberparleiter <Peter.Oberparleiter at de.ibm.com>
@@ -15,7 +15,7 @@
 
 
 #define SCAN_SECTION_NUM		7
-#define SCAN_KEYWORD_NUM		14
+#define SCAN_KEYWORD_NUM		19
 
 enum scan_id {
 	scan_id_empty = 0,
@@ -40,6 +40,11 @@ enum scan_keyword_id {
 	scan_keyword_defaultmenu = 11,
 	scan_keyword_tape	= 12,
 	scan_keyword_mvdump	= 13,
+	scan_keyword_targetbase = 14,
+	scan_keyword_targettype = 15,
+	scan_keyword_targetgeometry = 16,
+	scan_keyword_targetblocksize = 17,
+	scan_keyword_targetoffset = 18,
 };
 
 enum scan_section_type {
@@ -53,6 +58,14 @@ enum scan_section_type {
 	section_mvdump		= 6,
 };
 
+enum scan_target_type {
+	target_type_invalid	= -1,
+	target_type_scsi	= 0,
[...2317 lines suppressed...]
+			$type = $DEV_TYPE_LDL;
+		} elsif ($format == 2) {
+			$type = $DEV_TYPE_CDL;
+		}
+	}
+
+	return ($type, $cyl, $heads, $sectors);
+}
+
+# get_partition_start(device)
+# Return the partition offset of device.
+sub get_partition_start($)
+{
+	my ($dev) = @_;
+	my $line;
+	my $offset;
+	local *HANDLE;
+
+	open(HANDLE, "$blockdev --report $dev 2>/dev/null|") or
+		return undef;
+	$line = <HANDLE>;
+	if ($line =~ /RO\s+RA\s+SSZ\s+BSZ\s+StartSec\s+Size\s+Device/) {
+		$line = <HANDLE>;
+		if ($line =~ /^\S+\s+\d+\s+\d+\s+\d+\s+(\d+)/) {
+			$offset = $1;
+		}
+	}
+	close(HANDLE);
+	return $offset;
+}
+
+# is_dasd(type)
+# Return whether disk with type is a DASD.
+sub is_dasd($)
+{
+	my ($type) = @_;
+
+	return ($type == $DEV_TYPE_CDL) || ($type == $DEV_TYPE_LDL) ||
+	       ($type == $DEV_TYPE_FBA);
+}
+
+# get_partition_base(type, major, minor)
+# Return (major, minor) of the base device on which the partition is located.
+sub get_partition_base($$$)
+{
+	my ($type, $major, $minor) = @_;
+
+	if (is_dasd($type)) {
+		return ($major, $minor & ~$DASD_PARTN_MASK);
+	} else {
+		return ($major, $minor & ~$SCSI_PARTN_MASK);
+	}
+}
+
+# get_device_characteristics(major, minor)
+# Returns (type, blocksize, geometry, bootsectors, partstart) for device.
+sub get_device_characteristics($$)
+{
+	my ($major, $minor) = @_;
+	my $dev;
+	my $blocksize;
+	my $type;
+	my $cyl;
+	my $heads;
+	my $sectors;
+	my $geometry;
+	my $bootsectors;
+	my $partstart;
+
+	$dev = create_temp_device_node("b", $major, $minor);
+	$blocksize = get_blocksize($dev);
+	if (!defined($blocksize)) {
+		unlink($dev);
+		die("Error: Could not get block size for ".
+		    get_device_name($major, $minor)."\n");
+	}
+	($type, $cyl, $heads, $sectors) = get_dasd_info($dev);
+	if (defined($type)) {
+		$geometry = "$cyl,$heads,$sectors";
+		if ($type == $DEV_TYPE_CDL) {
+			# First track contains IPL records
+			$bootsectors = $blocksize * $sectors / $SECTOR_SIZE;
+		} elsif ($type == $DEV_TYPE_LDL) {
+			# First two blocks contain IPL records
+			$bootsectors = $blocksize * 2 / $SECTOR_SIZE;
+		} elsif ($type == $DEV_TYPE_FBA) {
+			# First block contains IPL records
+			$bootsectors = $blocksize / $SECTOR_SIZE;
+		}
+	} else {
+		# Assume SCSI if get_dasd_info failed
+		$type = $DEV_TYPE_SCSI;
+		# First block contains IPL records
+		$bootsectors = $blocksize / $SECTOR_SIZE;
+	}
+	$partstart = get_partition_start($dev);
+	unlink($dev);
+	if (!defined($partstart)) {
+		die("Error: Could not determine partition start for ".
+		    get_device_name($major, $minor)."\n");
+	}
+	return ($type, $blocksize, $geometry, $bootsectors, $partstart);
+}
+
+# get_type_name(type)
+# Return textual representation of device type.
+sub get_type_name($)
+{
+	my ($type) = @_;
+
+	if ($type == $DEV_TYPE_CDL) {
+		return "CDL";
+	} elsif ($type == $DEV_TYPE_LDL) {
+		return "LDL";
+	} elsif ($type == $DEV_TYPE_FBA) {
+		return "FBA";
+	} elsif ($type == $DEV_TYPE_SCSI) {
+		return "SCSI";
+	}
+	return undef;
+}
+
+
+# check_for_mirror(index, target_list)
+# Die if there is a mirror target between index and 0.
+sub check_for_mirror($@)
+{
+	my ($i, @target_list) = @_;
+
+	for (;$i >= 0; $i--) {
+		my $entry = $target_list[$i];
+		my ($major, $minor, $target) = @$entry;
+
+		if ($target->[$TARGET_TYPE] == $TARGET_TYPE_MIRROR) {
+			# IPL records are not mirrored.
+			die("Error: Unsupported setup: Block 0 is not ".
+			    "mirrored in device '".
+			    get_device_name($major, $minor)."'\n");
+		}
+	}
+}
+
+# get_target_base(bottom_major, bottom_minor, start, length, target_list)
+# Return (major, minor) for the top most target in the target list that maps
+# the region on (bottom_major, bottom_minor) defined by start and length at
+# offset 0.
+sub get_target_base($$$$@)
+{
+	my ($bot_major, $bot_minor, $start, $length, @target_list) = @_;
+	my $entry;
+	my $top_major;
+	my $top_minor;
+	my $i;
+
+	# Pre-initialize with bottom major-minor
+	$top_major = $bot_major;
+	$top_minor = $bot_minor;
+	# Process all entries starting with the last one
+	for ($i = scalar(@target_list) - 1; $i >= 0; $i--) {
+		my $entry = $target_list[$i];
+		my ($major, $minor, $target) = @$entry;
+
+		if (($target->[$TARGET_START] != 0) ||
+		    (get_target_start($target) != 0) ||
+		    ($target->[$TARGET_LENGTH] < $length)) {
+			last;
+		}
+		$top_major = $major;
+		$top_minor = $minor;
+	}
+	# Check for mirrorring between base device and fs device.
+	check_for_mirror($i, @target_list);
+	return ($top_major, $top_minor);
+}
+
+# get_device_name(major, minor)
+# Return the name of the device specified by major and minor.
+sub get_device_name($$)
+{
+	my ($major, $minor) = @_;
+	my $name;
+	local *HANDLE;
+
+	$name = "$major:$minor";
+	open(HANDLE, "</proc/partitions") or goto out;
+	while (<HANDLE>) {
+		if (/^\s*(\d+)\s+(\d+)\s+\d+\s+(\S+)\s*$/) {
+			if (($major == $1) && ($minor == $2)) {
+				$name = $3;
+				last;
+			}
+		}
+	}
+	close(HANDLE);
+out:
+	return $name;
+}
-- 
1.6.3.3


0016-s390tools-1.8.2-lsreipl-nss.patch:
 ccw.c     |   42 ++++++++++++++++++------------------------
 chreipl.h |    9 ++++++---
 fcp.c     |   13 +++++++------
 ipl.c     |   57 +++++++++++++++++++++++++++++++++++----------------------
 main.c    |   25 +++++++++++++++++++------
 system.c  |    4 ++--
 6 files changed, 87 insertions(+), 63 deletions(-)

--- NEW FILE 0016-s390tools-1.8.2-lsreipl-nss.patch ---
>From 62fb535a68f1df693869e4361150259b42c6f211 Mon Sep 17 00:00:00 2001
From: =?utf-8?q?Dan=20Hor=C3=A1k?= <dan at danny.cz>
Date: Thu, 10 Dec 2009 18:30:52 +0100
Subject: [PATCH 16/16] s390tools-1.8.2-lsreipl-nss

---
 ipl_tools/ccw.c     |   42 ++++++++++++++++---------------------
 ipl_tools/chreipl.h |    9 +++++--
 ipl_tools/fcp.c     |   13 ++++++-----
 ipl_tools/ipl.c     |   57 +++++++++++++++++++++++++++++++-------------------
 ipl_tools/main.c    |   25 +++++++++++++++++-----
 ipl_tools/system.c  |    3 +-
 6 files changed, 87 insertions(+), 62 deletions(-)

diff --git a/ipl_tools/ccw.c b/ipl_tools/ccw.c
index 7959831..eef4550 100644
--- a/ipl_tools/ccw.c
+++ b/ipl_tools/ccw.c
@@ -52,22 +52,19 @@ int isccwdev(const char *devno)
 }
 
 
-int get_ccw_devno_old_sysfs(char *device, char *devno)
+int get_ccw_devno_old_sysfs(char *device)
 {
 	FILE *filp;
-	int len, errorpath, rc;
+	int errorpath;
 	char path1[4096];
 	char buf[4096];
-	char *match, *s1, *s2;
+	char *match = NULL, *s1, *s2;
 
 	errorpath = 1;
-	rc = 0;
 	sprintf(path1, "/sys/block/%s/uevent", device);
 	filp = fopen(path1, "r");
-	if (!filp) {
-		rc = -1;
-		return rc;
-	}
+	if (!filp)
+		return -1;
 	/*
 	 * the uevent file contains an entry like this:
 	 * PHYSDEVPATH=/devices/css0/0.0.206a/0.0.7e78
@@ -77,16 +74,16 @@ int get_ccw_devno_old_sysfs(char *device, char *devno)
 		if (match != NULL)
 			break;
 	}
+	fclose(filp);
+	if (!match)
+		return -1;
 	s1 =  strchr(buf, '/');
 	s2 =  strrchr(buf, '/');
-	len = s2-s1;
-	strncpy(devno, s2 + 1, sizeof(devno));
-	devno[len] = '\0';
-	fclose(filp);
+	strncpy(devno, s2 + 1, sizeof(devno) - 1);
 	return 0;
 }
 
-int get_ccw_devno_new_sysfs(char *device, char *devno)
+int get_ccw_devno_new_sysfs(char *device)
 {
 	int len, errorpath, rc;
 	char path2[4096];
@@ -119,8 +116,7 @@ int get_ccw_devno_new_sysfs(char *device, char *devno)
 			return rc;
 		}
 	}
-	strncpy(devno, s2 + 1, sizeof(devno));
-	devno[len] = '\0';
+	strncpy(devno, s2 + 1, sizeof(devno) - 1);
 	return 0;
 }
 
@@ -134,16 +130,14 @@ int get_ccw_devno_new_sysfs(char *device, char *devno)
  *
  * This does not work when booting from tape
  */
-int get_ccw_devno(char *device, char *devno)
+int get_ccw_devno(char *device)
 {
-    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 0;
+	if (get_ccw_devno_old_sysfs(device) == 0)
+		return 0;
+	if (get_ccw_devno_new_sysfs(device) == 0)
+		return 0;
+	fprintf(stderr, "%s: Failed to lookup the device number\n", name);
+	return -1;
 }
 
 int get_ccw_dev(char *partition, char *device)
diff --git a/ipl_tools/chreipl.h b/ipl_tools/chreipl.h
index 19a83eb..37807a7 100644
--- a/ipl_tools/chreipl.h
+++ b/ipl_tools/chreipl.h
@@ -34,6 +34,9 @@ extern char saction[8];
 extern char name[256];
 extern int action;
 
+#define IPL_TYPE_LEN_MAX	100
+#define NSS_NAME_LEN_MAX	8
+
 #define ACT_CCW		1
 #define ACT_FCP		2
 #define ACT_NODE	3
@@ -63,10 +66,10 @@ int is_valid_case(char *c);
 int is_valid_action(char *action);
 void parse_shutdown_options(int argc, char **argv);
 void strlow(char *s);
-int get_ccw_devno(char *device, char *devno);
-int get_reipl_type(void);
+int get_ccw_devno(char *device);
+int get_reipl_type(char *reipltype);
 void parse_lsreipl_options(int argc, char **argv);
-int get_ipl_type();
+int get_ipl_type(char *reipltype);
 int get_ipl_loadparam(void);
 void print_ipl_settings(void);
 int get_sa(char *action, char *file);
diff --git a/ipl_tools/fcp.c b/ipl_tools/fcp.c
index 86fa95b..7a8b4c5 100644
--- a/ipl_tools/fcp.c
+++ b/ipl_tools/fcp.c
@@ -33,12 +33,11 @@
 
 /*
  * return the current reipl type from /sys/firmware/reipl/reipl_type
- * 0 = fcp, 1 = ccw, -1, error
+ * 0 = fcp, 1 = ccw, 2 = nss, -1 = unknown
  */
-int get_reipl_type(void)
+int get_reipl_type(char *reipltype)
 {
 	FILE *filp;
-	char reipltype[4];
 	char path[4096];
 	int rc;
 
@@ -49,7 +48,7 @@ int get_reipl_type(void)
 			fprintf(stderr,	"%s: Can not open /sys/firmware/"
 				"reipl/reipl_type: ", name);
 			fprintf(stderr, "%s\n", strerror(errno));
-			return -1;
+			exit(1);
 		}
 		rc = fscanf(filp, "%s", reipltype);
 		fclose(filp);
@@ -57,17 +56,19 @@ int get_reipl_type(void)
 			fprintf(stderr, "%s: Failed to read "
 				"/sys/firmware/reipl/reipl_type:", name);
 			fprintf(stderr, "%s\n", strerror(errno));
-			return -1;
+			exit(1);
 		}
 		if (strncmp(reipltype, "fcp", strlen("fcp")) == 0)
 			return T_FCP;
 		else if (strncmp(reipltype, "ccw", strlen("ccw")) == 0)
 			return T_CCW;
-		/* TODO: add NSS support */
+		else if (strncmp(reipltype, "nss", strlen("nss")) == 0)
+			return T_NSS;
 	} else {
 		fprintf(stderr, "%s: Can not open /sys/firmware/reipl/"
 			"reipl_type:", name);
 		fprintf(stderr, " %s\n", strerror(errno));
+		exit(1);
 	}
 	return -1;
 }
diff --git a/ipl_tools/ipl.c b/ipl_tools/ipl.c
index 2bf817a..8cca700 100644
--- a/ipl_tools/ipl.c
+++ b/ipl_tools/ipl.c
@@ -33,12 +33,11 @@
 
 /*
  * return the ipl type based on /sys/firmware/ipl/ipl_type
- * returns 0 in case of fcp and 1 in case of ccw, -1 otherwise
+ * returns 0 in case of fcp and 1 in case of ccw, 2 for nss and -1 otherwise
  */
-int get_ipl_type()
+int get_ipl_type(char *reipltype)
 {
 	FILE *filp;
-	char reipltype[4];
 	char path[4096];
 	int rc;
 
@@ -49,7 +48,7 @@ int get_ipl_type()
 			fprintf(stderr,	"%s: Can not open /sys/firmware/ipl/"
 				"ipl_type: ", name);
 			fprintf(stderr, "%s\n", strerror(errno));
-			return -1;
+			exit(1);
 		}
 		rc = fscanf(filp, "%s", reipltype);
 		fclose(filp);
@@ -57,12 +56,14 @@ int get_ipl_type()
 			fprintf(stderr, "%s: Failed to read "
 				"/sys/firmware/ipl/ipl_type: ", name);
 			fprintf(stderr, "%s\n", strerror(errno));
-			return -1;
+			exit(1);
 		}
 		if (strncmp(reipltype, "fcp", strlen("fcp")) == 0)
 			return T_FCP;
 		else if (strncmp(reipltype, "ccw", strlen("ccw")) == 0)
 			return T_CCW;
+		else if (strncmp(reipltype, "nss", strlen("nss")) == 0)
+			return T_NSS;
 	} else {
 		fprintf(stderr, "%s: Can not open /sys/firmware/ipl/"
 			"ipl_type:", name);
@@ -111,30 +112,38 @@ int get_ipl_loadparam(void)
 void print_ipl_settings(void)
 {
 	int rc, type;
-	char bootprog[1024], lba[1024];
+	char bootprog[1024], lba[1024], nss_name[NSS_NAME_LEN_MAX + 1];
+	char reipltype[IPL_TYPE_LEN_MAX + 1];
 
-	type = get_ipl_type();
-	/*
-	 * TODO: add nss support
-	 */
-	if (type == 1)
+	type = get_ipl_type(reipltype);
+	switch (type) {
+	case T_NSS:
+		printf("IPL type:      nss\n");
+		rc = strrd(nss_name, "/sys/firmware/ipl/name");
+		if (rc != 0)
+			exit(1);
+		printf("Name:          %s\n", nss_name);
+		break;
+	case T_CCW:
 		printf("IPL type:      ccw\n");
-	if (type == 0)
-		printf("IPL type:      fcp\n");
-	rc = strrd(devno, "/sys/firmware/ipl/device");
-	if (rc != 0)
-		exit(1) /* the error msg comes from get_ipl_device */;
-	if (strlen(devno) > 0)
-		printf("Device:        %s\n", devno);
-	if (type == 1) {
+		rc = strrd(devno, "/sys/firmware/ipl/device");
+		if (rc != 0)
+			exit(1);
+		if (strlen(devno) > 0)
+			printf("Device:        %s\n", devno);
 		rc = get_ipl_loadparam();
 		if (rc != -1)
 			printf("Loadparm:      %d\n", rc);
 		else
 			printf("Loadparm:      \n");
-	}
-	if (type == 0) {
-		/* these settings are only available for fcp */
+		break;
+	case T_FCP:
+		printf("IPL type:      fcp\n");
+		rc = strrd(devno, "/sys/firmware/ipl/device");
+		if (rc != 0)
+			exit(1);
+		if (strlen(devno) > 0)
+			printf("Device:        %s\n", devno);
 		rc = strrd(wwpn, "/sys/firmware/reipl/fcp/wwpn");
 		if (rc != -1 && strlen(wwpn) > 0)
 			printf("WWPN:          %s\n", wwpn);
@@ -147,6 +156,10 @@ void print_ipl_settings(void)
 		rc = strrd(lba, "/sys/firmware/ipl/br_lba");
 		if (rc != -1 &&  strlen(lba) > 0)
 			printf("br_lba:        %s\n", lba);
+		break;
+	default:
+		printf("IPL type:      %s (unknown)\n", reipltype);
+		break;
 	}
 	exit(0);
 }
diff --git a/ipl_tools/main.c b/ipl_tools/main.c
index 2eaa043..bcebabe 100644
--- a/ipl_tools/main.c
+++ b/ipl_tools/main.c
@@ -57,13 +57,22 @@ int action;		/* either CCW, FCP or NODE */
 int lsreipl(int argc, char *argv[])
 {
 	int rc;
-	char bootprog[1024], lba[1024], val[9];
+	char bootprog[1024], lba[1024], val[9], reipltype[IPL_TYPE_LEN_MAX + 1];
+	char nss_name[NSS_NAME_LEN_MAX + 1];
 
 	/* parse the command line options in getop.c */
 	parse_lsreipl_options(argc, argv);
 
-	rc = get_reipl_type();
-	if (rc == 0) {
+	rc = get_reipl_type(reipltype);
+	switch (rc) {
+	case T_NSS:
+		printf("Re-IPL type:   nss\n");
+		rc = strrd(nss_name, "/sys/firmware/reipl/nss/name");
+		if (rc != 0)
+			exit(1);
+		printf("Name:          %s\n", nss_name);
+		break;
+	case T_FCP:
 		printf("Re-IPL type: fcp\n");
 		rc = strrd(wwpn, "/sys/firmware/reipl/fcp/wwpn");
 		if (rc != 0)
@@ -90,8 +99,8 @@ int lsreipl(int argc, char *argv[])
 			printf("bootprog:    %s\n", bootprog);
 		if (strlen(lba) > 0)
 			printf("br_lba:      %s\n", lba);
-	}
-	if (rc == 1) {
+		break;
+	case T_CCW:
 		printf("Re-IPL type:   ccw\n");
 		rc = strrd(devno, "/sys/firmware/reipl/ccw/device");
 		if (rc != 0)
@@ -106,6 +115,10 @@ int lsreipl(int argc, char *argv[])
 			printf("Loadparm:      %s\n", val);
 		else
 			printf("Loadparm:      \n");
+		break;
+	default:
+		printf("Re-IPL type: %s (unknown)\n", reipltype);
+		break;
 	}
 	return 0;
 }
@@ -134,7 +147,7 @@ int reipl(int argc, char *argv[])
 					"partition: %s\n", name, partition);
 				exit(1);
 			}
-			rc = get_ccw_devno(device, devno);
+			rc = get_ccw_devno(device);
 			if (rc != 0)  {
 				fprintf(stderr, "%s: Unable to lookup device"
 					" number for device %s\n", name,
diff --git a/ipl_tools/system.c b/ipl_tools/system.c
index fd5b76b..ca6c5af 100644
--- a/ipl_tools/system.c
+++ b/ipl_tools/system.c
@@ -174,7 +174,7 @@ int strrd(char *string, char *file)
 			fprintf(stderr, "%s\n", strerror(errno));
 			exit(1);
 		}
-		rc = fread(string, 4096, 1, filp);
+		rc = fread(string, 1, 4096, filp);
 		fclose(filp);
 		/*
 		 *  special handling is required for
@@ -193,6 +193,7 @@ int strrd(char *string, char *file)
 			fprintf(stderr, "%s\n", strerror(errno));
 			return -1;
 		} else {
+			string[rc] = 0;
 			if (string[strlen(string) - 1] == '\n')
 				string[strlen(string) - 1] = 0;
 			return 0;
-- 
1.6.3.3



Index: s390utils.spec
===================================================================
RCS file: /cvs/pkgs/rpms/s390utils/F-12/s390utils.spec,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -p -r1.15 -r1.16
--- s390utils.spec	1 Dec 2009 09:59:31 -0000	1.15
+++ s390utils.spec	10 Dec 2009 17:48:03 -0000	1.16
@@ -46,6 +46,8 @@ Patch11:  0011-update-readahead-value-fo
 Patch12:  0012-fix-multipath-device-detection-in-ziomon.patch
 Patch13:  0013-zipl-handle-status-during-ipl.patch
 Patch14:  0014-dasdview-fdasd-fix-floating-point-error-for-unformat.patch
+Patch15:  0015-s390tools-1.8.2-zipl-dm.patch
+Patch16:  0016-s390tools-1.8.2-lsreipl-nss.patch
 
 Patch100:       cmsfs-1.1.8-warnings.patch
 Patch101:       cmsfs-1.1.8-kernel26.patch
@@ -117,6 +119,12 @@ be used together with the zSeries (s390)
 # Fix floating point error for unformatted devices in fdasd and dasdview (#537144)
 %patch14 -p1 -b .dasd-zero-division
 
+# Add device-mapper support into zipl (#546280)
+%patch15 -p1 -b .zipl-dm
+
+# Add missing check and print NSS name in case an NSS has been IPLed (#546297)
+%patch16 -p1 -b .lsreipl-nss
+
 #
 # cmsfs
 #
@@ -798,9 +806,11 @@ User-space development files for the s39
 
 
 %changelog
-* Tue Dec  1 2009 Dan Horák <dan[at]danny.cz> 2:1.8.2-6
+* Thu Dec 10 2009 Dan Horák <dan[at]danny.cz> 2:1.8.2-6
 - fixed return value in cpi initscript (#541389)
 - updated zfcpconf.sh script from dracut
+- added device-mapper support into zipl (#546280)
+- added missing check and print NSS name in case an NSS has been IPLed (#546297)
 
 * Fri Nov 13 2009 Dan Horák <dan[at]danny.cz> 2:1.8.2-5
 - added multiple fixes from IBM (#533955, #537142, #537144)




More information about the scm-commits mailing list