Skip to content

pkg/parsers/kernel: simplify#1889

Merged
openshift-merge-bot[bot] merged 1 commit intocontainers:mainfrom
kolyshkin:kernel
Apr 18, 2024
Merged

pkg/parsers/kernel: simplify#1889
openshift-merge-bot[bot] merged 1 commit intocontainers:mainfrom
kolyshkin:kernel

Conversation

@kolyshkin
Copy link
Copy Markdown
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
Copy Markdown
Member

rhatdan commented Apr 16, 2024

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

Copy link
Copy Markdown
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
Copy Markdown
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 <kolyshkin@gmail.com>
Copy link
Copy Markdown
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

@openshift-ci
Copy link
Copy Markdown
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

Details 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
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