[PATCH] error value for opening block devices

From: Ulrich Drepper
Date: Sat Mar 20 2004 - 05:15:31 EST


Opening a non-existing block device currently yields an ENXIO error.
Doing the same for char devices produces the correct error ENODEV.

The attached patch fixes the symptoms. Somebody with more knowledge
will have to decide whether there are any negative side effects.

--
â Ulrich Drepper â Red Hat, Inc. â 444 Castro St â Mountain View, CA â
--- fs/block_dev.c-save 2004-03-12 11:44:14.000000000 -0800
+++ fs/block_dev.c 2004-03-20 01:53:19.000000000 -0800
@@ -550,7 +550,7 @@ static int do_open(struct block_device *
{
struct module *owner = NULL;
struct gendisk *disk;
- int ret = -ENXIO;
+ int ret = -ENODEV;
int part;

file->f_mapping = bdev->bd_inode->i_mapping;
@@ -563,6 +563,7 @@ static int do_open(struct block_device *
}
owner = disk->fops->owner;

+ ret = -ENXIO;
down(&bdev->bd_sem);
if (!bdev->bd_openers) {
bdev->bd_disk = disk;