Linux Device Mapper development
 help / color / mirror / Atom feed
From: Milan Broz <mbroz@redhat.com>
To: dm-devel@redhat.com
Cc: Milan Broz <mbroz@redhat.com>
Subject: [PATCH] Use only specific errors when failing dm-ioctl
Date: Wed, 16 Feb 2011 18:32:05 +0100	[thread overview]
Message-ID: <1297877525-10163-1-git-send-email-mbroz@redhat.com> (raw)
In-Reply-To: <1297777960-22662-2-git-send-email-mbroz@redhat.com>

The return codes of ioctl are part of device-mapper
API and only defined errno should be returned.

Unify return codes for device lookup function on one place
and allow ENOMEM and ENXIO for now.

(Later it can be added more codes as userspace is prepared
to handle them.)

Signed-off-by: Milan Broz <mbroz@redhat.com>
---
 drivers/md/dm-table.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
index 38e4eb1..ca19e4d 100644
--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
@@ -532,7 +532,17 @@ EXPORT_SYMBOL_GPL(dm_set_device_limits);
 int dm_get_device(struct dm_target *ti, const char *path, fmode_t mode,
 		  struct dm_dev **result)
 {
-	return __table_get_device(ti->table, ti, path, mode, result);
+	int r = __table_get_device(ti->table, ti, path, mode, result);
+
+	/*
+	 * Return code is directly used for dm ioctl.
+	 * Allow only ENOMEM here, all other codes
+	 * means device lookup failed.
+	 */
+	if (r && r != -ENOMEM)
+		r = -ENXIO;
+
+	return r;
 }
 
 
-- 
1.7.2.3

      reply	other threads:[~2011-02-16 17:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-15 13:52 [PATCH] Do not open log and cow device read-write for read-only mappings Milan Broz
2011-02-15 13:52 ` [PATCH] Propagate device open error to table constructor Milan Broz
2011-02-16 17:32   ` Milan Broz [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=1297877525-10163-1-git-send-email-mbroz@redhat.com \
    --to=mbroz@redhat.com \
    --cc=dm-devel@redhat.com \
    /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