* [PATCH] maple: change the pointer name from maple_enode to maple_enode_p
@ 2022-07-17 12:12 Li Hongyu
2022-07-17 14:47 ` Matthew Wilcox
0 siblings, 1 reply; 3+ messages in thread
From: Li Hongyu @ 2022-07-17 12:12 UTC (permalink / raw)
To: Liam R. Howlett, linux-mm, linux-kernel; +Cc: Miguel Ojeda
The current name of the pointer to struct maple_enode is also
maple_enode. This is correct from the grammar point but can be
comfusing. Besides it seems in Linux it prefers typedef struct foo
*foo_p;, e.g. typedef struct cpumask *cpumask_var_t; and typedef
struct cgraph_node *cgraph_node_ptr;. I use re to search in the
Linux project and cannot find another example in typedef struct
foo *foo; style.
This also results in a bug in the bindings of the
rust-for-linux subsystem, which can be seen in this github issue.
https://github.com/Rust-for-Linux/linux/issues/795
The struct pointer maple_enode and maple_pnode are not used. It is
safe to change it to a new name.
Signed-off-by: Li Hongyu <lihongyu1999@bupt.edu.cn>
---
include/linux/maple_tree.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/linux/maple_tree.h b/include/linux/maple_tree.h
index 2c9dede989c7..4886e019a2b5 100644
--- a/include/linux/maple_tree.h
+++ b/include/linux/maple_tree.h
@@ -72,8 +72,8 @@
* 0x010 : 32 bit values, type in 0-2, slot in 3-6
* 0x110 : 64 bit values, type in 0-2, slot in 3-6
*/
-typedef struct maple_enode *maple_enode; /* encoded node */
-typedef struct maple_pnode *maple_pnode; /* parent node */
+typedef struct maple_enode *maple_enode_p; /* encoded node */
+typedef struct maple_pnode *maple_pnode_p; /* parent node */
/*
* This metadata is used to optimize the gap updating code and in reverse
--
2.17.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] maple: change the pointer name from maple_enode to maple_enode_p
2022-07-17 12:12 [PATCH] maple: change the pointer name from maple_enode to maple_enode_p Li Hongyu
@ 2022-07-17 14:47 ` Matthew Wilcox
2022-07-18 4:27 ` Li Hongyu
0 siblings, 1 reply; 3+ messages in thread
From: Matthew Wilcox @ 2022-07-17 14:47 UTC (permalink / raw)
To: Li Hongyu; +Cc: Liam R. Howlett, linux-mm, linux-kernel, Miguel Ojeda
On Sun, Jul 17, 2022 at 09:12:42PM +0900, Li Hongyu wrote:
> The current name of the pointer to struct maple_enode is also
> maple_enode. This is correct from the grammar point but can be
> comfusing. Besides it seems in Linux it prefers typedef struct foo
> *foo_p;, e.g. typedef struct cpumask *cpumask_var_t; and typedef
> struct cgraph_node *cgraph_node_ptr;. I use re to search in the
> Linux project and cannot find another example in typedef struct
> foo *foo; style.
>
> This also results in a bug in the bindings of the
> rust-for-linux subsystem, which can be seen in this github issue.
>
> https://github.com/Rust-for-Linux/linux/issues/795
>
> The struct pointer maple_enode and maple_pnode are not used. It is
> safe to change it to a new name.
>
> Signed-off-by: Li Hongyu <lihongyu1999@bupt.edu.cn>
> ---
> include/linux/maple_tree.h | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/include/linux/maple_tree.h b/include/linux/maple_tree.h
> index 2c9dede989c7..4886e019a2b5 100644
> --- a/include/linux/maple_tree.h
> +++ b/include/linux/maple_tree.h
> @@ -72,8 +72,8 @@
> * 0x010 : 32 bit values, type in 0-2, slot in 3-6
> * 0x110 : 64 bit values, type in 0-2, slot in 3-6
> */
> -typedef struct maple_enode *maple_enode; /* encoded node */
> -typedef struct maple_pnode *maple_pnode; /* parent node */
> +typedef struct maple_enode *maple_enode_p; /* encoded node */
> +typedef struct maple_pnode *maple_pnode_p; /* parent node */
If this is the only change needed, then clearly they're not being used,
so just delete them?
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] maple: change the pointer name from maple_enode to maple_enode_p
2022-07-17 14:47 ` Matthew Wilcox
@ 2022-07-18 4:27 ` Li Hongyu
0 siblings, 0 replies; 3+ messages in thread
From: Li Hongyu @ 2022-07-18 4:27 UTC (permalink / raw)
To: Matthew Wilcox; +Cc: Liam R. Howlett, linux-mm, linux-kernel, Miguel Ojeda
On Sun, Jul 17, 2022 at 03:47:55PM +0100, Matthew Wilcox wrote:
> If this is the only change needed, then clearly they're not being used,
> so just delete them?
There is no definition of the struct maple_enode or maple_pnode. This
struct is only used as a pointer. There are some comments about this
pointer, which will be gone if we delete these two typedef statements.
If you worry about generating a not used data type, it may be better to
change `struct maple_enode *foo` to `maple_enode_p foo`. This keeps the
code more readable and used the maple_enode_p type.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-07-18 4:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-17 12:12 [PATCH] maple: change the pointer name from maple_enode to maple_enode_p Li Hongyu
2022-07-17 14:47 ` Matthew Wilcox
2022-07-18 4:27 ` Li Hongyu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox