| 1844 | |
| 1845 | |
| 1846 | Try<Device> Device::parse(const string& s) |
| 1847 | { |
| 1848 | vector<string> device = strings::tokenize(s, ":"); |
| 1849 | if (device.size() != 2) { |
| 1850 | return Error("Invalid major:minor device number: '" + s + "'"); |
| 1851 | } |
| 1852 | |
| 1853 | Try<unsigned int> major = numify<unsigned int>(device[0]); |
| 1854 | if (major.isError()) { |
| 1855 | return Error("Invalid device major number: '" + device[0] + "'"); |
| 1856 | } |
| 1857 | |
| 1858 | Try<unsigned int> minor = numify<unsigned int>(device[1]); |
| 1859 | if (minor.isError()) { |
| 1860 | return Error("Invalid device minor number: '" + device[1] + "'"); |
| 1861 | } |
| 1862 | |
| 1863 | return Device(makedev(major.get(), minor.get())); |
| 1864 | } |
| 1865 | |
| 1866 | |
| 1867 | static bool isOperation(const string& s) |
nothing calls this directly
no test coverage detected