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: system: use Major, Minor and Mkdev from x/sys/unix #194

Merged
merged 2 commits into from
Oct 17, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion hack/vendor.sh
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ clone github.com/opencontainers/runtime-spec v1.0.0
clone github.com/opencontainers/runtime-tools 2d270b8764c02228eeb13e36f076f5ce6f2e3591
clone github.com/syndtr/gocapability 2c00daeb6c3b45114c80ac44119e7b8801fdd852
clone golang.org/x/crypto b8a2a83acfe6e6770b75de42d5ff4c67596675c0 https://github.com/golang/crypto
clone golang.org/x/sys fb4cac33e3196ff7f507ab9b2d2a44b0142f5b5a https://github.com/golang/sys
clone golang.org/x/sys 686000749eaec0b8855b8eef5336cf63899fe51d https://github.com/golang/sys
clone github.com/docker/go-units v0.3.1
clone github.com/pkg/errors v0.8.0
clone github.com/apex/log afb2e76037a5f36542c77e88ef8aef9f469b09f8
Expand Down
8 changes: 3 additions & 5 deletions pkg/system/mknod_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,17 @@ func Tarmode(typeflag byte) uint32 {
// similar to makedev(3).
func Makedev(major, minor uint64) Dev_t {
// These values come from new_envode_dev inside <linux/kdev_t.h>.
return Dev_t((minor & 0xff) | (major << 8) | ((minor &^ 0xff) << 12))
return Dev_t(unix.Mkdev(uint32(major), uint32(minor)))
}

// Majordev returns the major device number given a dev_t, similar to major(3).
func Majordev(device Dev_t) uint64 {
// These values come from new_decode_dev() inside <linux/kdev_t.h>.
return uint64((device & 0xfff00) >> 8)
return uint64(unix.Major(uint64(device)))
}

// Minordev returns the minor device number given a dev_t, similar to minor(3).
func Minordev(device Dev_t) uint64 {
// These values come from new_decode_dev() inside <linux/kdev_t.h>.
return uint64((device & 0xff) | ((device >> 12) & 0xfff00))
return uint64(unix.Minor(uint64(device)))
}

// Mknod is a wrapper around mknod(2).
Expand Down
29 changes: 29 additions & 0 deletions vendor/golang.org/x/sys/unix/asm_openbsd_arm.s

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

195 changes: 195 additions & 0 deletions vendor/golang.org/x/sys/unix/cap_freebsd.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions vendor/golang.org/x/sys/unix/dev_darwin.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions vendor/golang.org/x/sys/unix/dev_dragonfly.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions vendor/golang.org/x/sys/unix/dev_freebsd.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

42 changes: 42 additions & 0 deletions vendor/golang.org/x/sys/unix/dev_linux.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading