public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cciss/cpqarray/md should use generic BLKGETSIZE
@ 2003-01-16 21:40 Christoph Hellwig
  0 siblings, 0 replies; 2+ messages in thread
From: Christoph Hellwig @ 2003-01-16 21:40 UTC (permalink / raw)
  To: marcelo; +Cc: linux-kernel

I did that already in 2.4.9/2.4.10 timeframe but it looks like a few
offenders started duplicating code again..



--- 1.28/drivers/block/cciss.c	Thu Dec 12 17:14:12 2002
+++ edited/drivers/block/cciss.c	Wed Jan 15 23:15:36 2003
@@ -505,16 +505,12 @@
 			return  -EFAULT;
 		return 0;
 	}
-	case BLKGETSIZE:
-		put_user(hba[ctlr]->hd[MINOR(inode->i_rdev)].nr_sects, (unsigned long *)arg);
-		return 0;
-	case BLKGETSIZE64:
-		put_user((u64)hba[ctlr]->hd[MINOR(inode->i_rdev)].nr_sects << 9, (u64*)arg);
-		return 0;
 	case BLKRRPART:
 		if (!capable(CAP_SYS_ADMIN))
 			return -EPERM;
 		return revalidate_logvol(inode->i_rdev, 1);
+	case BLKGETSIZE:
+	case BLKGETSIZE64:
 	case BLKFLSBUF:
 	case BLKBSZSET:
 	case BLKBSZGET:
===== drivers/block/cpqarray.c 1.27 vs edited =====
--- 1.27/drivers/block/cpqarray.c	Tue Dec 17 00:26:25 2002
+++ edited/drivers/block/cpqarray.c	Wed Jan 15 23:16:02 2003
@@ -1279,13 +1279,6 @@
 		ida_ioctl_t *io = (ida_ioctl_t*)arg;
 		return copy_to_user(&io->c.drv,&hba[ctlr]->drv[dsk],sizeof(drv_info_t));
 	}
-	case BLKGETSIZE:
-		if (!arg) 
-			return -EINVAL;
-		return put_user(hba[ctlr]->hd[MINOR(inode->i_rdev)].nr_sects, 
-			(unsigned long *)arg);
-	case BLKGETSIZE64:
-		return put_user((u64)(hba[ctlr]->hd[MINOR(inode->i_rdev)].nr_sects) << 9, (u64*)arg);
 	case BLKRRPART:
 		return revalidate_logvol(inode->i_rdev, 1);
 	case IDAPASSTHRU:
@@ -1379,6 +1372,8 @@
 		return(0);
 	}
 
+	case BLKGETSIZE:
+	case BLKGETSIZE64:
 	case BLKFLSBUF:
 	case BLKBSZSET:
 	case BLKBSZGET:
===== drivers/md/md.c 1.37 vs edited =====
--- 1.37/drivers/md/md.c	Fri Jan  3 00:45:34 2003
+++ edited/drivers/md/md.c	Wed Jan 15 23:15:01 2003
@@ -2617,21 +2617,8 @@
 			goto done;
 #endif
 
-		case BLKGETSIZE:	/* Return device size */
-			if (!arg) {
-				err = -EINVAL;
-				MD_BUG();
-				goto abort;
-			}
-			err = md_put_user(md_hd_struct[minor].nr_sects,
-						(unsigned long *) arg);
-			goto done;
-
-		case BLKGETSIZE64:	/* Return device size */
-			err = md_put_user((u64)md_hd_struct[minor].nr_sects << 9,
-						(u64 *) arg);
-			goto done;
-
+		case BLKGETSIZE:
+		case BLKGETSIZE64:
 		case BLKRAGET:
 		case BLKRASET:
 		case BLKFLSBUF:

^ permalink raw reply	[flat|nested] 2+ messages in thread
* [PATCH] cciss/cpqarray/md should use generic BLKGETSIZE
@ 2002-12-13 22:52 Christoph Hellwig
  0 siblings, 0 replies; 2+ messages in thread
From: Christoph Hellwig @ 2002-12-13 22:52 UTC (permalink / raw)
  To: marcelo; +Cc: linux-kernel

I did that already in 2.4.9/2.4.10 timeframe but it looks like a few
offenders started duplicating code again..


--- 1.27/drivers/block/cciss.c	Wed Dec  4 01:00:00 2002
+++ edited/drivers/block/cciss.c	Fri Dec 13 15:23:19 2002
@@ -468,16 +468,12 @@
 			return  -EFAULT;
 		return(0);
 	}
-	case BLKGETSIZE:
-		put_user(hba[ctlr]->hd[MINOR(inode->i_rdev)].nr_sects, (unsigned long *)arg);
-		return 0;
-	case BLKGETSIZE64:
-		put_user((u64)hba[ctlr]->hd[MINOR(inode->i_rdev)].nr_sects << 9, (u64*)arg);
-		return 0;
 	case BLKRRPART:
 		if(!capable(CAP_SYS_ADMIN))
 			return -EPERM;
 		return revalidate_logvol(inode->i_rdev, 1);
+	case BLKGETSIZE:
+	case BLKGETSIZE64:
 	case BLKFLSBUF:
 	case BLKBSZSET:
 	case BLKBSZGET:
--- 1.26/drivers/block/cpqarray.c	Mon Oct 28 16:18:57 2002
+++ edited/drivers/block/cpqarray.c	Fri Dec 13 15:24:07 2002
@@ -1287,12 +1287,6 @@
 
 	case IDAGETDRVINFO:
 		return copy_to_user(&io->c.drv,&hba[ctlr]->drv[dsk],sizeof(drv_info_t));
-	case BLKGETSIZE:
-		if (!arg) return -EINVAL;
-		return put_user(hba[ctlr]->hd[MINOR(inode->i_rdev)].nr_sects, 
-			(unsigned long *)arg);
-	case BLKGETSIZE64:
-		return put_user((u64)(hba[ctlr]->hd[MINOR(inode->i_rdev)].nr_sects) << 9, (u64*)arg);
 	case BLKRRPART:
 		return revalidate_logvol(inode->i_rdev, 1);
 	case IDAPASSTHRU:
@@ -1360,6 +1354,8 @@
 		return(0);
 	}
 
+	case BLKGETSIZE:
+	case BLKGETSIZE64:
 	case BLKFLSBUF:
 	case BLKBSZSET:
 	case BLKBSZGET:
--- 1.33/drivers/md/md.c	Tue Aug  6 16:42:18 2002
+++ edited/drivers/md/md.c	Fri Dec 13 15:24:42 2002
@@ -2610,21 +2610,8 @@
 			goto done;
 #endif
 
-		case BLKGETSIZE:	/* Return device size */
-			if (!arg) {
-				err = -EINVAL;
-				MD_BUG();
-				goto abort;
-			}
-			err = md_put_user(md_hd_struct[minor].nr_sects,
-						(unsigned long *) arg);
-			goto done;
-
-		case BLKGETSIZE64:	/* Return device size */
-			err = md_put_user((u64)md_hd_struct[minor].nr_sects << 9,
-						(u64 *) arg);
-			goto done;
-
+		case BLKGETSIZE:
+		case BLKGETSIZE64:
 		case BLKRAGET:
 		case BLKRASET:
 		case BLKFLSBUF:

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-01-16 14:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-01-16 21:40 [PATCH] cciss/cpqarray/md should use generic BLKGETSIZE Christoph Hellwig
  -- strict thread matches above, loose matches on Subject: below --
2002-12-13 22:52 Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox