~emersion/go-drm

ref: c0c2450906d94f52d69c264e485731cbaf1a63f4 go-drm/device.go -rw-r--r-- 282 bytes
c0c24509Simon Ser Improve format/modifier pretty-printing 4 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
package drm

import (
	"syscall"
)

func modeIsChr(mode uint32) bool {
	return mode&syscall.S_IFMT == syscall.S_IFCHR
}

func devIsDRM(dev uint64) bool {
	return major(dev) == drmMajor
}

func isDRM(stat *syscall.Stat_t) bool {
	return devIsDRM(stat.Rdev) && modeIsChr(stat.Mode)
}