Lines Matching refs:fd

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