Lines Matching +full:multi +full:- +full:ported
21 * Pittsburgh PA 15213-3890
52 #define NO_DISK_SECTORS ((u_int32_t)-1)
61 * Ported to 386bsd by Julian Elischer Thu Oct 15 20:26:46 PDT 1992
63 * 14-Dec-89 Robert Baron (rvb) at Carnegie-Mellon University
140 [0x07] = "NTFS, OS/2 HPFS, QNX-2 (16 bit) or Advanced UNIX",
149 [0x11] = "OS/2 BM: hidden DOS with 12-bit FAT",
151 [0x14] = "OS/2 BM: hidden DOS with 16-bit FAT (< 32MB)",
152 [0x16] = "OS/2 BM: hidden DOS with 16-bit FAT (>= 32MB)",
171 [0x55] = "EZ-Drive (disk manager)",
179 [0x70] = "DiskSecure Multi-Boot",
206 [0xC1] = "DRDOS/sec with 12-bit FAT",
207 [0xC4] = "DRDOS/sec with 16-bit FAT (< 32MB)",
208 [0xC6] = "DRDOS/sec with 16-bit FAT (>= 32MB)",
211 [0xDE] = "DELL Utilities - FAT filesystem",
212 [0xE1] = "DOS access or SpeedStor with 12-bit FAT extended partition",
214 [0xE4] = "SpeedStor with 16-bit FAT extended partition < 1024 cyl.",
265 int partition = -1; in main()
272 while ((c = getopt(argc, argv, "BIab:f:ipqstuv1234")) != -1) in main()
314 partition = c - '0'; in main()
323 argc -= optind; in main()
339 if (read_disk(0, mboot.bootinst) == -1) in main()
354 if (partp->dp_start == 0 && partp->dp_size == 0) in main()
357 printf("p %d 0x%02x %lu %lu\n", i + 1, partp->dp_typ, in main()
358 (u_long)partp->dp_start, (u_long)partp->dp_size); in main()
361 if (partp->dp_flag & 0x80) in main()
374 if (partp->dp_start == 0 && partp->dp_size == 0) in main()
377 (u_long) partp->dp_start, in main()
378 (u_long) partp->dp_size, partp->dp_typ, in main()
379 partp->dp_flag); in main()
391 partp->dp_typ = DOSPTYP_386BSD; in main()
392 partp->dp_flag = ACTIVE; in main()
393 partp->dp_start = dos_sectors; in main()
394 partp->dp_size = rounddown(disksecs, dos_cylsecs) - in main()
426 if (partition == -1) in main()
448 printf("\n-t flag specified -- partition table not written.\n"); in main()
460 "usage: fdisk [-BIaipqstu] [-b bootcode] [-1234] [disk]\n", in usage()
461 " fdisk -f configfile [-itv] [disk]\n"); in usage()
474 print_part(&mboot.parts[i - 1]); in print_s0()
492 part_mb = partp->dp_size; in print_part()
495 printf("sysid %d (%#04x),(%s)\n", partp->dp_typ, partp->dp_typ, in print_part()
496 get_type(partp->dp_typ)); in print_part()
498 (u_long)partp->dp_start, in print_part()
499 (u_long)partp->dp_size, in print_part()
501 partp->dp_flag, in print_part()
502 partp->dp_flag == ACTIVE ? " (active)" : ""); in print_part()
504 ,DPCYL(partp->dp_scyl, partp->dp_ssect) in print_part()
505 ,partp->dp_shd in print_part()
506 ,DPSECT(partp->dp_ssect) in print_part()
507 ,DPCYL(partp->dp_ecyl, partp->dp_esect) in print_part()
508 ,partp->dp_ehd in print_part()
509 ,DPSECT(partp->dp_esect)); in print_part()
521 if ((fdesc = open(fname, O_RDONLY)) == -1 || in init_boot()
522 fstat(fdesc, &sb) == -1) in init_boot()
532 if ((n = read(fdesc, mboot.bootinst, mboot.bootinst_size)) == -1 || in init_boot()
547 partp->dp_typ = DOSPTYP_386BSD; in init_sector0()
548 partp->dp_flag = ACTIVE; in init_sector0()
552 partp->dp_start = start; in init_sector0()
553 partp->dp_size = rounddown(disksecs, dos_cylsecs) - start; in init_sector0()
561 struct dos_partition *partp = &mboot.parts[i - 1]; in change_part()
579 Decimal("sysid (165=FreeBSD)", partp->dp_typ, tmp, 255); in change_part()
580 Decimal("start", partp->dp_start, tmp, NO_DISK_SECTORS); in change_part()
581 Decimal("size", partp->dp_size, tmp, NO_DISK_SECTORS); in change_part()
584 partp->dp_typ = 0; in change_part()
590 tcyl = DPCYL(partp->dp_scyl,partp->dp_ssect); in change_part()
591 thd = partp->dp_shd; in change_part()
592 tsec = DPSECT(partp->dp_ssect); in change_part()
596 partp->dp_scyl = DOSCYL(tcyl); in change_part()
597 partp->dp_ssect = DOSSECT(tsec,tcyl); in change_part()
598 partp->dp_shd = thd; in change_part()
600 tcyl = DPCYL(partp->dp_ecyl,partp->dp_esect); in change_part()
601 thd = partp->dp_ehd; in change_part()
602 tsec = DPSECT(partp->dp_esect); in change_part()
606 partp->dp_ecyl = DOSCYL(tcyl); in change_part()
607 partp->dp_esect = DOSSECT(tsec,tcyl); in change_part()
608 partp->dp_ehd = thd; in change_part()
620 printf("parameters extracted from in-core disklabel are:\n"); in print_params()
636 active = -1; in change_active()
641 if (active == -1) in change_active()
644 if (a_flag && which != -1) in change_active()
646 else if (active == -1) in change_active()
656 printf("Active partition number must be in range 1-4." in change_active()
665 partp[active-1].dp_flag = ACTIVE; in change_active()
704 if (partp->dp_typ == 0 && partp->dp_start == 0 && partp->dp_size == 0) { in dos()
710 partp->dp_shd = partp->dp_start % dos_cylsecs / dos_sectors; in dos()
711 cy = partp->dp_start / dos_cylsecs; in dos()
712 sec = partp->dp_start % dos_sectors + 1; in dos()
713 partp->dp_scyl = DOSCYL(cy); in dos()
714 partp->dp_ssect = DOSSECT(sec, cy); in dos()
717 end = partp->dp_start + partp->dp_size - 1; in dos()
718 partp->dp_ehd = end % dos_cylsecs / dos_sectors; in dos()
721 partp->dp_ecyl = DOSCYL(cy); in dos()
722 partp->dp_esect = DOSSECT(sec, cy); in dos()
733 /* If the mode fails, try read-only if we didn't. */ in open_disk()
734 if (fd == -1 && errno == EPERM && rwmode) in open_disk()
736 if (fd == -1 && errno == ENXIO) in open_disk()
737 return -2; in open_disk()
738 if (fd == -1) { in open_disk()
740 return -1; in open_disk()
742 if (get_params() == -1) { in open_disk()
744 return -1; in open_disk()
767 return -1; in read_disk()
782 if (strcmp(class->lg_name, name) == 0) { in geom_class_available()
838 return (-1); in get_params()
842 return (-1); in get_params()
863 return -1; in read_s0()
865 if (read_disk(0, mboot.bootinst) == -1) { in read_s0()
867 return -1; in read_s0()
872 return -1; in read_s0()
896 &mboot.bootinst[sector * secsize]) == -1) { in write_s0()
898 return -1; in write_s0()
911 lbuf[strlen(lbuf)-1] = 0; in ok()
934 lbuf[strlen(lbuf)-1] = 0; in decimal()
946 acc = acc * 10 + c - '0'; in decimal()
980 command->cmd = *cp++; in parse_config_line()
992 command->args[command->n_args].argtype = *cp++; in parse_config_line()
994 command->args[command->n_args].arg_val = strtoul(cp, &end, 0); in parse_config_line()
1000 command->args[command->n_args].arg_str = strdup(cp); in parse_config_line()
1003 command->args[command->n_args].arg_str = NULL; in parse_config_line()
1005 command->n_args++; in parse_config_line()
1027 if (command->n_args != 3) { in process_geometry()
1037 switch (command->args[i].argtype) { in process_geometry()
1039 dos_cyls = command->args[i].arg_val; in process_geometry()
1042 dos_heads = command->args[i].arg_val; in process_geometry()
1045 dos_sectors = command->args[i].arg_val; in process_geometry()
1050 current_line_number, command->args[i].argtype, in process_geometry()
1051 command->args[i].argtype); in process_geometry()
1071 "WARNING line %d: number of cylinders (%d) may be out-of-range\n\ in process_geometry()
1072 (must be within 1-1024 for normal BIOS operation, unless the entire disk\n\ in process_geometry()
1082 warnx("ERROR line %d: number of heads must be within (1-256)", in process_geometry()
1092 warnx("ERROR line %d: number of sectors must be within (1-63)", in process_geometry()
1140 if (command->n_args != 4) { in process_partition()
1145 partition = command->args[0].arg_val; in process_partition()
1151 partp = &mboot.parts[partition - 1]; in process_partition()
1153 partp->dp_typ = command->args[1].arg_val; in process_partition()
1154 if (command->args[2].arg_str != NULL) { in process_partition()
1155 if (strcmp(command->args[2].arg_str, "*") == 0) { in process_partition()
1157 partp->dp_start = dos_sectors; in process_partition()
1161 &mboot.parts) + i - 1; in process_partition()
1162 if (prev_partp->dp_typ != 0) in process_partition()
1163 partp->dp_start = prev_partp->dp_start + in process_partition()
1164 prev_partp->dp_size; in process_partition()
1166 if (partp->dp_start % dos_sectors != 0) { in process_partition()
1167 prev_head_boundary = rounddown(partp->dp_start, in process_partition()
1169 partp->dp_start = prev_head_boundary + in process_partition()
1173 partp->dp_start = str2sectors(command->args[2].arg_str); in process_partition()
1174 if (partp->dp_start == NO_DISK_SECTORS) in process_partition()
1178 partp->dp_start = command->args[2].arg_val; in process_partition()
1180 if (command->args[3].arg_str != NULL) { in process_partition()
1181 if (strcmp(command->args[3].arg_str, "*") == 0) in process_partition()
1182 partp->dp_size = rounddown(disksecs, dos_cylsecs) - in process_partition()
1183 partp->dp_start; in process_partition()
1185 partp->dp_size = str2sectors(command->args[3].arg_str); in process_partition()
1186 if (partp->dp_size == NO_DISK_SECTORS) in process_partition()
1189 prev_cyl_boundary = rounddown(partp->dp_start + partp->dp_size, in process_partition()
1191 if (prev_cyl_boundary > partp->dp_start) in process_partition()
1192 partp->dp_size = prev_cyl_boundary - partp->dp_start; in process_partition()
1194 partp->dp_size = command->args[3].arg_val; in process_partition()
1196 max_end = partp->dp_start + partp->dp_size; in process_partition()
1198 if (partp->dp_typ == 0) { in process_partition()
1213 if (partp->dp_start % dos_sectors != 0) { in process_partition()
1214 prev_head_boundary = rounddown(partp->dp_start, dos_sectors); in process_partition()
1216 prev_head_boundary > max_end - dos_sectors) { in process_partition()
1229 partition, (u_int)partp->dp_start, in process_partition()
1231 partp->dp_start = prev_head_boundary + dos_sectors; in process_partition()
1238 prev_cyl_boundary = rounddown(partp->dp_start + partp->dp_size, in process_partition()
1240 if (prev_cyl_boundary > partp->dp_start) in process_partition()
1241 adj_size = prev_cyl_boundary - partp->dp_start; in process_partition()
1248 if (adj_size != partp->dp_size) { in process_partition()
1252 partition, (u_int)partp->dp_size, (u_int)adj_size); in process_partition()
1253 partp->dp_size = adj_size; in process_partition()
1255 if (partp->dp_size == 0) { in process_partition()
1277 if (command->n_args != 1) { in process_active()
1283 partition = command->args[0].arg_val; in process_active()
1295 partp[partition-1].dp_flag = ACTIVE; in process_active()
1348 if (strcmp(config_file, "-") != 0) { in read_config()
1399 start = partp->dp_start; in sanitize_partition()
1400 size = partp->dp_size; in sanitize_partition()
1404 if (start == 0 && partp->dp_typ == 0) in sanitize_partition()
1432 prev_head_boundary >= max_end - dos_sectors) { in sanitize_partition()
1449 size = prev_cyl_boundary - start; in sanitize_partition()
1457 if (start != partp->dp_start) { in sanitize_partition()
1460 partp->dp_start = start; in sanitize_partition()
1462 if (size != partp->dp_size) { in sanitize_partition()
1464 partp->dp_size = size; in sanitize_partition()
1488 if (statfs("/", &rootfs) == -1) in get_rootdisk()
1491 if ((rv = regcomp(&re, "^(/dev/[a-z/]+[0-9]+)([sp][0-9]+)?[a-h]?(\\.journal)?$", in get_rootdisk()
1502 if ((s = malloc(rm[1].rm_eo - rm[1].rm_so + 1)) == NULL) in get_rootdisk()
1505 rm[1].rm_eo - rm[1].rm_so); in get_rootdisk()
1506 s[rm[1].rm_eo - rm[1].rm_so] = 0; in get_rootdisk()