At 2012-5-22 23:15, Dave Anderson wrote:
Doing it that way really confuses two different "offset"
issues that are associated
with this command:
(1) the offset of an rb_root or radix_tree_node within a containing
data structure, and
(2) the offset of an rb_node within a containing data structure.
And in both cases, forget trying to implement the "the -o is not necessary"
and
"the -o is only necessary..." optimizations, because it would be almost
impossible
to do.
Hello Dave,
I will list all the situations I was concerning.
First red-black tree:
1. rb_node is embedded in a structure. Address is the address of the
structure, and -o shows the offset of rb_node to the structure.
2. same as 1., but the address is the address of rb_node when using -N
in command line.
rb_root was not concering. I will recall the reason. I can get the root
node from rb_root. And then the offspring of the root node. Then I still
need a offset that shows the offset of the offspring node to its related
structure to get the structure's information.
Then radix tree:
3. radix_tree_root's address is specified.
4. radix_tree_node's address is specified.
According to your reply, "-r offset" indicates rb_root and
radix_tree_root, and "-n offset" indicates rb_node and radix_tree_node.
And if I use "-r offset", then I need another option to show the offset
of rb_node. And when using "-n offset" together with an address, which
can only be one of rb_node's address and address of the structure
rb_node embedded in, I may need another option to indicate the address's
type.
So I think "tree -t type -r offset -n offset -m addr..." is a good
choice. "-r offset" indicates the rb_root or radix_tree_root's offset,
and "-n offset" indicates the rb_node or radix_tree_node's offset. When
only using "-n offset" indicates the addr is related to rb_node or
radix_tree_node, but if "-r offset" is also specified, the addr is
related to rb_root or radix_tree_root. When "-m" is specified, the addr
is the address of the root(when specified "-r offset") or the node. If
"-m" is not specified, the addr is the address of the structure that
containing the root(when specified "-r offset") or the node.
Do you think it's OK?
--
--
Regards
Qiao Nuohan