Re: 2.6.8-rc2-mm1

Andrew Morton
2004-07-29T20:59:32Z

Michael Hunold <hunold@convergence.de> wrote:
>
> > This is a hack introduced by someone years ago. The "pointer" is
> > actually an integer argument, e.g. in include/linux/dvb/audio.h:
> >
> > #define AUDIO_SET_MUTE _IO('o', 6)
> >
> > actually takes an integer argument (!0 mute, 0 unmute), so one can write
> >
> > if (ioctl(fd, AUDIO_SET_MUTE, 1) == -1)
> > perror("mute");
> >
> > It is unusual (maybe even wrong?), but we cannot change it without
> > losing binary API compatibility. However, I see that sparse might
> > flag this as a possible bug :-(
>
> Is this convenient trick considered harmful?
> Or is it a creative way of using ioctls?
>
> We're currently using this stuff in the overhauled DVB v4 API, too. So
> before we finally establish the DVB v4 API, I'd like to know if this is
> a no-no.

It's a no-no. Please define the interface to be as typesafe and as
__user-correct as possible.