Lines Matching refs:state
68 static void uiPrint(State* state, const std::string& buffer) { in uiPrint() argument
69 UpdaterInfo* ui = static_cast<UpdaterInfo*>(state->cookie); in uiPrint()
86 void uiPrintf(State* _Nonnull state, const char* _Nonnull format, ...) { in uiPrintf() argument
94 uiPrint(state, error_msg); in uiPrintf()
99 Value* UIPrintFn(const char* name, State* state, const std::vector<std::unique_ptr<Expr>>& argv) { in UIPrintFn() argument
101 if (!ReadArgs(state, argv, &args)) { in UIPrintFn()
102 return ErrorAbort(state, kArgsParsingFailure, "%s(): Failed to parse the argument(s)", name); in UIPrintFn()
106 uiPrint(state, buffer); in UIPrintFn()
114 Value* PackageExtractFileFn(const char* name, State* state, in PackageExtractFileFn() argument
117 return ErrorAbort(state, kArgsParsingFailure, "%s() expects 1 or 2 args, got %zu", name, in PackageExtractFileFn()
125 if (!ReadArgs(state, argv, &args)) { in PackageExtractFileFn()
126 return ErrorAbort(state, kArgsParsingFailure, "%s() Failed to parse %zu args", name, in PackageExtractFileFn()
132 ZipArchiveHandle za = static_cast<UpdaterInfo*>(state->cookie)->package_zip; in PackageExtractFileFn()
170 if (!ReadArgs(state, argv, &args)) { in PackageExtractFileFn()
171 return ErrorAbort(state, kArgsParsingFailure, "%s() Failed to parse %zu args", name, in PackageExtractFileFn()
176 ZipArchiveHandle za = static_cast<UpdaterInfo*>(state->cookie)->package_zip; in PackageExtractFileFn()
180 return ErrorAbort(state, kPackageExtractFileFailure, "%s(): no %s in package", name, in PackageExtractFileFn()
190 return ErrorAbort(state, kPackageExtractFileFailure, in PackageExtractFileFn()
207 Value* PatchPartitionCheckFn(const char* name, State* state, in PatchPartitionCheckFn() argument
210 return ErrorAbort(state, kArgsParsingFailure, in PatchPartitionCheckFn()
215 if (!ReadArgs(state, argv, &args, 0, 2)) { in PatchPartitionCheckFn()
216 return ErrorAbort(state, kArgsParsingFailure, "%s(): Failed to parse the argument(s)", name); in PatchPartitionCheckFn()
222 return ErrorAbort(state, kArgsParsingFailure, "%s(): Failed to parse target \"%s\": %s", name, in PatchPartitionCheckFn()
228 return ErrorAbort(state, kArgsParsingFailure, "%s(): Failed to parse source \"%s\": %s", name, in PatchPartitionCheckFn()
243 Value* PatchPartitionFn(const char* name, State* state, in PatchPartitionFn() argument
246 return ErrorAbort(state, kArgsParsingFailure, in PatchPartitionFn()
251 if (!ReadArgs(state, argv, &args, 0, 2)) { in PatchPartitionFn()
252 return ErrorAbort(state, kArgsParsingFailure, "%s(): Failed to parse the argument(s)", name); in PatchPartitionFn()
258 return ErrorAbort(state, kArgsParsingFailure, "%s(): Failed to parse target \"%s\": %s", name, in PatchPartitionFn()
264 return ErrorAbort(state, kArgsParsingFailure, "%s(): Failed to parse source \"%s\": %s", name, in PatchPartitionFn()
269 if (!ReadValueArgs(state, argv, &values, 2, 1) || values[0]->type != Value::Type::BLOB) { in PatchPartitionFn()
270 return ErrorAbort(state, kArgsParsingFailure, "%s(): Invalid patch arg", name); 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()
334 uiPrintf(state, "%s: Failed to mount %s at %s: %s", name, location.c_str(), mount_point.c_str(), in MountFn()
343 Value* IsMountedFn(const char* name, State* state, const std::vector<std::unique_ptr<Expr>>& argv) { in IsMountedFn() argument
345 return ErrorAbort(state, kArgsParsingFailure, "%s() expects 1 arg, got %zu", name, argv.size()); in IsMountedFn()
349 if (!ReadArgs(state, argv, &args)) { in IsMountedFn()
350 return ErrorAbort(state, kArgsParsingFailure, "%s() Failed to parse the argument(s)", name); in IsMountedFn()
354 return ErrorAbort(state, kArgsParsingFailure, in IsMountedFn()
367 Value* UnmountFn(const char* name, State* state, const std::vector<std::unique_ptr<Expr>>& argv) { in UnmountFn() argument
369 return ErrorAbort(state, kArgsParsingFailure, "%s() expects 1 arg, got %zu", name, argv.size()); in UnmountFn()
372 if (!ReadArgs(state, argv, &args)) { in UnmountFn()
373 return ErrorAbort(state, kArgsParsingFailure, "%s() Failed to parse the argument(s)", name); in UnmountFn()
377 return ErrorAbort(state, kArgsParsingFailure, in UnmountFn()
384 uiPrintf(state, "Failed to unmount %s: No such volume", mount_point.c_str()); in UnmountFn()
389 uiPrintf(state, "Failed to unmount %s: %s", mount_point.c_str(), strerror(errno)); in UnmountFn()
421 Value* FormatFn(const char* name, State* state, const std::vector<std::unique_ptr<Expr>>& argv) { in FormatFn() argument
423 return ErrorAbort(state, kArgsParsingFailure, "%s() expects 5 args, got %zu", name, in FormatFn()
428 if (!ReadArgs(state, argv, &args)) { in FormatFn()
429 return ErrorAbort(state, kArgsParsingFailure, "%s() Failed to parse the argument(s)", name); in FormatFn()
438 return ErrorAbort(state, kArgsParsingFailure, "fs_type argument to %s() can't be empty", name); in FormatFn()
441 return ErrorAbort(state, kArgsParsingFailure, "partition_type argument to %s() can't be empty", in FormatFn()
445 return ErrorAbort(state, kArgsParsingFailure, "location argument to %s() can't be empty", name); in FormatFn()
448 return ErrorAbort(state, kArgsParsingFailure, "mount_point argument to %s() can't be empty", in FormatFn()
454 return ErrorAbort(state, kArgsParsingFailure, "%s: failed to parse int in %s", name, in FormatFn()
509 Value* ShowProgressFn(const char* name, State* state, in ShowProgressFn() argument
512 return ErrorAbort(state, kArgsParsingFailure, "%s() expects 2 args, got %zu", name, in ShowProgressFn()
517 if (!ReadArgs(state, argv, &args)) { in ShowProgressFn()
518 return ErrorAbort(state, kArgsParsingFailure, "%s() Failed to parse the argument(s)", name); in ShowProgressFn()
525 return ErrorAbort(state, kArgsParsingFailure, "%s: failed to parse double in %s", name, in ShowProgressFn()
530 return ErrorAbort(state, kArgsParsingFailure, "%s: failed to parse int in %s", name, in ShowProgressFn()
534 UpdaterInfo* ui = static_cast<UpdaterInfo*>(state->cookie); in ShowProgressFn()
540 Value* SetProgressFn(const char* name, State* state, in SetProgressFn() argument
543 return ErrorAbort(state, kArgsParsingFailure, "%s() expects 1 arg, got %zu", name, argv.size()); in SetProgressFn()
547 if (!ReadArgs(state, argv, &args)) { in SetProgressFn()
548 return ErrorAbort(state, kArgsParsingFailure, "%s() Failed to parse the argument(s)", name); in SetProgressFn()
554 return ErrorAbort(state, kArgsParsingFailure, "%s: failed to parse double in %s", name, in SetProgressFn()
558 UpdaterInfo* ui = static_cast<UpdaterInfo*>(state->cookie); in SetProgressFn()
564 Value* GetPropFn(const char* name, State* state, const std::vector<std::unique_ptr<Expr>>& argv) { in GetPropFn() argument
566 return ErrorAbort(state, kArgsParsingFailure, "%s() expects 1 arg, got %zu", name, argv.size()); in GetPropFn()
569 if (!Evaluate(state, argv[0], &key)) { in GetPropFn()
582 Value* FileGetPropFn(const char* name, State* state, in FileGetPropFn() argument
585 return ErrorAbort(state, kArgsParsingFailure, "%s() expects 2 args, got %zu", name, in FileGetPropFn()
590 if (!ReadArgs(state, argv, &args)) { in FileGetPropFn()
591 return ErrorAbort(state, kArgsParsingFailure, "%s() Failed to parse the argument(s)", name); in FileGetPropFn()
598 ErrorAbort(state, kFreadFailure, "%s: failed to read %s", name, filename.c_str()); in FileGetPropFn()
628 Value* ApplyPatchSpaceFn(const char* name, State* state, in ApplyPatchSpaceFn() argument
631 return ErrorAbort(state, kArgsParsingFailure, "%s() expects 1 args, got %zu", name, in ApplyPatchSpaceFn()
635 if (!ReadArgs(state, argv, &args)) { in ApplyPatchSpaceFn()
636 return ErrorAbort(state, kArgsParsingFailure, "%s() Failed to parse the argument(s)", name); in ApplyPatchSpaceFn()
642 return ErrorAbort(state, kArgsParsingFailure, "%s(): can't parse \"%s\" as byte count", name, in ApplyPatchSpaceFn()
647 if (state->is_retry || CheckAndFreeSpaceOnCache(bytes)) { in ApplyPatchSpaceFn()
653 Value* WipeCacheFn(const char* name, State* state, const std::vector<std::unique_ptr<Expr>>& argv) { in WipeCacheFn() argument
655 return ErrorAbort(state, kArgsParsingFailure, "%s() expects no args, got %zu", name, in WipeCacheFn()
658 fprintf(static_cast<UpdaterInfo*>(state->cookie)->cmd_pipe, "wipe_cache\n"); in WipeCacheFn()
662 Value* RunProgramFn(const char* name, State* state, const std::vector<std::unique_ptr<Expr>>& argv)… in RunProgramFn() argument
664 return ErrorAbort(state, kArgsParsingFailure, "%s() expects at least 1 arg", name); in RunProgramFn()
668 if (!ReadArgs(state, argv, &args)) { in RunProgramFn()
669 return ErrorAbort(state, kArgsParsingFailure, "%s() Failed to parse the argument(s)", name); in RunProgramFn()
697 Value* ReadFileFn(const char* name, State* state, const std::vector<std::unique_ptr<Expr>>& argv) { in ReadFileFn() argument
699 return ErrorAbort(state, kArgsParsingFailure, "%s() expects 1 arg, got %zu", name, argv.size()); in ReadFileFn()
703 if (!ReadArgs(state, argv, &args)) { in ReadFileFn()
704 return ErrorAbort(state, kArgsParsingFailure, "%s(): Failed to parse the argument(s)", name); in ReadFileFn()
721 Value* WriteValueFn(const char* name, State* state, const std::vector<std::unique_ptr<Expr>>& argv)… in WriteValueFn() argument
723 return ErrorAbort(state, kArgsParsingFailure, "%s() expects 2 args, got %zu", name, in WriteValueFn()
728 if (!ReadArgs(state, argv, &args)) { in WriteValueFn()
729 return ErrorAbort(state, kArgsParsingFailure, "%s(): Failed to parse the argument(s)", name); in WriteValueFn()
734 return ErrorAbort(state, kArgsParsingFailure, "%s(): Filename cannot be empty", name); in WriteValueFn()
755 Value* RebootNowFn(const char* name, State* state, const std::vector<std::unique_ptr<Expr>>& argv) { in RebootNowFn() argument
757 return ErrorAbort(state, kArgsParsingFailure, "%s() expects 2 args, got %zu", name, in RebootNowFn()
762 if (!ReadArgs(state, argv, &args)) { in RebootNowFn()
763 return ErrorAbort(state, kArgsParsingFailure, "%s(): Failed to parse the argument(s)", name); in RebootNowFn()
784 return ErrorAbort(state, kRebootFailure, "%s() failed to reboot", name); in RebootNowFn()
797 Value* SetStageFn(const char* name, State* state, const std::vector<std::unique_ptr<Expr>>& argv) { in SetStageFn() argument
799 return ErrorAbort(state, kArgsParsingFailure, "%s() expects 2 args, got %zu", name, in SetStageFn()
804 if (!ReadArgs(state, argv, &args)) { in SetStageFn()
805 return ErrorAbort(state, kArgsParsingFailure, "%s() Failed to parse the argument(s)", name); in SetStageFn()
831 Value* GetStageFn(const char* name, State* state, const std::vector<std::unique_ptr<Expr>>& argv) { in GetStageFn() argument
833 return ErrorAbort(state, kArgsParsingFailure, "%s() expects 1 arg, got %zu", name, argv.size()); in GetStageFn()
837 if (!ReadArgs(state, argv, &args)) { in GetStageFn()
838 return ErrorAbort(state, kArgsParsingFailure, "%s() Failed to parse the argument(s)", name); in GetStageFn()
852 Value* WipeBlockDeviceFn(const char* name, State* state, const std::vector<std::unique_ptr<Expr>>& … in WipeBlockDeviceFn() argument
854 return ErrorAbort(state, kArgsParsingFailure, "%s() expects 2 args, got %zu", name, in WipeBlockDeviceFn()
859 if (!ReadArgs(state, argv, &args)) { in WipeBlockDeviceFn()
860 return ErrorAbort(state, kArgsParsingFailure, "%s() Failed to parse the argument(s)", name); in WipeBlockDeviceFn()
881 Value* EnableRebootFn(const char* name, State* state, const std::vector<std::unique_ptr<Expr>>& arg… in EnableRebootFn() argument
883 return ErrorAbort(state, kArgsParsingFailure, "%s() expects no args, got %zu", name, in EnableRebootFn()
886 UpdaterInfo* ui = static_cast<UpdaterInfo*>(state->cookie); in EnableRebootFn()
891 Value* Tune2FsFn(const char* name, State* state, const std::vector<std::unique_ptr<Expr>>& argv) { in Tune2FsFn() argument
893 return ErrorAbort(state, kArgsParsingFailure, "%s() expects args, got %zu", name, argv.size()); in Tune2FsFn()
897 if (!ReadArgs(state, argv, &args)) { in Tune2FsFn()
898 return ErrorAbort(state, kArgsParsingFailure, "%s() could not read args", name); in Tune2FsFn()
907 return ErrorAbort(state, kTune2FsFailure, "%s() returned error code %d", name, result); in Tune2FsFn()