Re: kdbus: add header file
From: Arnd Bergmann
Date: Thu Oct 30 2014 - 04:20:35 EST
On Wednesday 29 October 2014 15:00:46 Greg Kroah-Hartman wrote:
> +enum kdbus_ioctl_type {
> + KDBUS_CMD_BUS_MAKE = _IOW(KDBUS_IOCTL_MAGIC, 0x00,
> + struct kdbus_cmd_make),
> + KDBUS_CMD_DOMAIN_MAKE = _IOW(KDBUS_IOCTL_MAGIC, 0x10,
> + struct kdbus_cmd_make),
> + KDBUS_CMD_ENDPOINT_MAKE = _IOW(KDBUS_IOCTL_MAGIC, 0x20,
> + struct kdbus_cmd_make),
> +
> + KDBUS_CMD_HELLO = _IOWR(KDBUS_IOCTL_MAGIC, 0x30,
> + struct kdbus_cmd_hello),
> + KDBUS_CMD_BYEBYE = _IO(KDBUS_IOCTL_MAGIC, 0x31),
> +
> + KDBUS_CMD_MSG_SEND = _IOWR(KDBUS_IOCTL_MAGIC, 0x40,
> + struct kdbus_msg),
> + KDBUS_CMD_MSG_RECV = _IOWR(KDBUS_IOCTL_MAGIC, 0x41,
> + struct kdbus_cmd_recv),
> + KDBUS_CMD_MSG_CANCEL = _IOW(KDBUS_IOCTL_MAGIC, 0x42,
> + struct kdbus_cmd_cancel),
> + KDBUS_CMD_FREE = _IOW(KDBUS_IOCTL_MAGIC, 0x43,
> + struct kdbus_cmd_free),
>
I think in general, using enum is great, but for ioctl command numbers,
we probably want to have defines so the user space implementation can
use #ifdef to see if the kernel version that it is being built for
knows a particular command.
You could do that using
#define KDBUS_CMD_BUS_MAKE KDBUS_CMD_BUS_MAKE
while keeping the enum, or do it like everybody else using
#define KDBUS_CMD_BUS_MAKE _IOW(KDBUS_IOCTL_MAGIC, 0x00, struct kdbus_cmd_make)
which might in fact help some tools that try to do automated parsing
of header files to find ioctl commands.
Arnd
--
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/