Lines Matching refs:filename

34 static int LoadPartitionContents(const char* filename, FileContents* file);
52 int LoadFileContents(const char* filename, FileContents* file) { in LoadFileContents() argument
57 if (strncmp(filename, "MTD:", 4) == 0 || in LoadFileContents()
58 strncmp(filename, "EMMC:", 5) == 0) { in LoadFileContents()
59 return LoadPartitionContents(filename, file); in LoadFileContents()
62 if (stat(filename, &file->st) != 0) { in LoadFileContents()
63 printf("failed to stat \"%s\": %s\n", filename, strerror(errno)); in LoadFileContents()
70 FILE* f = fopen(filename, "rb"); in LoadFileContents()
72 printf("failed to open \"%s\": %s\n", filename, strerror(errno)); in LoadFileContents()
81 filename, (long)bytes_read, (long)file->size); in LoadFileContents()
124 static int LoadPartitionContents(const char* filename, FileContents* file) { in LoadPartitionContents() argument
125 char* copy = strdup(filename); in LoadPartitionContents()
136 filename); in LoadPartitionContents()
143 for (i = 0; filename[i] != '\0'; ++i) { in LoadPartitionContents()
144 if (filename[i] == ':') { in LoadPartitionContents()
150 filename); in LoadPartitionContents()
162 printf("LoadPartitionContents called with bad size (%s)\n", filename); in LoadPartitionContents()
187 partition, filename); in LoadPartitionContents()
252 sha1sum[index[i]], filename); in LoadPartitionContents()
284 partition, filename); in LoadPartitionContents()
311 int SaveFileContents(const char* filename, const FileContents* file) { in SaveFileContents() argument
312 int fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_SYNC, S_IRUSR | S_IWUSR); in SaveFileContents()
315 filename, strerror(errno)); in SaveFileContents()
322 filename, (long)bytes_written, (long)file->size, in SaveFileContents()
328 printf("fsync of \"%s\" failed: %s\n", filename, strerror(errno)); in SaveFileContents()
332 printf("close of \"%s\" failed: %s\n", filename, strerror(errno)); in SaveFileContents()
336 if (chmod(filename, file->st.st_mode) != 0) { in SaveFileContents()
337 printf("chmod of \"%s\" failed: %s\n", filename, strerror(errno)); in SaveFileContents()
340 if (chown(filename, file->st.st_uid, file->st.st_gid) != 0) { in SaveFileContents()
341 printf("chown of \"%s\" failed: %s\n", filename, strerror(errno)); in SaveFileContents()
581 int applypatch_check(const char* filename, in applypatch_check() argument
590 if (LoadFileContents(filename, &file) != 0 || in applypatch_check()
594 "sha1 sums; checking cache\n", filename); in applypatch_check()
611 printf("cache bits don't match any sha1 for \"%s\"\n", filename); in applypatch_check()
659 size_t FreeSpaceForFile(const char* filename) { in FreeSpaceForFile() argument
661 if (statfs(filename, &sf) != 0) { in FreeSpaceForFile()
662 printf("failed to statfs %s: %s\n", filename, strerror(errno)); in FreeSpaceForFile()