bmahler commented on code in PR #503:
URL: https://github.com/apache/mesos/pull/503#discussion_r1518213231


##########
src/linux/cgroups2.cpp:
##########
@@ -72,6 +72,27 @@ const std::string TYPE = "cgroup.type";
 
 } // namespace control {
 
+namespace controllers {
+
+// Find the available controllers (AKA subsystems) in the provided cgroup.
+Try<set<string>> available(const string& cgroup)
+{
+  Try<string> subsystems =
+    cgroups2::read(cgroup, cgroups2::control::CONTROLLERS);
+  if (subsystems.isError()) {
+    return Error(
+      "Failed to read cgroup.controllers in '" + cgroup +
+      "': " + subsystems.error());
+  }
+  vector<string> _subsystems = strings::split(subsystems.get(), " ");
+  set<string> systems(
+    std::make_move_iterator(_subsystems.begin()),
+    std::make_move_iterator(_subsystems.end()));
+  return systems;

Review Comment:
   rather than declaring the variable and immediately returning it, we can 
return it directly



##########
src/linux/cgroups2.cpp:
##########
@@ -72,6 +72,27 @@ const std::string TYPE = "cgroup.type";
 
 } // namespace control {
 
+namespace controllers {
+
+// Find the available controllers (AKA subsystems) in the provided cgroup.
+Try<set<string>> available(const string& cgroup)
+{
+  Try<string> subsystems =

Review Comment:
   s/subsystems/read/



##########
src/linux/cgroups2.cpp:
##########
@@ -72,6 +72,27 @@ const std::string TYPE = "cgroup.type";
 
 } // namespace control {
 
+namespace controllers {
+
+// Find the available controllers (AKA subsystems) in the provided cgroup.
+Try<set<string>> available(const string& cgroup)
+{
+  Try<string> subsystems =
+    cgroups2::read(cgroup, cgroups2::control::CONTROLLERS);
+  if (subsystems.isError()) {
+    return Error(
+      "Failed to read cgroup.controllers in '" + cgroup +
+      "': " + subsystems.error());
+  }
+  vector<string> _subsystems = strings::split(subsystems.get(), " ");

Review Comment:
   can use * rather than .get() here
   
   s/_//



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscr...@mesos.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to