aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/golang.org/x/sys/unix/dev_linux.go
diff options
context:
space:
mode:
authorLibravatar Rutger Broekhoff2024-01-02 18:56:31 +0100
committerLibravatar Rutger Broekhoff2024-01-02 18:56:31 +0100
commit8db41da676ac8368ef7c2549d56239a5ff5eedde (patch)
tree09c427fd66de2ec1ebffc8342f5fdbb84b0701b5 /vendor/golang.org/x/sys/unix/dev_linux.go
parentd4f75fb6db22e57577867445a022227e70958931 (diff)
downloadgitolfs3-8db41da676ac8368ef7c2549d56239a5ff5eedde.tar.gz
gitolfs3-8db41da676ac8368ef7c2549d56239a5ff5eedde.zip
Delete vendor directory
Diffstat (limited to 'vendor/golang.org/x/sys/unix/dev_linux.go')
-rw-r--r--vendor/golang.org/x/sys/unix/dev_linux.go42
1 files changed, 0 insertions, 42 deletions
diff --git a/vendor/golang.org/x/sys/unix/dev_linux.go b/vendor/golang.org/x/sys/unix/dev_linux.go
deleted file mode 100644
index d165d6f..0000000
--- a/vendor/golang.org/x/sys/unix/dev_linux.go
+++ /dev/null
@@ -1,42 +0,0 @@
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
18package unix
19
20// Major returns the major component of a Linux device number.
21func 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.
28func 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.
36func 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}