VServer 1.9.2 (patch-2.6.8.1-vs1.9.2.diff)
[linux-2.6.git] / drivers / mtd / mtd_blkdevs.c
index 4a0f2ea..b134315 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: mtd_blkdevs.c,v 1.16 2003/06/23 13:34:43 dwmw2 Exp $
+ * $Id: mtd_blkdevs.c,v 1.22 2004/07/12 12:35:28 dwmw2 Exp $
  *
  * (C) 2003 David Woodhouse <dwmw2@infradead.org>
  *
@@ -220,7 +220,7 @@ static int blktrans_ioctl(struct inode *inode, struct file *file,
                                return ret;
 
                        g.start = get_start_sect(inode->i_bdev);
-                       if (copy_to_user((void *)arg, &g, sizeof(g)))
+                       if (copy_to_user((void __user *)arg, &g, sizeof(g)))
                                return -EFAULT;
                        return 0;
                } /* else */
@@ -295,7 +295,10 @@ int add_mtd_blktrans_dev(struct mtd_blktrans_dev *new)
        snprintf(gd->devfs_name, sizeof(gd->devfs_name),
                 "%s/%c", tr->name, (tr->part_bits?'a':'0') + new->devnum);
 
-       set_capacity(gd, new->size);
+       /* 2.5 has capacity in units of 512 bytes while still
+          having BLOCK_SIZE_BITS set to 10. Just to keep us amused. */
+       set_capacity(gd, (new->size * new->blksize) >> 9);
+
        gd->private_data = new;
        new->blkcore_priv = gd;
        gd->queue = tr->blkcore_priv->rq;