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

pkg/parsers/kernel: simplify #1889

Merged
merged 1 commit into from
Apr 18, 2024
Merged

Conversation

kolyshkin
Copy link
Contributor

Since golang.org/x/sys/unix provides portable way to use uname(2) syscall, let's use it for all unix variants, removing the duplicated code from uname_*.go.

While at it:

  • remove uname_unsupported*.go (not used);
  • use unix.ByteSliceToString.

NOTE this also removes the public definition of struct Utsname. I am puzzled as to why it was exported as it is not (and was not) used by any public functions in this package, nor I was able to find any usage of kernel.Utsname (using sourcegraph).

@rhatdan
Copy link
Member

rhatdan commented Apr 16, 2024

LGTM
/approve
@giuseppe @nalind @mtrmac @saschagrunert PTAL

Copy link
Collaborator

@mtrmac mtrmac left a comment

Choose a reason for hiding this comment

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

Simplifying the Unix implementation, sure.

WRT removing the public Utsname symbol, c/storage is supposed to have a stable API, but with things like #1622 (and many others), that’s… not been consistently the case.

@kolyshkin
Copy link
Contributor Author

Simplifying the Unix implementation, sure.

WRT removing the public Utsname symbol, c/storage is supposed to have a stable API, but with things like #1622 (and many others), that’s… not been consistently the case.

As I was not able to find any existing users of kernel.Utsname, this API breakage seems purely theoretical.

Since golang.org/x/sys/unix provides portable way to use uname(2)
syscall, let's use it for all unix variants, removing the duplicated
code from uname_*.go.

While at it:
 - remove uname_unsupported*.go (not used);
 - use unix.ByteSliceToString.

NOTE this also removes the public definition of struct Utsname. I am
puzzled as to why it was exported as it is not (and was not) used by
any public functions in this package, nor I was able to find any usage
of kernel.Utsname (using sourcegraph).

Signed-off-by: Kir Kolyshkin <[email protected]>
Copy link
Member

@giuseppe giuseppe left a comment

Choose a reason for hiding this comment

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

/lgtm

Copy link
Contributor

openshift-ci bot commented Apr 18, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: giuseppe, kolyshkin, rhatdan, saschagrunert

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [giuseppe,rhatdan,saschagrunert]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-bot openshift-merge-bot bot merged commit 0b293c3 into containers:main Apr 18, 2024
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants