(ctx context.Context, path string)
| 32 | } |
| 33 | |
| 34 | func CreateTUNDevice(ctx context.Context, path string) (Device, error) { |
| 35 | const ( |
| 36 | major uint = 10 |
| 37 | // See https://github.com/torvalds/linux/blob/master/Documentation/admin-guide/devices.txt#L336 |
| 38 | minor uint = 200 |
| 39 | ) |
| 40 | |
| 41 | // TODO offset (from legacy.go) |
| 42 | err := createDevice(ctx, deviceConfig{ |
| 43 | path: path, |
| 44 | mode: charDevMode, |
| 45 | dev: dev(major, minor), |
| 46 | major: major, |
| 47 | minor: minor, |
| 48 | ftype: charFileType, |
| 49 | }) |
| 50 | if err != nil { |
| 51 | return Device{}, xerrors.Errorf("create device: %w", err) |
| 52 | } |
| 53 | |
| 54 | return Device{ |
| 55 | Path: path, |
| 56 | Type: DeviceTypeChar, |
| 57 | Major: int64(major), |
| 58 | Minor: int64(minor), |
| 59 | FileMode: charDevMode, |
| 60 | }, nil |
| 61 | } |
| 62 | |
| 63 | func CreateFuseDevice(ctx context.Context, path string) (Device, error) { |
| 64 | const ( |
no test coverage detected