Lines Matching defs:vtoc

36 #include <sys/vtoc.h>
63 static int vtoc_to_label(struct dk_label *label, struct extvtoc *vtoc,
228 err_print("SMI vtoc to EFI failed\n");
275 struct extvtoc vtoc;
346 * Fill in the vtoc information
348 label.dkl_vtoc = cur_parts->vtoc;
356 * Put asciilabel in; on x86 it's in the vtoc, not the label.
374 * Convert the label into a vtoc
376 if (label_to_vtoc(&vtoc, &label) == -1) {
382 * we do this before writing the vtoc.
422 * Write the vtoc. At the time of this writing, our
423 * drivers convert the vtoc back to a label, and
426 * always use an ioctl to read the vtoc from the
429 if (write_extvtoc(cur_file, &vtoc) != 0) {
487 struct extvtoc vtoc;
491 if (read_extvtoc(fd, &vtoc) < 0 ||
497 return (vtoc_to_label(label, &vtoc, &geom, &dkinfo));
694 vtoc64_to_label(struct efi_info *label, struct dk_gpt *vtoc)
702 nparts = vtoc->efi_nparts;
715 lmap->efi_version = vtoc->efi_version;
716 lmap->efi_nparts = vtoc->efi_nparts;
717 lmap->efi_part_size = vtoc->efi_part_size;
718 lmap->efi_lbasize = vtoc->efi_lbasize;
719 lmap->efi_last_lba = vtoc->efi_last_lba;
720 lmap->efi_first_u_lba = vtoc->efi_first_u_lba;
721 lmap->efi_last_u_lba = vtoc->efi_last_u_lba;
722 lmap->efi_altern_lba = vtoc->efi_altern_lba;
723 lmap->efi_flags = vtoc->efi_flags;
725 (uchar_t *)&vtoc->efi_disk_uguid, sizeof (struct uuid));
728 lmap->efi_parts[i].p_tag = vtoc->efi_parts[i].p_tag;
729 lmap->efi_parts[i].p_flag = vtoc->efi_parts[i].p_flag;
730 lmap->efi_parts[i].p_start = vtoc->efi_parts[i].p_start;
731 lmap->efi_parts[i].p_size = vtoc->efi_parts[i].p_size;
733 (uchar_t *)&vtoc->efi_parts[i].p_uguid,
735 if (vtoc->efi_parts[i].p_tag == V_RESERVED) {
736 bcopy(vtoc->efi_parts[i].p_name,
744 * Convert vtoc/geom to label.
747 vtoc_to_label(struct dk_label *label, struct extvtoc *vtoc,
765 * Sanity-check the vtoc
767 if (vtoc->v_sanity != VTOC_SANE ||
768 vtoc->v_nparts != V_NUMPAR) {
809 * Copy vtoc structure fields into the disk label dk_vtoc
811 label->dkl_vtoc.v_sanity = vtoc->v_sanity;
812 label->dkl_vtoc.v_nparts = vtoc->v_nparts;
813 label->dkl_vtoc.v_version = vtoc->v_version;
815 (void) memcpy(label->dkl_vtoc.v_volume, vtoc->v_volume,
818 label->dkl_vtoc.v_part[i].p_tag = vtoc->v_part[i].p_tag;
819 label->dkl_vtoc.v_part[i].p_flag = vtoc->v_part[i].p_flag;
820 label->dkl_vtoc.v_timestamp[i] = vtoc->timestamp[i];
824 label->dkl_vtoc.v_reserved[i] = vtoc->v_reserved[i];
826 label->dkl_vtoc.v_bootinfo[0] = vtoc->v_bootinfo[0];
827 label->dkl_vtoc.v_bootinfo[1] = vtoc->v_bootinfo[1];
828 label->dkl_vtoc.v_bootinfo[2] = vtoc->v_bootinfo[2];
830 (void) memcpy(label->dkl_asciilabel, vtoc->v_asciilabel,
852 vpart = vtoc->v_part;
890 * Extract a vtoc structure out of a valid label
893 label_to_vtoc(struct extvtoc *vtoc, struct dk_label *label)
909 (void) memset((char *)vtoc, 0, sizeof (struct extvtoc));
914 * No valid vtoc information in the label.
917 vpart = vtoc->v_part;
925 vpart = vtoc->v_part;
935 vtoc->timestamp[i] = label->dkl_vtoc.v_timestamp[i];
937 (void) memcpy(vtoc->v_volume, label->dkl_vtoc.v_volume,
941 vtoc->v_reserved[i] = label->dkl_vtoc.v_reserved[i];
943 vtoc->v_bootinfo[0] = label->dkl_vtoc.v_bootinfo[0];
944 vtoc->v_bootinfo[1] = label->dkl_vtoc.v_bootinfo[1];
945 vtoc->v_bootinfo[2] = label->dkl_vtoc.v_bootinfo[2];
957 vtoc->v_sanity = VTOC_SANE;
958 vtoc->v_version = V_VERSION;
959 vtoc->v_sectorsz = cur_blksz;
960 vtoc->v_nparts = V_NUMPAR;
962 (void) memcpy(vtoc->v_asciilabel, label->dkl_asciilabel,
972 vpart = vtoc->v_part;
991 struct extvtoc vtoc;
993 if (read_extvtoc(fd, &vtoc) == VT_ENOTSUP) {
1002 err_check(struct dk_gpt *vtoc)
1012 for (i = 0; i < vtoc->efi_nparts; i++) {
1014 if ((vtoc->efi_parts[i].p_tag == V_UNASSIGNED) &&
1015 (vtoc->efi_parts[i].p_size != 0)) {
1018 vtoc->efi_parts[i].p_size);
1020 if (vtoc->efi_parts[i].p_tag == V_UNASSIGNED) {
1023 if (vtoc->efi_parts[i].p_tag == V_RESERVED) {
1029 if (vtoc->efi_parts[i].p_size != EFI_MIN_RESV_SIZE)
1034 if ((vtoc->efi_parts[i].p_start < vtoc->efi_first_u_lba) ||
1035 (vtoc->efi_parts[i].p_start > vtoc->efi_last_u_lba)) {
1039 vtoc->efi_parts[i].p_start);
1042 vtoc->efi_first_u_lba,
1043 vtoc->efi_last_u_lba);
1045 if ((vtoc->efi_parts[i].p_start +
1046 vtoc->efi_parts[i].p_size <
1047 vtoc->efi_first_u_lba) ||
1048 (vtoc->efi_parts[i].p_start +
1049 vtoc->efi_parts[i].p_size >
1050 vtoc->efi_last_u_lba + 1)) {
1054 vtoc->efi_parts[i].p_start +
1055 vtoc->efi_parts[i].p_size);
1058 vtoc->efi_first_u_lba,
1059 vtoc->efi_last_u_lba);
1062 for (j = 0; j < vtoc->efi_nparts; j++) {
1063 isize = vtoc->efi_parts[i].p_size;
1064 jsize = vtoc->efi_parts[j].p_size;
1065 istart = vtoc->efi_parts[i].p_start;
1066 jstart = vtoc->efi_parts[j].p_start;