Re: [RFC PATCH 07/20] famfs: Add include/linux/famfs_ioctl.h

From: Randy Dunlap
Date: Sat Feb 24 2024 - 18:40:47 EST




On 2/24/24 15:32, John Groves wrote:
> On 24/02/23 07:27PM, Randy Dunlap wrote:
>> Hi John,
>>
>> On 2/23/24 18:23, John Groves wrote:
>>>>> +
>>>>> +#define FAMFSIOC_MAGIC 'u'
>>>> This 'u' value should be documented in
>>>> Documentation/userspace-api/ioctl/ioctl-number.rst.
>>>>
>>>> and if possible, you might want to use values like 0x5x or 0x8x
>>>> that don't conflict with the ioctl numbers that are already used
>>>> in the 'u' space.
>>> Will do. I was trying to be too clever there, invoking "mu" for
>>> micron.
>>
>> I might have been unclear about this one.
>> It's OK to use 'u' but the values 1-4 below conflict in the 'u' space:
>>
>> 'u' 00-1F linux/smb_fs.h gone
>> 'u' 20-3F linux/uvcvideo.h USB video class host driver
>> 'u' 40-4f linux/udmabuf.h
>>
>> so if you could use
>> 'u' 50-5f
>> or
>> 'u' 80-8f
>>
>> then those conflicts wouldn't be there.
>> HTH.
>>
>>>>> +
>>>>> +/* famfs file ioctl opcodes */
>>>>> +#define FAMFSIOC_MAP_CREATE _IOW(FAMFSIOC_MAGIC, 1, struct famfs_ioc_map)
>>>>> +#define FAMFSIOC_MAP_GET _IOR(FAMFSIOC_MAGIC, 2, struct famfs_ioc_map)
>>>>> +#define FAMFSIOC_MAP_GETEXT _IOR(FAMFSIOC_MAGIC, 3, struct famfs_extent)
>>>>> +#define FAMFSIOC_NOP _IO(FAMFSIOC_MAGIC, 4)
>>
>> --
>> #Randy
>
> Thanks Randy; I think I'm the one that didn't read carefully enough.
>
> Does this look right?
>
> diff --git a/Documentation/userspace-api/ioctl/ioctl-number.rst b/Documentation/userspace-api/ioctl/ioctl-number.rst
> index 457e16f06e04..44a44809657b 100644
> --- a/Documentation/userspace-api/ioctl/ioctl-number.rst
> +++ b/Documentation/userspace-api/ioctl/ioctl-number.rst
> @@ -288,6 +288,7 @@ Code Seq# Include File Comments
> 'u' 00-1F linux/smb_fs.h gone
> 'u' 20-3F linux/uvcvideo.h USB video class host driver
> 'u' 40-4f linux/udmabuf.h userspace dma-buf misc device
> +'u' 50-5F linux/famfs_ioctl.h famfs shared memory file system
> 'v' 00-1F linux/ext2_fs.h conflict!
> 'v' 00-1F linux/fs.h conflict!
> 'v' 00-0F linux/sonypi.h conflict!
> diff --git a/include/uapi/linux/famfs_ioctl.h b/include/uapi/linux/famfs_ioctl.h
> index 6b3e6452d02f..57521898ed57 100644
> --- a/include/uapi/linux/famfs_ioctl.h
> +++ b/include/uapi/linux/famfs_ioctl.h
> @@ -48,9 +48,9 @@ struct famfs_ioc_map {
> #define FAMFSIOC_MAGIC 'u'
>
> /* famfs file ioctl opcodes */
> -#define FAMFSIOC_MAP_CREATE _IOW(FAMFSIOC_MAGIC, 1, struct famfs_ioc_map)
> -#define FAMFSIOC_MAP_GET _IOR(FAMFSIOC_MAGIC, 2, struct famfs_ioc_map)
> -#define FAMFSIOC_MAP_GETEXT _IOR(FAMFSIOC_MAGIC, 3, struct famfs_extent)
> -#define FAMFSIOC_NOP _IO(FAMFSIOC_MAGIC, 4)
> +#define FAMFSIOC_MAP_CREATE _IOW(FAMFSIOC_MAGIC, 0x50, struct famfs_ioc_map)
> +#define FAMFSIOC_MAP_GET _IOR(FAMFSIOC_MAGIC, 0x51, struct famfs_ioc_map)
> +#define FAMFSIOC_MAP_GETEXT _IOR(FAMFSIOC_MAGIC, 0x52, struct famfs_extent)
> +#define FAMFSIOC_NOP _IO(FAMFSIOC_MAGIC, 0x53)
>
> Thank you!
> John
>

Yes, that looks good.
Thanks.

--
#Randy