From 20abda5666386f98a1ef220481fe844a63b28b40 Mon Sep 17 00:00:00 2001
From: Sascha Wildner <saw@online.de>
Date: Thu, 16 Feb 2017 09:00:25 +0100
Subject: [PATCH 4/4] Fix various ioctl functions regarding cmd type and usage.

---
 sys/bus/cam/cam_periph.c        | 3 +--
 sys/bus/cam/cam_periph.h        | 3 +--
 sys/dev/raid/vinum/vinumioctl.c | 2 +-
 sys/kern/subr_diskiocom.c       | 2 +-
 sys/net/ip_mroute/ip_mroute.c   | 4 ++--
 sys/netinet6/ip6_mroute.c       | 2 +-
 sys/netinet6/ip6_mroute.h       | 2 +-
 sys/sys/disk.h                  | 3 +--
 8 files changed, 9 insertions(+), 12 deletions(-)

diff --git a/sys/bus/cam/cam_periph.c b/sys/bus/cam/cam_periph.c
index 8c4d97095f..985ccee588 100644
--- a/sys/bus/cam/cam_periph.c
+++ b/sys/bus/cam/cam_periph.c
@@ -27,7 +27,6 @@
  * SUCH DAMAGE.
  *
  * $FreeBSD: src/sys/cam/cam_periph.c,v 1.70 2008/02/12 11:07:33 raj Exp $
- * $DragonFly: src/sys/bus/cam/cam_periph.c,v 1.41 2008/07/18 00:07:21 dillon Exp $
  */
 
 #include <sys/param.h>
@@ -840,7 +839,7 @@ cam_periph_ccbwait(union ccb *ccb)
 }
 
 int
-cam_periph_ioctl(struct cam_periph *periph, int cmd, caddr_t addr,
+cam_periph_ioctl(struct cam_periph *periph, u_long cmd, caddr_t addr,
 		 int (*error_routine)(union ccb *ccb, 
 				      cam_flags camflags,
 				      u_int32_t sense_flags))
diff --git a/sys/bus/cam/cam_periph.h b/sys/bus/cam/cam_periph.h
index 869e5b6e17..5cda084d4a 100644
--- a/sys/bus/cam/cam_periph.h
+++ b/sys/bus/cam/cam_periph.h
@@ -26,7 +26,6 @@
  * SUCH DAMAGE.
  *
  * $FreeBSD: src/sys/cam/cam_periph.h,v 1.18 2007/04/19 22:46:26 scottl Exp $
- * $DragonFly: src/sys/bus/cam/cam_periph.h,v 1.12 2008/07/18 00:07:21 dillon Exp $
  */
 
 #ifndef _CAM_CAM_PERIPH_H
@@ -159,7 +158,7 @@ int		cam_periph_runccb(union ccb *ccb,
 						       u_int32_t sense_flags),
 				  cam_flags camflags, u_int32_t sense_flags,
 				  struct devstat *ds);
