Re: [PATCH v2] exfat: add ioctls for accessing attributes

From: Jan Cincera
Date: Mon Aug 28 2023 - 14:56:05 EST


On Mon, Aug 28, 2023, Darrick J. Wong wrote:
> On Sun, Aug 27, 2023 at 12:42:07PM +0200, Jan Cincera wrote:
>> Add GET and SET attributes ioctls to enable attribute modification.
>> We already do this in FAT and a few userspace utils made for it would
>> benefit from this also working on exFAT, namely fatattr.
>>
>> Signed-off-by: Jan Cincera <hcincera@xxxxxxxxx>
>> ---
>> Changes in v2:
>> - Removed irrelevant comments.
>> - Now masking reserved fields.
>>
>> fs/exfat/exfat_fs.h | 6 +++
>> fs/exfat/file.c | 93 +++++++++++++++++++++++++++++++++++++++++++++
>> 2 files changed, 99 insertions(+)
>>
>> diff --git a/fs/exfat/exfat_fs.h b/fs/exfat/exfat_fs.h
>> index 729ada9e26e8..ebe8c4b928f4 100644
>> --- a/fs/exfat/exfat_fs.h
>> +++ b/fs/exfat/exfat_fs.h
>> @@ -149,6 +149,12 @@ enum {
>> #define DIR_CACHE_SIZE \
>> (DIV_ROUND_UP(EXFAT_DEN_TO_B(ES_MAX_ENTRY_NUM), SECTOR_SIZE) + 1)
>>
>> +/*
>> + * attribute ioctls, same as their FAT equivalents.
>> + */
>> +#define EXFAT_IOCTL_GET_ATTRIBUTES _IOR('r', 0x10, __u32)
>> +#define EXFAT_IOCTL_SET_ATTRIBUTES _IOW('r', 0x11, __u32)
>
> Can you reuse the definitions from include/uapi/linux/msdos_fs.h instead
> of redefining them here?
>
> Otherwise this looks like a mostly straight port of the fs/fat/
> versions of these functions.
>
> --D
>

I don't think that's necessary right now, as exfat doesn't reuse attribute
definitions either. With some refactoring of existing code we could reuse
both, but I've been trying to keep this patch as simple as possible.

Jan Cincera