Mark GetNamespaceDescription const

PiperOrigin-RevId: 554460753
Change-Id: I3304fb7d19f93750b1d74aeb1b8213af2f0fea85
This commit is contained in:
Wiktor Garbacz 2023-08-07 06:46:50 -07:00 committed by Copybara-Service
parent dd664400d7
commit 4890c86cec
2 changed files with 4 additions and 3 deletions

View File

@ -27,12 +27,12 @@
#include <syscall.h> #include <syscall.h>
#include <unistd.h> #include <unistd.h>
#include <cstdio>
#include <cstring> #include <cstring>
#include <memory> #include <memory>
#include <utility> #include <utility>
#include "absl/strings/str_cat.h" #include "absl/strings/str_cat.h"
#include "sandboxed_api/sandbox2/violation.pb.h"
#include "sandboxed_api/util/fileops.h" #include "sandboxed_api/util/fileops.h"
#include "sandboxed_api/util/path.h" #include "sandboxed_api/util/path.h"
#include "sandboxed_api/util/raw_logging.h" #include "sandboxed_api/util/raw_logging.h"
@ -351,7 +351,8 @@ void Namespace::InitializeInitialNamespaces(uid_t uid, gid_t gid) {
"remounting rootfs read-only failed"); "remounting rootfs read-only failed");
} }
void Namespace::GetNamespaceDescription(NamespaceDescription* pb_description) { void Namespace::GetNamespaceDescription(
NamespaceDescription* pb_description) const {
pb_description->set_clone_flags(clone_flags_); pb_description->set_clone_flags(clone_flags_);
*pb_description->mutable_mount_tree_mounts() = mounts_.GetMountTree(); *pb_description->mutable_mount_tree_mounts() = mounts_.GetMountTree();
} }

View File

@ -42,7 +42,7 @@ class Namespace final {
std::string hostname, bool allow_mount_propagation); std::string hostname, bool allow_mount_propagation);
// Stores information about this namespace in the protobuf structure. // Stores information about this namespace in the protobuf structure.
void GetNamespaceDescription(NamespaceDescription* pb_description); void GetNamespaceDescription(NamespaceDescription* pb_description) const;
int32_t clone_flags() const { return clone_flags_; } int32_t clone_flags() const { return clone_flags_; }