Lines Matching refs:fd
272 int ch, fd, fd1;
376 fd = open(fname, O_RDWR | O_CREAT | O_TRUNC, 0644);
377 if (fd == -1)
379 if (ftruncate(fd, opt_create))
381 } else if ((fd = open(fname, opt_N ? O_RDONLY : O_RDWR)) == -1)
383 if (fstat(fd, &sb))
394 if (opt_ofs && opt_ofs != lseek(fd, opt_ofs, SEEK_SET))
416 getdiskinfo(fd, fname, dtype, oflag, &bpb);
721 if ((n = write(fd, img, bpb.bps)) == -1)
785 getdiskinfo(int fd, const char *fname, const char *dtype, __unused int oflag,
790 if (ioctl(fd, BLKSSZGET, &bpb->bps)) {
797 if (ioctl(fd, BLKGETSIZE, &bpb->bsec)) {
802 if (ioctl(fd, HDIO_GETGEO, &geom)) {
828 getdiskinfo(int fd, const char *fname, const char *dtype, __unused int oflag,
844 if (ioctl(fd, DIOCGMEDIASIZE, &ms) == -1) {
847 if (fstat(fd, &st))
856 } else if (ioctl(fd, FD_GTYPE, &type) != -1) {
867 if (ioctl(fd, DIOCGDINFO, &dlp) == -1) {
868 if (bpb->bps == 0 && ioctl(fd, DIOCGSECTORSIZE, &dlp.d_secsize) == -1)
874 if (bpb->spt == 0 && ioctl(fd, DIOCGFWSECTORS, &dlp.d_nsectors) == -1) {
878 if (bpb->hds == 0 && ioctl(fd, DIOCGFWHEADS, &dlp.d_ntracks) == -1) {