Lines Matching refs:device
90 ib_device_t *device = &data->device; in read_bootblock_from_file() local
117 if (!is_zfs(device->type)) { in read_bootblock_from_file()
152 if (!is_zfs(device->type)) { in read_bootblock_from_file()
268 ib_device_t *device = &data->device; in is_update_necessary() local
269 int dev_fd = device->fd; in is_update_necessary()
272 assert(device->fd != -1); in is_update_necessary()
275 if (!is_zfs(device->type)) in is_update_necessary()
281 BOOT_DEBUG("Unable to read bootblock from %s\n", device->path); in is_update_necessary()
294 "non versioned one\n", device->path); in is_update_necessary()
299 BOOT_DEBUG("Forcing update of %s bootblock\n", device->path); in is_update_necessary()
338 ib_device_t *device = &data->device; in prepare_bootblock() local
345 if (!is_zfs(device->type)) in prepare_bootblock()
386 ib_device_t *device = &data->device; in write_zfs_bootblock() local
392 assert(device->fd != -1); in write_zfs_bootblock()
404 if (write_out(device->fd, bufptr, size, SECTOR_SIZE) != BC_SUCCESS) { in write_zfs_bootblock()
406 device->path); in write_zfs_bootblock()
414 if (write_out(device->fd, bufptr, size, BBLK_ZFS_EXTRA_OFF) in write_zfs_bootblock()
417 "to %s at offset %d\n", device->path, BBLK_ZFS_EXTRA_OFF); in write_zfs_bootblock()
426 ib_device_t *device = &data->device; in write_bootblock() local
436 if (!is_zfs(device->type)) { in write_bootblock()
437 if (write_out(device->fd, bblock->buf, bblock->buf_size, in write_bootblock()
440 device->path); in write_bootblock()
452 open_device(ib_device_t *device) in open_device() argument
456 device->fd = open(device->path, O_RDWR); in open_device()
457 if (device->fd == -1) { in open_device()
458 BOOT_DEBUG("Unable to open %s\n", device->path); in open_device()
463 if (fstat(device->fd, &statbuf) != 0) { in open_device()
464 BOOT_DEBUG("Unable to stat %s\n", device->path); in open_device()
466 (void) close(device->fd); in open_device()
472 device->path); in open_device()
480 init_device(ib_device_t *device, char *path) in init_device() argument
482 bzero(device, sizeof (*device)); in init_device()
483 device->fd = -1; in init_device()
485 device->path = strdup(path); in init_device()
491 device->type = tgt_fs_type; in init_device()
492 if (open_device(device) != BC_SUCCESS) in init_device()
499 cleanup_device(ib_device_t *device) in cleanup_device() argument
501 free(device->path); in cleanup_device()
502 bzero(device, sizeof (*device)); in cleanup_device()
504 if (device->fd != -1) in cleanup_device()
505 (void) close(device->fd); in cleanup_device()
558 src->device.path, dest->device.path); in propagate_bootblock()
617 if (init_device(&install_data.device, device_path) != BC_SUCCESS) { in handle_install()
629 if (do_version && !is_zfs(install_data.device.type)) { in handle_install()
653 cleanup_device(&install_data.device); in handle_install()
675 ib_device_t *device = &data.device; in handle_getinfo() local
693 if (init_device(device, device_path) != BC_SUCCESS) { in handle_getinfo()
699 if (!is_zfs(device->type)) { in handle_getinfo()
705 ret = read_bootblock_from_disk(device->fd, bblock); in handle_getinfo()
742 cleanup_device(&data.device); in handle_getinfo()
763 ib_device_t *curr_device = &curr_data.device; in handle_mirror()
764 ib_device_t *attach_device = &attach_data.device; in handle_mirror()