Subversion Repositories SvarDOS

Rev

Rev 1982 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1982 Rev 1994
Line 668... Line 668...
668
  if (udsc_off == 0xffff) return(NULL);
668
  if (udsc_off == 0xffff) return(NULL);
669
  return(MK_FP(udsc_seg, udsc_off));
669
  return(MK_FP(udsc_seg, udsc_off));
670
}
670
}
671
 
671
 
672
 
672
 
-
 
673
/* returns 0 if fsid is a valid (recognized) filesystem for SvarDOS install  */
-
 
674
static int is_fstype_valid(char fsid) {
-
 
675
  switch (fsid) {
-
 
676
    case 0x01: /* FAT-12 in first 32M of disk                                */
-
 
677
    case 0x04: /* FAT-16 partition that resides within first 32M of disk     */
-
 
678
    case 0x06: /* FAT-16B with 64K+ sectors, must be within first 8G of disk */
-
 
679
    case 0x0B: /* FAT-32 with CHS addressing                                 */
-
 
680
    case 0x0C: /* FAT-32 with LBA addressing                                 */
-
 
681
    case 0x0E: /* FAT-16B with LBA addressing                                */
-
 
682
      return(0);
-
 
683
    default:
-
 
684
      return(-1);
-
 
685
  }
-
 
686
}
-
 
687
 
-
 
688
 
673
/* reads the MBR and matches its entries to DOS drives
689
/* reads the MBR and matches its entries to DOS drives
674
 * fills the drives array with up to 16 drives (4 partitions * 4 disks)
690
 * fills the drives array with up to 16 drives (4 partitions * 4 disks)
675
 * see https://github.com/SvarDOS/bugz/issues/89 */
691
 * see https://github.com/SvarDOS/bugz/issues/89 */
676
static int get_drives_list(char *buff, struct drivelist *drives) {
692
static int get_drives_list(char *buff, struct drivelist *drives) {
677
  int i;
693
  int i;
Line 692... Line 708...
692
      unsigned char *entry;
708
      unsigned char *entry;
693
 
709
 
694
      entry = buff + 0x01BE + (i * 16);
710
      entry = buff + 0x01BE + (i * 16);
695
 
711
 
696
      /* ignore partition if fs is unknown (non-FAT) */
712
      /* ignore partition if fs is unknown (non-FAT) */
697
      if ((entry[4] != 0x0E) && (entry[4] != 0x0C)  /* LBA FAT */
713
      if (is_fstype_valid(entry[4]) != 0) continue;
698
       && (entry[4] != 0x01) && (entry[4] != 0x06) && (entry[4] != 0x08)) { /* CHS FAT */
-
 
699
        continue;
-
 
700
      }
714
 
701
      bzero(&(drives[listlen]), sizeof(struct drivelist));
715
      bzero(&(drives[listlen]), sizeof(struct drivelist));
702
      drives[listlen].hd = drv & 3;
716
      drives[listlen].hd = drv & 3;
703
      drives[listlen].partid = i;
717
      drives[listlen].partid = i;
704
      drives[listlen].start_lba = ((unsigned long *)entry)[2];
718
      drives[listlen].start_lba = ((unsigned long *)entry)[2];
705
      drives[listlen].tot_sect = ((unsigned long *)entry)[3];
719
      drives[listlen].tot_sect = ((unsigned long *)entry)[3];