• Home
  • Raw
  • Download

Lines Matching refs:fd

106     int fd;  member
134 int fd, ret; in raw_open_common() local
151 s->fd = -1; in raw_open_common()
152 fd = qemu_open(filename, s->open_flags, 0644); in raw_open_common()
153 if (fd < 0) { in raw_open_common()
159 s->fd = fd; in raw_open_common()
197 close(fd); in raw_open_common()
243 ret = pread(s->fd, buf, count, offset); in raw_pread_aligned()
258 s->fd, bs->filename, offset, buf, count, in raw_pread_aligned()
263 ret = pread(s->fd, buf, count, offset); in raw_pread_aligned()
266 ret = pread(s->fd, buf, count, offset); in raw_pread_aligned()
272 s->fd, bs->filename, offset, buf, count, in raw_pread_aligned()
296 ret = pwrite(s->fd, buf, count, offset); in raw_pwrite_aligned()
302 s->fd, bs->filename, offset, buf, count, in raw_pwrite_aligned()
521 return laio_submit(bs, s->aio_ctx, s->fd, sector_num, qiov, in raw_aio_submit()
527 return paio_submit(bs, s->fd, sector_num, qiov, nb_sectors, in raw_aio_submit()
555 return paio_submit(bs, s->fd, 0, NULL, 0, cb, opaque, QEMU_AIO_FLUSH); in raw_aio_flush()
561 if (s->fd >= 0) { in raw_close()
562 close(s->fd); in raw_close()
563 s->fd = -1; in raw_close()
574 if (ftruncate(s->fd, offset) < 0) in raw_truncate()
583 int fd = s->fd; in raw_getlength() local
586 if (fstat(fd, &st)) in raw_getlength()
591 if (ioctl(fd, DIOCGDINFO, &dl)) in raw_getlength()
613 ret = ioctl(s->fd, DKIOCGMEDIAINFO, &minfo); in raw_getlength()
622 return lseek(s->fd, 0, SEEK_END); in raw_getlength()
628 int fd = s->fd; in raw_getlength() local
643 if (!fstat(fd, &sb) && (S_IFCHR & sb.st_mode)) { in raw_getlength()
645 if (ioctl(fd, DIOCGMEDIASIZE, (off_t *)&size)) in raw_getlength()
649 if (ioctl(fd, DIOCGPART, &pi) == 0) in raw_getlength()
659 size = lseek(fd, 0LL, SEEK_END); in raw_getlength()
675 size = lseek(fd, 0, SEEK_END); in raw_getlength()
690 return lseek(s->fd, 0, SEEK_END); in raw_getlength()
696 int fd; in raw_create() local
708 fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, in raw_create()
710 if (fd < 0) { in raw_create()
713 if (ftruncate(fd, total_size * BDRV_SECTOR_SIZE) != 0) { in raw_create()
716 if (close(fd) != 0) { in raw_create()
726 qemu_fdatasync(s->fd); in raw_flush()
847 int fd; in hdev_open() local
855 fd = open(bsdPath, O_RDONLY | O_BINARY | O_LARGEFILE); in hdev_open()
856 if (fd < 0) { in hdev_open()
859 close(fd); in hdev_open()
890 last_media_present = (s->fd >= 0); in fd_open()
891 if (s->fd >= 0 && in fd_open()
893 close(s->fd); in fd_open()
894 s->fd = -1; in fd_open()
899 if (s->fd < 0) { in fd_open()
907 s->fd = open(bs->filename, s->open_flags & ~O_NONBLOCK); in fd_open()
908 if (s->fd < 0) { in fd_open()
933 return ioctl(s->fd, req, buf); in hdev_ioctl()
944 return paio_ioctl(bs, s->fd, req, buf, cb, opaque); in hdev_aio_ioctl()
953 if (s->fd >= 0) in fd_open()
968 int fd; in hdev_create() local
981 fd = open(filename, O_WRONLY | O_BINARY); in hdev_create()
982 if (fd < 0) in hdev_create()
985 if (fstat(fd, &stat_buf) < 0) in hdev_create()
989 else if (lseek(fd, 0, SEEK_END) < total_size * BDRV_SECTOR_SIZE) in hdev_create()
992 close(fd); in hdev_create()
1042 close(s->fd); in floppy_open()
1043 s->fd = -1; in floppy_open()
1051 int fd, ret; in floppy_probe_device() local
1058 fd = open(filename, O_RDONLY | O_NONBLOCK); in floppy_probe_device()
1059 if (fd < 0) { in floppy_probe_device()
1064 ret = ioctl(fd, FDGETPRM, &fdparam); in floppy_probe_device()
1068 close(fd); in floppy_probe_device()
1100 int fd; in floppy_eject() local
1102 if (s->fd >= 0) { in floppy_eject()
1103 close(s->fd); in floppy_eject()
1104 s->fd = -1; in floppy_eject()
1106 fd = open(bs->filename, s->open_flags | O_NONBLOCK); in floppy_eject()
1107 if (fd >= 0) { in floppy_eject()
1108 if (ioctl(fd, FDEJECT, 0) < 0) in floppy_eject()
1110 close(fd); in floppy_eject()
1154 int fd, ret; in cdrom_probe_device() local
1160 fd = open(filename, O_RDONLY | O_NONBLOCK); in cdrom_probe_device()
1161 if (fd < 0) { in cdrom_probe_device()
1166 ret = ioctl(fd, CDROM_DRIVE_STATUS, CDSL_CURRENT); in cdrom_probe_device()
1170 close(fd); in cdrom_probe_device()
1180 ret = ioctl(s->fd, CDROM_DRIVE_STATUS, CDSL_CURRENT); in cdrom_is_inserted()
1191 if (ioctl(s->fd, CDROMEJECT, NULL) < 0) in cdrom_eject()
1194 if (ioctl(s->fd, CDROMCLOSETRAY, NULL) < 0) in cdrom_eject()
1205 if (ioctl(s->fd, CDROM_LOCKDOOR, locked) < 0) { in cdrom_set_locked()
1260 ioctl(s->fd, CDIOCALLOW); in cdrom_open()
1275 int fd; in cdrom_reopen() local
1281 if (s->fd >= 0) in cdrom_reopen()
1282 close(s->fd); in cdrom_reopen()
1283 fd = open(bs->filename, s->open_flags, 0644); in cdrom_reopen()
1284 if (fd < 0) { in cdrom_reopen()
1285 s->fd = -1; in cdrom_reopen()
1288 s->fd = fd; in cdrom_reopen()
1291 ioctl(s->fd, CDIOCALLOW); in cdrom_reopen()
1304 if (s->fd < 0) in cdrom_eject()
1307 (void) ioctl(s->fd, CDIOCALLOW); in cdrom_eject()
1310 if (ioctl(s->fd, CDIOCEJECT) < 0) in cdrom_eject()
1313 if (ioctl(s->fd, CDIOCCLOSE) < 0) in cdrom_eject()
1326 if (s->fd < 0) in cdrom_set_locked()
1328 if (ioctl(s->fd, (locked ? CDIOCPREVENT : CDIOCALLOW)) < 0) { in cdrom_set_locked()