[PATCH v6 1/2] erofs-utils: lib: introduce erofs_xattr_prefix_index()
Hongzhen Luo
hongzhen at linux.alibaba.com
Fri Sep 6 18:54:23 AEST 2024
On 2024/9/6 16:49, Gao Xiang wrote:
>
>
> On 2024/9/6 16:38, Hongzhen Luo wrote:
>> Prepare for the feature of exporting extended attributes for
>> `fsck.erofs`, which requires obtaining the index based on the
>> name of the extended attribute.
>>
>> Signed-off-by: Hongzhen Luo <hongzhen at linux.alibaba.com>
>> ---
>> include/erofs/xattr.h | 2 ++
>> lib/xattr.c | 7 +++++++
>> 2 files changed, 9 insertions(+)
>>
>> diff --git a/include/erofs/xattr.h b/include/erofs/xattr.h
>> index 7643611..7848fe7 100644
>> --- a/include/erofs/xattr.h
>> +++ b/include/erofs/xattr.h
>> @@ -61,6 +61,8 @@ void erofs_clear_opaque_xattr(struct erofs_inode
>> *inode);
>> int erofs_set_origin_xattr(struct erofs_inode *inode);
>> int erofs_read_xattrs_from_disk(struct erofs_inode *inode);
>> +int erofs_xattr_prefix_index(const char *key);
>> +
>> #ifdef __cplusplus
>> }
>> #endif
>> diff --git a/lib/xattr.c b/lib/xattr.c
>> index 9f31f2d..1fed7c0 100644
>> --- a/lib/xattr.c
>> +++ b/lib/xattr.c
>> @@ -1681,3 +1681,10 @@ out:
>> erofs_xattr_prefixes_cleanup(sbi);
>> return ret;
>> }
>> +
>> +int erofs_xattr_prefix_index(const char *key)
>> +{
>> + unsigned int index, len;
>> +
>> + return match_prefix(key, &index, &len) ? index : -EINVAL;
>
> Can we export match_prefix as erofs_xattr_match_prefix()
> directly?
>
> Thanks,
> Gao Xiang
>
Yes, i will do this in the next patch.
Thanks,
Hongzhen
>> +}
More information about the Linux-erofs
mailing list