Home | History | Annotate | Download | only in sunlabel

Lines Matching refs:label

81  * cheat, using (effectively) ptr-&label.partitions[0].
90 * A label. As the embedded comments indicate, much of this structure
108 struct label {
130 * Describes a field in the label.
133 * pointer to the place in the label where it's stored. print is a
145 * Note that while the fields in the label vary in size (8, 16, or 32
146 * bits), we store everything as ints in the label struct, above, and
170 static unsigned char labelbuf[512]; /* Buffer holding the label sector */
171 static struct label label; /* The label itself. */
179 * _ascii functions are for 128-byte string fields (the ASCII label);
193 {"ascii", &label.asciilabel[0], print_ascii, chval_ascii, 0, 0 },
194 {"rpm", &label.rpm, print_int, chval_int, 0, 0 },
195 {"pcyl", &label.pcyl, print_int, chval_int, 0, 0 },
196 {"apc", &label.apc, print_int, chval_int, 0, 0 },
197 {"obs1", &label.obs1, print_int, chval_int, 0, 0 },
198 {"obs2", &label.obs2, print_int, chval_int, 0, 0 },
199 {"intrlv", &label.intrlv, print_int, chval_int, 0, 0 },
200 {"ncyl", &label.ncyl, print_int, chval_int, 0, 0 },
201 {"acyl", &label.acyl, print_int, chval_int, 0, 0 },
202 {"nhead", &label.nhead, print_int, chval_int, update_spc, 0 },
203 {"nsect", &label.nsect, print_int, chval_int, update_spc, 0 },
204 {"obs3", &label.obs3, print_int, chval_int, 0, 0 },
205 {"obs4", &label.obs4, print_int, chval_int, 0, 0 },
244 warnx("No write access, label is readonly");
310 * label and anything in the label sector should be
362 if (label.spc == 0) {
365 p->endcyl = p->startcyl + how_many(p->nblk, label.spc);
370 * Unpack a label from disk into the in-core label structure. If
372 * blank label instead. This is where knowledge of the Sun label
394 bzero(&label.asciilabel[0], 128);
395 label.rpm = 0;
396 label.pcyl = 0;
397 label.apc = 0;
398 label.obs1 = 0;
399 label.obs2 = 0;
400 label.intrlv = 0;
401 label.ncyl = 0;
402 label.acyl = 0;
403 label.nhead = 0;
404 label.nsect = 0;
405 label.obs3 = 0;
406 label.obs4 = 0;
408 label.partitions[i].startcyl = 0;
409 label.partitions[i].nblk = 0;
410 set_endcyl(&label.partitions[i]);
412 label.spc = 0;
413 label.dirty = 1;
422 label.dirty = 1;
431 label.dirty = 0;
434 label.dirty = 1;
440 (void)memcpy(&label.asciilabel[0], &labelbuf[0], 128);
441 label.rpm = l_s[210];
442 label.pcyl = l_s[211];
443 label.apc = l_s[212];
444 label.obs1 = l_s[213];
445 label.obs2 = l_s[214];
446 label.intrlv = l_s[215];
447 label.ncyl = l_s[216];
448 label.acyl = l_s[217];
449 label.nhead = l_s[218];
450 label.nsect = l_s[219];
451 label.obs3 = l_s[220];
452 label.obs4 = l_s[221];
453 label.spc = label.nhead * label.nsect;
455 label.partitions[i].startcyl = (uint32_t)l_l[i + i + 111];
456 label.partitions[i].nblk = (uint32_t)l_l[i + i + 112];
457 set_endcyl(&label.partitions[i]);
466 label.dirty = 1;
479 label.partitions[i + 8].startcyl = (uint32_t)l_l[j++];
480 label.partitions[i + 8].nblk = (uint32_t)l_l[j++];
481 set_endcyl(&label.partitions[i + 8]);
485 label.partitions[i + 8].startcyl = 0;
486 label.partitions[i + 8].nblk = 0;
487 set_endcyl(&label.partitions[i + 8]);
494 * Pack a label from the in-core label structure into on-disk format.
495 * This is where knowledge of the Sun label format is kept for write;
518 memcpy(&labelbuf[0], &label.asciilabel[0], 128);
521 l_s[210] = label.rpm;
522 l_s[211] = label.pcyl;
523 l_s[212] = label.apc;
524 l_s[213] = label.obs1;
525 l_s[214] = label.obs2;
526 l_s[215] = label.intrlv;
527 l_s[216] = label.ncyl;
528 l_s[217] = label.acyl;
529 l_s[218] = label.nhead;
530 l_s[219] = label.nsect;
531 l_s[220] = label.obs3;
532 l_s[221] = label.obs4;
534 l_s[(i * 4) + 222] = label.partitions[i].startcyl >> 16;
535 l_s[(i * 4) + 223] = label.partitions[i].startcyl & 0xffff;
536 l_s[(i * 4) + 224] = label.partitions[i].nblk >> 16;
537 l_s[(i * 4) + 225] = label.partitions[i].nblk & 0xffff;
540 if (label.partitions[i + 8].startcyl ||
541 label.partitions[i + 8].nblk)
550 l_s[j++] = label.partitions[i + 8].startcyl >> 16;
551 l_s[j++] = label.partitions[i + 8].startcyl & 0xffff;
552 l_s[j++] = label.partitions[i + 8].nblk >> 16;
553 l_s[j++] = label.partitions[i + 8].nblk & 0xffff;
573 * Get the label. Read it off the disk and unpack it. This function
586 err(1, "read label from `%s' failed", diskname);
594 errx(1, "bogus label on `%s' (%s)", diskname, lerr);
598 * Put the label. Pack it and write it to the disk. This function is
617 err(1, "write label to `%s' failed", diskname);
625 label.dirty = 0;
698 * ((n1*label.nhead)+n2)*label.nsect)+n3. In particular,
699 * if label.nhead or label.nsect is zero, this has limited
716 * If label.spc is nonzero but the partition size is not a multiple of
734 cyl0 = label.partitions[epno].endcyl;
743 cyl0 = label.partitions[spno].startcyl;
757 if (label.partitions[epno].endcyl <= cyl0) {
762 size = label.partitions[epno].nblk;
764 if (cyl0 > label.partitions[epno].startcyl) {
765 size -= (cyl0 - label.partitions[epno].startcyl)
766 * label.spc;
767 } else if (cyl0 < label.partitions[epno].startcyl) {
768 size += (label.partitions[epno].startcyl - cyl0)
769 * label.spc;
779 if (label.partitions[spno].startcyl <= cyl0) {
784 size = (label.partitions[spno].startcyl - cyl0)
785 * label.spc;
794 size = label.partitions[spno].nblk;
819 size = sizes + (label.nsect * (sizet
820 + (label.nhead * sizec)));
823 if (label.spc && (size % label.spc)) {
825 size / label.spc,
826 (size % label.spc) / label.nsect, size % label.nsect);
828 label.partitions[pno].startcyl = cyl0;
829 label.partitions[pno].nblk = size;
830 set_endcyl(&label.partitions[pno]);
831 if ((label.partitions[pno].startcyl * label.spc)
832 + label.partitions[pno].nblk > label.spc * label.ncyl) {
835 label.dirty = 1;
840 * the ASCII label field.
851 warnx("Ascii label string too long - max 128 characters");
855 label.dirty = 1;
860 * function, regardless of the field size in the on-disk label.
870 label.dirty = 1;
906 * `changed' function for the ntrack and nsect fields; update label.spc
914 label.spc = label.nhead * label.nsect;
916 set_endcyl(&label.partitions[i]);
921 * label, but we don't depend on that.
947 * Print the whole label. Just call the print function for each field,
1025 struct part *p = label.partitions;
1031 if (label.spc) {
1032 printf("%u/%u/%u - ", p[i].nblk / label.spc,
1033 (p[i].nblk % label.spc) / label.nsect,
1034 p[i].nblk % label.nsect);
1151 * This computes an appropriate checksum for an in-core label. It's
1172 * Set the in-core label. This is basically putlabel, except it builds
1173 * a struct disklabel instead of a Sun label buffer, and uses
1186 struct part *p = label.partitions;
1195 u.l.d_nsectors = label.nsect;
1196 u.l.d_ntracks = label.nhead;
1197 label.ncyl;
1198 u.l.d_secpercyl = label.nsect * label.nhead;
1199 u.l.d_rpm = label.rpm;
1200 u.l.d_interleave = label.intrlv;
1207 * label.nsect * label.nhead;
1225 "L\t- print label, except for partition table",
1229 "V <name> <value> - change a non-partition label value",
1230 "W\t- write (possibly modified) label out",
1232 "S\t- set label in the kernel (orthogonal to W)",
1274 if ((cmdline[1] == '!') || !label.dirty)
1276 printf("Label is dirty - use w to write it\n");