Lines Matching refs:fd

86 read_snapshot_file(int fd, KeyedVector<String8,FileState>* snapshot)  in read_snapshot_file()  argument
92 amt = read(fd, &header, sizeof(header)); in read_snapshot_file()
107 amt = read(fd, &file, sizeof(FileState)); in read_snapshot_file()
119 amt = read(fd, filename, nameBufSize); in read_snapshot_file()
143 write_snapshot_file(int fd, const KeyedVector<String8,FileRec>& snapshot) in write_snapshot_file() argument
158 LOGP("write_snapshot_file fd=%d\n", fd); in write_snapshot_file()
163 amt = write(fd, &header, sizeof(header)); in write_snapshot_file()
175 amt = write(fd, &r.s, sizeof(FileState)); in write_snapshot_file()
182 amt = write(fd, name.string(), nameLen); in write_snapshot_file()
190 amt = write(fd, &padding, paddingLen); in write_snapshot_file()
211 write_update_file(BackupDataWriter* dataStream, int fd, int mode, const String8& key, in write_update_file() argument
225 fileSize = lseek(fd, 0, SEEK_END); in write_update_file()
226 lseek(fd, 0, SEEK_SET); in write_update_file()
251 while ((amt = read(fd, buf, bufsize)) != 0 && bytesLeft > 0) { in write_update_file()
296 int fd = open(realFilename, O_RDONLY); in write_update_file() local
297 if (fd == -1) { in write_update_file()
301 err = write_update_file(dataStream, fd, st.st_mode, key, realFilename); in write_update_file()
302 close(fd); in write_update_file()
308 int fd = open(file, O_RDONLY); in compute_crc32() local
309 if (fd < 0) { in compute_crc32()
319 lseek(fd, 0, SEEK_SET); in compute_crc32()
321 while ((amt = read(fd, buf, bufsize)) != 0) { in compute_crc32()
325 close(fd); in compute_crc32()
412 int fd = open(g.file.string(), O_RDONLY); in back_up_files() local
413 if (fd < 0) { in back_up_files()
416 write_update_file(dataStream, fd, g.s.mode, p, g.file.string()); in back_up_files()
417 close(fd); in back_up_files()
544 int fd = open(filepath.string(), O_RDONLY); in write_tarfile() local
545 if (fd < 0) { in write_tarfile()
691 ssize_t nRead = read(fd, buf, toRead); in write_tarfile()
721 close(fd); in write_tarfile()
747 int fd; in WriteFile() local
782 fd = open(filename.string(), O_CREAT|O_RDWR|O_TRUNC, mode); in WriteFile()
783 if (fd == -1) { in WriteFile()
789 err = write(fd, buf, amt); in WriteFile()
791 close(fd); in WriteFile()
798 close(fd); in WriteFile()
822 RestoreHelperBase::WriteSnapshot(int fd) in WriteSnapshot() argument
824 return write_snapshot_file(fd, m_files);; in WriteSnapshot()
835 int fd; in write_text_file() local
838 fd = creat(path, 0666); in write_text_file()
839 if (fd == -1) { in write_text_file()
845 amt = write(fd, data, len); in write_text_file()
851 close(fd); in write_text_file()
859 int fd; in compare_file() local
862 fd = open(path, O_RDONLY); in compare_file()
863 if (fd == -1) { in compare_file()
875 amt = lseek(fd, 0, SEEK_END); in compare_file()
880 lseek(fd, 0, SEEK_SET); in compare_file()
883 amt = read(fd, contents, readLen); in compare_file()
907 int fd; in backup_helper_test_empty() local
915 fd = creat(filename, 0666); in backup_helper_test_empty()
916 if (fd == -1) { in backup_helper_test_empty()
921 err = write_snapshot_file(fd, snapshot); in backup_helper_test_empty()
923 close(fd); in backup_helper_test_empty()
941 fd = open(filename, O_RDONLY); in backup_helper_test_empty()
942 if (fd == -1) { in backup_helper_test_empty()
948 err = read_snapshot_file(fd, &readSnapshot); in backup_helper_test_empty()
966 int fd; in backup_helper_test_four() local
974 fd = creat(filename, 0666); in backup_helper_test_four()
975 if (fd == -1) { in backup_helper_test_four()
1025 err = write_snapshot_file(fd, snapshot); in backup_helper_test_four()
1027 close(fd); in backup_helper_test_four()
1077 fd = open(filename, O_RDONLY); in backup_helper_test_four()
1078 if (fd == -1) { in backup_helper_test_four()
1085 err = read_snapshot_file(fd, &readSnapshot); in backup_helper_test_four()
1168 int fd; in backup_helper_test_data_writer() local
1175 fd = creat(filename, 0666); in backup_helper_test_data_writer()
1176 if (fd == -1) { in backup_helper_test_data_writer()
1181 BackupDataWriter writer(fd); in backup_helper_test_data_writer()
1189 close(fd); in backup_helper_test_data_writer()
1273 int fd; in backup_helper_test_data_reader() local
1280 fd = creat(filename, 0666); in backup_helper_test_data_reader()
1281 if (fd == -1) { in backup_helper_test_data_reader()
1286 err = write(fd, DATA_GOLDEN_FILE, DATA_GOLDEN_FILE_SIZE); in backup_helper_test_data_reader()
1292 close(fd); in backup_helper_test_data_reader()
1294 fd = open(filename, O_RDONLY); in backup_helper_test_data_reader()
1295 if (fd == -1) { in backup_helper_test_data_reader()
1302 BackupDataReader reader(fd); in backup_helper_test_data_reader()
1323 close(fd); in backup_helper_test_data_reader()