(ctx context.Context, path string)
| 61 | } |
| 62 | |
| 63 | func 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 | |
| 92 | type deviceConfig struct { |
| 93 | path string |
no test coverage detected