Lines Matching refs:label

48 #include "label.h"
183 struct dk_label *label,
190 struct dk_label *label,
194 int build_default_partition(struct dk_label *label,
198 struct dk_label *label);
207 struct dk_label *label);
212 struct dk_label *label);
215 static int auto_label_init(struct dk_label *label);
243 * label type
246 auto_efi_sense(int fd, struct efi_info *label)
277 if (get_disk_info(fd, label, disk_info) == -1) {
288 label->e_parts = vtoc;
292 * S0 takes the whole disk except the primary EFI label,
293 * backup EFI label, and the reserved partition.
334 disk->vendor = strdup(label->vendor);
335 disk->product = strdup(label->product);
336 disk->revision = strdup(label->revision);
348 disk->capacity = label->capacity;
447 * To convert EFI to SMI labels, we need to get label geometry.
450 * it and clear EFI label, do a DKIOCGGEOM and put the EFI label
452 * This routine gets the label geometry and initializes the label
457 auto_label_init(struct dk_label *label)
509 * back up efi label goes to capacity - 1, we are reading an extra block
510 * before the back up label.
570 label->dkl_pcyl = pcyl;
571 label->dkl_ncyl = ncyl;
572 label->dkl_acyl = acyl;
573 label->dkl_nhead = nhead;
574 label->dkl_nsect = nsect;
575 label->dkl_apc = 0;
576 label->dkl_intrlv = 1;
577 label->dkl_rpm = disk_geom.dkg_rpm;
579 label->dkl_magic = DKL_MAGIC;
581 (void) snprintf(label->dkl_asciilabel, sizeof (label->dkl_asciilabel),
587 (void) auto_solaris_part(label);
588 ncyl = label->dkl_ncyl;
592 if (!build_default_partition(label, DKC_DIRECT)) {
596 (void) checksum(label, CK_MAKESUM);
612 struct dk_label *label)
675 disk->dtype_pcyl = label->dkl_pcyl;
676 disk->dtype_ncyl = label->dkl_ncyl;
677 disk->dtype_acyl = label->dkl_acyl;
678 disk->dtype_nhead = label->dkl_nhead;
679 disk->dtype_nsect = label->dkl_nsect;
680 disk->dtype_rpm = label->dkl_rpm;
702 * Fill in the partition info from the label
707 part->pinfo_map[i] = label->dkl_map[i];
711 label->dkl_vtoc.v_part[i].p_start /
715 label->dkl_vtoc.v_part[i].p_size;
724 if (label->dkl_vtoc.v_version == V_VERSION) {
725 (void) memcpy(disk_info->v_volume, label->dkl_vtoc.v_volume,
727 part->vtoc = label->dkl_vtoc;
742 * Get a disk type that has label info. This is used to convert
743 * EFI label to SMI label
746 auto_direct_get_geom_label(int fd, struct dk_label *label)
750 if (auto_label_init(label) != 0) {
751 err_print("auto_direct_get_geom_label: failed to get label"
755 disk_type = new_direct_disk_type(fd, "DEFAULT", label);
762 * necessary to construct a label. We have two different
773 struct dk_label *label)
865 return (generic_disk_sense(fd, can_prompt, label,
873 if (use_existing_disk_type(fd, can_prompt, label,
886 return (generic_disk_sense(fd, can_prompt, label,
897 struct dk_label *label,
982 * Construct a new label out of the sense data,
1032 * The sd driver reserves 2 cylinders the backup disk label and
1163 * fields in our disk label. To do this we need to `square
1172 err_print("This disk is too big to label. "
1230 impossible("label overflow adjustment");
1301 (void) memset((char *)label, 0, sizeof (struct dk_label));
1303 label->dkl_magic = DKL_MAGIC;
1305 (void) snprintf(label->dkl_asciilabel, sizeof (label->dkl_asciilabel),
1309 label->dkl_pcyl = pcyl;
1310 label->dkl_ncyl = ncyl;
1311 label->dkl_acyl = acyl;
1312 label->dkl_nhead = nhead;
1313 label->dkl_nsect = nsect;
1314 label->dkl_apc = 0;
1315 label->dkl_intrlv = 1;
1316 label->dkl_rpm = rpm;
1319 if (auto_solaris_part(label) == -1)
1321 ncyl = label->dkl_ncyl;
1325 if (!build_default_partition(label, DKC_SCSI_CCS)) {
1329 (void) checksum(label, CK_MAKESUM);
1341 if ((disk = find_scsi_disk_type(disk_name, label)) == NULL) {
1351 (void) snprintf(label->dkl_asciilabel,
1352 sizeof (label->dkl_asciilabel),
1355 (void) checksum(label, CK_MAKESUM);
1356 disk = find_scsi_disk_type(disk_name, label);
1359 disk = new_scsi_disk_type(fd, disk_name, label);
1381 struct dk_label *label,
1393 * Construct a new label out of the format.dat
1411 (void) memset((char *)label, 0, sizeof (struct dk_label));
1413 label->dkl_magic = DKL_MAGIC;
1415 (void) snprintf(label->dkl_asciilabel, sizeof (label->dkl_asciilabel),
1420 label->dkl_pcyl = pcyl;
1421 label->dkl_ncyl = ncyl;
1422 label->dkl_acyl = acyl;
1423 label->dkl_nhead = nhead;
1424 label->dkl_nsect = nsect;
1425 label->dkl_apc = 0;
1426 label->dkl_intrlv = 1;
1427 label->dkl_rpm = rpm;
1429 if (!build_default_partition(label, DKC_SCSI_CCS)) {
1433 (void) checksum(label, CK_MAKESUM);
1446 struct dk_label *label,
1468 vtoc = &label->dkl_vtoc;
1482 capacity = ((diskaddr_t)(label->dkl_ncyl) * label->dkl_nhead *
1483 label->dkl_nsect) / (diskaddr_t)((1024 * 1024) / cur_blksz);
1504 freecyls = label->dkl_ncyl;
1505 blks_per_cyl = label->dkl_nhead * label->dkl_nsect;
1574 assert(ncyl == (label->dkl_ncyl));
1577 * Finally, install the partition in the label.
1585 label->dkl_vtoc.v_part[i].p_start = cyl * blks_per_cyl;
1586 label->dkl_vtoc.v_part[i].p_size = ncyls[i] * blks_per_cyl;
1601 label->dkl_map[i].dkl_cylno = 0;
1602 label->dkl_map[i].dkl_nblk = 0;
1608 label->dkl_map[i].dkl_cylno = cyl;
1609 label->dkl_map[i].dkl_nblk = ncyls[i] * blks_per_cyl;
1611 label->dkl_vtoc.v_part[i].p_start = cyl * blks_per_cyl;
1612 label->dkl_vtoc.v_part[i].p_size = ncyls[i] * blks_per_cyl;
1625 label->dkl_map[2].dkl_cylno = 0;
1626 label->dkl_map[2].dkl_nblk =
1627 label->dkl_ncyl * label->dkl_nhead * label->dkl_nsect;
1630 label->dkl_vtoc.v_part[2].p_start = 0;
1631 label->dkl_vtoc.v_part[2].p_size =
1632 (label->dkl_ncyl + label->dkl_acyl) * label->dkl_nhead *
1633 label->dkl_nsect;
1644 if (label->dkl_map[i].dkl_nblk == 0)
1647 if (label->dkl_vtoc.v_part[i].p_size == 0)
1656 scaled = bn2mb(label->dkl_map[i].dkl_nblk);
1660 scaled = bn2mb(label->dkl_vtoc.v_part[i].p_size);
1672 label->dkl_map[i].dkl_nblk/blks_per_cyl);
1675 label->dkl_vtoc.v_part[i].p_size/blks_per_cyl);
1696 struct dk_label *label)
1705 dp->dtype_pcyl == label->dkl_pcyl &&
1706 dp->dtype_ncyl == label->dkl_ncyl &&
1707 dp->dtype_acyl == label->dkl_acyl &&
1708 dp->dtype_nhead == label->dkl_nhead &&
1709 dp->dtype_nsect == label->dkl_nsect) {
1804 struct dk_label *label)
1867 disk->dtype_pcyl = label->dkl_pcyl;
1868 disk->dtype_ncyl = label->dkl_ncyl;
1869 disk->dtype_acyl = label->dkl_acyl;
1870 disk->dtype_nhead = label->dkl_nhead;
1871 disk->dtype_nsect = label->dkl_nsect;
1872 disk->dtype_rpm = label->dkl_rpm;
1875 * Attempt to match the partition map in the label
1879 if (parts_match(label, part)) {
1908 * Fill in the partition info from the label
1913 part->pinfo_map[i] = label->dkl_map[i];
1917 label->dkl_vtoc.v_part[i].p_start /
1921 label->dkl_vtoc.v_part[i].p_size;
1933 if (label->dkl_vtoc.v_version == V_VERSION) {
1934 (void) memcpy(disk_info->v_volume, label->dkl_vtoc.v_volume,
1936 part->vtoc = label->dkl_vtoc;