Re: [PATCH v2 1/6] Port the maple tree data structures and main functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks for the update, excellent work!

On 2022/10/25 21:38, Tao Liu wrote:

> +static inline void *mas_root(struct ma_state *mas)
> +{
> +	char tree[MAPLE_BUFSIZE];
> +	assert(SIZE(maple_tree_struct) <= MAPLE_BUFSIZE);
> +
> +	readmem((ulonglong)(mas->tree), KVADDR, tree, SIZE(maple_tree_struct),
> +		"mas_root read maple_tree", FAULT_ON_ERROR);

The casts to ulonglong in the patch set cause the warnings below
with e.g. target=X86:

$ make warn target=X86
...
cc -c -g -DX86 -m32 -D_FILE_OFFSET_BITS=64 -DGDB_10_2  maple_tree.c -Wall -O2 -Wstrict-prototypes -Wmissing-prototypes -fstack-protector -Wformat-security
maple_tree.c: In function ‘mas_root’:
maple_tree.c:75:10: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
   readmem((ulonglong)(mas->tree), KVADDR, tree, SIZE(maple_tree_struct),
           ^
...

> +/***********************************************/
> +void maple_init(void)
> +{
> +	int array_len;
> +
> +	STRUCT_SIZE_INIT(maple_tree_struct, "maple_tree");
> +	STRUCT_SIZE_INIT(maple_node_struct, "maple_node");
> +
> +	MEMBER_OFFSET_INIT(maple_tree_ma_root, "maple_tree", "ma_root");
> +	MEMBER_OFFSET_INIT(maple_tree_ma_flags, "maple_tree", "ma_flags");
> +
> +	MEMBER_OFFSET_INIT(maple_node_parent, "maple_node", "parent");
> +	MEMBER_OFFSET_INIT(maple_node_ma64, "maple_node", "ma64");
> +	MEMBER_OFFSET_INIT(maple_node_mr64, "maple_node", "mr64");
> +	MEMBER_OFFSET_INIT(maple_node_slot, "maple_node", "slot");
> +
> +	MEMBER_OFFSET_INIT(maple_arange_64_parent, "maple_arange_64", "parent");
> +	MEMBER_OFFSET_INIT(maple_arange_64_pivot, "maple_arange_64", "pivot");
> +	MEMBER_OFFSET_INIT(maple_arange_64_slot, "maple_arange_64", "slot");
> +	MEMBER_OFFSET_INIT(maple_arange_64_meta, "maple_arange_64", "meta");
> +
> +	MEMBER_OFFSET_INIT(maple_range_64_parent, "maple_range_64", "parent");
> +	MEMBER_OFFSET_INIT(maple_range_64_pivot, "maple_range_64", "pivot");
> +	MEMBER_OFFSET_INIT(maple_range_64_slot, "maple_range_64", "slot");
> +	MEMBER_OFFSET_INIT(maple_range_64_meta, "maple_range_64", "meta");
> +
> +	MEMBER_OFFSET_INIT(maple_metadata_end, "maple_metadata", "end");
> +
> +	array_len = get_array_length("mt_slots", NULL, sizeof(char));
> +	mt_slots = calloc(array_len, sizeof(char));
> +	readmem(symbol_value("mt_slots"), KVADDR, mt_slots,
> +		array_len * sizeof(char), "maple_init read mt_slots",
> +		FAULT_ON_ERROR);

FAULT_ON_ERROR here leads crash to fail to start session, but crash does
not need the maple tree to start.  RETURN_ON_ERROR will be better.

> +
> +	array_len = get_array_length("mt_pivots", NULL, sizeof(char));
> +	mt_pivots = calloc(array_len, sizeof(char));
> +	readmem(symbol_value("mt_pivots"), KVADDR, mt_pivots,
> +		array_len * sizeof(char), "maple_init read mt_pivots",
> +		FAULT_ON_ERROR);

Ditto.

Thanks,
Kazu
--
Crash-utility mailing list
Crash-utility@xxxxxxxxxx
https://listman.redhat.com/mailman/listinfo/crash-utility
Contribution Guidelines: https://github.com/crash-utility/crash/wiki




[Index of Archives]     [Fedora Development]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]     [Fedora Tools]

 

Powered by Linux