Fix up casefolding sysfs entries for F2FS
Subsystems (3)
v2 cover Fix up casefolding sysfs entries for F2FS
These correct displaying support for casefolding only when that capability is present, and advertise if encryption and casefolding are supported together. Casefolding requires CONFIG_UNICODE, and casefolding with encryption wasn't supported until commit 7ad08a58bf67
("f2fs: Handle casefolding with Encryption")
Changes for v2: Added comments to double #endif's, added Fixes and Cc tags
Daniel Rosenberg (2):
f2fs: Show casefolding support only when supported
f2fs: Advertise encrypted casefolding in sysfs
fs/f2fs/sysfs.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-)
Signature · 1 line
2.32.0.rc0.204.g9fa02ecfa5-goog
PATCH v2 1/2 f2fs: Show casefolding support only when supported
The casefolding feature is only supported when CONFIG_UNICODE is set. This modifies the feature list f2fs presents under sysfs accordingly.
--- fs/f2fs/sysfs.c | 4 ++++ 1 file changed, 4 insertions(+)
fs/f2fs/sysfs.c +4 -0
@@ -720,7 +720,9 @@ F2FS_FEATURE_RO_ATTR(lost_found, FEAT_LOST_FOUND);F2FS_FEATURE_RO_ATTR (verity,FEAT_VERITY );#endif F2FS_FEATURE_RO_ATTR (sb_checksum,FEAT_SB_CHECKSUM ); +#ifdef CONFIG_UNICODE F2FS_FEATURE_RO_ATTR (casefold,FEAT_CASEFOLD ); +#endif #ifdef CONFIG_F2FS_FS_COMPRESSION F2FS_FEATURE_RO_ATTR (compression,FEAT_COMPRESSION );F2FS_RW_ATTR (F2FS_SBI , f2fs_sb_info, compr_written_block, compr_written_block);
@@ -829,7 +831,9 @@ static struct attribute *f2fs_feat_attrs[] = { ATTR_LIST(verity), #endif ATTR_LIST(sb_checksum), +#ifdef CONFIG_UNICODE ATTR_LIST(casefold), +#endif #ifdef CONFIG_F2FS_FS_COMPRESSION ATTR_LIST(compression),#endif
Signature · 1 line
2.32.0.rc0.204.g9fa02ecfa5-goog
Re: [PATCH v2 1/2] f2fs: Show casefolding support only when supported
Quoted 9 lines · Daniel Rosenberg
The casefolding feature is only supported when
CONFIG_UNICODEis set. This modifies the feature list f2fs presents under sysfs accordingly.Fixes 5aba54302a46 ("f2fs: include charset encoding information in the superblock")Cc [email protected] # v5.4+Signed-off-by Daniel Rosenberg <[email protected]>--- fs/f2fs/sysfs.c | 4 ++++ 1 file changed, 4 insertions(+)
Re: [PATCH v2 1/2] f2fs: Show casefolding support only when supported
In reply to Daniel RosenbergQuoted 6 lines · Daniel Rosenberg
The casefolding feature is only supported when
CONFIG_UNICODEis set. This modifies the feature list f2fs presents under sysfs accordingly.Fixes 5aba54302a46 ("f2fs: include charset encoding information in the superblock")Cc [email protected] # v5.4+Signed-off-by Daniel Rosenberg <[email protected]>
Thanks,
PATCH v2 2/2 f2fs: Advertise encrypted casefolding in sysfs
In reply to Daniel RosenbergOlder kernels don't support encryption with casefolding. This adds the sysfs entry encrypted_casefold to show support for those combined features. Support for this feature was originally added by commit 7ad08a58bf67 ("f2fs: Handle casefolding with Encryption")
--- fs/f2fs/sysfs.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)
fs/f2fs/sysfs.c +13 -2
@@ -161,6 +161,9 @@ static ssize_t features_show(struct f2fs_attr *a,if (f2fs_sb_has_compression (sbi)) len +=scnprintf (buf + len,PAGE_SIZE - len,"%s%s" , len ?", " :"" ,"compression" ); +if (f2fs_sb_has_casefold (sbi) &&f2fs_sb_has_encrypt (sbi)) + len +=scnprintf (buf + len,PAGE_SIZE - len,"%s%s" , + len ?", " :"" ,"encrypted_casefold" ); len +=scnprintf (buf + len,PAGE_SIZE - len,"%s%s" , len ?", " :"" ,"pin_file" ); len +=scnprintf (buf + len,PAGE_SIZE - len,"\n" );
@@ -579,6 +582,7 @@ enum feat_id {FEAT_CASEFOLD ,FEAT_COMPRESSION ,FEAT_TEST_DUMMY_ENCRYPTION_V2 , + FEAT_ENCRYPTED_CASEFOLD, }; static ssize_t f2fs_feature_show(struct f2fs_attr *a,
@@ -600,6 +604,7 @@ static ssize_t f2fs_feature_show(struct f2fs_attr *a,case FEAT_CASEFOLD :case FEAT_COMPRESSION :case FEAT_TEST_DUMMY_ENCRYPTION_V2 : +case FEAT_ENCRYPTED_CASEFOLD :return sprintf (buf,"supported\n" ); }return 0 ;
@@ -704,7 +709,10 @@ F2FS_GENERAL_RO_ATTR(avg_vblocks);#ifdef CONFIG_FS_ENCRYPTION F2FS_FEATURE_RO_ATTR (encryption,FEAT_CRYPTO );F2FS_FEATURE_RO_ATTR (test_dummy_encryption_v2,FEAT_TEST_DUMMY_ENCRYPTION_V2 ); -#endif +#ifdef CONFIG_UNICODE +F2FS_FEATURE_RO_ATTR (encrypted_casefold,FEAT_ENCRYPTED_CASEFOLD ); +#endif /* CONFIG_UNICODE */ +#endif /* CONFIG_FS_ENCRYPTION */ #ifdef CONFIG_BLK_DEV_ZONED F2FS_FEATURE_RO_ATTR (block_zoned,FEAT_BLKZONED );#endif
@@ -815,7 +823,10 @@ static struct attribute *f2fs_feat_attrs[] = {#ifdef CONFIG_FS_ENCRYPTION ATTR_LIST(encryption), ATTR_LIST(test_dummy_encryption_v2), -#endif +#ifdef CONFIG_UNICODE + ATTR_LIST(encrypted_casefold), +#endif /* CONFIG_UNICODE */ +#endif /* CONFIG_FS_ENCRYPTION */ #ifdef CONFIG_BLK_DEV_ZONED ATTR_LIST(block_zoned),#endif
Signature · 1 line
2.32.0.rc0.204.g9fa02ecfa5-goog
Greg KH
maintainerRe: [PATCH v2 2/2] f2fs: Advertise encrypted casefolding in sysfs
Quoted 17 lines · Daniel Rosenberg
Older kernels don't support encryption with casefolding. This adds the sysfs entry
encrypted_casefoldto show support for those combined features. Support for this feature was originally added by commit7ad08a58bf67("f2fs: Handle casefolding with Encryption")Fixes 7ad08a58bf67 ("f2fs: Handle casefolding with Encryption")Cc [email protected] # v5.11+Signed-off-by Daniel Rosenberg <[email protected]>--- fs/f2fs/sysfs.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)fs/f2fs/sysfs.c +0
-0
fs/f2fs/sysfs.c static ssize_t features_show(struct f2fs_attr *a, · line 169
Quoted 9 lines
fs/f2fs/sysfs.c +3
-0@@ -161,6 +161,9 @@ static ssize_t features_show(struct f2fs_attr *a,if (f2fs_sb_has_compression (sbi)) len +=scnprintf (buf + len,PAGE_SIZE - len,"%s%s" , len ?", " :"" ,"compression" ); +if (f2fs_sb_has_casefold (sbi) &&f2fs_sb_has_encrypt (sbi)) + len +=scnprintf (buf + len,PAGE_SIZE - len,"%s%s" , + len ?", " :"" ,"encrypted_casefold" ); len +=scnprintf (buf + len,PAGE_SIZE - len,"%s%s" , len ?", " :"" ,"pin_file" ); len +=scnprintf (buf + len,PAGE_SIZE - len,"\n" );
This is a HUGE abuse of sysfs and should not be encouraged and added to.
Please make these "one value per file" and do not keep growing a single file that has to be parsed otherwise you will break userspace tools.
And I don't see a Documentation/ABI/ entry for this either :(
not good...
greg k-h
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Jaegeuk Kim
maintainerRe: [PATCH v2 2/2] f2fs: Advertise encrypted casefolding in sysfs
Quoted 13 lines · Greg KH
Quoted 12 lines · Daniel Rosenberg
Older kernels don't support encryption with casefolding. This adds the sysfs entry
encrypted_casefoldto show support for those combined features. Support for this feature was originally added by commit7ad08a58bf67("f2fs: Handle casefolding with Encryption")Fixes 7ad08a58bf67 ("f2fs: Handle casefolding with Encryption")Cc [email protected] # v5.11+Signed-off-by Daniel Rosenberg <[email protected]>--- fs/f2fs/sysfs.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)
Quoted 16 lines
Quoted 5 lines
fs/f2fs/sysfs.c +0
-0fs/f2fs/sysfs.c static ssize_t features_show(struct f2fs_attr *a, · line 169
Quoted 9 lines
fs/f2fs/sysfs.c +3
-0@@ -161,6 +161,9 @@ static ssize_t features_show(struct f2fs_attr *a,if (f2fs_sb_has_compression (sbi)) len +=scnprintf (buf + len,PAGE_SIZE - len,"%s%s" , len ?", " :"" ,"compression" ); +if (f2fs_sb_has_casefold (sbi) &&f2fs_sb_has_encrypt (sbi)) + len +=scnprintf (buf + len,PAGE_SIZE - len,"%s%s" , + len ?", " :"" ,"encrypted_casefold" ); len +=scnprintf (buf + len,PAGE_SIZE - len,"%s%s" , len ?", " :"" ,"pin_file" ); len +=scnprintf (buf + len,PAGE_SIZE - len,"\n" );This is a HUGE abuse of sysfs and should not be encouraged and added to.
This feature entry was originally added in 2017. Let me try to clean this up after merging this.
Quoted 5 lines
Please make these "one value per file" and do not keep growing a single file that has to be parsed otherwise you will break userspace tools.
And I don't see a
Documentation/ABI/entry for this either :(
There is in Documentation/ABI/testing/sysfs-fs-f2fs.
Quoted 4 lines
not good...
greg k-h
Greg KH
maintainerRe: [PATCH v2 2/2] f2fs: Advertise encrypted casefolding in sysfs
Quoted 31 lines · Jaegeuk Kim
Quoted 13 lines · Greg KH
Quoted 12 lines · Daniel Rosenberg
Older kernels don't support encryption with casefolding. This adds the sysfs entry
encrypted_casefoldto show support for those combined features. Support for this feature was originally added by commit7ad08a58bf67("f2fs: Handle casefolding with Encryption")Fixes 7ad08a58bf67 ("f2fs: Handle casefolding with Encryption")Cc [email protected] # v5.11+Signed-off-by Daniel Rosenberg <[email protected]>--- fs/f2fs/sysfs.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)Quoted 16 lines
Quoted 5 lines
fs/f2fs/sysfs.c +0
-0fs/f2fs/sysfs.c static ssize_t features_show(struct f2fs_attr *a, · line 169
Quoted 9 lines
fs/f2fs/sysfs.c +3
-0@@ -161,6 +161,9 @@ static ssize_t features_show(struct f2fs_attr *a,if (f2fs_sb_has_compression (sbi)) len +=scnprintf (buf + len,PAGE_SIZE - len,"%s%s" , len ?", " :"" ,"compression" ); +if (f2fs_sb_has_casefold (sbi) &&f2fs_sb_has_encrypt (sbi)) + len +=scnprintf (buf + len,PAGE_SIZE - len,"%s%s" , + len ?", " :"" ,"encrypted_casefold" ); len +=scnprintf (buf + len,PAGE_SIZE - len,"%s%s" , len ?", " :"" ,"pin_file" ); len +=scnprintf (buf + len,PAGE_SIZE - len,"\n" );This is a HUGE abuse of sysfs and should not be encouraged and added to.
Quoted 2 lines
This feature entry was originally added in 2017. Let me try to clean this up after merging this.
Thank you.
Quoted 6 lines
Quoted 4 lines
Please make these "one value per file" and do not keep growing a single file that has to be parsed otherwise you will break userspace tools.
And I don't see a
Documentation/ABI/entry for this either :(There is in
Documentation/ABI/testing/sysfs-fs-f2fs.
So this new item was documented in the file before the kernel change was made?
greg k-h
Jaegeuk Kim
maintainerRe: [PATCH v2 2/2] f2fs: Advertise encrypted casefolding in sysfs
Quoted 40 lines · Greg KH
Quoted 31 lines · Jaegeuk Kim
Quoted 13 lines · Greg KH
Quoted 12 lines · Daniel Rosenberg
Older kernels don't support encryption with casefolding. This adds the sysfs entry
encrypted_casefoldto show support for those combined features. Support for this feature was originally added by commit7ad08a58bf67("f2fs: Handle casefolding with Encryption")Fixes 7ad08a58bf67 ("f2fs: Handle casefolding with Encryption")Cc [email protected] # v5.11+Signed-off-by Daniel Rosenberg <[email protected]>--- fs/f2fs/sysfs.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)Quoted 16 lines
Quoted 5 lines
fs/f2fs/sysfs.c +0
-0fs/f2fs/sysfs.c static ssize_t features_show(struct f2fs_attr *a, · line 169
Quoted 9 lines
fs/f2fs/sysfs.c +3
-0@@ -161,6 +161,9 @@ static ssize_t features_show(struct f2fs_attr *a,if (f2fs_sb_has_compression (sbi)) len +=scnprintf (buf + len,PAGE_SIZE - len,"%s%s" , len ?", " :"" ,"compression" ); +if (f2fs_sb_has_casefold (sbi) &&f2fs_sb_has_encrypt (sbi)) + len +=scnprintf (buf + len,PAGE_SIZE - len,"%s%s" , + len ?", " :"" ,"encrypted_casefold" ); len +=scnprintf (buf + len,PAGE_SIZE - len,"%s%s" , len ?", " :"" ,"pin_file" ); len +=scnprintf (buf + len,PAGE_SIZE - len,"\n" );This is a HUGE abuse of sysfs and should not be encouraged and added to.
Quoted 2 lines
This feature entry was originally added in 2017. Let me try to clean this up after merging this.
Thank you.
Quoted 3 lines
Quoted 3 lines
Please make these "one value per file" and do not keep growing a single file that has to be parsed otherwise you will break userspace tools.
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
And I don't see a
Documentation/ABI/entry for this either :(There is in
Documentation/ABI/testing/sysfs-fs-f2fs.So this new item was documented in the file before the kernel change was made?
Do we need to describe all the strings in this entry?
203 What: /sys/fs/f2fs/<disk>/features 204 Date: July 2017 205 Contact: "Jaegeuk Kim" <[email protected]> 206 Description: Shows all enabled features in current device.
Quoted 2 lines
greg k-h
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Greg KH
maintainerRe: [PATCH v2 2/2] f2fs: Advertise encrypted casefolding in sysfs
Quoted 48 lines · Jaegeuk Kim
Quoted 40 lines · Greg KH
Quoted 31 lines · Jaegeuk Kim
Quoted 13 lines · Greg KH
Quoted 12 lines · Daniel Rosenberg
Older kernels don't support encryption with casefolding. This adds the sysfs entry
encrypted_casefoldto show support for those combined features. Support for this feature was originally added by commit7ad08a58bf67("f2fs: Handle casefolding with Encryption")Fixes 7ad08a58bf67 ("f2fs: Handle casefolding with Encryption")Cc [email protected] # v5.11+Signed-off-by Daniel Rosenberg <[email protected]>--- fs/f2fs/sysfs.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)Quoted 16 lines
Quoted 5 lines
fs/f2fs/sysfs.c +0
-0fs/f2fs/sysfs.c static ssize_t features_show(struct f2fs_attr *a, · line 169
Quoted 9 lines
fs/f2fs/sysfs.c +3
-0@@ -161,6 +161,9 @@ static ssize_t features_show(struct f2fs_attr *a,if (f2fs_sb_has_compression (sbi)) len +=scnprintf (buf + len,PAGE_SIZE - len,"%s%s" , len ?", " :"" ,"compression" ); +if (f2fs_sb_has_casefold (sbi) &&f2fs_sb_has_encrypt (sbi)) + len +=scnprintf (buf + len,PAGE_SIZE - len,"%s%s" , + len ?", " :"" ,"encrypted_casefold" ); len +=scnprintf (buf + len,PAGE_SIZE - len,"%s%s" , len ?", " :"" ,"pin_file" ); len +=scnprintf (buf + len,PAGE_SIZE - len,"\n" );This is a HUGE abuse of sysfs and should not be encouraged and added to.
Quoted 2 lines
This feature entry was originally added in 2017. Let me try to clean this up after merging this.
Thank you.
Quoted 3 lines
Quoted 3 lines
Please make these "one value per file" and do not keep growing a single file that has to be parsed otherwise you will break userspace tools.
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
And I don't see a
Documentation/ABI/entry for this either :(There is in
Documentation/ABI/testing/sysfs-fs-f2fs.So this new item was documented in the file before the kernel change was made?
Quoted 6 lines
Do we need to describe all the strings in this entry?
203 What: /sys/fs/f2fs/<disk>/features 204 Date: July 2017 205 Contact: "Jaegeuk Kim" <[email protected]> 206 Description: Shows all enabled features in current device.
Of course! Especially as this is a total violation of normal sysfs files, how else are you going to parse the thing?
Why wouldn't you describe the contents?
But again, please obsolete this file and make the features all individual
files like they should be so that you do not have any parsing problems.
thanks,
greg k-h
Jaegeuk Kim
maintainerRe: [PATCH v2 2/2] f2fs: Advertise encrypted casefolding in sysfs
Quoted 56 lines · Greg KH
Quoted 48 lines · Jaegeuk Kim
Quoted 40 lines · Greg KH
Quoted 31 lines · Jaegeuk Kim
Quoted 13 lines · Greg KH
Quoted 12 lines · Daniel Rosenberg
Older kernels don't support encryption with casefolding. This adds the sysfs entry
encrypted_casefoldto show support for those combined features. Support for this feature was originally added by commit7ad08a58bf67("f2fs: Handle casefolding with Encryption")Fixes 7ad08a58bf67 ("f2fs: Handle casefolding with Encryption")Cc [email protected] # v5.11+Signed-off-by Daniel Rosenberg <[email protected]>--- fs/f2fs/sysfs.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)Quoted 16 lines
Quoted 5 lines
fs/f2fs/sysfs.c +0
-0fs/f2fs/sysfs.c static ssize_t features_show(struct f2fs_attr *a, · line 169
Quoted 9 lines
fs/f2fs/sysfs.c +3
-0@@ -161,6 +161,9 @@ static ssize_t features_show(struct f2fs_attr *a,if (f2fs_sb_has_compression (sbi)) len +=scnprintf (buf + len,PAGE_SIZE - len,"%s%s" , len ?", " :"" ,"compression" ); +if (f2fs_sb_has_casefold (sbi) &&f2fs_sb_has_encrypt (sbi)) + len +=scnprintf (buf + len,PAGE_SIZE - len,"%s%s" , + len ?", " :"" ,"encrypted_casefold" ); len +=scnprintf (buf + len,PAGE_SIZE - len,"%s%s" , len ?", " :"" ,"pin_file" ); len +=scnprintf (buf + len,PAGE_SIZE - len,"\n" );This is a HUGE abuse of sysfs and should not be encouraged and added to.
Quoted 2 lines
This feature entry was originally added in 2017. Let me try to clean this up after merging this.
Thank you.
Quoted 3 lines
Quoted 3 lines
Please make these "one value per file" and do not keep growing a single file that has to be parsed otherwise you will break userspace tools.
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
And I don't see a
Documentation/ABI/entry for this either :(There is in
Documentation/ABI/testing/sysfs-fs-f2fs.So this new item was documented in the file before the kernel change was made?
Quoted 6 lines
Do we need to describe all the strings in this entry?
203 What: /sys/fs/f2fs/<disk>/features 204 Date: July 2017 205 Contact: "Jaegeuk Kim" <[email protected]> 206 Description: Shows all enabled features in current device.
Quoted 4 lines
Of course! Especially as this is a total violation of normal sysfs files, how else are you going to parse the thing?
Why wouldn't you describe the contents?
Because I was lazy. :P
Daniel, let me clean up all together in another patch. :)
Quoted 4 lines
But again, please obsolete this file and make the features all individual
files like they should be so that you do not have any parsing problems.
Yup, will do.
Quoted 4 lines
thanks,
greg k-h
RE: [PATCH v2 2/2] f2fs: Advertise encrypted casefolding in sysfs
In reply to Greg KHFrom: Greg KH
Quoted 58 lines
Sent: 03 June 2021 19:13
Quoted 48 lines · Jaegeuk Kim
Quoted 40 lines · Greg KH
Quoted 31 lines · Jaegeuk Kim
Quoted 13 lines · Greg KH
Quoted 12 lines · Daniel Rosenberg
Older kernels don't support encryption with casefolding. This adds the sysfs entry
encrypted_casefoldto show support for those combined features. Support for this feature was originally added by commit7ad08a58bf67("f2fs: Handle casefolding with Encryption")Fixes 7ad08a58bf67 ("f2fs: Handle casefolding with Encryption")Cc [email protected] # v5.11+Signed-off-by Daniel Rosenberg <[email protected]>--- fs/f2fs/sysfs.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)Quoted 16 lines
Quoted 5 lines
fs/f2fs/sysfs.c +0
-0fs/f2fs/sysfs.c static ssize_t features_show(struct f2fs_attr *a, · line 169
Quoted 9 lines
fs/f2fs/sysfs.c +3
-0@@ -161,6 +161,9 @@ static ssize_t features_show(struct f2fs_attr *a,if (f2fs_sb_has_compression (sbi)) len +=scnprintf (buf + len,PAGE_SIZE - len,"%s%s" , len ?", " :"" ,"compression" ); +if (f2fs_sb_has_casefold (sbi) &&f2fs_sb_has_encrypt (sbi)) + len +=scnprintf (buf + len,PAGE_SIZE - len,"%s%s" , + len ?", " :"" ,"encrypted_casefold" ); len +=scnprintf (buf + len,PAGE_SIZE - len,"%s%s" , len ?", " :"" ,"pin_file" ); len +=scnprintf (buf + len,PAGE_SIZE - len,"\n" );This is a HUGE abuse of sysfs and should not be encouraged and added to.
Quoted 2 lines
This feature entry was originally added in 2017. Let me try to clean this up after merging this.
Thank you.
Quoted 3 lines
Quoted 3 lines
Please make these "one value per file" and do not keep growing a single file that has to be parsed otherwise you will break userspace tools.
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
And I don't see a
Documentation/ABI/entry for this either :(There is in
Documentation/ABI/testing/sysfs-fs-f2fs.So this new item was documented in the file before the kernel change was made?
Quoted 6 lines
Do we need to describe all the strings in this entry?
203 What: /sys/fs/f2fs/<disk>/features 204 Date: July 2017 205 Contact: "Jaegeuk Kim" <[email protected]> 206 Description: Shows all enabled features in current device.
Quoted 8 lines
Of course! Especially as this is a total violation of normal sysfs files, how else are you going to parse the thing?
Why wouldn't you describe the contents?
But again, please obsolete this file and make the features all individual
files like they should be so that you do not have any parsing problems.
My 2c:
Isn't this a list of fixed strings - rather than a list of values. So parsing isn't that difficult.
Although it would be more sensible to add new ones at the end.
If they were in separate files you'd need to start reading the directory to find which names were supported (or known) and then read the file itself to see if it was actually in use.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)
Re: [PATCH v2 2/2] f2fs: Advertise encrypted casefolding in sysfs
In reply to Daniel RosenbergQuoted 43 lines · Daniel Rosenberg
Older kernels don't support encryption with casefolding. This adds the sysfs entry
encrypted_casefoldto show support for those combined features. Support for this feature was originally added by commit7ad08a58bf67("f2fs: Handle casefolding with Encryption")Fixes 7ad08a58bf67 ("f2fs: Handle casefolding with Encryption")Cc [email protected] # v5.11+Signed-off-by Daniel Rosenberg <[email protected]>--- fs/f2fs/sysfs.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)fs/f2fs/sysfs.c +5
-0@@ -161,6 +161,9 @@ static ssize_t features_show(struct f2fs_attr *a,if (f2fs_sb_has_compression (sbi)) len +=scnprintf (buf + len,PAGE_SIZE - len,"%s%s" , len ?", " :"" ,"compression" ); +if (f2fs_sb_has_casefold (sbi) &&f2fs_sb_has_encrypt (sbi)) + len +=scnprintf (buf + len,PAGE_SIZE - len,"%s%s" , + len ?", " :"" ,"encrypted_casefold" ); len +=scnprintf (buf + len,PAGE_SIZE - len,"%s%s" , len ?", " :"" ,"pin_file" ); len +=scnprintf (buf + len,PAGE_SIZE - len,"\n" );@@ -579,6 +582,7 @@ enum feat_id {FEAT_CASEFOLD ,FEAT_COMPRESSION ,FEAT_TEST_DUMMY_ENCRYPTION_V2 , + FEAT_ENCRYPTED_CASEFOLD, }; static ssize_t f2fs_feature_show(struct f2fs_attr *a,@@ -600,6 +604,7 @@ static ssize_t f2fs_feature_show(struct f2fs_attr *a,case FEAT_CASEFOLD :case FEAT_COMPRESSION :case FEAT_TEST_DUMMY_ENCRYPTION_V2 : +case FEAT_ENCRYPTED_CASEFOLD :return sprintf (buf,"supported\n" ); }return 0 ;
fs/f2fs/sysfs.c F2FS_GENERAL_RO_ATTR(avg_vblocks); · line 715
Quoted 8 lines
fs/f2fs/sysfs.c +4
-1@@ -704,7 +709,10 @@ F2FS_GENERAL_RO_ATTR(avg_vblocks);#ifdef CONFIG_FS_ENCRYPTION F2FS_FEATURE_RO_ATTR (encryption,FEAT_CRYPTO );F2FS_FEATURE_RO_ATTR (test_dummy_encryption_v2,FEAT_TEST_DUMMY_ENCRYPTION_V2 ); -#endif +#ifdef CONFIG_UNICODE +F2FS_FEATURE_RO_ATTR (encrypted_casefold,FEAT_ENCRYPTED_CASEFOLD ); +#endif /* CONFIG_UNICODE */ +#endif /* CONFIG_FS_ENCRYPTION */
I had only asked for the #endif comment for CONFIG_FS_ENCRYPTION, since that is a longer block. #endif comments aren't helpful for single-line blocks. See Documentation/process/coding-style.rst:
At the end of any non-trivial #if or #ifdef block (more than a few lines), place a comment after the #endif on the same line, noting the conditional expression used.
Anyway, doesn't matter much...
- Eric
Re: [PATCH v2 2/2] f2fs: Advertise encrypted casefolding in sysfs
In reply to Daniel RosenbergQuoted 27 lines · Daniel Rosenberg
Older kernels don't support encryption with casefolding. This adds the sysfs entry
encrypted_casefoldto show support for those combined features. Support for this feature was originally added by commit7ad08a58bf67("f2fs: Handle casefolding with Encryption")Fixes 7ad08a58bf67 ("f2fs: Handle casefolding with Encryption")Cc [email protected] # v5.11+Signed-off-by Daniel Rosenberg <[email protected]>--- fs/f2fs/sysfs.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)fs/f2fs/sysfs.c +3
-0@@ -161,6 +161,9 @@ static ssize_t features_show(struct f2fs_attr *a,if (f2fs_sb_has_compression (sbi)) len +=scnprintf (buf + len,PAGE_SIZE - len,"%s%s" , len ?", " :"" ,"compression" ); +if (f2fs_sb_has_casefold (sbi) &&f2fs_sb_has_encrypt (sbi)) + len +=scnprintf (buf + len,PAGE_SIZE - len,"%s%s" , + len ?", " :"" ,"encrypted_casefold" ); len +=scnprintf (buf + len,PAGE_SIZE - len,"%s%s" , len ?", " :"" ,"pin_file" ); len +=scnprintf (buf + len,PAGE_SIZE - len,"\n" );
fs/f2fs/sysfs.c enum feat_id { · line 586
Quoted 5 lines
fs/f2fs/sysfs.c +1
-0@@ -579,6 +582,7 @@ enum feat_id {FEAT_CASEFOLD ,FEAT_COMPRESSION ,FEAT_TEST_DUMMY_ENCRYPTION_V2 , + FEAT_ENCRYPTED_CASEFOLD, };
Actually looking at it more closely, this patch is wrong.
It only makes sense to declare "encrypted_casefold" as a feature of the filesystem implementation, i.e. /sys/fs/f2fs/features/encrypted_casefold.
It does *not* make sense to declare it as a feature of a particular filesystem instance, i.e. /sys/fs/f2fs/$disk/features, as it is already implied by the filesystem instance having both the encryption and casefold features enabled.
Can we add /sys/fs/f2fs/features/encrypted_casefold only?
- Eric
Jaegeuk Kim
maintainerRe: [PATCH v2 2/2] f2fs: Advertise encrypted casefolding in sysfs
Quoted 36 lines · Eric Biggers
Quoted 27 lines · Daniel Rosenberg
Older kernels don't support encryption with casefolding. This adds the sysfs entry
encrypted_casefoldto show support for those combined features. Support for this feature was originally added by commit7ad08a58bf67("f2fs: Handle casefolding with Encryption")Fixes 7ad08a58bf67 ("f2fs: Handle casefolding with Encryption")Cc [email protected] # v5.11+Signed-off-by Daniel Rosenberg <[email protected]>--- fs/f2fs/sysfs.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)fs/f2fs/sysfs.c +3
-0@@ -161,6 +161,9 @@ static ssize_t features_show(struct f2fs_attr *a,if (f2fs_sb_has_compression (sbi)) len +=scnprintf (buf + len,PAGE_SIZE - len,"%s%s" , len ?", " :"" ,"compression" ); +if (f2fs_sb_has_casefold (sbi) &&f2fs_sb_has_encrypt (sbi)) + len +=scnprintf (buf + len,PAGE_SIZE - len,"%s%s" , + len ?", " :"" ,"encrypted_casefold" ); len +=scnprintf (buf + len,PAGE_SIZE - len,"%s%s" , len ?", " :"" ,"pin_file" ); len +=scnprintf (buf + len,PAGE_SIZE - len,"\n" );fs/f2fs/sysfs.c enum feat_id { · line 586
Quoted 5 lines
fs/f2fs/sysfs.c +1
-0@@ -579,6 +582,7 @@ enum feat_id {FEAT_CASEFOLD ,FEAT_COMPRESSION ,FEAT_TEST_DUMMY_ENCRYPTION_V2 , + FEAT_ENCRYPTED_CASEFOLD, };Actually looking at it more closely, this patch is wrong.
Quoted 8 lines
It only makes sense to declare "
encrypted_casefold" as a feature of the filesystem implementation, i.e./sys/fs/f2fs/features/encrypted_casefold.It does *not* make sense to declare it as a feature of a particular filesystem instance, i.e.
/sys/fs/f2fs/$disk/features, as it is already implied by the filesystem instance having both the encryption and casefold features enabled.Can we add
/sys/fs/f2fs/features/encrypted_casefoldonly?
wait.. /sys/fs/f2fs/features/encrypted_casefold is on by CONFIG_FS_ENCRYPTION && CONFIG_UNICODE.
OTOH, /sys/fs/f2fs/$dis/feature_list/encrypted_casefold is on by on-disk features: F2FS_FEATURE_ENCRYPT and F2FS_FEATURE_CASEFOLD.
Quoted 2 lines
- Eric
Re: [PATCH v2 2/2] f2fs: Advertise encrypted casefolding in sysfs
Quoted 44 lines · Jaegeuk Kim
Quoted 43 lines · Eric Biggers
Quoted 27 lines · Daniel Rosenberg
Older kernels don't support encryption with casefolding. This adds the sysfs entry
encrypted_casefoldto show support for those combined features. Support for this feature was originally added by commit7ad08a58bf67("f2fs: Handle casefolding with Encryption")Fixes 7ad08a58bf67 ("f2fs: Handle casefolding with Encryption")Cc [email protected] # v5.11+Signed-off-by Daniel Rosenberg <[email protected]>--- fs/f2fs/sysfs.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)fs/f2fs/sysfs.c +3
-0@@ -161,6 +161,9 @@ static ssize_t features_show(struct f2fs_attr *a,if (f2fs_sb_has_compression (sbi)) len +=scnprintf (buf + len,PAGE_SIZE - len,"%s%s" , len ?", " :"" ,"compression" ); +if (f2fs_sb_has_casefold (sbi) &&f2fs_sb_has_encrypt (sbi)) + len +=scnprintf (buf + len,PAGE_SIZE - len,"%s%s" , + len ?", " :"" ,"encrypted_casefold" ); len +=scnprintf (buf + len,PAGE_SIZE - len,"%s%s" , len ?", " :"" ,"pin_file" ); len +=scnprintf (buf + len,PAGE_SIZE - len,"\n" );fs/f2fs/sysfs.c enum feat_id { · line 586
Quoted 5 lines
fs/f2fs/sysfs.c +1
-0@@ -579,6 +582,7 @@ enum feat_id {FEAT_CASEFOLD ,FEAT_COMPRESSION ,FEAT_TEST_DUMMY_ENCRYPTION_V2 , + FEAT_ENCRYPTED_CASEFOLD, };Actually looking at it more closely, this patch is wrong.
It only makes sense to declare "
encrypted_casefold" as a feature of the filesystem implementation, i.e./sys/fs/f2fs/features/encrypted_casefold.It does *not* make sense to declare it as a feature of a particular filesystem instance, i.e.
/sys/fs/f2fs/$disk/features, as it is already implied by the filesystem instance having both the encryption and casefold features enabled.
Quoted 7 lines
Quoted 1 line
Can we add
/sys/fs/f2fs/features/encrypted_casefoldonly?wait..
/sys/fs/f2fs/features/encrypted_casefoldis on byCONFIG_FS_ENCRYPTION&&CONFIG_UNICODE.
OTOH,/sys/fs/f2fs/$dis/feature_list/encrypted_casefoldis on by on-disk features:F2FS_FEATURE_ENCRYPTandF2FS_FEATURE_CASEFOLD.
Yes, but in the on-disk case, encrypted_casefold is redundant because it simply means encrypt && casefold. There is no encrypted_casefold flag on-disk.
- Eric
Jaegeuk Kim
maintainerRe: [PATCH v2 2/2] f2fs: Advertise encrypted casefolding in sysfs
Quoted 47 lines · Eric Biggers
Quoted 46 lines · Jaegeuk Kim
Quoted 44 lines · Eric Biggers
Quoted 27 lines · Daniel Rosenberg
Older kernels don't support encryption with casefolding. This adds the sysfs entry
encrypted_casefoldto show support for those combined features. Support for this feature was originally added by commit7ad08a58bf67("f2fs: Handle casefolding with Encryption")Fixes 7ad08a58bf67 ("f2fs: Handle casefolding with Encryption")Cc [email protected] # v5.11+Signed-off-by Daniel Rosenberg <[email protected]>--- fs/f2fs/sysfs.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)fs/f2fs/sysfs.c +3
-0@@ -161,6 +161,9 @@ static ssize_t features_show(struct f2fs_attr *a,if (f2fs_sb_has_compression (sbi)) len +=scnprintf (buf + len,PAGE_SIZE - len,"%s%s" , len ?", " :"" ,"compression" ); +if (f2fs_sb_has_casefold (sbi) &&f2fs_sb_has_encrypt (sbi)) + len +=scnprintf (buf + len,PAGE_SIZE - len,"%s%s" , + len ?", " :"" ,"encrypted_casefold" ); len +=scnprintf (buf + len,PAGE_SIZE - len,"%s%s" , len ?", " :"" ,"pin_file" ); len +=scnprintf (buf + len,PAGE_SIZE - len,"\n" );fs/f2fs/sysfs.c enum feat_id { · line 586
Quoted 5 lines
fs/f2fs/sysfs.c +1
-0@@ -579,6 +582,7 @@ enum feat_id {FEAT_CASEFOLD ,FEAT_COMPRESSION ,FEAT_TEST_DUMMY_ENCRYPTION_V2 , + FEAT_ENCRYPTED_CASEFOLD, };Actually looking at it more closely, this patch is wrong.
It only makes sense to declare "
encrypted_casefold" as a feature of the filesystem implementation, i.e./sys/fs/f2fs/features/encrypted_casefold.It does *not* make sense to declare it as a feature of a particular filesystem instance, i.e.
/sys/fs/f2fs/$disk/features, as it is already implied by the filesystem instance having both the encryption and casefold features enabled.Can we add
/sys/fs/f2fs/features/encrypted_casefoldonly?
Quoted 8 lines
Quoted 5 lines
wait..
/sys/fs/f2fs/features/encrypted_casefoldis on byCONFIG_FS_ENCRYPTION&&CONFIG_UNICODE.
OTOH,/sys/fs/f2fs/$dis/feature_list/encrypted_casefoldis on by on-disk features:F2FS_FEATURE_ENCRYPTandF2FS_FEATURE_CASEFOLD.Yes, but in the on-disk case,
encrypted_casefoldis redundant because it simply means encrypt && casefold. There is noencrypted_casefoldflag on-disk.
I prefer to keep encrypted_casefold likewise kernel feature, which is more intuitive to users.
Quoted 2 lines
- Eric
Re: [PATCH v2 2/2] f2fs: Advertise encrypted casefolding in sysfs
Quoted 55 lines · Jaegeuk Kim
Quoted 53 lines · Eric Biggers
Quoted 51 lines · Jaegeuk Kim
Quoted 36 lines · Eric Biggers
Quoted 27 lines · Daniel Rosenberg
Older kernels don't support encryption with casefolding. This adds the sysfs entry
encrypted_casefoldto show support for those combined features. Support for this feature was originally added by commit7ad08a58bf67("f2fs: Handle casefolding with Encryption")Fixes 7ad08a58bf67 ("f2fs: Handle casefolding with Encryption")Cc [email protected] # v5.11+Signed-off-by Daniel Rosenberg <[email protected]>--- fs/f2fs/sysfs.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)fs/f2fs/sysfs.c +3
-0@@ -161,6 +161,9 @@ static ssize_t features_show(struct f2fs_attr *a,if (f2fs_sb_has_compression (sbi)) len +=scnprintf (buf + len,PAGE_SIZE - len,"%s%s" , len ?", " :"" ,"compression" ); +if (f2fs_sb_has_casefold (sbi) &&f2fs_sb_has_encrypt (sbi)) + len +=scnprintf (buf + len,PAGE_SIZE - len,"%s%s" , + len ?", " :"" ,"encrypted_casefold" ); len +=scnprintf (buf + len,PAGE_SIZE - len,"%s%s" , len ?", " :"" ,"pin_file" ); len +=scnprintf (buf + len,PAGE_SIZE - len,"\n" );fs/f2fs/sysfs.c enum feat_id { · line 586
Quoted 5 lines
fs/f2fs/sysfs.c +1
-0@@ -579,6 +582,7 @@ enum feat_id {FEAT_CASEFOLD ,FEAT_COMPRESSION ,FEAT_TEST_DUMMY_ENCRYPTION_V2 , + FEAT_ENCRYPTED_CASEFOLD, };Actually looking at it more closely, this patch is wrong.
Quoted 8 lines
It only makes sense to declare "
encrypted_casefold" as a feature of the filesystem implementation, i.e./sys/fs/f2fs/features/encrypted_casefold.It does *not* make sense to declare it as a feature of a particular filesystem instance, i.e.
/sys/fs/f2fs/$disk/features, as it is already implied by the filesystem instance having both the encryption and casefold features enabled.Can we add
/sys/fs/f2fs/features/encrypted_casefoldonly?wait..
/sys/fs/f2fs/features/encrypted_casefoldis on byCONFIG_FS_ENCRYPTION&&CONFIG_UNICODE.
OTOH,/sys/fs/f2fs/$dis/feature_list/encrypted_casefoldis on by on-disk features:F2FS_FEATURE_ENCRYPTandF2FS_FEATURE_CASEFOLD.
Quoted 8 lines
Quoted 2 lines
Yes, but in the on-disk case,
encrypted_casefoldis redundant because it simply means encrypt && casefold. There is noencrypted_casefoldflag on-disk.I prefer to keep
encrypted_casefoldlikewise kernel feature, which is more intuitive to users.Quoted 2 lines
- Eric
When I added the feature_show one, I had been mistakenly thinking of cases where both were enabled in the filesystem, but not on the same directory. That case doesn't actually exist, since before the patch to support both on the same directory, we just wouldn't mount a filesystem that reported both as on. I think it'd make more sense without that part. The kernel feature one definitely makes sense, since previously the kernel could support either, but not both.
-Daniel
Re: [PATCH v2 2/2] f2fs: Advertise encrypted casefolding in sysfs
In reply to Jaegeuk KimQuoted 5 lines · Jaegeuk Kim
Quoted 2 lines
Yes, but in the on-disk case,
encrypted_casefoldis redundant because it simply means encrypt && casefold. There is noencrypted_casefoldflag on-disk.I prefer to keep
encrypted_casefoldlikewise kernel feature, which is more intuitive to users.
At least for ext4, there are kernel vesions which support encryption and casefold *separetely*, but which do not support the file systems that have encryption and casefold enabled simultaneously. This is why I had added /sys/fs/ext4/features/encrypted_casefold. It was originally not to indicate whether the on-disk file system supported those features, but to indicate that the kernel in question supported both features being enabled simultaneously.
- Ted
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Chao Yu
maintainerRe: [PATCH v2 2/2] f2fs: Advertise encrypted casefolding in sysfs
In reply to Jaegeuk KimQuoted 54 lines · Jaegeuk Kim
Quoted 53 lines · Eric Biggers
Quoted 51 lines · Jaegeuk Kim
Quoted 36 lines · Eric Biggers
Quoted 27 lines · Daniel Rosenberg
Older kernels don't support encryption with casefolding. This adds the sysfs entry
encrypted_casefoldto show support for those combined features. Support for this feature was originally added by commit7ad08a58bf67("f2fs: Handle casefolding with Encryption")Fixes 7ad08a58bf67 ("f2fs: Handle casefolding with Encryption")Cc [email protected] # v5.11+Signed-off-by Daniel Rosenberg <[email protected]>--- fs/f2fs/sysfs.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)fs/f2fs/sysfs.c +3
-0@@ -161,6 +161,9 @@ static ssize_t features_show(struct f2fs_attr *a,if (f2fs_sb_has_compression (sbi)) len +=scnprintf (buf + len,PAGE_SIZE - len,"%s%s" , len ?", " :"" ,"compression" ); +if (f2fs_sb_has_casefold (sbi) &&f2fs_sb_has_encrypt (sbi)) + len +=scnprintf (buf + len,PAGE_SIZE - len,"%s%s" , + len ?", " :"" ,"encrypted_casefold" ); len +=scnprintf (buf + len,PAGE_SIZE - len,"%s%s" , len ?", " :"" ,"pin_file" ); len +=scnprintf (buf + len,PAGE_SIZE - len,"\n" );fs/f2fs/sysfs.c enum feat_id { · line 586
Quoted 5 lines
fs/f2fs/sysfs.c +1
-0@@ -579,6 +582,7 @@ enum feat_id {FEAT_CASEFOLD ,FEAT_COMPRESSION ,FEAT_TEST_DUMMY_ENCRYPTION_V2 , + FEAT_ENCRYPTED_CASEFOLD, };Actually looking at it more closely, this patch is wrong.
Quoted 8 lines
It only makes sense to declare "
encrypted_casefold" as a feature of the filesystem implementation, i.e./sys/fs/f2fs/features/encrypted_casefold.It does *not* make sense to declare it as a feature of a particular filesystem instance, i.e.
/sys/fs/f2fs/$disk/features, as it is already implied by the filesystem instance having both the encryption and casefold features enabled.Can we add
/sys/fs/f2fs/features/encrypted_casefoldonly?wait..
/sys/fs/f2fs/features/encrypted_casefoldis on byCONFIG_FS_ENCRYPTION&&CONFIG_UNICODE.
OTOH,/sys/fs/f2fs/$dis/feature_list/encrypted_casefoldis on by on-disk features:F2FS_FEATURE_ENCRYPTandF2FS_FEATURE_CASEFOLD.
Quoted 5 lines
Quoted 2 lines
Yes, but in the on-disk case,
encrypted_casefoldis redundant because it simply means encrypt && casefold. There is noencrypted_casefoldflag on-disk.I prefer to keep
encrypted_casefoldlikewise kernel feature, which is more intuitive to users.
encrypted_casefold is a kernel feature support flag, not a disk one, IMO, it's not needed to add it in to per-disk feature list, it may mislead user that compatible encrypted casefold needs a extra disk layout support while disk has already encrypted and casefold feature enabled.
Thanks,
Quoted 3 lines
Quoted 3 lines
- Eric
Jaegeuk Kim
maintainerRe: [PATCH v2 2/2] f2fs: Advertise encrypted casefolding in sysfs
Quoted 58 lines · Chao Yu
Quoted 57 lines · Jaegeuk Kim
Quoted 55 lines · Eric Biggers
Quoted 44 lines · Jaegeuk Kim
Quoted 43 lines · Eric Biggers
Quoted 27 lines · Daniel Rosenberg
Older kernels don't support encryption with casefolding. This adds the sysfs entry
encrypted_casefoldto show support for those combined features. Support for this feature was originally added by commit7ad08a58bf67("f2fs: Handle casefolding with Encryption")Fixes 7ad08a58bf67 ("f2fs: Handle casefolding with Encryption")Cc [email protected] # v5.11+Signed-off-by Daniel Rosenberg <[email protected]>--- fs/f2fs/sysfs.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)fs/f2fs/sysfs.c +3
-0@@ -161,6 +161,9 @@ static ssize_t features_show(struct f2fs_attr *a,if (f2fs_sb_has_compression (sbi)) len +=scnprintf (buf + len,PAGE_SIZE - len,"%s%s" , len ?", " :"" ,"compression" ); +if (f2fs_sb_has_casefold (sbi) &&f2fs_sb_has_encrypt (sbi)) + len +=scnprintf (buf + len,PAGE_SIZE - len,"%s%s" , + len ?", " :"" ,"encrypted_casefold" ); len +=scnprintf (buf + len,PAGE_SIZE - len,"%s%s" , len ?", " :"" ,"pin_file" ); len +=scnprintf (buf + len,PAGE_SIZE - len,"\n" );fs/f2fs/sysfs.c enum feat_id { · line 586
Quoted 5 lines
fs/f2fs/sysfs.c +1
-0@@ -579,6 +582,7 @@ enum feat_id {FEAT_CASEFOLD ,FEAT_COMPRESSION ,FEAT_TEST_DUMMY_ENCRYPTION_V2 , + FEAT_ENCRYPTED_CASEFOLD, };Actually looking at it more closely, this patch is wrong.
It only makes sense to declare "
encrypted_casefold" as a feature of the filesystem implementation, i.e./sys/fs/f2fs/features/encrypted_casefold.It does *not* make sense to declare it as a feature of a particular filesystem instance, i.e.
/sys/fs/f2fs/$disk/features, as it is already implied by the filesystem instance having both the encryption and casefold features enabled.Quoted 7 lines
Quoted 1 line
Can we add
/sys/fs/f2fs/features/encrypted_casefoldonly?wait..
/sys/fs/f2fs/features/encrypted_casefoldis on byCONFIG_FS_ENCRYPTION&&CONFIG_UNICODE.
OTOH,/sys/fs/f2fs/$dis/feature_list/encrypted_casefoldis on by on-disk features:F2FS_FEATURE_ENCRYPTandF2FS_FEATURE_CASEFOLD.Yes, but in the on-disk case,
encrypted_casefoldis redundant because it simply means encrypt && casefold. There is noencrypted_casefoldflag on-disk.
Quoted 7 lines
Quoted 2 lines
I prefer to keep
encrypted_casefoldlikewise kernel feature, which is more intuitive to users.
encrypted_casefoldis a kernel feature support flag, not a disk one, IMO, it's not needed to add it in to per-disk feature list, it may mislead user that compatible encrypted casefold needs a extra disk layout support while disk has already encrypted and casefold feature enabled.
Yeah, I overlooked, and per Ted and Daniel's comments, I already removed it locally, but couldn't post it yet. :P
Quoted 6 lines
Thanks,
Quoted 3 lines
Quoted 3 lines
- Eric
RE: [PATCH v2 2/2] f2fs: Advertise encrypted casefolding in sysfs
In reply to Jaegeuk KimFrom: Jaegeuk Kim
Quoted 1 line
Sent: 04 June 2021 05:45
...
Quoted 10 lines
Quoted 10 lines
fs/f2fs/sysfs.c static ssize_t features_show(struct f2fs_attr *a, · line 169
Quoted 10 lines
fs/f2fs/sysfs.c +3
-0@@ -161,6 +161,9 @@ static ssize_t features_show(struct f2fs_attr *a,if (f2fs_sb_has_compression (sbi)) len +=scnprintf (buf + len,PAGE_SIZE - len,"%s%s" , len ?", " :"" ,"compression" ); +if (f2fs_sb_has_casefold (sbi) &&f2fs_sb_has_encrypt (sbi)) + len +=scnprintf (buf + len,PAGE_SIZE - len,"%s%s" , + len ?", " :"" ,"encrypted_casefold" ); len +=scnprintf (buf + len,PAGE_SIZE - len,"%s%s" , len ?", " :"" ,"pin_file" ); len +=scnprintf (buf + len,PAGE_SIZE - len,"\n" );
Looking at that pattern, why don't you just append "tag, " each time and then replace the final ", " with "\n" at the end.
Although if I wanted to quickly parse that in (say) a shell script I wouldn't really want the ",".
OTOH it is too late to change that.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)
Re: [PATCH v2 2/2] f2fs: Advertise encrypted casefolding in sysfs
Quoted 16 lines · David Laight
From: Jaegeuk Kim
Quoted 1 line
Sent: 04 June 2021 05:45
...
Quoted 10 lines
Quoted 10 lines
fs/f2fs/sysfs.c static ssize_t features_show(struct f2fs_attr *a, · line 169
Quoted 10 lines
fs/f2fs/sysfs.c +3
-0@@ -161,6 +161,9 @@ static ssize_t features_show(struct f2fs_attr *a,if (f2fs_sb_has_compression (sbi)) len +=scnprintf (buf + len,PAGE_SIZE - len,"%s%s" , len ?", " :"" ,"compression" ); +if (f2fs_sb_has_casefold (sbi) &&f2fs_sb_has_encrypt (sbi)) + len +=scnprintf (buf + len,PAGE_SIZE - len,"%s%s" , + len ?", " :"" ,"encrypted_casefold" ); len +=scnprintf (buf + len,PAGE_SIZE - len,"%s%s" , len ?", " :"" ,"pin_file" ); len +=scnprintf (buf + len,PAGE_SIZE - len,"\n" );Looking at that pattern, why don't you just append "tag, " each time and then replace the final ", " with "\n" at the end.
Again PLEASE NO!
This is not how sysfs is supposed to work and do not perpetuate this mess in any way.
greg k-h
Re: [PATCH v2 2/2] f2fs: Advertise encrypted casefolding in sysfs
In reply to Daniel RosenbergQuoted 8 lines · Daniel Rosenberg
Older kernels don't support encryption with casefolding. This adds the sysfs entry
encrypted_casefoldto show support for those combined features. Support for this feature was originally added by commit7ad08a58bf67("f2fs: Handle casefolding with Encryption")Fixes 7ad08a58bf67 ("f2fs: Handle casefolding with Encryption")Cc [email protected] # v5.11+Signed-off-by Daniel Rosenberg <[email protected]>
Thanks,