From fc514451e0bf859af2bdba5a87cca396938917e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Szaw=C5=82owski?= Date: Thu, 20 Feb 2020 03:54:27 -0800 Subject: [PATCH] Internal BUILD changes PiperOrigin-RevId: 296174640 Change-Id: I94c8e36d76d6cbb2b9d65f35d8700018b62d3db1 --- sandboxed_api/embed_file.cc | 2 +- .../examples/stringop/main_stringop.cc | 2 +- sandboxed_api/examples/sum/main_sum.cc | 2 +- sandboxed_api/proto_helper.h | 2 +- sandboxed_api/rpcchannel.cc | 2 +- sandboxed_api/sandbox.cc | 2 +- sandboxed_api/sandbox2/buffer.cc | 2 +- sandboxed_api/sandbox2/client.cc | 2 +- sandboxed_api/sandbox2/forkserver.cc | 2 +- sandboxed_api/sandbox2/mounts.cc | 2 +- .../sandbox2/network_proxy_client.cc | 2 +- sandboxed_api/sandbox2/policybuilder.cc | 2 +- sandboxed_api/sandbox2/regs.cc | 2 +- sandboxed_api/sandbox2/result.cc | 2 +- sandboxed_api/sandbox2/sandbox2.cc | 2 +- sandboxed_api/sandbox2/util.cc | 2 +- sandboxed_api/sandbox2/util/maps_parser.cc | 2 +- sandboxed_api/sandbox2/util/minielf.cc | 2 +- sandboxed_api/sandbox2/util/temp_file.cc | 2 +- sandboxed_api/transaction.cc | 2 +- sandboxed_api/transaction.h | 2 +- sandboxed_api/util/canonical_errors.cc | 117 ------------------ sandboxed_api/util/canonical_errors.h | 67 ---------- sandboxed_api/var_abstract.cc | 2 +- sandboxed_api/var_array.h | 2 +- sandboxed_api/var_int.cc | 2 +- 26 files changed, 24 insertions(+), 208 deletions(-) delete mode 100644 sandboxed_api/util/canonical_errors.cc delete mode 100644 sandboxed_api/util/canonical_errors.h diff --git a/sandboxed_api/embed_file.cc b/sandboxed_api/embed_file.cc index a4039a0..d8ecc06 100644 --- a/sandboxed_api/embed_file.cc +++ b/sandboxed_api/embed_file.cc @@ -27,7 +27,7 @@ #include "sandboxed_api/sandbox2/util/fileops.h" #include "sandboxed_api/sandbox2/util/strerror.h" #include "sandboxed_api/util/raw_logging.h" -#include "sandboxed_api/util/canonical_errors.h" +#include "util/task/canonical_errors.h" #include "sandboxed_api/util/status.h" namespace file_util = ::sandbox2::file_util; diff --git a/sandboxed_api/examples/stringop/main_stringop.cc b/sandboxed_api/examples/stringop/main_stringop.cc index 84d63d7..f3a40c0 100644 --- a/sandboxed_api/examples/stringop/main_stringop.cc +++ b/sandboxed_api/examples/stringop/main_stringop.cc @@ -28,7 +28,7 @@ #include "sandboxed_api/transaction.h" #include "sandboxed_api/util/status_matchers.h" #include "sandboxed_api/vars.h" -#include "sandboxed_api/util/canonical_errors.h" +#include "util/task/canonical_errors.h" #include "sandboxed_api/util/status.h" #include "sandboxed_api/util/status_macros.h" diff --git a/sandboxed_api/examples/sum/main_sum.cc b/sandboxed_api/examples/sum/main_sum.cc index 662acd9..e19e707 100644 --- a/sandboxed_api/examples/sum/main_sum.cc +++ b/sandboxed_api/examples/sum/main_sum.cc @@ -25,7 +25,7 @@ #include "sandboxed_api/examples/sum/lib/sum_params.pb.h" #include "sandboxed_api/transaction.h" #include "sandboxed_api/vars.h" -#include "sandboxed_api/util/canonical_errors.h" +#include "util/task/canonical_errors.h" #include "sandboxed_api/util/status.h" namespace { diff --git a/sandboxed_api/proto_helper.h b/sandboxed_api/proto_helper.h index 453ceb1..fcb077c 100644 --- a/sandboxed_api/proto_helper.h +++ b/sandboxed_api/proto_helper.h @@ -22,7 +22,7 @@ #include #include "sandboxed_api/proto_arg.pb.h" -#include "sandboxed_api/util/canonical_errors.h" +#include "util/task/canonical_errors.h" #include "sandboxed_api/util/status.h" #include "sandboxed_api/util/statusor.h" diff --git a/sandboxed_api/rpcchannel.cc b/sandboxed_api/rpcchannel.cc index f148516..a073dfc 100644 --- a/sandboxed_api/rpcchannel.cc +++ b/sandboxed_api/rpcchannel.cc @@ -19,7 +19,7 @@ #include "absl/synchronization/mutex.h" #include "sandboxed_api/call.h" #include "sandboxed_api/sandbox2/comms.h" -#include "sandboxed_api/util/canonical_errors.h" +#include "util/task/canonical_errors.h" #include "sandboxed_api/util/status_macros.h" namespace sapi { diff --git a/sandboxed_api/sandbox.cc b/sandboxed_api/sandbox.cc index 6fa2615..aedce3c 100644 --- a/sandboxed_api/sandbox.cc +++ b/sandboxed_api/sandbox.cc @@ -39,7 +39,7 @@ #include "sandboxed_api/sandbox2/util/fileops.h" #include "sandboxed_api/sandbox2/util/path.h" #include "sandboxed_api/sandbox2/util/runfiles.h" -#include "sandboxed_api/util/canonical_errors.h" +#include "util/task/canonical_errors.h" #include "sandboxed_api/util/status_macros.h" namespace file = ::sandbox2::file; diff --git a/sandboxed_api/sandbox2/buffer.cc b/sandboxed_api/sandbox2/buffer.cc index 170ddce..f2682b9 100644 --- a/sandboxed_api/sandbox2/buffer.cc +++ b/sandboxed_api/sandbox2/buffer.cc @@ -24,7 +24,7 @@ #include "absl/strings/str_cat.h" #include "sandboxed_api/sandbox2/util.h" #include "sandboxed_api/sandbox2/util/strerror.h" -#include "sandboxed_api/util/canonical_errors.h" +#include "util/task/canonical_errors.h" namespace sandbox2 { diff --git a/sandboxed_api/sandbox2/client.cc b/sandboxed_api/sandbox2/client.cc index 235ec19..be870f4 100644 --- a/sandboxed_api/sandbox2/client.cc +++ b/sandboxed_api/sandbox2/client.cc @@ -44,7 +44,7 @@ #include "sandboxed_api/sandbox2/sanitizer.h" #include "sandboxed_api/sandbox2/util/strerror.h" #include "sandboxed_api/util/raw_logging.h" -#include "sandboxed_api/util/canonical_errors.h" +#include "util/task/canonical_errors.h" namespace sandbox2 { diff --git a/sandboxed_api/sandbox2/forkserver.cc b/sandboxed_api/sandbox2/forkserver.cc index 205cf22..b8c791d 100644 --- a/sandboxed_api/sandbox2/forkserver.cc +++ b/sandboxed_api/sandbox2/forkserver.cc @@ -57,7 +57,7 @@ #include "sandboxed_api/sandbox2/util/fileops.h" #include "sandboxed_api/sandbox2/util/strerror.h" #include "sandboxed_api/util/raw_logging.h" -#include "sandboxed_api/util/canonical_errors.h" +#include "util/task/canonical_errors.h" #include "sandboxed_api/util/status.h" #include "sandboxed_api/util/statusor.h" diff --git a/sandboxed_api/sandbox2/mounts.cc b/sandboxed_api/sandbox2/mounts.cc index ab18403..81723f1 100644 --- a/sandboxed_api/sandbox2/mounts.cc +++ b/sandboxed_api/sandbox2/mounts.cc @@ -38,7 +38,7 @@ #include "sandboxed_api/sandbox2/util/path.h" #include "sandboxed_api/sandbox2/util/strerror.h" #include "sandboxed_api/util/raw_logging.h" -#include "sandboxed_api/util/canonical_errors.h" +#include "util/task/canonical_errors.h" #include "sandboxed_api/util/status_macros.h" #include "sandboxed_api/util/statusor.h" diff --git a/sandboxed_api/sandbox2/network_proxy_client.cc b/sandboxed_api/sandbox2/network_proxy_client.cc index 5e214e9..2e26864 100644 --- a/sandboxed_api/sandbox2/network_proxy_client.cc +++ b/sandboxed_api/sandbox2/network_proxy_client.cc @@ -27,7 +27,7 @@ #include "absl/memory/memory.h" #include "absl/strings/str_cat.h" #include "sandboxed_api/sandbox2/util/strerror.h" -#include "sandboxed_api/util/canonical_errors.h" +#include "util/task/canonical_errors.h" #include "sandboxed_api/util/status.h" #include "sandboxed_api/util/status_macros.h" diff --git a/sandboxed_api/sandbox2/policybuilder.cc b/sandboxed_api/sandbox2/policybuilder.cc index c731e97..99d2d8a 100644 --- a/sandboxed_api/sandbox2/policybuilder.cc +++ b/sandboxed_api/sandbox2/policybuilder.cc @@ -39,7 +39,7 @@ #include "sandboxed_api/sandbox2/namespace.h" #include "sandboxed_api/sandbox2/util/bpf_helper.h" #include "sandboxed_api/sandbox2/util/path.h" -#include "sandboxed_api/util/canonical_errors.h" +#include "util/task/canonical_errors.h" #include "sandboxed_api/util/status_macros.h" namespace sandbox2 { diff --git a/sandboxed_api/sandbox2/regs.cc b/sandboxed_api/sandbox2/regs.cc index 3735ed8..fc65662 100644 --- a/sandboxed_api/sandbox2/regs.cc +++ b/sandboxed_api/sandbox2/regs.cc @@ -25,7 +25,7 @@ #include "absl/strings/str_cat.h" #include "sandboxed_api/sandbox2/util/strerror.h" -#include "sandboxed_api/util/canonical_errors.h" +#include "util/task/canonical_errors.h" namespace sandbox2 { diff --git a/sandboxed_api/sandbox2/result.cc b/sandboxed_api/sandbox2/result.cc index 1fa194f..4f0ac0c 100644 --- a/sandboxed_api/sandbox2/result.cc +++ b/sandboxed_api/sandbox2/result.cc @@ -19,7 +19,7 @@ #include "absl/strings/str_cat.h" #include "sandboxed_api/sandbox2/syscall.h" #include "sandboxed_api/sandbox2/util.h" -#include "sandboxed_api/util/canonical_errors.h" +#include "util/task/canonical_errors.h" namespace sandbox2 { diff --git a/sandboxed_api/sandbox2/sandbox2.cc b/sandboxed_api/sandbox2/sandbox2.cc index 8f066cd..88c3bcb 100644 --- a/sandboxed_api/sandbox2/sandbox2.cc +++ b/sandboxed_api/sandbox2/sandbox2.cc @@ -24,7 +24,7 @@ #include "absl/time/time.h" #include "sandboxed_api/sandbox2/monitor.h" #include "sandboxed_api/sandbox2/result.h" -#include "sandboxed_api/util/canonical_errors.h" +#include "util/task/canonical_errors.h" namespace sandbox2 { diff --git a/sandboxed_api/sandbox2/util.cc b/sandboxed_api/sandbox2/util.cc index e43cf0a..01bfb48 100644 --- a/sandboxed_api/sandbox2/util.cc +++ b/sandboxed_api/sandbox2/util.cc @@ -43,7 +43,7 @@ #include "sandboxed_api/sandbox2/util/path.h" #include "sandboxed_api/sandbox2/util/strerror.h" #include "sandboxed_api/util/raw_logging.h" -#include "sandboxed_api/util/canonical_errors.h" +#include "util/task/canonical_errors.h" namespace sandbox2 { namespace util { diff --git a/sandboxed_api/sandbox2/util/maps_parser.cc b/sandboxed_api/sandbox2/util/maps_parser.cc index d6314a9..097fa82 100644 --- a/sandboxed_api/sandbox2/util/maps_parser.cc +++ b/sandboxed_api/sandbox2/util/maps_parser.cc @@ -14,7 +14,7 @@ #include "sandboxed_api/sandbox2/util/maps_parser.h" #include "absl/strings/str_split.h" -#include "sandboxed_api/util/canonical_errors.h" +#include "util/task/canonical_errors.h" namespace sandbox2 { diff --git a/sandboxed_api/sandbox2/util/minielf.cc b/sandboxed_api/sandbox2/util/minielf.cc index 3aa47b0..c913cf8 100644 --- a/sandboxed_api/sandbox2/util/minielf.cc +++ b/sandboxed_api/sandbox2/util/minielf.cc @@ -25,7 +25,7 @@ #include "sandboxed_api/sandbox2/util.h" #include "sandboxed_api/sandbox2/util/strerror.h" #include "sandboxed_api/util/raw_logging.h" -#include "sandboxed_api/util/canonical_errors.h" +#include "util/task/canonical_errors.h" #include "sandboxed_api/util/status.h" #include "sandboxed_api/util/status_macros.h" diff --git a/sandboxed_api/sandbox2/util/temp_file.cc b/sandboxed_api/sandbox2/util/temp_file.cc index 552e79c..d51e514 100644 --- a/sandboxed_api/sandbox2/util/temp_file.cc +++ b/sandboxed_api/sandbox2/util/temp_file.cc @@ -25,7 +25,7 @@ #include "absl/strings/str_cat.h" #include "sandboxed_api/sandbox2/util/fileops.h" #include "sandboxed_api/sandbox2/util/strerror.h" -#include "sandboxed_api/util/canonical_errors.h" +#include "util/task/canonical_errors.h" namespace sandbox2 { diff --git a/sandboxed_api/transaction.cc b/sandboxed_api/transaction.cc index b2d4bd1..61f7931 100644 --- a/sandboxed_api/transaction.cc +++ b/sandboxed_api/transaction.cc @@ -13,7 +13,7 @@ // limitations under the License. #include "sandboxed_api/transaction.h" -#include "sandboxed_api/util/canonical_errors.h" +#include "util/task/canonical_errors.h" #include "sandboxed_api/util/status_macros.h" namespace sapi { diff --git a/sandboxed_api/transaction.h b/sandboxed_api/transaction.h index 4edab9e..2b4856e 100644 --- a/sandboxed_api/transaction.h +++ b/sandboxed_api/transaction.h @@ -21,7 +21,7 @@ #include "absl/strings/str_cat.h" #include "absl/time/time.h" #include "sandboxed_api/sandbox.h" -#include "sandboxed_api/util/canonical_errors.h" +#include "util/task/canonical_errors.h" #include "sandboxed_api/util/status.h" #include "sandboxed_api/util/status_macros.h" diff --git a/sandboxed_api/util/canonical_errors.cc b/sandboxed_api/util/canonical_errors.cc deleted file mode 100644 index 651e62d..0000000 --- a/sandboxed_api/util/canonical_errors.cc +++ /dev/null @@ -1,117 +0,0 @@ -// Copyright 2019 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include "sandboxed_api/util/canonical_errors.h" - -namespace sapi { - -Status AbortedError(absl::string_view message) { - return Status{StatusCode::kAborted, message}; -} -Status AlreadyExistsError(absl::string_view message) { - return Status{StatusCode::kAlreadyExists, message}; -} -Status CancelledError(absl::string_view message) { - return Status{StatusCode::kCancelled, message}; -} -Status DataLossError(absl::string_view message) { - return Status{StatusCode::kDataLoss, message}; -} -Status DeadlineExceededError(absl::string_view message) { - return Status{StatusCode::kDeadlineExceeded, message}; -} -Status FailedPreconditionError(absl::string_view message) { - return Status{StatusCode::kFailedPrecondition, message}; -} -Status InternalError(absl::string_view message) { - return Status{StatusCode::kInternal, message}; -} -Status InvalidArgumentError(absl::string_view message) { - return Status{StatusCode::kInvalidArgument, message}; -} -Status NotFoundError(absl::string_view message) { - return Status{StatusCode::kNotFound, message}; -} -Status OutOfRangeError(absl::string_view message) { - return Status{StatusCode::kOutOfRange, message}; -} -Status PermissionDeniedError(absl::string_view message) { - return Status{StatusCode::kPermissionDenied, message}; -} -Status ResourceExhaustedError(absl::string_view message) { - return Status{StatusCode::kResourceExhausted, message}; -} -Status UnauthenticatedError(absl::string_view message) { - return Status{StatusCode::kUnauthenticated, message}; -} -Status UnavailableError(absl::string_view message) { - return Status{StatusCode::kUnavailable, message}; -} -Status UnimplementedError(absl::string_view message) { - return Status{StatusCode::kUnimplemented, message}; -} -Status UnknownError(absl::string_view message) { - return Status{StatusCode::kUnknown, message}; -} - -bool IsAborted(const Status& status) { - return status.code() == StatusCode::kAborted; -} -bool IsAlreadyExists(const Status& status) { - return status.code() == StatusCode::kAlreadyExists; -} -bool IsCancelled(const Status& status) { - return status.code() == StatusCode::kCancelled; -} -bool IsDataLoss(const Status& status) { - return status.code() == StatusCode::kDataLoss; -} -bool IsDeadlineExceeded(const Status& status) { - return status.code() == StatusCode::kDeadlineExceeded; -} -bool IsFailedPrecondition(const Status& status) { - return status.code() == StatusCode::kFailedPrecondition; -} -bool IsInternal(const Status& status) { - return status.code() == StatusCode::kInternal; -} -bool IsInvalidArgument(const Status& status) { - return status.code() == StatusCode::kInvalidArgument; -} -bool IsNotFound(const Status& status) { - return status.code() == StatusCode::kNotFound; -} -bool IsOutOfRange(const Status& status) { - return status.code() == StatusCode::kOutOfRange; -} -bool IsPermissionDenied(const Status& status) { - return status.code() == StatusCode::kPermissionDenied; -} -bool IsResourceExhausted(const Status& status) { - return status.code() == StatusCode::kResourceExhausted; -} -bool IsUnauthenticated(const Status& status) { - return status.code() == StatusCode::kUnauthenticated; -} -bool IsUnavailable(const Status& status) { - return status.code() == StatusCode::kUnavailable; -} -bool IsUnimplemented(const Status& status) { - return status.code() == StatusCode::kUnimplemented; -} -bool IsUnknown(const Status& status) { - return status.code() == StatusCode::kUnknown; -} - -} // namespace sapi diff --git a/sandboxed_api/util/canonical_errors.h b/sandboxed_api/util/canonical_errors.h deleted file mode 100644 index b86afa2..0000000 --- a/sandboxed_api/util/canonical_errors.h +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2019 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef SANDBOXED_API_UTIL_CANONICAL_ERRORS_H_ -#define SANDBOXED_API_UTIL_CANONICAL_ERRORS_H_ - -#include "absl/base/attributes.h" -#include "absl/strings/string_view.h" -#include "sandboxed_api/util/status.h" - -namespace sapi { - -// Each of the functions below creates a canonical error with the given -// message. The error code of the returned status object matches the name of -// the function. -Status AbortedError(absl::string_view message); -Status AlreadyExistsError(absl::string_view message); -Status CancelledError(absl::string_view message); -Status DataLossError(absl::string_view message); -Status DeadlineExceededError(absl::string_view message); -Status FailedPreconditionError(absl::string_view message); -Status InternalError(absl::string_view message); -Status InvalidArgumentError(absl::string_view message); -Status NotFoundError(absl::string_view message); -Status OutOfRangeError(absl::string_view message); -Status PermissionDeniedError(absl::string_view message); -Status ResourceExhaustedError(absl::string_view message); -Status UnauthenticatedError(absl::string_view message); -Status UnavailableError(absl::string_view message); -Status UnimplementedError(absl::string_view message); -Status UnknownError(absl::string_view message); - -// Each of the functions below returns true if the given status matches the -// canonical error code implied by the function's name. If necessary, the -// status will be converted to the canonical error space to perform the -// comparison. -ABSL_MUST_USE_RESULT bool IsAborted(const Status& status); -ABSL_MUST_USE_RESULT bool IsAlreadyExists(const Status& status); -ABSL_MUST_USE_RESULT bool IsCancelled(const Status& status); -ABSL_MUST_USE_RESULT bool IsDataLoss(const Status& status); -ABSL_MUST_USE_RESULT bool IsDeadlineExceeded(const Status& status); -ABSL_MUST_USE_RESULT bool IsFailedPrecondition(const Status& status); -ABSL_MUST_USE_RESULT bool IsInternal(const Status& status); -ABSL_MUST_USE_RESULT bool IsInvalidArgument(const Status& status); -ABSL_MUST_USE_RESULT bool IsNotFound(const Status& status); -ABSL_MUST_USE_RESULT bool IsOutOfRange(const Status& status); -ABSL_MUST_USE_RESULT bool IsPermissionDenied(const Status& status); -ABSL_MUST_USE_RESULT bool IsResourceExhausted(const Status& status); -ABSL_MUST_USE_RESULT bool IsUnauthenticated(const Status& status); -ABSL_MUST_USE_RESULT bool IsUnavailable(const Status& status); -ABSL_MUST_USE_RESULT bool IsUnimplemented(const Status& status); -ABSL_MUST_USE_RESULT bool IsUnknown(const Status& status); - -} // namespace sapi - -#endif // SANDBOXED_API_UTIL_CANONICAL_ERRORS_H_ diff --git a/sandboxed_api/var_abstract.cc b/sandboxed_api/var_abstract.cc index ae17b29..651f272 100644 --- a/sandboxed_api/var_abstract.cc +++ b/sandboxed_api/var_abstract.cc @@ -22,7 +22,7 @@ #include "sandboxed_api/sandbox2/comms.h" #include "absl/strings/str_cat.h" #include "sandboxed_api/rpcchannel.h" -#include "sandboxed_api/util/canonical_errors.h" +#include "util/task/canonical_errors.h" #include "sandboxed_api/util/status_macros.h" namespace sapi::v { diff --git a/sandboxed_api/var_array.h b/sandboxed_api/var_array.h index ab620a1..45152ae 100644 --- a/sandboxed_api/var_array.h +++ b/sandboxed_api/var_array.h @@ -24,7 +24,7 @@ #include "sandboxed_api/var_abstract.h" #include "sandboxed_api/var_pointable.h" #include "sandboxed_api/var_ptr.h" -#include "sandboxed_api/util/canonical_errors.h" +#include "util/task/canonical_errors.h" #include "sandboxed_api/util/status_macros.h" namespace sapi::v { diff --git a/sandboxed_api/var_int.cc b/sandboxed_api/var_int.cc index c0a9c96..f17b0d0 100644 --- a/sandboxed_api/var_int.cc +++ b/sandboxed_api/var_int.cc @@ -14,7 +14,7 @@ #include "sandboxed_api/var_int.h" #include "sandboxed_api/rpcchannel.h" -#include "sandboxed_api/util/canonical_errors.h" +#include "util/task/canonical_errors.h" #include "sandboxed_api/util/status_macros.h" namespace sapi::v {