summaryrefslogtreecommitdiffstats
path: root/cpukit/libblock/src/ide_part_table.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2003-03-25 17:01:52 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2003-03-25 17:01:52 +0000
commitdbe06865bfc174d2cfe89b7a41f194301fd48aa3 (patch)
tree2be8d009e9a483271dab57bb2b4d1d40badafeac /cpukit/libblock/src/ide_part_table.c
parent2003-03-25 Thomas Doerfler <Thomas.Doerfler@imd-systems.de> (diff)
downloadrtems-dbe06865bfc174d2cfe89b7a41f194301fd48aa3.tar.bz2
2003-03-25 Thomas Doerfler <Thomas.Doerfler@imd-systems.de>
PR 367/filesystem * Makefile.am, include/rtems/ide_part_table.h, src/ata.c, src/ide_part_table.c: Some bugs were still present in the DOSFS implementation: - FAT12 did not work properly on Big-Endian machines - Some synchronization and error handling problems were present - Some legal codings for EOC were not recognized
Diffstat (limited to 'cpukit/libblock/src/ide_part_table.c')
-rw-r--r--cpukit/libblock/src/ide_part_table.c47
1 files changed, 37 insertions, 10 deletions
diff --git a/cpukit/libblock/src/ide_part_table.c b/cpukit/libblock/src/ide_part_table.c
index ec5460ff4c..0e44c9c9b8 100644
--- a/cpukit/libblock/src/ide_part_table.c
+++ b/cpukit/libblock/src/ide_part_table.c
@@ -19,7 +19,7 @@
*****************************************************************************/
#include <rtems/ide_part_table.h>
-
+#include <string.h>
/*
* get_sector --
@@ -112,6 +112,29 @@ is_extended(unsigned8 type)
return ((type == EXTENDED_PARTITION) || (type == LINUX_EXTENDED));
}
+/*
+ * is_fat_partition --
+ * checks if the partition type is defined for FAT
+ *
+ * PARAMETERS:
+ * type - type of partition to check
+ *
+ * RETURNS:
+ * TRUE if partition type is extended, FALSE otherwise
+ */
+static rtems_boolean
+is_fat_partition(unsigned8 type)
+{
+ static const unsigned8 fat_part_types[] = {
+ DOS_FAT12_PARTITION,DOS_FAT16_PARTITION,
+ DOS_P32MB_PARTITION,
+ FAT32_PARTITION ,FAT32_LBA_PARTITION,
+ FAT16_LBA_PARTITION
+ };
+
+ return (NULL != memchr(fat_part_types,type,sizeof(fat_part_types)));
+}
+
/*
* data_to_part_desc --
@@ -157,16 +180,20 @@ data_to_part_desc(unsigned8 *data, part_desc_t **new_part_desc)
memcpy(&temp, data + RTEMS_IDE_PARTITION_SIZE_OFFSET, sizeof(unsigned32));
part_desc->size = LE_TO_CPU_U32(temp);
- if ((part_desc->sys_type == EMPTY_PARTITION) ||
- ((part_desc->size == 0) && (!is_extended(part_desc->sys_type))))
- {
- /* empty partition */
- free(part_desc);
- return RTEMS_SUCCESSFUL;
+ /*
+ * use partitions that are
+ * - extended
+ * or
+ * - FAT type and non-zero
+ */
+ if (is_extended(part_desc->sys_type) ||
+ (is_fat_partition(part_desc->sys_type)) && (part_desc->size != 0)) {
+ *new_part_desc = part_desc;
+ }
+ else {
+ /* empty partition */
+ free(part_desc);
}
-
- *new_part_desc = part_desc;
-
return RTEMS_SUCCESSFUL;
}