Lines Matching refs:label

135 sun_compute_checksum (SunRawLabel *label)
137 u_int16_t *ush = (u_int16_t *)label;
140 while(ush < (u_int16_t *)(&label->csum))
142 label->csum = csum;
147 sun_verify_checksum (SunRawLabel const *label)
149 u_int16_t *ush = ((u_int16_t *)(label + 1)) - 1;
152 while (ush >= (u_int16_t *)label)
166 SunRawLabel const *label = (void const *) s0;
170 if (PED_BE16_TO_CPU (label->magic) != SUN_DISK_MAGIC) {
174 if (!sun_verify_checksum(label)) {
179 _("Corrupted Sun disk label detected."));
192 SunRawLabel* label;
212 label = &sun_specific->raw_label;
213 memset(label, 0, sizeof(SunRawLabel));
216 label->magic = PED_CPU_TO_BE16 (SUN_DISK_MAGIC);
217 label->nacyl = 0;
218 label->pcylcount = PED_CPU_TO_BE16 (bios_geom->cylinders);
219 label->rspeed = PED_CPU_TO_BE16 (5400);
220 label->ilfact = PED_CPU_TO_BE16 (1);
221 label->sparecyl = 0;
222 label->ntrks = PED_CPU_TO_BE16 (bios_geom->heads);
223 label->nsect = PED_CPU_TO_BE16 (bios_geom->sectors);
224 label->ncyl = PED_CPU_TO_BE16 (dev->length / cyl_size);
226 label->sanity = PED_CPU_TO_BE32 (SUN_VTOC_SANITY);
227 label->version = PED_CPU_TO_BE32 (SUN_VTOC_VERSION);
228 label->nparts = PED_CPU_TO_BE16 (SUN_DISK_MAXPARTITIONS);
231 label->infos[WHOLE_DISK_PART].id = WHOLE_DISK_ID;
232 label->partitions[WHOLE_DISK_PART].start_cylinder = 0;
233 label->partitions[WHOLE_DISK_PART].num_sectors =
236 /* Now a neato string to describe this label */
237 snprintf(label->info, sizeof(label->info) - 1,
239 PED_BE16_TO_CPU(label->ncyl),
240 PED_BE16_TO_CPU(label->nacyl),
241 PED_BE16_TO_CPU(label->ntrks),
242 PED_BE16_TO_CPU(label->nsect));
244 sun_compute_checksum(label);
313 _check_geometry_sanity (PedDisk* disk, SunRawLabel* label)
317 if (PED_BE16_TO_CPU(label->nsect) == dev->hw_geom.sectors &&
318 PED_BE16_TO_CPU(label->ntrks) == dev->hw_geom.heads)
321 if (!!PED_BE16_TO_CPU(label->pcylcount)
322 * !!PED_BE16_TO_CPU(label->ntrks)
323 * !!PED_BE16_TO_CPU(label->nsect) == 0)
326 if (PED_BE16_TO_CPU(label->nsect) != dev->bios_geom.sectors ||
327 PED_BE16_TO_CPU(label->ntrks) != dev->bios_geom.heads) {
334 "the geometry stored on the disk label "
339 PED_BE16_TO_CPU(label->pcylcount),
340 PED_BE16_TO_CPU(label->ntrks),
341 PED_BE16_TO_CPU(label->nsect))
345 dev->bios_geom.sectors = PED_BE16_TO_CPU(label->nsect);
346 dev->bios_geom.heads = PED_BE16_TO_CPU(label->ntrks);
347 dev->bios_geom.cylinders = PED_BE16_TO_CPU(label->pcylcount);
354 _("The disk label describes a disk bigger than "
386 SunRawLabel *label = &disk_data->raw_label;
387 verify (sizeof (*label) == 512);
388 memcpy (label, s0, sizeof (*label));
391 if (!_check_geometry_sanity (disk, label))
398 if (!PED_BE32_TO_CPU(label->partitions[i].num_sectors))
400 if (!label->infos[i].id)
402 if (label->infos[i].id == WHOLE_DISK_ID)
405 start = PED_BE32_TO_CPU(label->partitions[i].start_cylinder)
408 + PED_BE32_TO_CPU(label->partitions[i].num_sectors) - 1;
416 sun_data->type = label->infos[i].id;
457 SunRawLabel* label;
479 label = &disk_data->raw_label;
481 memset (label->partitions, 0,
483 memset (label->infos, 0,
494 label->infos[i].id = WHOLE_DISK_ID;
495 label->partitions[i].start_cylinder = 0;
496 label->partitions[i].num_sectors =
504 label->infos[i].id = sun_data->type;
505 label->partitions[i].start_cylinder
509 label->partitions[i].num_sectors
514 /* We assume the harddrive is always right, and that the label may
531 label->pcylcount = PED_CPU_TO_BE16 (disk->dev->bios_geom.cylinders);
532 label->ncyl = PED_CPU_TO_BE16 (disk->dev->bios_geom.cylinders
533 - PED_BE16_TO_CPU (label->nacyl));
535 sun_compute_checksum (label);
537 verify (sizeof *label == 512);
538 memcpy (s0, label, sizeof *label);
884 _("Sun disk label is full."));
902 /* Sun disk label does not need to allocate a sector. The disk
903 label is contained within the first 512 bytes, which should not