Lines Matching refs:fd
525 static int io_all(void *fd, void *buf, int count, int do_write)
528 struct ntfs_device *dev = fd;
532 i = write(*(int *)fd, buf, count);
534 i = read(*(int *)fd, buf, count);
549 static void rescue_sector(void *fd, off_t pos, void *buff)
552 struct ntfs_device *dev = fd;
555 if (lseek(*(int *)fd, pos, SEEK_SET) == (off_t)-1)
562 if (read_all(fd, buff, NTFS_SECTOR_SIZE) == -1) {
576 void *fd = (void *)&fd_in;
581 fd = vol->u.dev;
586 if (read_all(fd, buff, csize) == -1) {
593 rescue_sector(fd, rescue_pos + i, buff + i);
1439 static int device_offset_valid(int fd, s64 ofs)
1443 if (lseek(fd, ofs, SEEK_SET) >= 0 && read(fd, &ch, 1) == 1)
1448 static s64 device_size_get(int fd)
1454 if (ioctl(fd, BLKGETSIZE64, &size) >= 0) {
1465 if (ioctl(fd, BLKGETSIZE, &size) >= 0) {
1475 if (ioctl(fd, FDGETPRM, &this_floppy) >= 0) {
1488 for (high = 1024LL; !device_offset_valid(fd, high); high <<= 1)
1493 if (!device_offset_valid(fd, mid))
1498 lseek(fd, 0LL, SEEK_SET);
1502 static void fsync_clone(int fd)
1505 if (fsync(fd) && errno != EINVAL)