parseDevice parses the device token of a line and converts it to a dev_t (mkdev) like structure.
(s string)
| 61 | // parseDevice parses the device token of a line and converts it to a dev_t |
| 62 | // (mkdev) like structure. |
| 63 | func parseDevice(s string) (uint64, error) { |
| 64 | i := strings.Index(s, ":") |
| 65 | if i == -1 { |
| 66 | return 0, fmt.Errorf("%w: expected separator `:` in %s", ErrFileParse, s) |
| 67 | } |
| 68 | |
| 69 | major, err := strconv.ParseUint(s[0:i], 16, 0) |
| 70 | if err != nil { |
| 71 | return 0, err |
| 72 | } |
| 73 | |
| 74 | minor, err := strconv.ParseUint(s[i+1:], 16, 0) |
| 75 | if err != nil { |
| 76 | return 0, err |
| 77 | } |
| 78 | |
| 79 | return unix.Mkdev(uint32(major), uint32(minor)), nil |
| 80 | } |
| 81 | |
| 82 | // parseAddress converts a hex-string to a uintptr. |
| 83 | func parseAddress(s string) (uintptr, error) { |
no outgoing calls
searching dependent graphs…