Lines Matching refs:device

90 	ib_device_t	*device = &data->device;
117 if (!is_zfs(device->type)) {
152 if (!is_zfs(device->type)) {
268 ib_device_t *device = &data->device;
269 int dev_fd = device->fd;
272 assert(device->fd != -1);
275 if (!is_zfs(device->type))
281 BOOT_DEBUG("Unable to read bootblock from %s\n", device->path);
292 (void) fprintf(stdout, "WARNING: target device %s has a "
294 "non versioned one\n", device->path);
299 BOOT_DEBUG("Forcing update of %s bootblock\n", device->path);
338 ib_device_t *device = &data->device;
345 if (!is_zfs(device->type))
386 ib_device_t *device = &data->device;
392 assert(device->fd != -1);
404 if (write_out(device->fd, bufptr, size, SECTOR_SIZE) != BC_SUCCESS) {
406 device->path);
414 if (write_out(device->fd, bufptr, size, BBLK_ZFS_EXTRA_OFF)
417 "to %s at offset %d\n", device->path, BBLK_ZFS_EXTRA_OFF);
426 ib_device_t *device = &data->device;
436 if (!is_zfs(device->type)) {
437 if (write_out(device->fd, bblock->buf, bblock->buf_size,
440 device->path);
452 open_device(ib_device_t *device)
456 device->fd = open(device->path, O_RDWR);
457 if (device->fd == -1) {
458 BOOT_DEBUG("Unable to open %s\n", device->path);
463 if (fstat(device->fd, &statbuf) != 0) {
464 BOOT_DEBUG("Unable to stat %s\n", device->path);
466 (void) close(device->fd);
471 (void) fprintf(stderr, gettext("%s: Not a character device\n"),
472 device->path);
480 init_device(ib_device_t *device, char *path)
482 bzero(device, sizeof (*device));
483 device->fd = -1;
485 device->path = strdup(path);
491 device->type = tgt_fs_type;
492 if (open_device(device) != BC_SUCCESS)
499 cleanup_device(ib_device_t *device)
501 free(device->path);
502 bzero(device, sizeof (*device));
504 if (device->fd != -1)
505 (void) close(device->fd);
558 src->device.path, dest->device.path);
585 * Install a new bootblock on the given device. handle_install() expects argv
586 * to contain 2 parameters (the target device path and the path to the
613 BOOT_DEBUG("device path: %s, bootblock file path: %s\n", device_path,
617 if (init_device(&install_data.device, device_path) != BC_SUCCESS) {
618 (void) fprintf(stderr, gettext("Unable to open device %s\n"),
629 if (do_version && !is_zfs(install_data.device.type)) {
653 cleanup_device(&install_data.device);
661 * Retrieves from a device the extended information (einfo) associated to the
663 * Expects one parameter, the device path, in the form: /dev/rdsk/c?[t?]d?s0.
675 ib_device_t *device = &data.device;
691 BOOT_DEBUG("device path: %s\n", device_path);
693 if (init_device(device, device_path) != BC_SUCCESS) {
694 (void) fprintf(stderr, gettext("Unable to gather device "
699 if (!is_zfs(device->type)) {
705 ret = read_bootblock_from_disk(device->fd, bblock);
742 cleanup_device(&data.device);
763 ib_device_t *curr_device = &curr_data.device;
764 ib_device_t *attach_device = &attach_data.device;
782 BOOT_DEBUG("Current device path is: %s, attaching device path is: "
795 (void) fprintf(stderr, gettext("Unable to gather device "
796 "information from %s (current device)\n"),
802 (void) fprintf(stderr, gettext("Unable to gather device "
803 "information from %s (attaching device)\n"),
841 "raw-device\n" \
842 "\t%s [-e|-V] -i -F zfs raw-device\n" \
843 "\t%s -M -F zfs raw-device attach-raw-device\n" \