Merge "Drop base:: in front of ErrnoErrorf"
diff --git a/bpfloader/Android.bp b/bpfloader/Android.bp
index fd650d4..7b7eb53 100644
--- a/bpfloader/Android.bp
+++ b/bpfloader/Android.bp
@@ -47,6 +47,7 @@
required: [
"clatd.o",
"netd.o",
+ "offload.o",
],
}
diff --git a/libbpf_android/include/bpf/BpfMap.h b/libbpf_android/include/bpf/BpfMap.h
index 629605f..bdc4cfd 100644
--- a/libbpf_android/include/bpf/BpfMap.h
+++ b/libbpf_android/include/bpf/BpfMap.h
@@ -146,7 +146,7 @@
const auto deleteAllEntries = [](const Key& key,
BpfMap<Key, Value>& map) -> base::Result<void> {
base::Result<void> res = map.deleteValue(key);
- if (!res && res.error().code() != ENOENT) {
+ if (!res.ok() && res.error().code() != ENOENT) {
ALOGE("Failed to delete data %s", strerror(res.error().code()));
}
return {};
@@ -182,10 +182,10 @@
const std::function<base::Result<void>(const Key& key, const BpfMap<Key, Value>& map)>&
filter) const {
base::Result<Key> curKey = getFirstKey();
- while (curKey) {
+ while (curKey.ok()) {
const base::Result<Key>& nextKey = getNextKey(curKey.value());
base::Result<void> status = filter(curKey.value(), *this);
- if (!status) return status;
+ if (!status.ok()) return status;
curKey = nextKey;
}
if (curKey.error().code() == ENOENT) return {};
@@ -197,12 +197,12 @@
const std::function<base::Result<void>(const Key& key, const Value& value,
const BpfMap<Key, Value>& map)>& filter) const {
base::Result<Key> curKey = getFirstKey();
- while (curKey) {
+ while (curKey.ok()) {
const base::Result<Key>& nextKey = getNextKey(curKey.value());
base::Result<Value> curValue = this->readValue(curKey.value());
- if (!curValue) return curValue.error();
+ if (!curValue.ok()) return curValue.error();
base::Result<void> status = filter(curKey.value(), curValue.value(), *this);
- if (!status) return status;
+ if (!status.ok()) return status;
curKey = nextKey;
}
if (curKey.error().code() == ENOENT) return {};
@@ -213,10 +213,10 @@
base::Result<void> BpfMap<Key, Value>::iterate(
const std::function<base::Result<void>(const Key& key, BpfMap<Key, Value>& map)>& filter) {
base::Result<Key> curKey = getFirstKey();
- while (curKey) {
+ while (curKey.ok()) {
const base::Result<Key>& nextKey = getNextKey(curKey.value());
base::Result<void> status = filter(curKey.value(), *this);
- if (!status) return status;
+ if (!status.ok()) return status;
curKey = nextKey;
}
if (curKey.error().code() == ENOENT) return {};
@@ -228,12 +228,12 @@
const std::function<base::Result<void>(const Key& key, const Value& value,
BpfMap<Key, Value>& map)>& filter) {
base::Result<Key> curKey = getFirstKey();
- while (curKey) {
+ while (curKey.ok()) {
const base::Result<Key>& nextKey = getNextKey(curKey.value());
base::Result<Value> curValue = this->readValue(curKey.value());
- if (!curValue) return curValue.error();
+ if (!curValue.ok()) return curValue.error();
base::Result<void> status = filter(curKey.value(), curValue.value(), *this);
- if (!status) return status;
+ if (!status.ok()) return status;
curKey = nextKey;
}
if (curKey.error().code() == ENOENT) return {};