* ENOTTY from ext3 code?
@ 2002-02-19 19:09 Pavel Machek
2002-02-19 20:31 ` Alexander Viro
` (3 more replies)
0 siblings, 4 replies; 8+ messages in thread
From: Pavel Machek @ 2002-02-19 19:09 UTC (permalink / raw)
To: kernel list
Hi!
ext3/ioctl.c:
...
return -ENOTTY;
Does it really make sense to return "not a typewriter" from ext3
ioctl?
Pavel
--
(about SSSCA) "I don't say this lightly. However, I really think that the U.S.
no longer is classifiable as a democracy, but rather as a plutocracy." --hpa
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: ENOTTY from ext3 code?
2002-02-19 19:09 ENOTTY from ext3 code? Pavel Machek
@ 2002-02-19 20:31 ` Alexander Viro
2002-02-19 20:34 ` Richard B. Johnson
` (2 subsequent siblings)
3 siblings, 0 replies; 8+ messages in thread
From: Alexander Viro @ 2002-02-19 20:31 UTC (permalink / raw)
To: Pavel Machek; +Cc: kernel list
On Tue, 19 Feb 2002, Pavel Machek wrote:
> Hi!
>
> ext3/ioctl.c:
>
> ...
> return -ENOTTY;
>
> Does it really make sense to return "not a typewriter" from ext3
> ioctl?
s/typewriter/teletype/ and ext3 indeed is not one (and thus shouldn't _have_
ioctl() in the first place). Seriously, -ENOTTY is normal error for "I don't
know anything about that ioctl".
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: ENOTTY from ext3 code?
2002-02-19 19:09 ENOTTY from ext3 code? Pavel Machek
2002-02-19 20:31 ` Alexander Viro
@ 2002-02-19 20:34 ` Richard B. Johnson
2002-02-19 20:56 ` Andrew Morton
2002-02-19 21:26 ` Guest section DW
3 siblings, 0 replies; 8+ messages in thread
From: Richard B. Johnson @ 2002-02-19 20:34 UTC (permalink / raw)
To: Pavel Machek; +Cc: kernel list
On Tue, 19 Feb 2002, Pavel Machek wrote:
> Hi!
>
> ext3/ioctl.c:
>
> ...
> return -ENOTTY;
>
> Does it really make sense to return "not a typewriter" from ext3
> ioctl?
But yes! The de-facto return code for a file-system ioctl() that
is undefined, i.e., wrong parameter, is ENOTTY. This is because
it really means "Not a terminal". Terminals have the most ioctls.
Cheers,
Dick Johnson
Penguin : Linux version 2.4.1 on an i686 machine (797.90 BogoMips).
111,111,111 * 111,111,111 = 12,345,678,987,654,321
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: ENOTTY from ext3 code?
2002-02-19 19:09 ENOTTY from ext3 code? Pavel Machek
2002-02-19 20:31 ` Alexander Viro
2002-02-19 20:34 ` Richard B. Johnson
@ 2002-02-19 20:56 ` Andrew Morton
2002-02-19 21:20 ` Andreas Dilger
2002-02-19 21:26 ` Guest section DW
3 siblings, 1 reply; 8+ messages in thread
From: Andrew Morton @ 2002-02-19 20:56 UTC (permalink / raw)
To: Pavel Machek; +Cc: kernel list
Pavel Machek wrote:
>
> Hi!
>
> ext3/ioctl.c:
>
> ...
> return -ENOTTY;
>
> Does it really make sense to return "not a typewriter" from ext3
> ioctl?
ERRORS
...
ENOTTY d is not associated with a character special
device.
ENOTTY The specified request does not apply to the kind of
object that the descriptor d references.
Lots and lots of ioctls return ENOTTY when passed a request
which they don't understand. There's probably a great reason
for this, but I can't immediately think what it might be.
-
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: ENOTTY from ext3 code?
2002-02-19 20:56 ` Andrew Morton
@ 2002-02-19 21:20 ` Andreas Dilger
0 siblings, 0 replies; 8+ messages in thread
From: Andreas Dilger @ 2002-02-19 21:20 UTC (permalink / raw)
To: Andrew Morton; +Cc: Pavel Machek, kernel list
On Feb 19, 2002 12:56 -0800, Andrew Morton wrote:
> Pavel Machek wrote:
> > ext3/ioctl.c:
> >
> > ...
> > return -ENOTTY;
> >
> > Does it really make sense to return "not a typewriter" from ext3
> > ioctl?
>
> ERRORS
> ...
>
> ENOTTY The specified request does not apply to the kind of
> object that the descriptor d references.
>
> Lots and lots of ioctls return ENOTTY when passed a request
> which they don't understand. There's probably a great reason
> for this, but I can't immediately think what it might be.
Well, returning ENOTTY for unknown ioctls instead of EINVAL allows you
to distinguish between 'I have no idea what you are asking of me' and
'you passed me the incorrect parameter to this request' in the caller.
Cheers, Andreas
--
Andreas Dilger
http://sourceforge.net/projects/ext2resize/
http://www-mddsp.enel.ucalgary.ca/People/adilger/
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: ENOTTY from ext3 code?
2002-02-19 19:09 ENOTTY from ext3 code? Pavel Machek
` (2 preceding siblings ...)
2002-02-19 20:56 ` Andrew Morton
@ 2002-02-19 21:26 ` Guest section DW
3 siblings, 0 replies; 8+ messages in thread
From: Guest section DW @ 2002-02-19 21:26 UTC (permalink / raw)
To: Pavel Machek; +Cc: kernel list
On Tue, Feb 19, 2002 at 08:09:32PM +0100, Pavel Machek wrote:
> ext3/ioctl.c:
>
> ...
> return -ENOTTY;
>
> Does it really make sense to return "not a typewriter" from ext3
> ioctl?
I suppose you know the definition of ENOTTY?
Quoting POSIX:
[ENOTTY] Inappropriate I/O control operation.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: ENOTTY from ext3 code?
[not found] <mailman.1014150283.20067.linux-kernel2news@redhat.com>
@ 2002-02-19 21:53 ` Pete Zaitcev
2002-02-20 1:23 ` Alan Cox
0 siblings, 1 reply; 8+ messages in thread
From: Pete Zaitcev @ 2002-02-19 21:53 UTC (permalink / raw)
To: Pavel Machek; +Cc: linux-kernel
> ext3/ioctl.c:
> ...
> return -ENOTTY;
>
> Does it really make sense to return "not a typewriter" from ext3
> ioctl?
Absolutely. In fact, it's a pet pieve of mine. Lots and lots
of clueless driver writes return -EINVAL in such cases,
and I keep cleaning it up. The problem with EINVAL is that
it makes it harder to diagnose any problems that can come up.
Also, recent strerror() returns "Inappropriate ioctl for a device",
if that is your concern. Personally, I think "Not a typewriter"
was a warmer and fuzzier reference to the roots, but oh well...
Dennis giveth, TOG taketh away...
-- Pete
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: ENOTTY from ext3 code?
2002-02-19 21:53 ` Pete Zaitcev
@ 2002-02-20 1:23 ` Alan Cox
0 siblings, 0 replies; 8+ messages in thread
From: Alan Cox @ 2002-02-20 1:23 UTC (permalink / raw)
To: Pete Zaitcev; +Cc: Pavel Machek, linux-kernel
> if that is your concern. Personally, I think "Not a typewriter"
> was a warmer and fuzzier reference to the roots, but oh well...
> Dennis giveth, TOG taketh away...
TOG says you are right. -ENOTTY is the right thing in most cases
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2002-02-20 1:09 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-02-19 19:09 ENOTTY from ext3 code? Pavel Machek
2002-02-19 20:31 ` Alexander Viro
2002-02-19 20:34 ` Richard B. Johnson
2002-02-19 20:56 ` Andrew Morton
2002-02-19 21:20 ` Andreas Dilger
2002-02-19 21:26 ` Guest section DW
[not found] <mailman.1014150283.20067.linux-kernel2news@redhat.com>
2002-02-19 21:53 ` Pete Zaitcev
2002-02-20 1:23 ` Alan Cox
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox