Skip to content

libct/cgroups/fscommon: nits#2604

Merged
mrunalp merged 5 commits into
opencontainers:masterfrom
kolyshkin:fscommon-I
Sep 30, 2020
Merged

libct/cgroups/fscommon: nits#2604
mrunalp merged 5 commits into
opencontainers:masterfrom
kolyshkin:fscommon-I

Conversation

@kolyshkin
Copy link
Copy Markdown
Contributor

This is mostly error message fixes, doc improvements, and other minor cleanups.

This used to be a part of #2598

AkihiroSuda
AkihiroSuda previously approved these changes Sep 29, 2020
Copy link
Copy Markdown
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

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

one nit in the first commit, LGTM otherwise

Comment thread libcontainer/cgroups/fs2/hugetlb.go Outdated
Comment thread libcontainer/cgroups/fs2/hugetlb.go Outdated
1. Don't wrap the error from fscommon.GetCgroupParamUint as it already
   contains the file name.

2. Don't put file name when wrapping the error from ioutil.ReadFile
   since it already has it.

3. Don't reconstruct file name, use existing one since it's available.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2. Fix wrapping the error to not have the value as it's already
   part of the error returned from ParseUint.

3. Fix/improve doc.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
1. Use own ReadFile wrapper instead of ioutils.ReadFile.
   This makes it use the security measures of ReadFile.

2. Improve doc.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
1. Use GetCgroupParamString as the initial part of both functions are
   the same and we can reuse it. This also gives us whatever security
   measures GetCgroupParamString has (see previous commit).

2. Fix the error wrapping to not add the value, as it is already a part
   of the error returned by ParseUint.

3. Improve docstring.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Document ReadFile and WriteFile. Fix doc for ParseUint to be in
canonical form.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
@kolyshkin
Copy link
Copy Markdown
Contributor Author

@AkihiroSuda @thaJeztah @mrunalp PTAL

Copy link
Copy Markdown
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

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

LGTM

@thaJeztah
Copy link
Copy Markdown
Member

@mrunalp @cyphar ptal

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.

4 participants