Lines Matching refs:state
49 Value* MountFn(const char* name, State* state, int argc, Expr* argv[]) { in MountFn() argument
52 return ErrorAbort(state, "%s() expects 4 args, got %d", name, argc); in MountFn()
58 if (ReadArgs(state, argv, 4, &fs_type, &partition_type, in MountFn()
64 ErrorAbort(state, "fs_type argument to %s() can't be empty", name); in MountFn()
68 ErrorAbort(state, "partition_type argument to %s() can't be empty", in MountFn()
73 ErrorAbort(state, "location argument to %s() can't be empty", name); in MountFn()
77 ErrorAbort(state, "mount_point argument to %s() can't be empty", name); in MountFn()
133 Value* IsMountedFn(const char* name, State* state, int argc, Expr* argv[]) { in IsMountedFn() argument
136 return ErrorAbort(state, "%s() expects 1 arg, got %d", name, argc); in IsMountedFn()
139 if (ReadArgs(state, argv, 1, &mount_point) < 0) { in IsMountedFn()
143 ErrorAbort(state, "mount_point argument to unmount() can't be empty"); in IsMountedFn()
161 Value* UnmountFn(const char* name, State* state, int argc, Expr* argv[]) { in UnmountFn() argument
164 return ErrorAbort(state, "%s() expects 1 arg, got %d", name, argc); in UnmountFn()
167 if (ReadArgs(state, argv, 1, &mount_point) < 0) { in UnmountFn()
171 ErrorAbort(state, "mount_point argument to unmount() can't be empty"); in UnmountFn()
198 Value* FormatFn(const char* name, State* state, int argc, Expr* argv[]) { in FormatFn() argument
201 return ErrorAbort(state, "%s() expects 5 args, got %d", name, argc); in FormatFn()
209 … if (ReadArgs(state, argv, 5, &fs_type, &partition_type, &location, &fs_size, &mount_point) < 0) { in FormatFn()
214 ErrorAbort(state, "fs_type argument to %s() can't be empty", name); in FormatFn()
218 ErrorAbort(state, "partition_type argument to %s() can't be empty", in FormatFn()
223 ErrorAbort(state, "location argument to %s() can't be empty", name); in FormatFn()
228 ErrorAbort(state, "mount_point argument to %s() can't be empty", name); in FormatFn()
283 Value* DeleteFn(const char* name, State* state, int argc, Expr* argv[]) { in DeleteFn() argument
287 paths[i] = Evaluate(state, argv[i]); in DeleteFn()
314 Value* ShowProgressFn(const char* name, State* state, int argc, Expr* argv[]) { in ShowProgressFn() argument
316 return ErrorAbort(state, "%s() expects 2 args, got %d", name, argc); in ShowProgressFn()
320 if (ReadArgs(state, argv, 2, &frac_str, &sec_str) < 0) { in ShowProgressFn()
327 UpdaterInfo* ui = (UpdaterInfo*)(state->cookie); in ShowProgressFn()
334 Value* SetProgressFn(const char* name, State* state, int argc, Expr* argv[]) { in SetProgressFn() argument
336 return ErrorAbort(state, "%s() expects 1 arg, got %d", name, argc); in SetProgressFn()
339 if (ReadArgs(state, argv, 1, &frac_str) < 0) { in SetProgressFn()
345 UpdaterInfo* ui = (UpdaterInfo*)(state->cookie); in SetProgressFn()
352 Value* PackageExtractDirFn(const char* name, State* state, in PackageExtractDirFn() argument
355 return ErrorAbort(state, "%s() expects 2 args, got %d", name, argc); in PackageExtractDirFn()
359 if (ReadArgs(state, argv, 2, &zip_path, &dest_path) < 0) return NULL; in PackageExtractDirFn()
361 ZipArchive* za = ((UpdaterInfo*)(state->cookie))->package_zip; in PackageExtractDirFn()
380 Value* PackageExtractFileFn(const char* name, State* state, in PackageExtractFileFn() argument
383 return ErrorAbort(state, "%s() expects 1 or 2 args, got %d", in PackageExtractFileFn()
392 if (ReadArgs(state, argv, 2, &zip_path, &dest_path) < 0) return NULL; in PackageExtractFileFn()
394 ZipArchive* za = ((UpdaterInfo*)(state->cookie))->package_zip; in PackageExtractFileFn()
424 if (ReadArgs(state, argv, 1, &zip_path) < 0) return NULL; in PackageExtractFileFn()
426 ZipArchive* za = ((UpdaterInfo*)(state->cookie))->package_zip; in PackageExtractFileFn()
478 Value* SymlinkFn(const char* name, State* state, int argc, Expr* argv[]) { in SymlinkFn() argument
480 return ErrorAbort(state, "%s() expects 1+ args, got %d", name, argc); in SymlinkFn()
483 target = Evaluate(state, argv[0]); in SymlinkFn()
486 char** srcs = ReadVarArgs(state, argc-1, argv+1); in SymlinkFn()
516 return ErrorAbort(state, "%s: some symlinks failed", name); in SymlinkFn()
522 Value* SetPermFn(const char* name, State* state, int argc, Expr* argv[]) { in SetPermFn() argument
528 return ErrorAbort(state, "%s() expects %d+ args, got %d", in SetPermFn()
532 char** args = ReadVarArgs(state, argc, argv); in SetPermFn()
541 ErrorAbort(state, "%s: \"%s\" not a valid uid", name, args[0]); in SetPermFn()
547 ErrorAbort(state, "%s: \"%s\" not a valid gid", name, args[1]); in SetPermFn()
554 ErrorAbort(state, "%s: \"%s\" not a valid dirmode", name, args[2]); in SetPermFn()
560 ErrorAbort(state, "%s: \"%s\" not a valid filemode", in SetPermFn()
571 ErrorAbort(state, "%s: \"%s\" not a valid mode", name, args[2]); in SetPermFn()
598 return ErrorAbort(state, "%s: some changes failed", name); in SetPermFn()
604 Value* GetPropFn(const char* name, State* state, int argc, Expr* argv[]) { in GetPropFn() argument
606 return ErrorAbort(state, "%s() expects 1 arg, got %d", name, argc); in GetPropFn()
609 key = Evaluate(state, argv[0]); in GetPropFn()
625 Value* FileGetPropFn(const char* name, State* state, int argc, Expr* argv[]) { in FileGetPropFn() argument
630 if (ReadArgs(state, argv, 2, &filename, &key) < 0) { in FileGetPropFn()
636 ErrorAbort(state, "%s: failed to stat \"%s\": %s", in FileGetPropFn()
644 ErrorAbort(state, "%s too large for %s (max %d)", in FileGetPropFn()
651 ErrorAbort(state, "%s: failed to alloc %lld bytes", name, st.st_size+1); in FileGetPropFn()
657 ErrorAbort(state, "%s: failed to open %s: %s", in FileGetPropFn()
663 ErrorAbort(state, "%s: failed to read %lld bytes from %s", in FileGetPropFn()
682 ErrorAbort(state, "%s: malformed line \"%s\": %s not a prop file?", in FileGetPropFn()
728 Value* WriteRawImageFn(const char* name, State* state, int argc, Expr* argv[]) { in WriteRawImageFn() argument
733 if (ReadValueArgs(state, argv, 2, &contents, &partition_value) < 0) { in WriteRawImageFn()
739 ErrorAbort(state, "partition argument to %s must be string", name); in WriteRawImageFn()
744 ErrorAbort(state, "partition argument to %s can't be empty", name); in WriteRawImageFn()
748 ErrorAbort(state, "file argument to %s can't be empty", name); in WriteRawImageFn()
819 Value* ApplyPatchSpaceFn(const char* name, State* state, in ApplyPatchSpaceFn() argument
822 if (ReadArgs(state, argv, 1, &bytes_str) < 0) { in ApplyPatchSpaceFn()
829 ErrorAbort(state, "%s(): can't parse \"%s\" as byte count\n\n", in ApplyPatchSpaceFn()
840 Value* ApplyPatchFn(const char* name, State* state, int argc, Expr* argv[]) { in ApplyPatchFn() argument
842 return ErrorAbort(state, "%s(): expected at least 6 args and an " in ApplyPatchFn()
851 if (ReadArgs(state, argv, 4, &source_filename, &target_filename, in ApplyPatchFn()
859 ErrorAbort(state, "%s(): can't parse \"%s\" as byte count", in ApplyPatchFn()
869 Value** patches = ReadValueVarArgs(state, argc-4, argv+4); in ApplyPatchFn()
874 ErrorAbort(state, "%s(): sha-1 #%d is not string", name, i); in ApplyPatchFn()
878 ErrorAbort(state, "%s(): patch #%d is not blob", name, i); in ApplyPatchFn()
912 Value* ApplyPatchCheckFn(const char* name, State* state, in ApplyPatchCheckFn() argument
915 return ErrorAbort(state, "%s(): expected at least 1 arg, got %d", in ApplyPatchCheckFn()
920 if (ReadArgs(state, argv, 1, &filename) < 0) { in ApplyPatchCheckFn()
925 char** sha1s = ReadVarArgs(state, argc-1, argv+1); in ApplyPatchCheckFn()
938 Value* UIPrintFn(const char* name, State* state, int argc, Expr* argv[]) { in UIPrintFn() argument
939 char** args = ReadVarArgs(state, argc, argv); in UIPrintFn()
961 fprintf(((UpdaterInfo*)(state->cookie))->cmd_pipe, in UIPrintFn()
965 fprintf(((UpdaterInfo*)(state->cookie))->cmd_pipe, "ui_print\n"); in UIPrintFn()
970 Value* WipeCacheFn(const char* name, State* state, int argc, Expr* argv[]) { in WipeCacheFn() argument
972 return ErrorAbort(state, "%s() expects no args, got %d", name, argc); in WipeCacheFn()
974 fprintf(((UpdaterInfo*)(state->cookie))->cmd_pipe, "wipe_cache\n"); in WipeCacheFn()
978 Value* RunProgramFn(const char* name, State* state, int argc, Expr* argv[]) { in RunProgramFn() argument
980 return ErrorAbort(state, "%s() expects at least 1 arg", name); in RunProgramFn()
982 char** args = ReadVarArgs(state, argc, argv); in RunProgramFn()
1045 Value* Sha1CheckFn(const char* name, State* state, int argc, Expr* argv[]) { in Sha1CheckFn() argument
1047 return ErrorAbort(state, "%s() expects at least 1 arg", name); in Sha1CheckFn()
1050 Value** args = ReadValueVarArgs(state, argc, argv); in Sha1CheckFn()
1097 Value* ReadFileFn(const char* name, State* state, int argc, Expr* argv[]) { in ReadFileFn() argument
1099 return ErrorAbort(state, "%s() expects 1 arg, got %d", name, argc); in ReadFileFn()
1102 if (ReadArgs(state, argv, 1, &filename) < 0) return NULL; in ReadFileFn()
1109 ErrorAbort(state, "%s() loading \"%s\" failed: %s", in ReadFileFn()