[PATCH 0/2] configfs: Constify some fileds in struct config_item_type

Christophe JAILLET posted 2 patches 3 months, 2 weeks ago
fs/configfs/dir.c        | 2 +-
fs/configfs/file.c       | 2 +-
include/linux/configfs.h | 4 ++--
3 files changed, 4 insertions(+), 4 deletions(-)
[PATCH 0/2] configfs: Constify some fileds in struct config_item_type
Posted by Christophe JAILLET 3 months, 2 weeks ago
These 2 patches constify ct_item_ops and ct_group_ops in struct
config_item_type.

When/if they are applied, I'll send some patchess in each subsystem to
constify the corresponding structures.

This 2 steps approach is IMHO easier way to make these changes.
This avoids long series and cover-letter/first patches sent to many
maintainers and lists.

However, if you prefer things to be done in the same serie, I can do
that as well.

Christophe JAILLET (2):
  configfs: Constify ct_group_ops in struct config_item_type
  configfs: Constify ct_item_ops in struct config_item_type

 fs/configfs/dir.c        | 2 +-
 fs/configfs/file.c       | 2 +-
 include/linux/configfs.h | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

-- 
2.51.0
Re: [PATCH 0/2] configfs: Constify some fileds in struct config_item_type
Posted by Andreas Hindborg 2 months, 1 week ago
On Sat, 25 Oct 2025 13:15:36 +0200, Christophe JAILLET wrote:
> These 2 patches constify ct_item_ops and ct_group_ops in struct
> config_item_type.
> 
> When/if they are applied, I'll send some patchess in each subsystem to
> constify the corresponding structures.
> 
> This 2 steps approach is IMHO easier way to make these changes.
> This avoids long series and cover-letter/first patches sent to many
> maintainers and lists.
> 
> [...]

Applied, thanks!

[1/2] configfs: Constify ct_group_ops in struct config_item_type
      commit: f2f36500a63b73a8be90127322ad740253cf89c0
[2/2] configfs: Constify ct_item_ops in struct config_item_type
      commit: f7f78098690d60a03b47942ac7d73ea17b42239e

Best regards,
-- 
Andreas Hindborg <a.hindborg@kernel.org>
Re: [PATCH 0/2] configfs: Constify some fileds in struct config_item_type
Posted by Andreas Hindborg 3 months, 1 week ago
"Christophe JAILLET" <christophe.jaillet@wanadoo.fr> writes:

> These 2 patches constify ct_item_ops and ct_group_ops in struct
> config_item_type.
>
> When/if they are applied, I'll send some patchess in each subsystem to
> constify the corresponding structures.
>
> This 2 steps approach is IMHO easier way to make these changes.
> This avoids long series and cover-letter/first patches sent to many
> maintainers and lists.
>
> However, if you prefer things to be done in the same serie, I can do
> that as well.

Looks good to me. Please also include a patch to fix up the rust
bindings in the 2nd step:

diff --git a/rust/kernel/configfs.rs b/rust/kernel/configfs.rs
index 318a2f073d1c7..468c8c4170d5e 100644
--- a/rust/kernel/configfs.rs
+++ b/rust/kernel/configfs.rs
@@ -755,8 +755,8 @@ pub const fn new_with_child_ctor<const N: usize, Child>(
                 Self {
                     item_type: Opaque::new(bindings::config_item_type {
                         ct_owner: owner.as_ptr(),
-                        ct_group_ops: GroupOperationsVTable::<Data, Child>::vtable_ptr().cast_mut(),
-                        ct_item_ops: ItemOperationsVTable::<$tpe, Data>::vtable_ptr().cast_mut(),
+                        ct_group_ops: GroupOperationsVTable::<Data, Child>::vtable_ptr(),
+                        ct_item_ops: ItemOperationsVTable::<$tpe, Data>::vtable_ptr(),
                         ct_attrs: core::ptr::from_ref(attributes).cast_mut().cast(),
                         ct_bin_attrs: core::ptr::null_mut(),
                     }),
@@ -773,7 +773,7 @@ pub const fn new<const N: usize>(
                     item_type: Opaque::new(bindings::config_item_type {
                         ct_owner: owner.as_ptr(),
                         ct_group_ops: core::ptr::null_mut(),
-                        ct_item_ops: ItemOperationsVTable::<$tpe, Data>::vtable_ptr().cast_mut(),
+                        ct_item_ops: ItemOperationsVTable::<$tpe, Data>::vtable_ptr(),
                         ct_attrs: core::ptr::from_ref(attributes).cast_mut().cast(),
                         ct_bin_attrs: core::ptr::null_mut(),
                     }),



Best regards,
Andreas Hindborg
Re: [PATCH 0/2] configfs: Constify some fileds in struct config_item_type
Posted by Christophe JAILLET 3 months, 1 week ago
Le 29/10/2025 à 08:18, Andreas Hindborg a écrit :
> "Christophe JAILLET" <christophe.jaillet@wanadoo.fr> writes:
> 
>> These 2 patches constify ct_item_ops and ct_group_ops in struct
>> config_item_type.
>>
>> When/if they are applied, I'll send some patchess in each subsystem to
>> constify the corresponding structures.
>>
>> This 2 steps approach is IMHO easier way to make these changes.
>> This avoids long series and cover-letter/first patches sent to many
>> maintainers and lists.
>>
>> However, if you prefer things to be done in the same serie, I can do
>> that as well.
> 
> Looks good to me. Please also include a patch to fix up the rust
> bindings in the 2nd step:
> 
> diff --git a/rust/kernel/configfs.rs b/rust/kernel/configfs.rs
> index 318a2f073d1c7..468c8c4170d5e 100644
> --- a/rust/kernel/configfs.rs
> +++ b/rust/kernel/configfs.rs
> @@ -755,8 +755,8 @@ pub const fn new_with_child_ctor<const N: usize, Child>(
>                   Self {
>                       item_type: Opaque::new(bindings::config_item_type {
>                           ct_owner: owner.as_ptr(),
> -                        ct_group_ops: GroupOperationsVTable::<Data, Child>::vtable_ptr().cast_mut(),
> -                        ct_item_ops: ItemOperationsVTable::<$tpe, Data>::vtable_ptr().cast_mut(),
> +                        ct_group_ops: GroupOperationsVTable::<Data, Child>::vtable_ptr(),
> +                        ct_item_ops: ItemOperationsVTable::<$tpe, Data>::vtable_ptr(),
>                           ct_attrs: core::ptr::from_ref(attributes).cast_mut().cast(),
>                           ct_bin_attrs: core::ptr::null_mut(),
>                       }),
> @@ -773,7 +773,7 @@ pub const fn new<const N: usize>(
>                       item_type: Opaque::new(bindings::config_item_type {
>                           ct_owner: owner.as_ptr(),
>                           ct_group_ops: core::ptr::null_mut(),
> -                        ct_item_ops: ItemOperationsVTable::<$tpe, Data>::vtable_ptr().cast_mut(),
> +                        ct_item_ops: ItemOperationsVTable::<$tpe, Data>::vtable_ptr(),
>                           ct_attrs: core::ptr::from_ref(attributes).cast_mut().cast(),
>                           ct_bin_attrs: core::ptr::null_mut(),
>                       }),
> 

I'm not a big fan of mixing c and rs files updates in the same commit.
And, as I don't know rust, I'm reluctant to changes things that I don't 
understand and I'm not able to at least compile test.

Can s.o. send this change as a follow-up patch?

CJ

> 
> 
> Best regards,
> Andreas Hindborg
> 
> 
> 
> 

Re: [PATCH 0/2] configfs: Constify some fileds in struct config_item_type
Posted by Andreas Hindborg 3 months, 1 week ago
"Christophe JAILLET" <christophe.jaillet@wanadoo.fr> writes:

> Le 29/10/2025 à 08:18, Andreas Hindborg a écrit :
>> "Christophe JAILLET" <christophe.jaillet@wanadoo.fr> writes:
>>
>>> These 2 patches constify ct_item_ops and ct_group_ops in struct
>>> config_item_type.
>>>
>>> When/if they are applied, I'll send some patchess in each subsystem to
>>> constify the corresponding structures.
>>>
>>> This 2 steps approach is IMHO easier way to make these changes.
>>> This avoids long series and cover-letter/first patches sent to many
>>> maintainers and lists.
>>>
>>> However, if you prefer things to be done in the same serie, I can do
>>> that as well.
>>
>> Looks good to me. Please also include a patch to fix up the rust
>> bindings in the 2nd step:
>>
>> diff --git a/rust/kernel/configfs.rs b/rust/kernel/configfs.rs
>> index 318a2f073d1c7..468c8c4170d5e 100644
>> --- a/rust/kernel/configfs.rs
>> +++ b/rust/kernel/configfs.rs
>> @@ -755,8 +755,8 @@ pub const fn new_with_child_ctor<const N: usize, Child>(
>>                   Self {
>>                       item_type: Opaque::new(bindings::config_item_type {
>>                           ct_owner: owner.as_ptr(),
>> -                        ct_group_ops: GroupOperationsVTable::<Data, Child>::vtable_ptr().cast_mut(),
>> -                        ct_item_ops: ItemOperationsVTable::<$tpe, Data>::vtable_ptr().cast_mut(),
>> +                        ct_group_ops: GroupOperationsVTable::<Data, Child>::vtable_ptr(),
>> +                        ct_item_ops: ItemOperationsVTable::<$tpe, Data>::vtable_ptr(),
>>                           ct_attrs: core::ptr::from_ref(attributes).cast_mut().cast(),
>>                           ct_bin_attrs: core::ptr::null_mut(),
>>                       }),
>> @@ -773,7 +773,7 @@ pub const fn new<const N: usize>(
>>                       item_type: Opaque::new(bindings::config_item_type {
>>                           ct_owner: owner.as_ptr(),
>>                           ct_group_ops: core::ptr::null_mut(),
>> -                        ct_item_ops: ItemOperationsVTable::<$tpe, Data>::vtable_ptr().cast_mut(),
>> +                        ct_item_ops: ItemOperationsVTable::<$tpe, Data>::vtable_ptr(),
>>                           ct_attrs: core::ptr::from_ref(attributes).cast_mut().cast(),
>>                           ct_bin_attrs: core::ptr::null_mut(),
>>                       }),
>>
>
> I'm not a big fan of mixing c and rs files updates in the same commit.
> And, as I don't know rust, I'm reluctant to changes things that I don't
> understand and I'm not able to at least compile test.

This is why I gave you the diff.

>
> Can s.o. send this change as a follow-up patch?

Sure, I can do that.


Best regards,
Andreas Hindborg