-int		cam_periph_ioctl(struct cam_periph *periph, int cmd, 
+int		cam_periph_ioctl(struct cam_periph *periph, u_long cmd, 
 				 caddr_t addr,
 				 int (*error_routine)(union ccb *ccb,
 						      cam_flags camflags,
diff --git a/sys/dev/raid/vinum/vinumioctl.c b/sys/dev/raid/vinum/vinumioctl.c
index 044043cb8c..4566a5f6cd 100644
--- a/sys/dev/raid/vinum/vinumioctl.c
+++ b/sys/dev/raid/vinum/vinumioctl.c
@@ -317,12 +317,12 @@ vinumioctl(struct dev_ioctl_args *ap)
 	case VINUM_MOVE:
 	    moveobject((struct vinum_ioctl_msg *) data);
 	    break;
+	case VINUM_LABEL:
 	default:
 	    error = EINVAL;
 	    break;
 	}
 	break;
-    case VINUM_LABEL:
     case VINUM_DRIVE_TYPE:
     case VINUM_SD_TYPE:
     case VINUM_RAWSD_TYPE:
diff --git a/sys/kern/subr_diskiocom.c b/sys/kern/subr_diskiocom.c
index 946c360857..e816960d97 100644
--- a/sys/kern/subr_diskiocom.c
+++ b/sys/kern/subr_diskiocom.c
@@ -107,7 +107,7 @@ disk_iocom_uninit(struct disk *dp)
 }
 
 int
-disk_iocom_ioctl(struct disk *dp, int cmd, void *data)
+disk_iocom_ioctl(struct disk *dp, u_long cmd, caddr_t *data)
 {
 	struct file *fp;
 	struct disk_ioc_recluster *recl;
diff --git a/sys/net/ip_mroute/ip_mroute.c b/sys/net/ip_mroute/ip_mroute.c
index e86bf4ded8..79129dfa71 100644
--- a/sys/net/ip_mroute/ip_mroute.c
+++ b/sys/net/ip_mroute/ip_mroute.c
@@ -237,7 +237,7 @@ static int	X_ip_mrouter_done(void);
 static int	X_ip_mrouter_get(struct socket *so, struct sockopt *m);
 static int	X_ip_mrouter_set(struct socket *so, struct sockopt *m);
 static int	X_legal_vif_num(int vif);
-static int	X_mrt_ioctl(int cmd, caddr_t data);
+static int	X_mrt_ioctl(u_long cmd, caddr_t data);
 
 static int get_sg_cnt(struct sioc_sg_req *);
 static int get_vif_cnt(struct sioc_vif_req *);
@@ -493,7 +493,7 @@ X_ip_mrouter_get(struct socket *so, struct sockopt *sopt)
  * Handle ioctl commands to obtain information from the cache
  */
 static int
-X_mrt_ioctl(int cmd, caddr_t data)
+X_mrt_ioctl(u_long cmd, caddr_t data)
 {
     int error = 0;
 
diff --git a/sys/netinet6/ip6_mroute.c b/sys/netinet6/ip6_mroute.c
index 6d97d660cf..8da2b248af 100644
--- a/sys/netinet6/ip6_mroute.c
+++ b/sys/netinet6/ip6_mroute.c
@@ -329,7 +329,7 @@ ip6_mrouter_get(struct socket *so, struct sockopt *sopt)
  * Handle ioctl commands to obtain information from the cache
  */
 int
-mrt6_ioctl(int cmd, caddr_t data)
+mrt6_ioctl(u_long cmd, caddr_t data)
 {
 	int error = 0;
 
diff --git a/sys/netinet6/ip6_mroute.h b/sys/netinet6/ip6_mroute.h
index 396dcbd910..8c562954bb 100644
--- a/sys/netinet6/ip6_mroute.h
+++ b/sys/netinet6/ip6_mroute.h
@@ -287,7 +287,7 @@ struct socket;
 int	ip6_mrouter_set (struct socket *so, struct sockopt *sopt);
 int	ip6_mrouter_get (struct socket *so, struct sockopt *sopt);
 int	ip6_mrouter_done (void);
-int	mrt6_ioctl (int, caddr_t);
+int	mrt6_ioctl (u_long, caddr_t);
 #endif /* _KERNEL */
 
 #endif /* !_NETINET6_IP6_MROUTE_H_ */
diff --git a/sys/sys/disk.h b/sys/sys/disk.h
index 9729e412e6..1b32a89b67 100644
--- a/sys/sys/disk.h
+++ b/sys/sys/disk.h
@@ -39,7 +39,6 @@
  * ----------------------------------------------------------------------------
  *
  * $FreeBSD: src/sys/sys/disk.h,v 1.16.2.3 2001/06/20 16:11:01 scottl Exp $
- * $DragonFly: src/sys/sys/disk.h,v 1.18 2007/07/30 08:02:40 dillon Exp $
  */
 
 #ifndef _SYS_DISK_H_
@@ -187,7 +186,7 @@ int bounds_check_with_mediasize(struct bio *bio, int secsize, uint64_t mediasize
 void disk_iocom_init(struct disk *dp);
 void disk_iocom_update(struct disk *dp);
 void disk_iocom_uninit(struct disk *dp);
-int disk_iocom_ioctl(struct disk *dp, int cmd, void *data);
+int disk_iocom_ioctl(struct disk *dp, u_long cmd, caddr_t *data);
 void disk_clusterctl_wakeup(kdmsg_iocom_t *iocom);
 
 typedef struct disk_msg {
-- 
2.11.0

