This repository was archived by the owner on Feb 24, 2020. It is now read-only.
pkg/fileutil: helper function to get major, minor numbers of a device file#3500
Merged
lucab merged 1 commit intorkt:masterfrom Jan 6, 2017
Merged
pkg/fileutil: helper function to get major, minor numbers of a device file#3500lucab merged 1 commit intorkt:masterfrom
lucab merged 1 commit intorkt:masterfrom
Conversation
jonboulle
suggested changes
Jan 2, 2017
pkg/fileutil/fileutil_linux.go
Outdated
| } | ||
| stat_t, ok := d.Sys().(*syscall.Stat_t) | ||
| if !ok { | ||
| err = fmt.Errorf("Cannot determine device number") |
| } | ||
|
|
||
| // GetDeviceInfo returns the type, major, and minor numbers of a device | ||
| func GetDeviceInfo(path string) (kind rune, major uint64, minor uint64, err error) { |
Contributor
There was a problem hiding this comment.
Change this to
func GetDeviceInfo(path string) (kind rune, major uint64, minor uint64, err error) {
d, err := os.Lstat(path)
if err != nil {
return ' ', 0, 0, err
}
return getDeviceInfo(d)
}
func getDeviceInfo(d *os.FileInfo) (kind rune, major uint64, minor uint64, err error) {
...
}
Then you can test the inner function to your heart's content
58d2a44 to
a8a42aa
Compare
Member
|
Ci complains about: |
a8a42aa to
b30c557
Compare
b30c557 to
7033fb5
Compare
Contributor
Author
|
@jonboulle care to re-review? |
jonboulle
approved these changes
Jan 5, 2017
Contributor
|
Seems OK but I'll defer to @lucab for approval |
lucab
approved these changes
Jan 6, 2017
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.