Subject: [PATCH] [BZ none] s390-tools: Fix various compile warnings
From: Michael Holzheu <holzheu@linux.vnet.ibm.com>

SUSE requested to fix the s390-tools compile warnings for SLES11 (BZ 100681).
So do this now.

Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
---
 cmsfs-fuse/amap.c       |    5 ++--
 cmsfs-fuse/cmsfs-fuse.c |    4 +--
 cpuplugd/cpuplugd.h     |    1 
 cpuplugd/daemon.c       |    4 +--
 cpuplugd/main.c         |    2 -
 cpuplugd/terms.c        |    4 +--
 dasdfmt/dasdfmt.c       |   11 +++------
 dasdinfo/dasdinfo.c     |    4 +--
 fdasd/fdasd.c           |   54 ++++++++++++++++++++----------------------------
 include/vtoc.h          |    5 ----
 iucvterm/src/iucvtty.c  |    5 +---
 libvtoc/vtoc.c          |   19 ++++++----------
 zdump/dfi_vmcoreinfo.c  |    3 +-
 zfcpdump_v2/Makefile    |    2 -
 zfcpdump_v2/zfcpdump.c  |   19 ++++++++++------
 15 files changed, 64 insertions(+), 78 deletions(-)

--- a/cmsfs-fuse/amap.c
+++ b/cmsfs-fuse/amap.c
@@ -73,8 +73,9 @@ static off_t get_amap_addr(int level, of
 	if (level--) {
 		ptr = get_fixed_pointer(ptr + (off_t ) block * PTR_SIZE);
 		if (!ptr)
-			DIE("amap invalid ptr at addr: %lx\n",
-				ptr + block * PTR_SIZE);
+			DIE("amap invalid ptr at addr: %llx\n",
+				(unsigned long long) ptr +
+				(off_t) block * PTR_SIZE);
 		return get_amap_addr(level, addr, ptr);
 	}
 	return ptr;
--- a/cmsfs-fuse/cmsfs-fuse.c
+++ b/cmsfs-fuse/cmsfs-fuse.c
@@ -314,7 +314,7 @@ static void setup_iconv(iconv_t *conv, c
 
 static inline struct file *get_fobj(struct fuse_file_info *fi)
 {
-	return (struct file *) fi->fh;
+	return (struct file *)(unsigned long) fi->fh;
 }
 
 static int access_ok(size_t size, off_t addr)
@@ -1860,7 +1860,7 @@ static int cmsfs_open(const char *path,
 	if (fi->flags & O_RDWR || fi->flags & O_WRONLY)
 		f->write_count++;
 
-	fi->fh = (u64) f;
+	fi->fh = (uint64_t)(unsigned long) f;
 	return 0;
 }
 
--- a/cpuplugd/cpuplugd.h
+++ b/cpuplugd/cpuplugd.h
@@ -20,6 +20,7 @@
 #include <ctype.h>
 #include <syslog.h>
 #include <setjmp.h>
+#include "zt_common.h"
 
 #define NAME		"cpuplugd"
 #define MAX_CPU		64 /* max amount of possible cpus */
--- a/cpuplugd/daemon.c
+++ b/cpuplugd/daemon.c
@@ -102,7 +102,7 @@ void clean_up()
 /*
  * End the deamon
  */
-void kill_daemon(int a)
+void kill_daemon(int UNUSED(a))
 {
 	cpuplugd_info("shutting down\n");
 	remove(pid_file);
@@ -116,7 +116,7 @@ void kill_daemon(int a)
 /*
  * Reload the daemon (for lsb compliance)
  */
-void reload_handler(int a)
+void reload_handler(int UNUSED(a))
 {
 	reload_pending = 1;
 }
--- a/cpuplugd/main.c
+++ b/cpuplugd/main.c
@@ -69,7 +69,7 @@ static struct sigaction act;
 /*
  * Handle the sigfpe signal which we might catch during rule evaluating
  */
-static void sigfpe_handler(int sig)
+static void sigfpe_handler(int UNUSED(sig))
 {
 	longjmp(jmpenv, 1);
 }
--- a/cpuplugd/terms.c
+++ b/cpuplugd/terms.c
@@ -223,7 +223,7 @@ void print_term(struct term *fn)
 	}
 }
 
-static struct term *parse_var_term(char **p, enum op_prio prio)
+static struct term *parse_var_term(char **p)
 {
 	char *s, *var_rvalue;
 	struct term *fn;
@@ -309,7 +309,7 @@ struct term *parse_term(char **p, enum o
 		s++;
 	} else {
 		/* Check for variable name */
-		fn = parse_var_term(&s, OP_PRIO_NONE);
+		fn = parse_var_term(&s);
 		if (fn == NULL) {
 			for (i = 0; i < sym_names_count; i++)
 				if (strncmp(s, sym_names[i].name,
--- a/dasdfmt/dasdfmt.c
+++ b/dasdfmt/dasdfmt.c
@@ -161,10 +161,9 @@ static char* getdev(char* sysfs_path)
   return 0;
 }
 
-static void get_device_name(dasdfmt_info_t *info, char *name, int argc, char * argv[])
+static void get_device_name(dasdfmt_info_t *info, char *name,
+			    int UNUSED(argc), char *UNUSED(argv[]))
 {
-		DIR* d;
-		struct dirent* de;
 		char buf[PATH_MAX];
 		char devno[9];
 		char* device;
@@ -524,9 +523,8 @@ static void dasdfmt_write_labels(dasdfmt
 			    "failed, only wrote %d bytes.\n", prog_name, rc);
 
 	/* write VTOC */
-	vtoc_init_format4_label(&f4, USABLE_PARTITIONS, geo.cylinders,
-				cylinders, heads, geo.sectors, blksize,
-				dasd_info.dev_type);
+	vtoc_init_format4_label(&f4, geo.cylinders, cylinders, heads,
+				geo.sectors, blksize, dasd_info.dev_type);
 
 	vtoc_init_format5_label(&f5);
 	vtoc_init_format7_label(&f7);
@@ -883,7 +881,6 @@ int main(int argc,char *argv[])
 	char str[ERR_LENGTH];
 	char buf[7];
 
-	char *devno_param_str   = NULL;
 	char *blksize_param_str = NULL;
 	char *hashstep_str      = NULL;
 
--- a/dasdinfo/dasdinfo.c
+++ b/dasdinfo/dasdinfo.c
@@ -255,7 +255,7 @@ static int dinfo_read_dasd_vlabel (char
 {
 	struct dasd_data data;
 	struct volume_label tmp;
-	unsigned int vlsize = sizeof(struct volume_label);
+	int vlsize = sizeof(struct volume_label);
 	unsigned long vlabel_start;
 	char vollbl[5];
 	int f;
@@ -461,7 +461,7 @@ static int dinfo_get_dev_from_blockdev(c
 }
 
 static int
-dinfo_is_busiddir(const char *fpath, const struct stat *sb,
+dinfo_is_busiddir(const char *fpath, const struct stat *UNUSED(sb),
 		  int tflag, struct FTW *ftwbuf)
 {
 	char *tempdir;
--- a/fdasd/fdasd.c
+++ b/fdasd/fdasd.c
@@ -1329,8 +1329,8 @@ static void fdasd_recreate_vtoc_uncondit
 	partition_info_t *part_info = anc->first;
 	int i;
 
-	vtoc_init_format4_label(anc->f4, USABLE_PARTITIONS,
-				geo.cylinders, anc->formatted_cylinders,
+	vtoc_init_format4_label(anc->f4, geo.cylinders,
+				anc->formatted_cylinders,
 				geo.heads, geo.sectors,
 				anc->blksize, anc->dev_type);
 
@@ -1415,8 +1415,7 @@ fdasd_reuse_vtoc(fdasd_anchor_t *anc)
 
 	if (!anc->silent) printf("re-creating VTOC... ");
 
-	vtoc_init_format4_label(&f4, USABLE_PARTITIONS,
-				geo.cylinders, anc->formatted_cylinders,
+	vtoc_init_format4_label(&f4, geo.cylinders, anc->formatted_cylinders,
 				geo.heads, geo.sectors,
 				anc->blksize, anc->dev_type);
 
@@ -1441,12 +1440,10 @@ fdasd_reuse_vtoc(fdasd_anchor_t *anc)
 		}
 
 		if (anc->formatted_cylinders > LV_COMPAT_CYL)
-			vtoc_init_format8_label(anc->vlabel->volid,
-						anc->blksize,
+			vtoc_init_format8_label(anc->blksize,
 						&part_info->f1->DS1EXT1, &f1);
 		else
-			vtoc_init_format1_label(anc->vlabel->volid,
-						anc->blksize,
+			vtoc_init_format1_label(anc->blksize,
 						&part_info->f1->DS1EXT1, &f1);
 
 
@@ -1720,8 +1717,8 @@ fdasd_process_invalid_vtoc(fdasd_anchor_
 	anc->formatted_cylinders = anc->hw_cylinders;
 	anc->fspace_trk = anc->formatted_cylinders * geo.heads
 		- FIRST_USABLE_TRK;
-	vtoc_init_format4_label(anc->f4, USABLE_PARTITIONS,
-				geo.cylinders, anc->formatted_cylinders,
+	vtoc_init_format4_label(anc->f4, geo.cylinders,
+				anc->formatted_cylinders,
 				geo.heads, geo.sectors,
 				anc->blksize, anc->dev_type);
 
@@ -1895,8 +1892,8 @@ fdasd_invalid_vtoc_pointer(fdasd_anchor_
 	anc->formatted_cylinders = anc->hw_cylinders;
 	anc->fspace_trk = anc->formatted_cylinders * geo.heads
 		- FIRST_USABLE_TRK;
-	vtoc_init_format4_label(anc->f4, USABLE_PARTITIONS,
-				geo.cylinders, anc->formatted_cylinders,
+	vtoc_init_format4_label(anc->f4, geo.cylinders,
+				anc->formatted_cylinders,
 				geo.heads, geo.sectors,
 				anc->blksize, anc->dev_type);
 
@@ -1996,8 +1993,8 @@ fdasd_check_volume (fdasd_anchor_t *anc)
 
 		fdasd_init_volume_label(anc);
 
-		vtoc_init_format4_label(anc->f4, USABLE_PARTITIONS,
-					geo.cylinders, anc->formatted_cylinders,
+		vtoc_init_format4_label(anc->f4, geo.cylinders,
+					anc->formatted_cylinders,
 					geo.heads, geo.sectors,
 					anc->blksize, anc->dev_type);
 
@@ -2549,11 +2546,9 @@ fdasd_add_partition (fdasd_anchor_t *anc
 	        return;
 
 	if (anc->formatted_cylinders > LV_COMPAT_CYL) {
-		vtoc_init_format8_label(anc->vlabel->volid, anc->blksize, &ext,
-					part_info->f1);
+		vtoc_init_format8_label(anc->blksize, &ext, part_info->f1);
 	} else
-		vtoc_init_format1_label(anc->vlabel->volid, anc->blksize, &ext,
-					 part_info->f1);
+		vtoc_init_format1_label(anc->blksize, &ext, part_info->f1);
 
 	fdasd_enqueue_new_partition(anc);
 	anc->used_partitions += 1;
@@ -2642,8 +2637,8 @@ fdasd_auto_partition(fdasd_anchor_t *anc
 	fdasd_init_volume_label(anc);
 
 	if (anc->verbose) printf("initializing labels...\n");
-	vtoc_init_format4_label(anc->f4, USABLE_PARTITIONS,
-				geo.cylinders, anc->formatted_cylinders,
+	vtoc_init_format4_label(anc->f4, geo.cylinders,
+				anc->formatted_cylinders,
 				geo.heads, geo.sectors,
 				anc->blksize, anc->dev_type);
 
@@ -2665,11 +2660,9 @@ fdasd_auto_partition(fdasd_anchor_t *anc
 	vtoc_set_extent(&ext, 0x01, 0x00, &llimit, &ulimit);
 
 	if (anc->formatted_cylinders > LV_COMPAT_CYL) {
-		vtoc_init_format8_label(anc->vlabel->volid, anc->blksize, &ext,
-					part_info->f1);
+		vtoc_init_format8_label(anc->blksize, &ext, part_info->f1);
 	} else
-		vtoc_init_format1_label(anc->vlabel->volid, anc->blksize, &ext,
-					part_info->f1);
+		vtoc_init_format1_label(anc->blksize, &ext, part_info->f1);
         anc->fspace_trk      = 0;
 	anc->used_partitions = 1;
 
@@ -2689,7 +2682,6 @@ fdasd_auto_partition(fdasd_anchor_t *anc
 static void
 fdasd_auto_partition_conffile(fdasd_anchor_t *anc)
 {
-	volume_label_t *vlabel = anc->vlabel;
 	partition_info_t *part_info = anc->first;
 	cchh_t llimit,ulimit;
 	unsigned long start, stop;
@@ -2700,8 +2692,8 @@ fdasd_auto_partition_conffile(fdasd_anch
 	fdasd_init_volume_label(anc);
 
 	if (anc->verbose) printf("initializing labels...\n");
-	vtoc_init_format4_label(anc->f4, USABLE_PARTITIONS,
-				geo.cylinders, anc->formatted_cylinders,
+	vtoc_init_format4_label(anc->f4, geo.cylinders,
+				anc->formatted_cylinders,
 				geo.heads, geo.sectors,
 				anc->blksize, anc->dev_type);
 
@@ -2733,11 +2725,11 @@ fdasd_auto_partition_conffile(fdasd_anch
 				0x00, &llimit, &ulimit);
 
 		if (anc->formatted_cylinders > LV_COMPAT_CYL) {
-			vtoc_init_format8_label(vlabel->volid, anc->blksize,
-						&ext, part_info->f1);
+			vtoc_init_format8_label(anc->blksize, &ext,
+						part_info->f1);
 		} else
-			vtoc_init_format1_label(vlabel->volid, anc->blksize,
-						&ext, part_info->f1);
+			vtoc_init_format1_label(anc->blksize, &ext,
+						part_info->f1);
 		anc->used_partitions += 1;
 
 		get_addr_of_highest_f1_f8_label(anc, &hf1);
--- a/include/vtoc.h
+++ b/include/vtoc.h
@@ -337,14 +337,12 @@ void vtoc_write_label (
 
 
 void vtoc_init_format1_label (
-        char *volid,
         unsigned int blksize,
         extent_t *part_extent,
         format1_label_t *f1);
 
 void vtoc_init_format4_label (
         format4_label_t *f4lbl,
-	unsigned int usable_partitions,
 	unsigned int compat_cylinders,
 	unsigned int real_cylinders,
 	unsigned int tracks,
@@ -363,7 +361,6 @@ void vtoc_init_format5_label (
 void vtoc_update_format5_label_add (
 	format5_label_t *f5,
 	int verbose,
-	int cyl,
 	int trk,
 	u_int16_t a, 
 	u_int16_t b, 
@@ -372,7 +369,6 @@ void vtoc_update_format5_label_add (
 void vtoc_update_format5_label_del (
 	format5_label_t *f5,
 	int verbose,
-	int cyl,
 	int trk,
 	u_int16_t a, 
 	u_int16_t b, 
@@ -394,7 +390,6 @@ void vtoc_update_format7_label_del (
 	u_int32_t b);
 
 void vtoc_init_format8_label (
-        char *volid,
         unsigned int blksize,
         extent_t *part_extent,
         format1_label_t *f1);
--- a/iucvterm/src/iucvtty.c
+++ b/iucvterm/src/iucvtty.c
@@ -65,11 +65,10 @@ static int exec_login_prog(char *cmd[])
  * @client:	Client file descriptor
  * @master:	PTY master file descriptor
  * @slave:	PTY slave file descriptor
- * @host:	Originator z/VM guest virtual machine
  * @cfg:	IUCV TTY configuration structure.
  */
 static int iucvtty_worker(int client, int master, int slave,
-			  const char *host, const struct iucvterm_cfg *cfg)
+			  const struct iucvterm_cfg *cfg)
 {
 	int rc;
 	struct iucvtty_msg *msg;
@@ -273,7 +272,7 @@ int main(int argc, char *argv[])
 		}
 
 		/* handle client terminal connection */
-		rc = iucvtty_worker(client, master, slave, client_host, &conf);
+		rc = iucvtty_worker(client, master, slave, &conf);
 	}
 
 	close(client);
--- a/libvtoc/vtoc.c
+++ b/libvtoc/vtoc.c
@@ -8,6 +8,7 @@
  * 2003-01-30 changed DS4VTOCI from 0x20 to 0xa0
  */
 
+#include "zt_common.h"
 #include "vtoc.h"
 
 static unsigned char EBCtoASC[256] =
@@ -622,7 +623,6 @@ vtoc_write_label (char *device,
 void 
 vtoc_init_format4_label (
 	format4_label_t    *f4,
-	unsigned int usable_partitions,
 	unsigned int compat_cylinders,
 	unsigned int real_cylinders,
 	unsigned int tracks,
@@ -731,7 +731,6 @@ vtoc_init_format7_label (format7_label_t
  * format1 or format 8 label, all but the field DS1FMTID
  */
 static void vtoc_init_format_1_8_label (
-	char *volid,
         unsigned int blksize,
 	extent_t *part_extent,
 	format1_label_t *f1)
@@ -795,22 +794,20 @@ static void vtoc_init_format_1_8_label (
 }
 
 void vtoc_init_format1_label (
-	char *volid,
         unsigned int blksize,
 	extent_t *part_extent,
 	format1_label_t *f1)
 {
-	vtoc_init_format_1_8_label(volid, blksize, part_extent, f1);
+	vtoc_init_format_1_8_label(blksize, part_extent, f1);
 	f1->DS1FMTID = 0xf1;
 }
 
 void vtoc_init_format8_label (
-	char *volid,
         unsigned int blksize,
 	extent_t *part_extent,
 	format1_label_t *f8)
 {
-	vtoc_init_format_1_8_label(volid, blksize, part_extent, f8);
+	vtoc_init_format_1_8_label(blksize, part_extent, f8);
 	f8->DS1FMTID = 0xf8;
 }
 
@@ -898,7 +895,6 @@ vtoc_reorganize_FMT5_extents (format5_la
 void 
 vtoc_update_format5_label_add (format5_label_t *f5,
 			       int verbose,
-			       int cyl,
 			       int trk,
 			       u_int16_t a, 
 			       u_int16_t b, 
@@ -994,7 +990,6 @@ vtoc_update_format5_label_add (format5_l
 void 
 vtoc_update_format5_label_del (format5_label_t *f5,
 			       int verbose,
-			       int cyl,
 			       int trk,
 			       u_int16_t a,
 			       u_int16_t b,
@@ -1077,8 +1072,8 @@ vtoc_update_format5_label_del (format5_l
 			ext->fc = (a - ext->t) / trk;
 			ext->ft = (a - ext->t) % trk;
 
-			vtoc_update_format5_label_add(f5, verbose, 
-						      cyl, trk, x, y, z);
+			vtoc_update_format5_label_add(f5, verbose,
+						      trk, x, y, z);
 
 			if (verbose) 
 				printf("FMT5 del extent: 2 pieces\n");
@@ -1333,11 +1328,11 @@ void vtoc_set_freespace(format4_label_t
 		z =  (u_int8_t) ((stop - start + 1) % trk);
 
 		if (ch == '+') {
-			vtoc_update_format5_label_add(f5, verbose, cyl, trk,
+			vtoc_update_format5_label_add(f5, verbose, trk,
 						      x, y, z);
 		}
 		else if (ch == '-') {
-			vtoc_update_format5_label_del(f5, verbose, cyl, trk,
+			vtoc_update_format5_label_del(f5, verbose, trk,
 						      x, y, z);
 		}
 		else {
--- a/zdump/dfi_vmcoreinfo.c
+++ b/zdump/dfi_vmcoreinfo.c
@@ -129,7 +129,8 @@ char *dfi_vmcoreinfo_get(void)
 /*
  * Generic function: Return vmcoreinfo item (-1 on failure)
  */
-static int vmcoreinfo_item(char *buf, int len, const char *fmt, const char *sym)
+static int vmcoreinfo_item(char *buf, int UNUSED(len), const char *fmt,
+			   const char *sym)
 {
 
 	char str[1024], *sym_str, *sym_str_end;
--- a/zfcpdump_v2/Makefile
+++ b/zfcpdump_v2/Makefile
@@ -6,7 +6,7 @@ LINUX_VERSION := 2.6.27
 LINUX_DIR := linux-$(LINUX_VERSION)
 E2FSPROGS := e2fsprogs-1.41.3
 
-CFLAGS        += -D_FILE_OFFSET_BITS=64
+CFLAGS        += -D_FILE_OFFSET_BITS=64 -I../include
 
 all: zfcpdump.image
 
--- a/zfcpdump_v2/zfcpdump.c
+++ b/zfcpdump_v2/zfcpdump.c
@@ -29,6 +29,7 @@
 #include <sys/time.h>
 #include <linux/reboot.h>
 #include <asm/types.h>
+#include "zt_common.h"
 #include "zfcpdump.h"
 #ifdef GZIP_SUPPORT
 #include <zlib.h>
@@ -376,7 +377,8 @@ static void terminate(void)
 	fd = open(DEV_ZCORE_REIPL, O_WRONLY, 0);
 	if (fd == -1)
 		goto no_reipl;
-	write(fd, REIPL, 1);
+	if (write(fd, REIPL, 1) < 0)
+		PRINT_TRACE("Write REIPL failed\n");
 	close(fd);
 no_reipl:
 	reboot(LINUX_REBOOT_CMD_POWER_OFF);
@@ -385,7 +387,8 @@ no_reipl:
 /*
  * Signal handler for zfcp_dumper
  */
-static __sighandler_t dump_sig_handler(int sig, siginfo_t *sip, void*p)
+static __sighandler_t dump_sig_handler(int sig, siginfo_t *UNUSED(sip),
+				       void *UNUSED(p))
 {
 	PRINT_ERR("Got signal: %i\n", sig);
 	PRINT_ERR("Dump failed!\n");
@@ -529,7 +532,8 @@ static int erase_oldest_dump(void)
 	} else {
 		while ((strcmp(answ, "y") != 0) && (strcmp(answ, "n") != 0)) {
 			PRINT("Remove oldest dump: '%s' (y/n)? ", dname);
-			scanf("%s", answ);
+			if (scanf("%s", answ) == EOF)
+				answ[0] = '\0';
 		}
 		if (strcmp(answ, "n") == 0)
 			return -1;
@@ -563,7 +567,7 @@ static ssize_t dump_write(int fd, const
 	ssize_t written, rc;
 
 	written = 0;
-	while (written != count) {
+	while (written != (ssize_t) count) {
 		rc = write(fd, buf + written, count - written);
 		if ((rc == -1) && (errno == ENOSPC)) {
 			PRINT_ERR("No space left on device!\n");
@@ -621,8 +625,9 @@ static int compress_gzip(const unsigned
 /*
  * Do nothing! - No compression
  */
-static int compress_none(const unsigned char *old, __u32 old_size,
-			 unsigned char *new, __u32 new_size)
+static int compress_none(const unsigned char *UNUSED(old),
+			 __u32 UNUSED(old_size), unsigned char *UNUSED(new),
+			 __u32 UNUSED(new_size))
 {
 	return -1; /* "-1" indicates, that compression was not done */
 }
@@ -1045,7 +1050,7 @@ static void load_modules(void)
 /*
  * main routine of the zfcp_dumper
  */
-int main(int argc, char *argv[])
+int main(int UNUSED(argc), char *UNUSED(argv[]))
 {
 	char linux_version[128];
 
