* [PATCH 0/2] configfs: Constify some fileds in struct config_item_type
@ 2025-10-25 11:15 ` Christophe JAILLET
2025-10-25 11:15 ` [PATCH 1/2] configfs: Constify ct_group_ops " Christophe JAILLET
` (3 more replies)
0 siblings, 4 replies; 9+ messages in thread
From: Christophe JAILLET @ 2025-10-25 11:15 UTC (permalink / raw)
To: a.hindborg, leitao; +Cc: linux-kernel, kernel-janitors, Christophe JAILLET
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
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/2] configfs: Constify ct_group_ops in struct config_item_type
2025-10-25 11:15 ` [PATCH 0/2] configfs: Constify some fileds in struct config_item_type Christophe JAILLET
@ 2025-10-25 11:15 ` Christophe JAILLET
2025-11-04 10:12 ` Breno Leitao
2025-10-25 11:15 ` [PATCH 2/2] configfs: Constify ct_item_ops " Christophe JAILLET
` (2 subsequent siblings)
3 siblings, 1 reply; 9+ messages in thread
From: Christophe JAILLET @ 2025-10-25 11:15 UTC (permalink / raw)
To: a.hindborg, leitao; +Cc: linux-kernel, kernel-janitors, Christophe JAILLET
Make 'ct_group_ops' const in struct config_item_type.
This allows constification of many structures which hold some function
pointers.
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
Compile tested only files that explicitly use ct_group_ops.
The script used for that is:
while IFS= read -r -d '' file; do
obj="${file%.c}.o" ; echo -e "\nCompiling $file" ; make "$obj"
done < <(git grep --name-only -z ct_group_ops '*.c')
---
fs/configfs/dir.c | 2 +-
include/linux/configfs.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c
index 81f4f06bc87e..4bcd14b3434c 100644
--- a/fs/configfs/dir.c
+++ b/fs/configfs/dir.c
@@ -598,7 +598,7 @@ static void detach_attrs(struct config_item * item)
static int populate_attrs(struct config_item *item)
{
const struct config_item_type *t = item->ci_type;
- struct configfs_group_operations *ops;
+ const struct configfs_group_operations *ops;
struct configfs_attribute *attr;
struct configfs_bin_attribute *bin_attr;
int error = 0;
diff --git a/include/linux/configfs.h b/include/linux/configfs.h
index 698520b1bfdb..31a7d7124460 100644
--- a/include/linux/configfs.h
+++ b/include/linux/configfs.h
@@ -65,7 +65,7 @@ extern void config_item_put(struct config_item *);
struct config_item_type {
struct module *ct_owner;
struct configfs_item_operations *ct_item_ops;
- struct configfs_group_operations *ct_group_ops;
+ const struct configfs_group_operations *ct_group_ops;
struct configfs_attribute **ct_attrs;
struct configfs_bin_attribute **ct_bin_attrs;
};
--
2.51.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/2] configfs: Constify ct_item_ops in struct config_item_type
2025-10-25 11:15 ` [PATCH 0/2] configfs: Constify some fileds in struct config_item_type Christophe JAILLET
2025-10-25 11:15 ` [PATCH 1/2] configfs: Constify ct_group_ops " Christophe JAILLET
@ 2025-10-25 11:15 ` Christophe JAILLET
2025-11-04 10:10 ` Breno Leitao
2025-10-29 7:18 ` [PATCH 0/2] configfs: Constify some fileds " Andreas Hindborg
2025-11-27 11:12 ` Andreas Hindborg
3 siblings, 1 reply; 9+ messages in thread
From: Christophe JAILLET @ 2025-10-25 11:15 UTC (permalink / raw)
To: a.hindborg, leitao; +Cc: linux-kernel, kernel-janitors, Christophe JAILLET
Make 'ct_item_ops' const in struct config_item_type.
This allows constification of many structures which hold some function
pointers.
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
Compile tested only files that explicitly use ct_group_ops.
The script used for that is:
while IFS= read -r -d '' file; do
obj="${file%.c}.o" ; echo -e "\nCompiling $file" ; make "$obj"
done < <(git grep --name-only -z ct_item_ops '*.c')
---
fs/configfs/file.c | 2 +-
include/linux/configfs.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/configfs/file.c b/fs/configfs/file.c
index 0ad32150611e..affe4742bbb5 100644
--- a/fs/configfs/file.c
+++ b/fs/configfs/file.c
@@ -30,7 +30,7 @@ struct configfs_buffer {
size_t count;
loff_t pos;
char * page;
- struct configfs_item_operations * ops;
+ const struct configfs_item_operations *ops;
struct mutex mutex;
int needs_read_fill;
bool read_in_progress;
diff --git a/include/linux/configfs.h b/include/linux/configfs.h
index 31a7d7124460..ef65c75beeaa 100644
--- a/include/linux/configfs.h
+++ b/include/linux/configfs.h
@@ -64,7 +64,7 @@ extern void config_item_put(struct config_item *);
struct config_item_type {
struct module *ct_owner;
- struct configfs_item_operations *ct_item_ops;
+ const struct configfs_item_operations *ct_item_ops;
const struct configfs_group_operations *ct_group_ops;
struct configfs_attribute **ct_attrs;
struct configfs_bin_attribute **ct_bin_attrs;
--
2.51.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 0/2] configfs: Constify some fileds in struct config_item_type
2025-10-25 11:15 ` [PATCH 0/2] configfs: Constify some fileds in struct config_item_type Christophe JAILLET
2025-10-25 11:15 ` [PATCH 1/2] configfs: Constify ct_group_ops " Christophe JAILLET
2025-10-25 11:15 ` [PATCH 2/2] configfs: Constify ct_item_ops " Christophe JAILLET
@ 2025-10-29 7:18 ` Andreas Hindborg
2025-11-01 13:13 ` Christophe JAILLET
2025-11-27 11:12 ` Andreas Hindborg
3 siblings, 1 reply; 9+ messages in thread
From: Andreas Hindborg @ 2025-10-29 7:18 UTC (permalink / raw)
To: Christophe JAILLET, leitao
Cc: linux-kernel, kernel-janitors, Christophe JAILLET
"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
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 0/2] configfs: Constify some fileds in struct config_item_type
2025-10-29 7:18 ` [PATCH 0/2] configfs: Constify some fileds " Andreas Hindborg
@ 2025-11-01 13:13 ` Christophe JAILLET
2025-11-01 15:02 ` Andreas Hindborg
0 siblings, 1 reply; 9+ messages in thread
From: Christophe JAILLET @ 2025-11-01 13:13 UTC (permalink / raw)
To: Andreas Hindborg, leitao; +Cc: linux-kernel, kernel-janitors
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
>
>
>
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 0/2] configfs: Constify some fileds in struct config_item_type
2025-11-01 13:13 ` Christophe JAILLET
@ 2025-11-01 15:02 ` Andreas Hindborg
0 siblings, 0 replies; 9+ messages in thread
From: Andreas Hindborg @ 2025-11-01 15:02 UTC (permalink / raw)
To: Christophe JAILLET, leitao; +Cc: linux-kernel, kernel-janitors
"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
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/2] configfs: Constify ct_item_ops in struct config_item_type
2025-10-25 11:15 ` [PATCH 2/2] configfs: Constify ct_item_ops " Christophe JAILLET
@ 2025-11-04 10:10 ` Breno Leitao
0 siblings, 0 replies; 9+ messages in thread
From: Breno Leitao @ 2025-11-04 10:10 UTC (permalink / raw)
To: Christophe JAILLET; +Cc: a.hindborg, linux-kernel, kernel-janitors
On Sat, Oct 25, 2025 at 01:15:38PM +0200, Christophe JAILLET wrote:
> Make 'ct_item_ops' const in struct config_item_type.
> This allows constification of many structures which hold some function
> pointers.
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Breno Leitao <leitao@debian.org>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] configfs: Constify ct_group_ops in struct config_item_type
2025-10-25 11:15 ` [PATCH 1/2] configfs: Constify ct_group_ops " Christophe JAILLET
@ 2025-11-04 10:12 ` Breno Leitao
0 siblings, 0 replies; 9+ messages in thread
From: Breno Leitao @ 2025-11-04 10:12 UTC (permalink / raw)
To: Christophe JAILLET; +Cc: a.hindborg, linux-kernel, kernel-janitors
On Sat, Oct 25, 2025 at 01:15:37PM +0200, Christophe JAILLET wrote:
> Make 'ct_group_ops' const in struct config_item_type.
> This allows constification of many structures which hold some function
> pointers.
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Breno Leitao <leitao@debian.org>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 0/2] configfs: Constify some fileds in struct config_item_type
2025-10-25 11:15 ` [PATCH 0/2] configfs: Constify some fileds in struct config_item_type Christophe JAILLET
` (2 preceding siblings ...)
2025-10-29 7:18 ` [PATCH 0/2] configfs: Constify some fileds " Andreas Hindborg
@ 2025-11-27 11:12 ` Andreas Hindborg
3 siblings, 0 replies; 9+ messages in thread
From: Andreas Hindborg @ 2025-11-27 11:12 UTC (permalink / raw)
To: leitao, Christophe JAILLET; +Cc: linux-kernel, kernel-janitors
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>
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2025-11-27 11:12 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <UMPsw5UqjtBaIrv5LPKiow0sOdVevbuvSx39jhXV_gtjHReEeeqGpgijGJj5OoJjMJA3mDIeSyzR9lffgIOr6g==@protonmail.internalid>
2025-10-25 11:15 ` [PATCH 0/2] configfs: Constify some fileds in struct config_item_type Christophe JAILLET
2025-10-25 11:15 ` [PATCH 1/2] configfs: Constify ct_group_ops " Christophe JAILLET
2025-11-04 10:12 ` Breno Leitao
2025-10-25 11:15 ` [PATCH 2/2] configfs: Constify ct_item_ops " Christophe JAILLET
2025-11-04 10:10 ` Breno Leitao
2025-10-29 7:18 ` [PATCH 0/2] configfs: Constify some fileds " Andreas Hindborg
2025-11-01 13:13 ` Christophe JAILLET
2025-11-01 15:02 ` Andreas Hindborg
2025-11-27 11:12 ` Andreas Hindborg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox