maple: change the pointer name from maple_enode to maple_enode_p
Subsystems (2)
PATCH 1/1 maple: change the pointer name from maple_enode to maple_enode_p
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.
--- include/linux/maple_tree.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
include/linux/maple_tree.h +2 -2
@@ -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
Signature · 1 line
2.17.1
Quoted 26 lines · Li Hongyu
The current name of the pointer to struct
maple_enodeis alsomaple_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 structcgraph_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_enodeandmaple_pnodeare not used. It is safe to change it to a new name.Signed-off-by Li Hongyu <[email protected]>--- include/linux/maple_tree.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)include/linux/maple_tree.h +0
-0
include/linux/maple_tree.h line 76
Quoted 7 lines
include/linux/maple_tree.h +2
-2@@ -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?
Quoted 2 lines · Matthew Wilcox
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.