Re: [RFC v2 1/1] fpga-region: Add generic IOCTL interface for runtime FPGA programming
From: Arnd Bergmann
Date: Mon Mar 17 2025 - 17:22:40 EST
> + * FPGA Region Control IOCTLs.
> + */
> +#define FPGA_REGION_MAGIC 'f'
> +#define FPGA_IOW(num, dtype) _IOW(FPGA_REGION_MAGIC, num, dtype)
> +#define FPGA_IOR(num, dtype) _IOR(FPGA_REGION_MAGIC, num, dtype)
> +
> +#define FPGA_REGION_IOCTL_LOAD FPGA_IOW(0, __u32)
> +#define FPGA_REGION_IOCTL_REMOVE FPGA_IOW(1, __u32)
> +#define FPGA_REGION_IOCTL_STATUS FPGA_IOR(2, __u32)
The definition does not appear to match the usage in the driver,
since you don't pass a __u32 structure but instead a
fpga_region_config_info.
Please also remove the extra FPGA_IOW/FPGA_IOR macros and just use
_IOW/IOR directly so it is possible to process the headers when
identifying ioctl command codes.
The 'f' range seems to be rather overloaded already with filesystem
ioctls:
'f' 00-1F linux/ext2_fs.h conflict!
'f' 00-1F linux/ext3_fs.h conflict!
'f' 00-0F fs/jfs/jfs_dinode.h conflict!
'f' 00-0F fs/ext4/ext4.h conflict!
'f' 00-0F linux/fs.h conflict!
'f' 00-0F fs/ocfs2/ocfs2_fs.h conflict!
In particular, the numbers you have defined are very similar to these:
some of these:
#define FS_IOC_GETFLAGS _IOR('f', 1, long)
#define FS_IOC_SETFLAGS _IOW('f', 2, long)
Arnd