Path: blob/main/vendor/golang.org/x/sys/unix/dev_freebsd.go
2880 views
// Copyright 2017 The Go Authors. All rights reserved.1// Use of this source code is governed by a BSD-style2// license that can be found in the LICENSE file.34// Functions to access/create device major and minor numbers matching the5// encoding used in FreeBSD's sys/types.h header.6//7// The information below is extracted and adapted from sys/types.h:8//9// Minor gives a cookie instead of an index since in order to avoid changing the10// meanings of bits 0-15 or wasting time and space shifting bits 16-31 for11// devices that don't use them.1213package unix1415// Major returns the major component of a FreeBSD device number.16func Major(dev uint64) uint32 {17return uint32((dev >> 8) & 0xff)18}1920// Minor returns the minor component of a FreeBSD device number.21func Minor(dev uint64) uint32 {22return uint32(dev & 0xffff00ff)23}2425// Mkdev returns a FreeBSD device number generated from the given major and26// minor components.27func Mkdev(major, minor uint32) uint64 {28return (uint64(major) << 8) | uint64(minor)29}303132