Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

btf: correct printing size of Int type in bytes #1182

Merged
merged 1 commit into from
Oct 24, 2023

Conversation

Asphaltt
Copy link
Contributor

It seems OK that the printing size of Int type in bits.

But while printing a struct, like 'struct sk_buff', it seems strange that the printing size units of Int type and Struct/Union type are different:

  : offset=1088
  : Union[fields=2]
    size: 4
    csum: offset=0
    csum: Typedef:"__wsum"[Typedef:"__u32"]
      __wsum: Typedef:"__u32"[Int:"unsigned int"]
        __u32: Int:"unsigned int"[unsigned size=32]
    : offset=0
    : Struct[fields=2]
  priority: offset=1120
  priority: Typedef:"__u32"[Int:"unsigned int"]
    __u32: Int:"unsigned int"[unsigned size=32]

So, it's better to make the printing size of Int type in bytes same as Struct/Union type.

It seems OK that the printing size of Int type in bits.

But while printing a struct, like 'struct sk_buff', it seems strange
that the printing size units of Int type and Struct/Union type are
different:

  : offset=1088
  : Union[fields=2]
    size: 4
    csum: offset=0
    csum: Typedef:"__wsum"[Typedef:"__u32"]
      __wsum: Typedef:"__u32"[Int:"unsigned int"]
        __u32: Int:"unsigned int"[unsigned size=32]
    : offset=0
    : Struct[fields=2]
  priority: offset=1120
  priority: Typedef:"__u32"[Int:"unsigned int"]
    __u32: Int:"unsigned int"[unsigned size=32]

So, it's better to make the printing size of Int type in bytes same as
Struct/Union type.

Signed-off-by: Leon Hwang <hffilwlqm@gmail.com>
Copy link
Collaborator

@lmb lmb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks :)

@lmb lmb merged commit c58aedd into cilium:main Oct 24, 2023
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants