Lines Matching refs:state
85 Value* UIPrintFn(const char* name, State* state, const std::vector<std::unique_ptr<Expr>>& argv) { in UIPrintFn() argument
87 if (!ReadArgs(state, argv, &args)) { in UIPrintFn()
88 return ErrorAbort(state, kArgsParsingFailure, "%s(): Failed to parse the argument(s)", name); in UIPrintFn()
92 state->updater->UiPrint(buffer); in UIPrintFn()
100 Value* PackageExtractFileFn(const char* name, State* state, in PackageExtractFileFn() argument
103 return ErrorAbort(state, kArgsParsingFailure, "%s() expects 1 or 2 args, got %zu", name, in PackageExtractFileFn()
111 if (!ReadArgs(state, argv, &args)) { in PackageExtractFileFn()
112 return ErrorAbort(state, kArgsParsingFailure, "%s() Failed to parse %zu args", name, in PackageExtractFileFn()
118 ZipArchiveHandle za = state->updater->GetPackageHandle(); in PackageExtractFileFn()
127 if (std::string block_device_name = state->updater->FindBlockDeviceName(dest_path); in PackageExtractFileFn()
162 if (!ReadArgs(state, argv, &args)) { in PackageExtractFileFn()
163 return ErrorAbort(state, kArgsParsingFailure, "%s() Failed to parse %zu args", name, in PackageExtractFileFn()
168 ZipArchiveHandle za = state->updater->GetPackageHandle(); in PackageExtractFileFn()
171 return ErrorAbort(state, kPackageExtractFileFailure, "%s(): no %s in package", name, in PackageExtractFileFn()
177 return ErrorAbort(state, kPackageExtractFileFailure, in PackageExtractFileFn()
186 return ErrorAbort(state, kPackageExtractFileFailure, in PackageExtractFileFn()
203 Value* PatchPartitionCheckFn(const char* name, State* state, in PatchPartitionCheckFn() argument
206 return ErrorAbort(state, kArgsParsingFailure, in PatchPartitionCheckFn()
211 if (!ReadArgs(state, argv, &args, 0, 2)) { in PatchPartitionCheckFn()
212 return ErrorAbort(state, kArgsParsingFailure, "%s(): Failed to parse the argument(s)", name); in PatchPartitionCheckFn()
218 return ErrorAbort(state, kArgsParsingFailure, "%s(): Failed to parse target \"%s\": %s", name, in PatchPartitionCheckFn()
224 return ErrorAbort(state, kArgsParsingFailure, "%s(): Failed to parse source \"%s\": %s", name, in PatchPartitionCheckFn()
228 if (!UpdateBlockDeviceNameForPartition(state->updater, &source) || in PatchPartitionCheckFn()
229 !UpdateBlockDeviceNameForPartition(state->updater, &target)) { in PatchPartitionCheckFn()
244 Value* PatchPartitionFn(const char* name, State* state, in PatchPartitionFn() argument
247 return ErrorAbort(state, kArgsParsingFailure, in PatchPartitionFn()
252 if (!ReadArgs(state, argv, &args, 0, 2)) { in PatchPartitionFn()
253 return ErrorAbort(state, kArgsParsingFailure, "%s(): Failed to parse the argument(s)", name); in PatchPartitionFn()
259 return ErrorAbort(state, kArgsParsingFailure, "%s(): Failed to parse target \"%s\": %s", name, in PatchPartitionFn()
265 return ErrorAbort(state, kArgsParsingFailure, "%s(): Failed to parse source \"%s\": %s", name, in PatchPartitionFn()
270 if (!ReadValueArgs(state, argv, &values, 2, 1) || values[0]->type != Value::Type::BLOB) { in PatchPartitionFn()
271 return ErrorAbort(state, kArgsParsingFailure, "%s(): Invalid patch arg", name); in PatchPartitionFn()
274 if (!UpdateBlockDeviceNameForPartition(state->updater, &source) || in PatchPartitionFn()
275 !UpdateBlockDeviceNameForPartition(state->updater, &target)) { in PatchPartitionFn()
287 Value* MountFn(const char* name, State* state, const std::vector<std::unique_ptr<Expr>>& argv) { in MountFn() argument
289 return ErrorAbort(state, kArgsParsingFailure, "%s() expects 4-5 args, got %zu", name, in MountFn()
294 if (!ReadArgs(state, argv, &args)) { in MountFn()
295 return ErrorAbort(state, kArgsParsingFailure, "%s() Failed to parse the argument(s)", name); in MountFn()
308 return ErrorAbort(state, kArgsParsingFailure, "fs_type argument to %s() can't be empty", name); in MountFn()
311 return ErrorAbort(state, kArgsParsingFailure, "partition_type argument to %s() can't be empty", in MountFn()
315 return ErrorAbort(state, kArgsParsingFailure, "location argument to %s() can't be empty", name); in MountFn()
318 return ErrorAbort(state, kArgsParsingFailure, "mount_point argument to %s() can't be empty", in MountFn()
322 auto updater = state->updater; in MountFn()
334 Value* IsMountedFn(const char* name, State* state, const std::vector<std::unique_ptr<Expr>>& argv) { in IsMountedFn() argument
336 return ErrorAbort(state, kArgsParsingFailure, "%s() expects 1 arg, got %zu", name, argv.size()); in IsMountedFn()
340 if (!ReadArgs(state, argv, &args)) { in IsMountedFn()
341 return ErrorAbort(state, kArgsParsingFailure, "%s() Failed to parse the argument(s)", name); in IsMountedFn()
345 return ErrorAbort(state, kArgsParsingFailure, in IsMountedFn()
349 auto updater_runtime = state->updater->GetRuntime(); in IsMountedFn()
357 Value* UnmountFn(const char* name, State* state, const std::vector<std::unique_ptr<Expr>>& argv) { in UnmountFn() argument
359 return ErrorAbort(state, kArgsParsingFailure, "%s() expects 1 arg, got %zu", name, argv.size()); in UnmountFn()
362 if (!ReadArgs(state, argv, &args)) { in UnmountFn()
363 return ErrorAbort(state, kArgsParsingFailure, "%s() Failed to parse the argument(s)", name); in UnmountFn()
367 return ErrorAbort(state, kArgsParsingFailure, in UnmountFn()
371 auto updater = state->updater; in UnmountFn()
392 Value* FormatFn(const char* name, State* state, const std::vector<std::unique_ptr<Expr>>& argv) { in FormatFn() argument
394 return ErrorAbort(state, kArgsParsingFailure, "%s() expects 5 args, got %zu", name, in FormatFn()
399 if (!ReadArgs(state, argv, &args)) { in FormatFn()
400 return ErrorAbort(state, kArgsParsingFailure, "%s() Failed to parse the argument(s)", name); in FormatFn()
409 return ErrorAbort(state, kArgsParsingFailure, "fs_type argument to %s() can't be empty", name); in FormatFn()
412 return ErrorAbort(state, kArgsParsingFailure, "partition_type argument to %s() can't be empty", in FormatFn()
416 return ErrorAbort(state, kArgsParsingFailure, "location argument to %s() can't be empty", name); in FormatFn()
419 return ErrorAbort(state, kArgsParsingFailure, "mount_point argument to %s() can't be empty", in FormatFn()
425 return ErrorAbort(state, kArgsParsingFailure, "%s: failed to parse int in %s", name, in FormatFn()
429 auto updater_runtime = state->updater->GetRuntime(); in FormatFn()
483 Value* ShowProgressFn(const char* name, State* state, in ShowProgressFn() argument
486 return ErrorAbort(state, kArgsParsingFailure, "%s() expects 2 args, got %zu", name, in ShowProgressFn()
491 if (!ReadArgs(state, argv, &args)) { in ShowProgressFn()
492 return ErrorAbort(state, kArgsParsingFailure, "%s() Failed to parse the argument(s)", name); in ShowProgressFn()
499 return ErrorAbort(state, kArgsParsingFailure, "%s: failed to parse double in %s", name, in ShowProgressFn()
504 return ErrorAbort(state, kArgsParsingFailure, "%s: failed to parse int in %s", name, in ShowProgressFn()
508 state->updater->WriteToCommandPipe(android::base::StringPrintf("progress %f %d", frac, sec)); in ShowProgressFn()
513 Value* SetProgressFn(const char* name, State* state, in SetProgressFn() argument
516 return ErrorAbort(state, kArgsParsingFailure, "%s() expects 1 arg, got %zu", name, argv.size()); in SetProgressFn()
520 if (!ReadArgs(state, argv, &args)) { in SetProgressFn()
521 return ErrorAbort(state, kArgsParsingFailure, "%s() Failed to parse the argument(s)", name); in SetProgressFn()
527 return ErrorAbort(state, kArgsParsingFailure, "%s: failed to parse double in %s", name, in SetProgressFn()
531 state->updater->WriteToCommandPipe(android::base::StringPrintf("set_progress %f", frac)); in SetProgressFn()
536 Value* GetPropFn(const char* name, State* state, const std::vector<std::unique_ptr<Expr>>& argv) { in GetPropFn() argument
538 return ErrorAbort(state, kArgsParsingFailure, "%s() expects 1 arg, got %zu", name, argv.size()); in GetPropFn()
541 if (!Evaluate(state, argv[0], &key)) { in GetPropFn()
545 auto updater_runtime = state->updater->GetRuntime(); in GetPropFn()
556 Value* FileGetPropFn(const char* name, State* state, in FileGetPropFn() argument
559 return ErrorAbort(state, kArgsParsingFailure, "%s() expects 2 args, got %zu", name, in FileGetPropFn()
564 if (!ReadArgs(state, argv, &args)) { in FileGetPropFn()
565 return ErrorAbort(state, kArgsParsingFailure, "%s() Failed to parse the argument(s)", name); in FileGetPropFn()
571 auto updater_runtime = state->updater->GetRuntime(); in FileGetPropFn()
573 ErrorAbort(state, kFreadFailure, "%s: failed to read %s", name, filename.c_str()); in FileGetPropFn()
603 Value* ApplyPatchSpaceFn(const char* name, State* state, in ApplyPatchSpaceFn() argument
606 return ErrorAbort(state, kArgsParsingFailure, "%s() expects 1 args, got %zu", name, in ApplyPatchSpaceFn()
610 if (!ReadArgs(state, argv, &args)) { in ApplyPatchSpaceFn()
611 return ErrorAbort(state, kArgsParsingFailure, "%s() Failed to parse the argument(s)", name); in ApplyPatchSpaceFn()
617 return ErrorAbort(state, kArgsParsingFailure, "%s(): can't parse \"%s\" as byte count", name, in ApplyPatchSpaceFn()
622 if (state->is_retry || CheckAndFreeSpaceOnCache(bytes)) { in ApplyPatchSpaceFn()
628 Value* WipeCacheFn(const char* name, State* state, const std::vector<std::unique_ptr<Expr>>& argv) { in WipeCacheFn() argument
630 return ErrorAbort(state, kArgsParsingFailure, "%s() expects no args, got %zu", name, in WipeCacheFn()
634 state->updater->WriteToCommandPipe("wipe_cache"); in WipeCacheFn()
638 Value* RunProgramFn(const char* name, State* state, const std::vector<std::unique_ptr<Expr>>& argv)… in RunProgramFn() argument
640 return ErrorAbort(state, kArgsParsingFailure, "%s() expects at least 1 arg", name); in RunProgramFn()
644 if (!ReadArgs(state, argv, &args)) { in RunProgramFn()
645 return ErrorAbort(state, kArgsParsingFailure, "%s() Failed to parse the argument(s)", name); in RunProgramFn()
648 auto updater_runtime = state->updater->GetRuntime(); in RunProgramFn()
655 Value* ReadFileFn(const char* name, State* state, const std::vector<std::unique_ptr<Expr>>& argv) { in ReadFileFn() argument
657 return ErrorAbort(state, kArgsParsingFailure, "%s() expects 1 arg, got %zu", name, argv.size()); in ReadFileFn()
661 if (!ReadArgs(state, argv, &args)) { in ReadFileFn()
662 return ErrorAbort(state, kArgsParsingFailure, "%s(): Failed to parse the argument(s)", name); in ReadFileFn()
667 auto updater_runtime = state->updater->GetRuntime(); in ReadFileFn()
680 Value* WriteValueFn(const char* name, State* state, const std::vector<std::unique_ptr<Expr>>& argv)… in WriteValueFn() argument
682 return ErrorAbort(state, kArgsParsingFailure, "%s() expects 2 args, got %zu", name, in WriteValueFn()
687 if (!ReadArgs(state, argv, &args)) { in WriteValueFn()
688 return ErrorAbort(state, kArgsParsingFailure, "%s(): Failed to parse the argument(s)", name); in WriteValueFn()
693 return ErrorAbort(state, kArgsParsingFailure, "%s(): Filename cannot be empty", name); in WriteValueFn()
697 auto updater_runtime = state->updater->GetRuntime(); in WriteValueFn()
714 Value* RebootNowFn(const char* name, State* state, const std::vector<std::unique_ptr<Expr>>& argv) { in RebootNowFn() argument
716 return ErrorAbort(state, kArgsParsingFailure, "%s() expects 2 args, got %zu", name, in RebootNowFn()
721 if (!ReadArgs(state, argv, &args)) { in RebootNowFn()
722 return ErrorAbort(state, kArgsParsingFailure, "%s(): Failed to parse the argument(s)", name); in RebootNowFn()
742 return ErrorAbort(state, kRebootFailure, "%s() failed to reboot", name); in RebootNowFn()
755 Value* SetStageFn(const char* name, State* state, const std::vector<std::unique_ptr<Expr>>& argv) { in SetStageFn() argument
757 return ErrorAbort(state, kArgsParsingFailure, "%s() expects 2 args, got %zu", name, in SetStageFn()
762 if (!ReadArgs(state, argv, &args)) { in SetStageFn()
763 return ErrorAbort(state, kArgsParsingFailure, "%s() Failed to parse the argument(s)", name); in SetStageFn()
789 Value* GetStageFn(const char* name, State* state, const std::vector<std::unique_ptr<Expr>>& argv) { in GetStageFn() argument
791 return ErrorAbort(state, kArgsParsingFailure, "%s() expects 1 arg, got %zu", name, argv.size()); in GetStageFn()
795 if (!ReadArgs(state, argv, &args)) { in GetStageFn()
796 return ErrorAbort(state, kArgsParsingFailure, "%s() Failed to parse the argument(s)", name); in GetStageFn()
810 Value* WipeBlockDeviceFn(const char* name, State* state, const std::vector<std::unique_ptr<Expr>>& … in WipeBlockDeviceFn() argument
812 return ErrorAbort(state, kArgsParsingFailure, "%s() expects 2 args, got %zu", name, in WipeBlockDeviceFn()
817 if (!ReadArgs(state, argv, &args)) { in WipeBlockDeviceFn()
818 return ErrorAbort(state, kArgsParsingFailure, "%s() Failed to parse the argument(s)", name); in WipeBlockDeviceFn()
828 auto updater_runtime = state->updater->GetRuntime(); in WipeBlockDeviceFn()
833 Value* EnableRebootFn(const char* name, State* state, const std::vector<std::unique_ptr<Expr>>& arg… in EnableRebootFn() argument
835 return ErrorAbort(state, kArgsParsingFailure, "%s() expects no args, got %zu", name, in EnableRebootFn()
838 state->updater->WriteToCommandPipe("enable_reboot"); in EnableRebootFn()
842 Value* Tune2FsFn(const char* name, State* state, const std::vector<std::unique_ptr<Expr>>& argv) { in Tune2FsFn() argument
844 return ErrorAbort(state, kArgsParsingFailure, "%s() expects args, got %zu", name, argv.size()); in Tune2FsFn()
848 if (!ReadArgs(state, argv, &args)) { in Tune2FsFn()
849 return ErrorAbort(state, kArgsParsingFailure, "%s() could not read args", name); in Tune2FsFn()
854 auto updater_runtime = state->updater->GetRuntime(); in Tune2FsFn()
856 return ErrorAbort(state, kTune2FsFailure, "%s() returned error code %d", name, result); in Tune2FsFn()
861 Value* AddSlotSuffixFn(const char* name, State* state, in AddSlotSuffixFn() argument
864 return ErrorAbort(state, kArgsParsingFailure, "%s() expects 1 arg, got %zu", name, argv.size()); in AddSlotSuffixFn()
867 if (!ReadArgs(state, argv, &args)) { in AddSlotSuffixFn()
868 return ErrorAbort(state, kArgsParsingFailure, "%s() Failed to parse the argument(s)", name); in AddSlotSuffixFn()
871 auto updater_runtime = state->updater->GetRuntime(); in AddSlotSuffixFn()