| 106 | } /* namespace UEventParser */ |
| 107 | |
| 108 | void parseUEventFromFile(const std::string& uevent_path, UEvent& uevent, bool attributes_only, bool trace) |
| 109 | { |
| 110 | std::ifstream uevent_stream(uevent_path); |
| 111 | |
| 112 | if (uevent_stream.good()) { |
| 113 | std::string uevent_string(4096, 0); |
| 114 | uevent_stream.readsome(&uevent_string[0], uevent_string.capacity()); |
| 115 | const auto read_size = uevent_stream.gcount(); |
| 116 | |
| 117 | if (read_size > 0) { |
| 118 | uevent_string.resize(read_size); |
| 119 | parseUEventFromString(uevent_string, uevent, attributes_only, trace); |
| 120 | } |
| 121 | } |
| 122 | else { |
| 123 | throw std::runtime_error("failed to open uevent source file"); |
| 124 | } |
| 125 | } |
| 126 | |
| 127 | template<class G> |
| 128 | void parseUEventFromString(const std::string& uevent_string, UEvent& uevent, bool trace) |
nothing calls this directly
no test coverage detected