Tue Aug 27 17:23:24 2019 UTC ()
When requesting no special FS sub type, default to FAT32 with LBA.
Fixes one part of PR 54490.


(martin)
diff -r1.20 -r1.21 src/usr.sbin/sysinst/mbr.c

cvs diff -r1.20 -r1.21 src/usr.sbin/sysinst/mbr.c (expand / switch to unified diff)

--- src/usr.sbin/sysinst/mbr.c 2019/08/14 13:02:23 1.20
+++ src/usr.sbin/sysinst/mbr.c 2019/08/27 17:23:24 1.21
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: mbr.c,v 1.20 2019/08/14 13:02:23 martin Exp $ */ 1/* $NetBSD: mbr.c,v 1.21 2019/08/27 17:23:24 martin Exp $ */
2 2
3/* 3/*
4 * Copyright 1997 Piermont Information Systems Inc. 4 * Copyright 1997 Piermont Information Systems Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Written by Philip A. Nelson for Piermont Information Systems Inc. 7 * Written by Philip A. Nelson for Piermont Information Systems Inc.
8 * 8 *
9 * Redistribution and use in source and binary forms, with or without 9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions 10 * modification, are permitted provided that the following conditions
11 * are met: 11 * are met:
12 * 1. Redistributions of source code must retain the above copyright 12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer. 13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright 14 * 2. Redistributions in binary form must reproduce the above copyright
@@ -1037,26 +1037,29 @@ mbr_get_part_type_count(void) @@ -1037,26 +1037,29 @@ mbr_get_part_type_count(void)
1037 1037
1038static const struct part_type_desc * 1038static const struct part_type_desc *
1039mbr_get_fs_part_type(unsigned fs_type, unsigned sub_type) 1039mbr_get_fs_part_type(unsigned fs_type, unsigned sub_type)
1040{ 1040{
1041 if (known_part_types == 0) 1041 if (known_part_types == 0)
1042 map_mbr_part_types(); 1042 map_mbr_part_types();
1043 1043
1044 switch (fs_type) { 1044 switch (fs_type) {
1045 case FS_BSDFFS: 1045 case FS_BSDFFS:
1046 return &mbr_gen_type_desc[MBR_PTYPE_NETBSD].gen; 1046 return &mbr_gen_type_desc[MBR_PTYPE_NETBSD].gen;
1047 case FS_EX2FS: 1047 case FS_EX2FS:
1048 return &mbr_gen_type_desc[MBR_PTYPE_LNXEXT2].gen; 1048 return &mbr_gen_type_desc[MBR_PTYPE_LNXEXT2].gen;
1049 case FS_MSDOS: 1049 case FS_MSDOS:
 1050 if (sub_type == 0)
 1051 sub_type = MBR_PTYPE_FAT32L;
 1052
1050 switch (sub_type) { 1053 switch (sub_type) {
1051 case MBR_PTYPE_FAT12: 1054 case MBR_PTYPE_FAT12:
1052 case MBR_PTYPE_FAT16S: 1055 case MBR_PTYPE_FAT16S:
1053 case MBR_PTYPE_FAT16B: 1056 case MBR_PTYPE_FAT16B:
1054 case MBR_PTYPE_FAT32: 1057 case MBR_PTYPE_FAT32:
1055 case MBR_PTYPE_FAT32L: 1058 case MBR_PTYPE_FAT32L:
1056 case MBR_PTYPE_FAT16L: 1059 case MBR_PTYPE_FAT16L:
1057 return &mbr_gen_type_desc[sub_type].gen; 1060 return &mbr_gen_type_desc[sub_type].gen;
1058 } 1061 }
1059 break; 1062 break;
1060 } 1063 }
1061 1064
1062 return NULL; 1065 return NULL;