Lines Matching refs:fd
309 write_blocks(int fd, struct entry& entry, bool append = false)
317 if (fstat(fd, &stat) != 0)
339 ssize_t bytesWritten = write(fd, block + blockOffset, toWrite);
392 int fd = open_file(file.name, O_RDONLY);
393 if (fd < 0) {
401 if (fstat(fd, &stat) != 0)
407 close(fd);
423 ssize_t bytesRead = read(fd, block, toRead);
445 close(fd);
562 int fd = open_file(name, O_RDWR | O_CREAT | O_TRUNC);
563 if (fd < 0)
570 write_blocks(fd, file);
574 fs_write_attr(fd, kIdentifierAttribute, B_UINT32_TYPE, 0, &file.identifier,
577 close(fd);
636 int fd = open_file(file.name, O_WRONLY | O_APPEND);
637 if (fd < 0) {
642 write_blocks(fd, file, true);
643 close(fd);
660 int fd = open_file(file.name, O_CREAT | O_WRONLY | O_TRUNC);
661 if (fd < 0) {
667 write_blocks(fd, file);
669 close(fd);
686 int fd = open_file(file.name, O_WRONLY | O_TRUNC);
687 if (fd < 0) {
694 close(fd);