mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: "Randy.Dunlap" <rddunlap@osdl.org>
Cc: drepper@redhat.com, linux-kernel@vger.kernel.org, torvalds@osdl.org
Subject: Re: [PATCH] error value for opening block devices
Date: Sun, 21 Mar 2004 20:13:58 -0800	[thread overview]
Message-ID: <20040321201358.6546423b.akpm@osdl.org> (raw)
In-Reply-To: <20040321195707.14a5a0f8.rddunlap@osdl.org>

"Randy.Dunlap" <rddunlap@osdl.org> wrote:
>
> [ENXIO]
>  The named file is a character special or block special file, and
>  the device associated with this special file does not exist.

Ho hum... It's chrdev_open which needs to be converted to return -ENXIO.

 25-akpm/fs/block_dev.c |    3 +--
 25-akpm/fs/char_dev.c  |    8 ++++----
 2 files changed, 5 insertions(+), 6 deletions(-)

diff -puN fs/char_dev.c~chrdev_open-retval-fix fs/char_dev.c
--- 25/fs/char_dev.c~chrdev_open-retval-fix	2004-03-21 20:10:02.961332256 -0800
+++ 25-akpm/fs/char_dev.c	2004-03-21 20:13:18.975533568 -0800
@@ -265,7 +265,7 @@ int chrdev_open(struct inode * inode, st
 		spin_unlock(&cdev_lock);
 		kobj = kobj_lookup(cdev_map, inode->i_rdev, &idx);
 		if (!kobj)
-			return -ENODEV;
+			return -ENXIO;
 		new = container_of(kobj, struct cdev, kobj);
 		spin_lock(&cdev_lock);
 		p = inode->i_cdev;
@@ -275,9 +275,9 @@ int chrdev_open(struct inode * inode, st
 			list_add(&inode->i_devices, &p->list);
 			new = NULL;
 		} else if (!cdev_get(p))
-			ret = -ENODEV;
+			ret = -ENXIO;
 	} else if (!cdev_get(p))
-		ret = -ENODEV;
+		ret = -ENXIO;
 	spin_unlock(&cdev_lock);
 	cdev_put(new);
 	if (ret)
@@ -285,7 +285,7 @@ int chrdev_open(struct inode * inode, st
 	filp->f_op = fops_get(p->ops);
 	if (!filp->f_op) {
 		cdev_put(p);
-		return -ENODEV;
+		return -ENXIO;
 	}
 	if (filp->f_op->open) {
 		lock_kernel();
diff -puN fs/block_dev.c~chrdev_open-retval-fix fs/block_dev.c
--- 25/fs/block_dev.c~chrdev_open-retval-fix	2004-03-21 20:10:02.978329672 -0800
+++ 25-akpm/fs/block_dev.c	2004-03-21 20:13:29.843881328 -0800
@@ -550,7 +550,7 @@ static int do_open(struct block_device *
 {
 	struct module *owner = NULL;
 	struct gendisk *disk;
-	int ret = -ENODEV;
+	int ret = -ENXIO;
 	int part;
 
 	file->f_mapping = bdev->bd_inode->i_mapping;
@@ -563,7 +563,6 @@ 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;

_


      reply	other threads:[~2004-03-22  4:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-20 10:13 Ulrich Drepper
2004-03-22  3:57 ` Randy.Dunlap
2004-03-22  4:13   ` Andrew Morton [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040321201358.6546423b.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=drepper@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rddunlap@osdl.org \
    --cc=torvalds@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®