Lines Matching defs:fn
563 std::string fn(STASH_DIRECTORY_BASE);
564 fn += "/" + base + "/" + id + postfix;
566 return fn;
594 static void DeleteFile(const std::string& fn) {
595 if (fn.empty()) return;
597 LOG(INFO) << "deleting " << fn;
599 if (unlink(fn.c_str()) == -1 && errno != ENOENT) {
600 PLOG(ERROR) << "unlink \"" << fn << "\" failed";
648 std::string fn = GetStashFileName(params.stashbase, id, "");
651 int res = stat(fn.c_str(), &sb);
655 PLOG(ERROR) << "stat \"" << fn << "\" failed";
661 LOG(INFO) << " loading " << fn;
664 LOG(ERROR) << fn << " size " << sb.st_size << " not multiple of block size " << BLOCKSIZE;
668 android::base::unique_fd fd(TEMP_FAILURE_RETRY(ota_open(fn.c_str(), O_RDONLY)));
670 PLOG(ERROR) << "open \"" << fn << "\" failed";
683 LOG(ERROR) << "unexpected contents in " << fn;
691 DeleteFile(fn);
709 std::string fn = GetStashFileName(base, id, ".partial");
731 TEMP_FAILURE_RETRY(ota_open(fn.c_str(), O_WRONLY | O_CREAT | O_TRUNC, STASH_FILE_MODE)));
733 PLOG(ERROR) << "failed to create \"" << fn << "\"";
738 PLOG(ERROR) << "failed to chown \"" << fn << "\"";
748 PLOG(ERROR) << "fsync \"" << fn << "\" failed";
752 if (rename(fn.c_str(), cn.c_str()) == -1) {
753 PLOG(ERROR) << "rename(\"" << fn << "\", \"" << cn << "\") failed";
830 EnumerateStash(dirname, [](const std::string& fn) {
831 if (android::base::EndsWith(fn, ".partial")) {
832 DeleteFile(fn);
837 EnumerateStash(dirname, [&existing](const std::string& fn) {
838 if (fn.empty()) return;
840 if (stat(fn.c_str(), &sb) == -1) {
841 PLOG(ERROR) << "stat \"" << fn << "\" failed";