Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(583)

Unified Diff: sandbox/linux/bpf_dsl/errorcode.cc

Issue 1292753009: sandbox/linux: move ErrorCode into bpf_dsl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bpf_dsl-deps
Patch Set: Rebase and cleanup test code Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sandbox/linux/bpf_dsl/errorcode.h ('k') | sandbox/linux/bpf_dsl/errorcode_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sandbox/linux/bpf_dsl/errorcode.cc
diff --git a/sandbox/linux/seccomp-bpf/errorcode.cc b/sandbox/linux/bpf_dsl/errorcode.cc
similarity index 85%
rename from sandbox/linux/seccomp-bpf/errorcode.cc
rename to sandbox/linux/bpf_dsl/errorcode.cc
index e10a08f2c79efb8a59fe6421ed792d4111341004..8660f71441895595ebf66a54f4b17bb4147a2b4b 100644
--- a/sandbox/linux/seccomp-bpf/errorcode.cc
+++ b/sandbox/linux/bpf_dsl/errorcode.cc
@@ -2,15 +2,15 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "sandbox/linux/seccomp-bpf/errorcode.h"
+#include "sandbox/linux/bpf_dsl/errorcode.h"
-#include "sandbox/linux/seccomp-bpf/die.h"
+#include "base/logging.h"
#include "sandbox/linux/system_headers/linux_seccomp.h"
namespace sandbox {
+namespace bpf_dsl {
-ErrorCode::ErrorCode() : error_type_(ET_INVALID), err_(SECCOMP_RET_INVALID) {
-}
+ErrorCode::ErrorCode() : error_type_(ET_INVALID), err_(SECCOMP_RET_INVALID) {}
ErrorCode::ErrorCode(int err) {
switch (err) {
@@ -32,20 +32,19 @@ ErrorCode::ErrorCode(int err) {
error_type_ = ET_SIMPLE;
break;
}
- SANDBOX_DIE("Invalid use of ErrorCode object");
+ LOG(FATAL) << "Invalid use of ErrorCode object";
}
}
ErrorCode::ErrorCode(uint16_t trap_id,
- Trap::TrapFnc fnc,
+ TrapRegistry::TrapFnc fnc,
const void* aux,
bool safe)
: error_type_(ET_TRAP),
fnc_(fnc),
aux_(const_cast<void*>(aux)),
safe_(safe),
- err_(SECCOMP_RET_TRAP + trap_id) {
-}
+ err_(SECCOMP_RET_TRAP + trap_id) {}
ErrorCode::ErrorCode(int argno,
ArgType width,
@@ -60,12 +59,11 @@ ErrorCode::ErrorCode(int argno,
width_(width),
passed_(passed),
failed_(failed),
- err_(SECCOMP_RET_INVALID) {
-}
+ err_(SECCOMP_RET_INVALID) {}
bool ErrorCode::Equals(const ErrorCode& err) const {
if (error_type_ == ET_INVALID || err.error_type_ == ET_INVALID) {
- SANDBOX_DIE("Dereferencing invalid ErrorCode");
+ LOG(FATAL) << "Dereferencing invalid ErrorCode";
}
if (error_type_ != err.error_type_) {
return false;
@@ -77,7 +75,8 @@ bool ErrorCode::Equals(const ErrorCode& err) const {
width_ == err.width_ && passed_->Equals(*err.passed_) &&
failed_->Equals(*err.failed_);
} else {
- SANDBOX_DIE("Corrupted ErrorCode");
+ LOG(FATAL) << "Corrupted ErrorCode";
+ return false;
}
}
@@ -87,7 +86,7 @@ bool ErrorCode::LessThan(const ErrorCode& err) const {
// into std::set<>. Actual ordering is not important as long as it is
// deterministic.
if (error_type_ == ET_INVALID || err.error_type_ == ET_INVALID) {
- SANDBOX_DIE("Dereferencing invalid ErrorCode");
+ LOG(FATAL) << "Dereferencing invalid ErrorCode";
}
if (error_type_ != err.error_type_) {
return error_type_ < err.error_type_;
@@ -111,9 +110,11 @@ bool ErrorCode::LessThan(const ErrorCode& err) const {
return false;
}
} else {
- SANDBOX_DIE("Corrupted ErrorCode");
+ LOG(FATAL) << "Corrupted ErrorCode";
+ return false;
}
}
}
+} // namespace bpf_dsl
} // namespace sandbox
« no previous file with comments | « sandbox/linux/bpf_dsl/errorcode.h ('k') | sandbox/linux/bpf_dsl/errorcode_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698