summaryrefslogtreecommitdiffstats
path: root/drivers/block/md.c
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>1999-06-17 13:25:08 +0000
committerRalf Baechle <ralf@linux-mips.org>1999-06-17 13:25:08 +0000
commit59223edaa18759982db0a8aced0e77457d10c68e (patch)
tree89354903b01fa0a447bffeefe00df3044495db2e /drivers/block/md.c
parentdb7d4daea91e105e3859cf461d7e53b9b77454b2 (diff)
Merge with Linux 2.3.6. Sorry, this isn't tested on silicon, I don't
have a MIPS box at hand.
Diffstat (limited to 'drivers/block/md.c')
-rw-r--r--drivers/block/md.c62
1 files changed, 10 insertions, 52 deletions
diff --git a/drivers/block/md.c b/drivers/block/md.c
index 77090708e..bd610dc7b 100644
--- a/drivers/block/md.c
+++ b/drivers/block/md.c
@@ -59,6 +59,7 @@
#define MD_DRIVER
#include <linux/blk.h>
+#include <linux/blkpg.h>
#include <asm/uaccess.h>
#include <asm/bitops.h>
#include <asm/atomic.h>
@@ -98,36 +99,6 @@ struct md_dev md_dev[MAX_MD_DEV];
int md_thread(void * arg);
-static struct gendisk *find_gendisk (kdev_t dev)
-{
- struct gendisk *tmp=gendisk_head;
-
- while (tmp != NULL)
- {
- if (tmp->major==MAJOR(dev))
- return (tmp);
-
- tmp=tmp->next;
- }
-
- return (NULL);
-}
-
-char *partition_name (kdev_t dev)
-{
- static char name[40]; /* This should be long
- enough for a device name ! */
- struct gendisk *hd = find_gendisk (dev);
-
- if (!hd)
- {
- sprintf (name, "[dev %s]", kdevname(dev));
- return (name);
- }
-
- return disk_name (hd, MINOR(dev), name); /* routine in genhd.c */
-}
-
static int legacy_raid_sb (int minor, int pnum)
{
int i, factor;
@@ -653,24 +624,7 @@ static int md_ioctl (struct inode *inode, struct file *file,
return err;
break;
- case BLKFLSBUF:
- fsync_dev (inode->i_rdev);
- invalidate_buffers (inode->i_rdev);
- break;
-
- case BLKRASET:
- if (arg > 0xff)
- return -EINVAL;
- read_ahead[MAJOR(inode->i_rdev)] = arg;
- return 0;
- case BLKRAGET:
- if (!arg) return -EINVAL;
- err = put_user (read_ahead[MAJOR(inode->i_rdev)], (long *) arg);
- if (err)
- return err;
- break;
-
/* We have a problem here : there is no easy way to give a CHS
virtual geometry. We currently pretend that we have a 2 heads
4 sectors (with a BIG number of cylinders...). This drives dosfs
@@ -693,7 +647,12 @@ static int md_ioctl (struct inode *inode, struct file *file,
return err;
break;
- RO_IOCTLS(inode->i_rdev,arg);
+ case BLKROSET:
+ case BLKROGET:
+ case BLKRAGET:
+ case BLKRASET:
+ case BLKFLSBUF:
+ return blk_ioctl(inode->i_rdev, cmd, arg);
default:
return -EINVAL;
@@ -817,12 +776,12 @@ struct md_thread *md_register_thread (void (*run) (void *), void *data)
struct md_thread *thread = (struct md_thread *)
kmalloc(sizeof(struct md_thread), GFP_KERNEL);
int ret;
- struct semaphore sem = MUTEX_LOCKED;
+ DECLARE_MUTEX_LOCKED(sem);
if (!thread) return NULL;
memset(thread, 0, sizeof(struct md_thread));
- init_waitqueue(&thread->wqueue);
+ init_waitqueue_head(&thread->wqueue);
thread->sem = &sem;
thread->run = run;
@@ -838,7 +797,7 @@ struct md_thread *md_register_thread (void (*run) (void *), void *data)
void md_unregister_thread (struct md_thread *thread)
{
- struct semaphore sem = MUTEX_LOCKED;
+ DECLARE_MUTEX_LOCKED(sem);
thread->sem = &sem;
thread->run = NULL;
@@ -901,7 +860,6 @@ EXPORT_SYMBOL(md_size);
EXPORT_SYMBOL(md_maxreadahead);
EXPORT_SYMBOL(register_md_personality);
EXPORT_SYMBOL(unregister_md_personality);
-EXPORT_SYMBOL(partition_name);
EXPORT_SYMBOL(md_dev);
EXPORT_SYMBOL(md_error);
EXPORT_SYMBOL(md_register_thread);