MCPcopy Index your code
hub / github.com/coder/envbox / CreateFuseDevice

Function CreateFuseDevice

xunix/device.go:63–90  ·  view source on GitHub ↗
(ctx context.Context, path string)

Source from the content-addressed store, hash-verified

61}
62
63func CreateFuseDevice(ctx context.Context, path string) (Device, error) {
64 const (
65 major uint = 10
66
67 // See https://github.com/torvalds/linux/blob/master/Documentation/admin-guide/devices.txt#L365
68 minor uint = 229
69 )
70
71 err := createDevice(ctx, deviceConfig{
72 path: path,
73 mode: charDevMode,
74 dev: dev(major, minor),
75 major: major,
76 minor: minor,
77 ftype: charFileType,
78 })
79 if err != nil {
80 return Device{}, xerrors.Errorf("create device: %w", err)
81 }
82
83 return Device{
84 Path: path,
85 Type: DeviceTypeChar,
86 Major: int64(major),
87 Minor: int64(minor),
88 FileMode: charDevMode,
89 }, nil
90}
91
92type deviceConfig struct {
93 path string

Callers 1

runDockerCVMFunction · 0.92

Calls 3

createDeviceFunction · 0.85
devFunction · 0.85
ErrorfMethod · 0.65

Tested by

no test coverage detected