linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@suse.de>
To: Jeff Garzik <jgarzik@pobox.com>
Cc: Andrew Morton <akpm@osdl.org>, Linus Torvalds <torvalds@osdl.org>,
	linux-ide@vger.kernel.org
Subject: Re: [BK PATCH] 2.6.x libata bug fix
Date: Tue, 26 Oct 2004 19:56:19 +0200	[thread overview]
Message-ID: <20041026175619.GE15290@suse.de> (raw)
In-Reply-To: <417E8D4B.8030203@pobox.com>

On Tue, Oct 26 2004, Jeff Garzik wrote:
> Jens Axboe wrote:
> >On Tue, Oct 26 2004, Jeff Garzik wrote:
> >>So, we return the proper return code, and ioctls we don't handle
> >>start to work again.  Overall, though, this is a fragile way to do
> >>things in the block layer, IMHO.
> >
> >
> >Well, it's pretty much the universally accepted way of signalling this
> >information, I'm not sure I agree. The crappy part is that EINVAL is so
> >wide spread as well.
> 
> 
> My point is that most Linux APIs don't apply default behavior by means 
> of a magic return code.
> 
> Each block/scsi/etc. driver should provide their own ioctl handler as 
> the highest-level callback.  Then, each individual driver decides its 
> fallback strategy for unknown ioctls -- in most cases, by calling 
> "libata_ioctl" or "scsi_ioctl" or "block_ioctl".
> 
> In this manner, ioctl handling cascades naturally up through the layers, 
> without magic return codes.

But it doesn't quite work so well if you are a device/driver that needs
to call several of these functions - you get the same problem, you need
to know when it was accepted or when to pass it on. Or you need to know
every single ioctl. Maybe you can kill it in the driver, but you need it
at least some place in the stack.

> The current "top-down" ioctl handling implementation leads to the 
> current situation:  a bunch of ->ioctl() callsites scattered through the 
> generic block ioctl handling code.

It is a bit messy in places, I agree. But I don't think this has
anything to do with it using -ENOTTY as a special magic "I dunno what
you are talking about", rather it just needs a little cleanup action.

Honestly, I don't think -ENOTTY is so nasty. It's been described a
number of times in various places, it should be common knowledge for
anyone doing a linux/unix driver.

-- 
Jens Axboe


  reply	other threads:[~2004-10-26 17:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-26 16:02 [BK PATCH] 2.6.x libata bug fix Jeff Garzik
2004-10-26 17:30 ` Jens Axboe
2004-10-26 17:45   ` Jeff Garzik
2004-10-26 17:56     ` Jens Axboe [this message]
  -- strict thread matches above, loose matches on Subject: below --
2004-10-27  0:00 Jeff Garzik

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=20041026175619.GE15290@suse.de \
    --to=axboe@suse.de \
    --cc=akpm@osdl.org \
    --cc=jgarzik@pobox.com \
    --cc=linux-ide@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).