diff options
author | Alex Pilon <apilon@hashicorp.com> | 2019-02-22 18:24:37 -0500 |
---|---|---|
committer | Alex Pilon <apilon@hashicorp.com> | 2019-02-22 18:24:37 -0500 |
commit | 15c0b25d011f37e7c20aeca9eaf461f78285b8d9 (patch) | |
tree | 255c250a5c9d4801c74092d33b7337d8c14438ff /vendor/golang.org/x/sys/unix/dev_linux.go | |
parent | 07971ca38143c5faf951d152fba370ddcbe26ad5 (diff) | |
download | terraform-provider-statuscake-15c0b25d011f37e7c20aeca9eaf461f78285b8d9.tar.gz terraform-provider-statuscake-15c0b25d011f37e7c20aeca9eaf461f78285b8d9.tar.zst terraform-provider-statuscake-15c0b25d011f37e7c20aeca9eaf461f78285b8d9.zip |
deps: github.com/hashicorp/terraform@sdk-v0.11-with-go-modules
Updated via: go get github.com/hashicorp/terraform@sdk-v0.11-with-go-modules and go mod tidy
Diffstat (limited to 'vendor/golang.org/x/sys/unix/dev_linux.go')
-rw-r--r-- | vendor/golang.org/x/sys/unix/dev_linux.go | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/vendor/golang.org/x/sys/unix/dev_linux.go b/vendor/golang.org/x/sys/unix/dev_linux.go new file mode 100644 index 0000000..d165d6f --- /dev/null +++ b/vendor/golang.org/x/sys/unix/dev_linux.go | |||
@@ -0,0 +1,42 @@ | |||
1 | // Copyright 2017 The Go Authors. All rights reserved. | ||
2 | // Use of this source code is governed by a BSD-style | ||
3 | // license that can be found in the LICENSE file. | ||
4 | |||
5 | // Functions to access/create device major and minor numbers matching the | ||
6 | // encoding used by the Linux kernel and glibc. | ||
7 | // | ||
8 | // The information below is extracted and adapted from bits/sysmacros.h in the | ||
9 | // glibc sources: | ||
10 | // | ||
11 | // dev_t in glibc is 64-bit, with 32-bit major and minor numbers. glibc's | ||
12 | // default encoding is MMMM Mmmm mmmM MMmm, where M is a hex digit of the major | ||
13 | // number and m is a hex digit of the minor number. This is backward compatible | ||
14 | // with legacy systems where dev_t is 16 bits wide, encoded as MMmm. It is also | ||
15 | // backward compatible with the Linux kernel, which for some architectures uses | ||
16 | // 32-bit dev_t, encoded as mmmM MMmm. | ||
17 | |||
18 | package unix | ||
19 | |||
20 | // Major returns the major component of a Linux device number. | ||
21 | func Major(dev uint64) uint32 { | ||
22 | major := uint32((dev & 0x00000000000fff00) >> 8) | ||
23 | major |= uint32((dev & 0xfffff00000000000) >> 32) | ||
24 | return major | ||
25 | } | ||
26 | |||
27 | // Minor returns the minor component of a Linux device number. | ||
28 | func Minor(dev uint64) uint32 { | ||
29 | minor := uint32((dev & 0x00000000000000ff) >> 0) | ||
30 | minor |= uint32((dev & 0x00000ffffff00000) >> 12) | ||
31 | return minor | ||
32 | } | ||
33 | |||
34 | // Mkdev returns a Linux device number generated from the given major and minor | ||
35 | // components. | ||
36 | func Mkdev(major, minor uint32) uint64 { | ||
37 | dev := (uint64(major) & 0x00000fff) << 8 | ||
38 | dev |= (uint64(major) & 0xfffff000) << 32 | ||
39 | dev |= (uint64(minor) & 0x000000ff) << 0 | ||
40 | dev |= (uint64(minor) & 0xffffff00) << 12 | ||
41 | return dev | ||
42 | } | ||