Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7875d824 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge changes from topic "nonab_on_vab_r" into rvc-dev am: b62ff1ab

Change-Id: Icb9c84e10f0a9723abbb087b28a6b066a3363d0c
parents 05569dc6 b62ff1ab
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ AllowShortIfStatementsOnASingleLine: true
ColumnLimit: 100
CommentPragmas: NOLINT:.*
DerivePointerAlignment: false
IncludeBlocks: Preserve
IndentWidth: 2
PointerAlignment: Left
TabWidth: 2
+3 −0
Original line number Diff line number Diff line
@@ -71,4 +71,7 @@ class UpdaterRuntimeInterface {
  virtual bool MapPartitionOnDeviceMapper(const std::string& partition_name, std::string* path) = 0;
  virtual bool UnmapPartitionOnDeviceMapper(const std::string& partition_name) = 0;
  virtual bool UpdateDynamicPartitions(const std::string_view op_list_value) = 0;

  // On devices supports A/B, add current slot suffix to arg. Otherwise, return |arg| as is.
  virtual std::string AddSlotSuffix(const std::string_view arg) const = 0;
};
+1 −0
Original line number Diff line number Diff line
@@ -53,6 +53,7 @@ class SimulatorRuntime : public UpdaterRuntimeInterface {
  bool MapPartitionOnDeviceMapper(const std::string& partition_name, std::string* path) override;
  bool UnmapPartitionOnDeviceMapper(const std::string& partition_name) override;
  bool UpdateDynamicPartitions(const std::string_view op_list_value) override;
  std::string AddSlotSuffix(const std::string_view arg) const override;

 private:
  std::string FindBlockDeviceName(const std::string_view name) const override;
+1 −0
Original line number Diff line number Diff line
@@ -56,6 +56,7 @@ class UpdaterRuntime : public UpdaterRuntimeInterface {
  bool MapPartitionOnDeviceMapper(const std::string& partition_name, std::string* path) override;
  bool UnmapPartitionOnDeviceMapper(const std::string& partition_name) override;
  bool UpdateDynamicPartitions(const std::string_view op_list_value) override;
  std::string AddSlotSuffix(const std::string_view arg) const override;

 private:
  struct selabel_handle* sehandle_{ nullptr };
+16 −0
Original line number Diff line number Diff line
@@ -852,6 +852,20 @@ Value* Tune2FsFn(const char* name, State* state, const std::vector<std::unique_p
  return StringValue("t");
}

Value* AddSlotSuffixFn(const char* name, State* state,
                       const std::vector<std::unique_ptr<Expr>>& argv) {
  if (argv.size() != 1) {
    return ErrorAbort(state, kArgsParsingFailure, "%s() expects 1 arg, got %zu", name, argv.size());
  }
  std::vector<std::string> args;
  if (!ReadArgs(state, argv, &args)) {
    return ErrorAbort(state, kArgsParsingFailure, "%s() Failed to parse the argument(s)", name);
  }
  const std::string& arg = args[0];
  auto updater_runtime = state->updater->GetRuntime();
  return StringValue(updater_runtime->AddSlotSuffix(arg));
}

void RegisterInstallFunctions() {
  RegisterFunction("mount", MountFn);
  RegisterFunction("is_mounted", IsMountedFn);
@@ -885,4 +899,6 @@ void RegisterInstallFunctions() {

  RegisterFunction("enable_reboot", EnableRebootFn);
  RegisterFunction("tune2fs", Tune2FsFn);

  RegisterFunction("add_slot_suffix", AddSlotSuffixFn);
}
Loading