Lines Matching refs:state
84 Value* UIPrintFn(const char* name, State* state, const std::vector<std::unique_ptr<Expr>>& argv) { in UIPrintFn() argument
86 if (!ReadArgs(state, argv, &args)) { in UIPrintFn()
87 return ErrorAbort(state, kArgsParsingFailure, "%s(): Failed to parse the argument(s)", name); in UIPrintFn()
91 state->updater->UiPrint(buffer); in UIPrintFn()
99 Value* PackageExtractFileFn(const char* name, State* state, in PackageExtractFileFn() argument
102 return ErrorAbort(state, kArgsParsingFailure, "%s() expects 1 or 2 args, got %zu", name, in PackageExtractFileFn()
110 if (!ReadArgs(state, argv, &args)) { in PackageExtractFileFn()
111 return ErrorAbort(state, kArgsParsingFailure, "%s() Failed to parse %zu args", name, in PackageExtractFileFn()
117 ZipArchiveHandle za = state->updater->GetPackageHandle(); in PackageExtractFileFn()
126 if (std::string block_device_name = state->updater->FindBlockDeviceName(dest_path); in PackageExtractFileFn()
161 if (!ReadArgs(state, argv, &args)) { in PackageExtractFileFn()
162 return ErrorAbort(state, kArgsParsingFailure, "%s() Failed to parse %zu args", name, in PackageExtractFileFn()
167 ZipArchiveHandle za = state->updater->GetPackageHandle(); in PackageExtractFileFn()
170 return ErrorAbort(state, kPackageExtractFileFailure, "%s(): no %s in package", name, in PackageExtractFileFn()
180 return ErrorAbort(state, kPackageExtractFileFailure, in PackageExtractFileFn()
197 Value* PatchPartitionCheckFn(const char* name, State* state, in PatchPartitionCheckFn() argument
200 return ErrorAbort(state, kArgsParsingFailure, in PatchPartitionCheckFn()
205 if (!ReadArgs(state, argv, &args, 0, 2)) { in PatchPartitionCheckFn()
206 return ErrorAbort(state, kArgsParsingFailure, "%s(): Failed to parse the argument(s)", name); in PatchPartitionCheckFn()
212 return ErrorAbort(state, kArgsParsingFailure, "%s(): Failed to parse target \"%s\": %s", name, in PatchPartitionCheckFn()
218 return ErrorAbort(state, kArgsParsingFailure, "%s(): Failed to parse source \"%s\": %s", name, in PatchPartitionCheckFn()
222 if (!UpdateBlockDeviceNameForPartition(state->updater, &source) || in PatchPartitionCheckFn()
223 !UpdateBlockDeviceNameForPartition(state->updater, &target)) { in PatchPartitionCheckFn()
238 Value* PatchPartitionFn(const char* name, State* state, in PatchPartitionFn() argument
241 return ErrorAbort(state, kArgsParsingFailure, in PatchPartitionFn()
246 if (!ReadArgs(state, argv, &args, 0, 2)) { in PatchPartitionFn()
247 return ErrorAbort(state, kArgsParsingFailure, "%s(): Failed to parse the argument(s)", name); in PatchPartitionFn()
253 return ErrorAbort(state, kArgsParsingFailure, "%s(): Failed to parse target \"%s\": %s", name, in PatchPartitionFn()
259 return ErrorAbort(state, kArgsParsingFailure, "%s(): Failed to parse source \"%s\": %s", name, in PatchPartitionFn()
264 if (!ReadValueArgs(state, argv, &values, 2, 1) || values[0]->type != Value::Type::BLOB) { in PatchPartitionFn()
265 return ErrorAbort(state, kArgsParsingFailure, "%s(): Invalid patch arg", name); in PatchPartitionFn()
268 if (!UpdateBlockDeviceNameForPartition(state->updater, &source) || in PatchPartitionFn()
269 !UpdateBlockDeviceNameForPartition(state->updater, &target)) { in PatchPartitionFn()
281 Value* MountFn(const char* name, State* state, const std::vector<std::unique_ptr<Expr>>& argv) { in MountFn() argument
283 return ErrorAbort(state, kArgsParsingFailure, "%s() expects 4-5 args, got %zu", name, in MountFn()
288 if (!ReadArgs(state, argv, &args)) { in MountFn()
289 return ErrorAbort(state, kArgsParsingFailure, "%s() Failed to parse the argument(s)", name); in MountFn()
302 return ErrorAbort(state, kArgsParsingFailure, "fs_type argument to %s() can't be empty", name); in MountFn()
305 return ErrorAbort(state, kArgsParsingFailure, "partition_type argument to %s() can't be empty", in MountFn()
309 return ErrorAbort(state, kArgsParsingFailure, "location argument to %s() can't be empty", name); in MountFn()
312 return ErrorAbort(state, kArgsParsingFailure, "mount_point argument to %s() can't be empty", in MountFn()
316 auto updater = state->updater; in MountFn()
328 Value* IsMountedFn(const char* name, State* state, const std::vector<std::unique_ptr<Expr>>& argv) { in IsMountedFn() argument
330 return ErrorAbort(state, kArgsParsingFailure, "%s() expects 1 arg, got %zu", name, argv.size()); in IsMountedFn()
334 if (!ReadArgs(state, argv, &args)) { in IsMountedFn()
335 return ErrorAbort(state, kArgsParsingFailure, "%s() Failed to parse the argument(s)", name); in IsMountedFn()
339 return ErrorAbort(state, kArgsParsingFailure, in IsMountedFn()
343 auto updater_runtime = state->updater->GetRuntime(); in IsMountedFn()
351 Value* UnmountFn(const char* name, State* state, const std::vector<std::unique_ptr<Expr>>& argv) { in UnmountFn() argument
353 return ErrorAbort(state, kArgsParsingFailure, "%s() expects 1 arg, got %zu", name, argv.size()); in UnmountFn()
356 if (!ReadArgs(state, argv, &args)) { in UnmountFn()
357 return ErrorAbort(state, kArgsParsingFailure, "%s() Failed to parse the argument(s)", name); in UnmountFn()
361 return ErrorAbort(state, kArgsParsingFailure, in UnmountFn()
365 auto updater = state->updater; in UnmountFn()
386 Value* FormatFn(const char* name, State* state, const std::vector<std::unique_ptr<Expr>>& argv) { in FormatFn() argument
388 return ErrorAbort(state, kArgsParsingFailure, "%s() expects 5 args, got %zu", name, in FormatFn()
393 if (!ReadArgs(state, argv, &args)) { in FormatFn()
394 return ErrorAbort(state, kArgsParsingFailure, "%s() Failed to parse the argument(s)", name); in FormatFn()
403 return ErrorAbort(state, kArgsParsingFailure, "fs_type argument to %s() can't be empty", name); in FormatFn()
406 return ErrorAbort(state, kArgsParsingFailure, "partition_type argument to %s() can't be empty", in FormatFn()
410 return ErrorAbort(state, kArgsParsingFailure, "location argument to %s() can't be empty", name); in FormatFn()
413 return ErrorAbort(state, kArgsParsingFailure, "mount_point argument to %s() can't be empty", in FormatFn()
419 return ErrorAbort(state, kArgsParsingFailure, "%s: failed to parse int in %s", name, in FormatFn()
423 auto updater_runtime = state->updater->GetRuntime(); in FormatFn()
477 Value* ShowProgressFn(const char* name, State* state, in ShowProgressFn() argument
480 return ErrorAbort(state, kArgsParsingFailure, "%s() expects 2 args, got %zu", name, in ShowProgressFn()
485 if (!ReadArgs(state, argv, &args)) { in ShowProgressFn()
486 return ErrorAbort(state, kArgsParsingFailure, "%s() Failed to parse the argument(s)", name); in ShowProgressFn()
493 return ErrorAbort(state, kArgsParsingFailure, "%s: failed to parse double in %s", name, in ShowProgressFn()
498 return ErrorAbort(state, kArgsParsingFailure, "%s: failed to parse int in %s", name, in ShowProgressFn()
502 state->updater->WriteToCommandPipe(android::base::StringPrintf("progress %f %d", frac, sec)); in ShowProgressFn()
507 Value* SetProgressFn(const char* name, State* state, in SetProgressFn() argument
510 return ErrorAbort(state, kArgsParsingFailure, "%s() expects 1 arg, got %zu", name, argv.size()); in SetProgressFn()
514 if (!ReadArgs(state, argv, &args)) { in SetProgressFn()
515 return ErrorAbort(state, kArgsParsingFailure, "%s() Failed to parse the argument(s)", name); in SetProgressFn()
521 return ErrorAbort(state, kArgsParsingFailure, "%s: failed to parse double in %s", name, in SetProgressFn()
525 state->updater->WriteToCommandPipe(android::base::StringPrintf("set_progress %f", frac)); in SetProgressFn()
530 Value* GetPropFn(const char* name, State* state, const std::vector<std::unique_ptr<Expr>>& argv) { in GetPropFn() argument
532 return ErrorAbort(state, kArgsParsingFailure, "%s() expects 1 arg, got %zu", name, argv.size()); in GetPropFn()
535 if (!Evaluate(state, argv[0], &key)) { in GetPropFn()
539 auto updater_runtime = state->updater->GetRuntime(); in GetPropFn()
550 Value* FileGetPropFn(const char* name, State* state, in FileGetPropFn() argument
553 return ErrorAbort(state, kArgsParsingFailure, "%s() expects 2 args, got %zu", name, in FileGetPropFn()
558 if (!ReadArgs(state, argv, &args)) { in FileGetPropFn()
559 return ErrorAbort(state, kArgsParsingFailure, "%s() Failed to parse the argument(s)", name); in FileGetPropFn()
565 auto updater_runtime = state->updater->GetRuntime(); in FileGetPropFn()
567 ErrorAbort(state, kFreadFailure, "%s: failed to read %s", name, filename.c_str()); in FileGetPropFn()
597 Value* ApplyPatchSpaceFn(const char* name, State* state, in ApplyPatchSpaceFn() argument
600 return ErrorAbort(state, kArgsParsingFailure, "%s() expects 1 args, got %zu", name, in ApplyPatchSpaceFn()
604 if (!ReadArgs(state, argv, &args)) { in ApplyPatchSpaceFn()
605 return ErrorAbort(state, kArgsParsingFailure, "%s() Failed to parse the argument(s)", name); in ApplyPatchSpaceFn()
611 return ErrorAbort(state, kArgsParsingFailure, "%s(): can't parse \"%s\" as byte count", name, in ApplyPatchSpaceFn()
616 if (state->is_retry || CheckAndFreeSpaceOnCache(bytes)) { in ApplyPatchSpaceFn()
622 Value* WipeCacheFn(const char* name, State* state, const std::vector<std::unique_ptr<Expr>>& argv) { in WipeCacheFn() argument
624 return ErrorAbort(state, kArgsParsingFailure, "%s() expects no args, got %zu", name, in WipeCacheFn()
628 state->updater->WriteToCommandPipe("wipe_cache"); in WipeCacheFn()
632 Value* RunProgramFn(const char* name, State* state, const std::vector<std::unique_ptr<Expr>>& argv)… in RunProgramFn() argument
634 return ErrorAbort(state, kArgsParsingFailure, "%s() expects at least 1 arg", name); in RunProgramFn()
638 if (!ReadArgs(state, argv, &args)) { in RunProgramFn()
639 return ErrorAbort(state, kArgsParsingFailure, "%s() Failed to parse the argument(s)", name); in RunProgramFn()
642 auto updater_runtime = state->updater->GetRuntime(); in RunProgramFn()
649 Value* ReadFileFn(const char* name, State* state, const std::vector<std::unique_ptr<Expr>>& argv) { in ReadFileFn() argument
651 return ErrorAbort(state, kArgsParsingFailure, "%s() expects 1 arg, got %zu", name, argv.size()); in ReadFileFn()
655 if (!ReadArgs(state, argv, &args)) { in ReadFileFn()
656 return ErrorAbort(state, kArgsParsingFailure, "%s(): Failed to parse the argument(s)", name); in ReadFileFn()
661 auto updater_runtime = state->updater->GetRuntime(); in ReadFileFn()
674 Value* WriteValueFn(const char* name, State* state, const std::vector<std::unique_ptr<Expr>>& argv)… in WriteValueFn() argument
676 return ErrorAbort(state, kArgsParsingFailure, "%s() expects 2 args, got %zu", name, in WriteValueFn()
681 if (!ReadArgs(state, argv, &args)) { in WriteValueFn()
682 return ErrorAbort(state, kArgsParsingFailure, "%s(): Failed to parse the argument(s)", name); in WriteValueFn()
687 return ErrorAbort(state, kArgsParsingFailure, "%s(): Filename cannot be empty", name); in WriteValueFn()
691 auto updater_runtime = state->updater->GetRuntime(); in WriteValueFn()
708 Value* RebootNowFn(const char* name, State* state, const std::vector<std::unique_ptr<Expr>>& argv) { in RebootNowFn() argument
710 return ErrorAbort(state, kArgsParsingFailure, "%s() expects 2 args, got %zu", name, in RebootNowFn()
715 if (!ReadArgs(state, argv, &args)) { in RebootNowFn()
716 return ErrorAbort(state, kArgsParsingFailure, "%s(): Failed to parse the argument(s)", name); in RebootNowFn()
736 return ErrorAbort(state, kRebootFailure, "%s() failed to reboot", name); in RebootNowFn()
749 Value* SetStageFn(const char* name, State* state, const std::vector<std::unique_ptr<Expr>>& argv) { in SetStageFn() argument
751 return ErrorAbort(state, kArgsParsingFailure, "%s() expects 2 args, got %zu", name, in SetStageFn()
756 if (!ReadArgs(state, argv, &args)) { in SetStageFn()
757 return ErrorAbort(state, kArgsParsingFailure, "%s() Failed to parse the argument(s)", name); in SetStageFn()
783 Value* GetStageFn(const char* name, State* state, const std::vector<std::unique_ptr<Expr>>& argv) { in GetStageFn() argument
785 return ErrorAbort(state, kArgsParsingFailure, "%s() expects 1 arg, got %zu", name, argv.size()); in GetStageFn()
789 if (!ReadArgs(state, argv, &args)) { in GetStageFn()
790 return ErrorAbort(state, kArgsParsingFailure, "%s() Failed to parse the argument(s)", name); in GetStageFn()
804 Value* WipeBlockDeviceFn(const char* name, State* state, const std::vector<std::unique_ptr<Expr>>& … in WipeBlockDeviceFn() argument
806 return ErrorAbort(state, kArgsParsingFailure, "%s() expects 2 args, got %zu", name, in WipeBlockDeviceFn()
811 if (!ReadArgs(state, argv, &args)) { in WipeBlockDeviceFn()
812 return ErrorAbort(state, kArgsParsingFailure, "%s() Failed to parse the argument(s)", name); in WipeBlockDeviceFn()
822 auto updater_runtime = state->updater->GetRuntime(); in WipeBlockDeviceFn()
827 Value* EnableRebootFn(const char* name, State* state, const std::vector<std::unique_ptr<Expr>>& arg… in EnableRebootFn() argument
829 return ErrorAbort(state, kArgsParsingFailure, "%s() expects no args, got %zu", name, in EnableRebootFn()
832 state->updater->WriteToCommandPipe("enable_reboot"); in EnableRebootFn()
836 Value* Tune2FsFn(const char* name, State* state, const std::vector<std::unique_ptr<Expr>>& argv) { in Tune2FsFn() argument
838 return ErrorAbort(state, kArgsParsingFailure, "%s() expects args, got %zu", name, argv.size()); in Tune2FsFn()
842 if (!ReadArgs(state, argv, &args)) { in Tune2FsFn()
843 return ErrorAbort(state, kArgsParsingFailure, "%s() could not read args", name); in Tune2FsFn()
848 auto updater_runtime = state->updater->GetRuntime(); in Tune2FsFn()
850 return ErrorAbort(state, kTune2FsFailure, "%s() returned error code %d", name, result); in Tune2FsFn()
855 Value* AddSlotSuffixFn(const char* name, State* state, in AddSlotSuffixFn() argument
858 return ErrorAbort(state, kArgsParsingFailure, "%s() expects 1 arg, got %zu", name, argv.size()); in AddSlotSuffixFn()
861 if (!ReadArgs(state, argv, &args)) { in AddSlotSuffixFn()
862 return ErrorAbort(state, kArgsParsingFailure, "%s() Failed to parse the argument(s)", name); in AddSlotSuffixFn()
865 auto updater_runtime = state->updater->GetRuntime(); in AddSlotSuffixFn()