Lines Matching defs:fd
49 static int get_attrs(disk_t *dp, int fd, nvlist_t *attrs);
123 int fd;
135 fd = drive_open_disk(dp->p.disk, NULL, 0);
137 if ((*errp = get_attrs(dp->p.disk, fd, attrs)) != 0) {
142 if (fd >= 0) {
143 (void) close(fd);
241 media_read_info(int fd, struct dk_minfo *minfo)
254 while ((status = ioctl(fd, DKIOCGMEDIAINFO, minfo)) < 0) {
309 int fd;
312 if ((fd = drive_open_disk(media[i]->p.disk, NULL, 0)) < 0) {
316 if (media_read_info(fd, &minfo)) {
336 (void) close(fd);
368 add_mbr_sig(int fd, nvlist_t *attrs)
379 if (ioctl(fd, DKIOCGMBOOT, buff) == -1) {
399 get_attrs(disk_t *dp, int fd, nvlist_t *attrs)
406 if (fd < 0) {
413 if (!media_read_info(fd, &minfo)) {
417 if (partition_has_fdisk(dp, fd)) {
422 ret = add_mbr_sig(fd, attrs);
453 if (efi_alloc_and_read(fd, &efip) >= 0) {
485 if (ioctl(fd, DKIOCG_PHYGEOM, &geometry) >= 0) {
495 } else if (ioctl(fd, DKIOCG_PHYGEOM, &geometry) >= 0) {
497 } else if (ioctl(fd, DKIOCGGEOM, &geometry) >= 0) {
535 if (read_extvtoc(fd, &vtoc) >= 0 && vtoc.v_volume[0] != 0) {
593 int fd;
597 if ((fd = drive_open_disk(dp, NULL, 0)) >= 0) {
600 if ((loaded = media_read_info(fd, &minfo))) {
603 if (read_extvtoc(fd, &vtoc) >= 0) {
617 (void) close(fd);