Re: 2.6.8-rc2-mm1
From: Andrew Morton
Date: Thu Jul 29 2004 - 16:02:43 EST
Michael Hunold <hunold@xxxxxxxxxxxxxx> 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.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/