MCPcopy Create free account
hub / github.com/ceph/ceph / from_error_code

Function from_error_code

src/common/error_code.cc:158–194  ·  view source on GitHub ↗

This is more complicated. For the case of categories defined elsewhere, we have to convert everything here.

Source from the content-addressed store, hash-verified

156// This is more complicated. For the case of categories defined
157// elsewhere, we have to convert everything here.
158[[nodiscard]] int from_error_code(boost::system::error_code e) noexcept
159{
160 if (!e)
161 return 0;
162
163 auto c = dynamic_cast<const converting_category*>(&e.category());
164 // For categories we define
165 if (c)
166 return c->from_code(e.value());
167
168 // For categories matching values of errno
169 if (e.category() == boost::system::system_category() ||
170 e.category() == boost::system::generic_category() ||
171 // ASIO uses the system category for these and matches system
172 // error values.
173 e.category() == boost::asio::error::get_netdb_category() ||
174 e.category() == boost::asio::error::get_addrinfo_category())
175 return -e.value();
176
177 if (e.category() == boost::asio::error::get_misc_category()) {
178 // These values are specific to asio
179 switch (e.value()) {
180 case boost::asio::error::already_open:
181 return -EIO;
182 case boost::asio::error::eof:
183 return -EIO;
184 case boost::asio::error::not_found:
185 return -ENOENT;
186 case boost::asio::error::fd_set_failure:
187 return -EINVAL;
188 }
189 }
190 // Add any other categories we use here.
191
192 // So many things defautl to EIO this is probably the safest
193 return -EIO;
194}
195}
196#pragma GCC diagnostic pop
197#pragma clang diagnostic pop

Callers 15

fetch_fsmapMethod · 0.85
start_reclaimMethod · 0.85
OpContextVertMethod · 0.85
subsystem_cancelMethod · 0.85
check_layout_vxattrMethod · 0.85
init_watchMethod · 0.85
log_trimMethod · 0.85
log_startMethod · 0.85
log_stopMethod · 0.85
bilog_listFunction · 0.85
cls_bucket_headMethod · 0.85

Calls 3

categoryMethod · 0.80
from_codeMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected