Lines Matching refs:lp

290 fixlabel(struct disklabel *lp)
295 for (i = 0; i < lp->d_npartitions; i++) {
298 if (lp->d_partitions[i].p_size)
302 dp = &lp->d_partitions[0];
304 dp->p_size = lp->d_secperunit - dp->p_offset;
311 makelabel(const char *type, struct disklabel *lp)
321 *lp = *dp;
322 bzero(lp->d_packname, sizeof(lp->d_packname));
373 struct disklabel *lp = &lab;
381 lp->d_magic = DISKMAGIC;
382 lp->d_magic2 = DISKMAGIC;
383 lp->d_checksum = 0;
384 lp->d_checksum = dkcksum(lp);
391 lp);
508 display(FILE *f, const struct disklabel *lp)
513 if (lp == NULL)
514 lp = &lab;
518 if (lp->d_type < DKMAXTYPES)
519 fprintf(f, "type: %s\n", dktypenames[lp->d_type]);
521 fprintf(f, "type: %u\n", lp->d_type);
522 fprintf(f, "disk: %.*s\n", (int)sizeof(lp->d_typename),
523 lp->d_typename);
524 fprintf(f, "label: %.*s\n", (int)sizeof(lp->d_packname),
525 lp->d_packname);
527 if (lp->d_flags & D_REMOVABLE)
529 if (lp->d_flags & D_ECC)
531 if (lp->d_flags & D_BADSECT)
534 fprintf(f, "bytes/sector: %lu\n", (u_long)lp->d_secsize);
535 fprintf(f, "sectors/track: %lu\n", (u_long)lp->d_nsectors);
536 fprintf(f, "tracks/cylinder: %lu\n", (u_long)lp->d_ntracks);
537 fprintf(f, "sectors/cylinder: %lu\n", (u_long)lp->d_secpercyl);
538 fprintf(f, "cylinders: %lu\n", (u_long)lp->d_ncylinders);
539 fprintf(f, "sectors/unit: %lu\n", (u_long)lp->d_secperunit);
540 fprintf(f, "rpm: %u\n", lp->d_rpm);
541 fprintf(f, "interleave: %u\n", lp->d_interleave);
542 fprintf(f, "trackskew: %u\n", lp->d_trackskew);
543 fprintf(f, "cylinderskew: %u\n", lp->d_cylskew);
545 (u_long)lp->d_headswitch);
547 (u_long)lp->d_trkseek);
550 if (lp->d_drivedata[i])
555 fprintf(f, "%lu ", (u_long)lp->d_drivedata[j]);
558 fprintf(f, "%u partitions:\n", lp->d_npartitions);
561 pp = lp->d_partitions;
562 for (i = 0; i < lp->d_npartitions; i++, pp++) {
720 * and fill in lp.
723 getasciilabel(FILE *f, struct disklabel *lp)
733 makelabel("auto", lp);
737 lp->d_bbsize = BBSIZE; /* XXX */
738 lp->d_sbsize = 0; /* XXX */
759 lp->d_type = cpp - dktypenames;
772 lp->d_type = v;
791 lp->d_flags = v;
796 lp->d_drivedata[i++] = strtoul(cp, NULL, 10);
805 lp->d_npartitions = MAXPARTITIONS;
810 lp->d_npartitions = DEFPARTITIONS;
813 lp->d_npartitions = v;
819 strncpy(lp->d_typename, tp, sizeof (lp->d_typename));
823 strncpy(lp->d_packname, tp, sizeof (lp->d_packname));
834 lp->d_secsize = v;
849 lp->d_nsectors = v;
859 lp->d_secpercyl = v;
869 lp->d_ntracks = v;
879 lp->d_ncylinders = v;
889 lp->d_secperunit = v;
899 lp->d_rpm = v;
909 lp->d_interleave = v;
919 lp->d_trackskew = v;
929 lp->d_cylskew = v;
934 lp->d_headswitch = v;
939 lp->d_trkseek = v;
953 if (part >= lp->d_npartitions) {
956 lineno, 'a' + lp->d_npartitions - 1, cp);
962 if (getasciipartspec(tp, lp, part, lineno) != 0) {
967 errors += checklabel(lp);
999 getasciipartspec(char *tp, struct disklabel *lp, int part, int lineno)
1006 pp = &lp->d_partitions[part];
1081 checklabel(struct disklabel *lp)
1093 if (lp == NULL)
1094 lp = &lab;
1098 if (lp->d_secsize == 0) {
1102 if (lp->d_nsectors == 0) {
1106 if (lp->d_ntracks == 0) {
1110 if (lp->d_ncylinders == 0) {
1114 if (lp->d_rpm == 0)
1116 if (lp->d_secpercyl == 0)
1117 lp->d_secpercyl = lp->d_nsectors * lp->d_ntracks;
1118 if (lp->d_secperunit == 0)
1119 lp->d_secperunit = lp->d_secpercyl * lp->d_ncylinders;
1120 if (lp->d_bbsize == 0) {
1123 } else if (lp->d_bbsize % lp->d_secsize)
1125 if (lp->d_npartitions > MAXPARTITIONS) {
1127 (u_long)lp->d_npartitions, MAXPARTITIONS);
1130 if (lp->d_npartitions < DEFPARTITIONS) {
1132 (u_long)lp->d_npartitions, DEFPARTITIONS);
1139 if (lp->d_secsize == 0)
1140 lp->d_secsize = vl->d_secsize;
1141 if (lp->d_nsectors == 0)
1142 lp->d_nsectors = vl->d_nsectors;
1143 if (lp->d_ntracks == 0)
1144 lp->d_ntracks = vl->d_ntracks;
1145 if (lp->d_ncylinders == 0)
1146 lp->d_ncylinders = vl->d_ncylinders;
1147 if (lp->d_rpm == 0)
1148 lp->d_rpm = vl->d_rpm;
1149 if (lp->d_interleave == 0)
1150 lp->d_interleave = vl->d_interleave;
1151 if (lp->d_secpercyl == 0)
1152 lp->d_secpercyl = vl->d_secpercyl;
1153 if (lp->d_secperunit == 0 ||
1154 lp->d_secperunit > vl->d_secperunit)
1155 lp->d_secperunit = vl->d_secperunit;
1156 if (lp->d_bbsize == 0)
1157 lp->d_bbsize = vl->d_bbsize;
1158 if (lp->d_npartitions < DEFPARTITIONS ||
1159 lp->d_npartitions > MAXPARTITIONS)
1160 lp->d_npartitions = vl->d_npartitions;
1168 for (i = 0; i < lp->d_npartitions; i++) {
1169 pp = &lp->d_partitions[i];
1173 pp->p_size = lp->d_secperunit;
1219 if (size % lp->d_secsize != 0)
1222 size /= lp->d_secsize;
1233 for (i = 0; i < lp->d_npartitions; i++) {
1234 pp = &lp->d_partitions[i];
1243 if (base_offset < lp->d_secperunit)
1244 free_space += lp->d_secperunit - base_offset;
1255 for (i = 0; i < lp->d_npartitions; i++) {
1256 pp = &lp->d_partitions[i];
1282 pp = &lp->d_partitions[i];
1292 current_offset = lp->d_secperunit;
1293 for (i = lp->d_npartitions - 1; i > hog_part; i--) {
1294 pp = &lp->d_partitions[i];
1311 lp->d_partitions[hog_part].p_size = 0;
1313 lp->d_partitions[hog_part].p_size = current_offset -
1321 for (i = 0; i < lp->d_npartitions; i++) {
1323 pp = &lp->d_partitions[i];
1359 for (i = 0; i < lp->d_npartitions; i++) {
1361 pp = &lp->d_partitions[i];
1366 if (pp->p_size % lp->d_secpercyl)
1369 if (pp->p_offset % lp->d_secpercyl)
1373 if (pp->p_offset > lp->d_secperunit) {
1378 if (pp->p_offset + pp->p_size > lp->d_secperunit) {
1389 if (pp->p_size != lp->d_secperunit)
1393 (pp->p_size != lp->d_secperunit)) {
1402 pp2 = &lp->d_partitions[j];
1417 for (; i < lp->d_npartitions; i++) {
1419 pp = &lp->d_partitions[i];