Lines Matching refs:device
89 ib_device_t *device = &data->device; in read_bootblock_from_file() local
116 if (!is_zfs(device->type)) { in read_bootblock_from_file()
151 if (!is_zfs(device->type)) { in read_bootblock_from_file()
265 ib_device_t *device = &data->device; in is_update_necessary() local
266 int dev_fd = device->fd; in is_update_necessary()
269 assert(device->fd != -1); in is_update_necessary()
272 if (!is_zfs(device->type)) in is_update_necessary()
278 BOOT_DEBUG("Unable to read bootblock from %s\n", device->path); in is_update_necessary()
291 "non versioned one\n", device->path); in is_update_necessary()
296 BOOT_DEBUG("Forcing update of %s bootblock\n", device->path); in is_update_necessary()
335 ib_device_t *device = &data->device; in prepare_bootblock() local
342 if (!is_zfs(device->type)) in prepare_bootblock()
383 ib_device_t *device = &data->device; in write_zfs_bootblock() local
389 assert(device->fd != -1); in write_zfs_bootblock()
401 if (write_out(device->fd, bufptr, size, SECTOR_SIZE) != BC_SUCCESS) { in write_zfs_bootblock()
403 device->path); in write_zfs_bootblock()
411 if (write_out(device->fd, bufptr, size, BBLK_ZFS_EXTRA_OFF) in write_zfs_bootblock()
414 "to %s at offset %d\n", device->path, BBLK_ZFS_EXTRA_OFF); in write_zfs_bootblock()
423 ib_device_t *device = &data->device; in write_bootblock() local
433 if (!is_zfs(device->type)) { in write_bootblock()
434 if (write_out(device->fd, bblock->buf, bblock->buf_size, in write_bootblock()
437 device->path); in write_bootblock()
449 open_device(ib_device_t *device) in open_device() argument
453 device->fd = open(device->path, O_RDWR); in open_device()
454 if (device->fd == -1) { in open_device()
455 BOOT_DEBUG("Unable to open %s\n", device->path); in open_device()
460 if (fstat(device->fd, &statbuf) != 0) { in open_device()
461 BOOT_DEBUG("Unable to stat %s\n", device->path); in open_device()
463 (void) close(device->fd); in open_device()
469 device->path); in open_device()
477 init_device(ib_device_t *device, char *path) in init_device() argument
479 bzero(device, sizeof (*device)); in init_device()
480 device->fd = -1; in init_device()
482 device->path = strdup(path); in init_device()
488 device->type = tgt_fs_type; in init_device()
489 if (open_device(device) != BC_SUCCESS) in init_device()
496 cleanup_device(ib_device_t *device) in cleanup_device() argument
498 free(device->path); in cleanup_device()
499 bzero(device, sizeof (*device)); in cleanup_device()
501 if (device->fd != -1) in cleanup_device()
502 (void) close(device->fd); in cleanup_device()
555 src->device.path, dest->device.path); in propagate_bootblock()
614 if (init_device(&install_data.device, device_path) != BC_SUCCESS) { in handle_install()
626 if (do_version && !is_zfs(install_data.device.type)) { in handle_install()
650 cleanup_device(&install_data.device); in handle_install()
672 ib_device_t *device = &data.device; in handle_getinfo() local
690 if (init_device(device, device_path) != BC_SUCCESS) { in handle_getinfo()
696 if (!is_zfs(device->type)) { in handle_getinfo()
702 ret = read_bootblock_from_disk(device->fd, bblock); in handle_getinfo()
739 cleanup_device(&data.device); in handle_getinfo()
760 ib_device_t *curr_device = &curr_data.device; in handle_mirror()
761 ib_device_t *attach_device = &attach_data.device; in handle_mirror()