[haiku-commits] Re: r40787 - haiku/trunk/src/system/kernel/fs

  • From: Jérôme Duval <korli@xxxxxxxxxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 3 Mar 2011 19:45:55 +0100

2011/3/3 Ingo Weinhold <ingo_weinhold@xxxxxx>:
> Yes, though I thought that would only be done for the two ioctls you
> mentioned. Admittedly I hadn't looked at the ioctl() specification before.
> Apparently ENOTTY is the right error when the file isn't a STREAMS device
> (i.e. that's the one to be returned by "normal" file systems) ENODEV when
> the file is a STREAMS device, but generally doesn't support ioctl(), and
> EINVAL, if the particular ioctl isn't supported.

Right. It's just a bit weird to use ENOTTY in file systems and no B_*
error code mapped to it.

> I would suggest to consequently use the error codes POSIX specifies for the
> respective cases. That would leave B_DEV_INVALID_IOCTL unused. IOW:
>
> * no FS ioctl() hook -> ENOTTY
>
> * devfs, no device ioctl() hook -> ENODEV or ENOTTY (depending on character
> vs. block device?)
>
> * in a "normal" FS ioctl() hook: ENOTTY, if not supported
>
> * in a device ioctl() hooks: EINVAL, if not supported

I would then have to revert my changes on file systems and devices
(returning B_DEV_INVALID_IOCTL) or changes them to ENOTTY.

Bye,
Jérôme

Other related posts: