MCPcopy
hub / github.com/google/gvisor / MakeDeviceID

Function MakeDeviceID

pkg/abi/linux/dev.go:24–26  ·  view source on GitHub ↗

MakeDeviceID encodes a major and minor device number into a single device ID. Format (see linux/kdev_t.h:new_encode_dev): Bits 7:0 - minor bits 7:0 Bits 19:8 - major bits 11:0 Bits 31:20 - minor bits 19:8

(major uint16, minor uint32)

Source from the content-addressed store, hash-verified

22// Bits 19:8 - major bits 11:0
23// Bits 31:20 - minor bits 19:8
24func MakeDeviceID(major uint16, minor uint32) uint32 {
25 return (minor & 0xff) | ((uint32(major) & 0xfff) << 8) | ((minor >> 8) << 20)
26}
27
28// DecodeDeviceID decodes a device ID into major and minor device numbers.
29func DecodeDeviceID(rdev uint32) (uint16, uint32) {

Callers 7

convertStatxToUserStatFunction · 0.92
convertStatxToUserStatFunction · 0.92
NewNodeMethod · 0.92
isOvlWhiteoutDevFunction · 0.92
DeviceIDMethod · 0.92
InitMethod · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…