summaryrefslogtreecommitdiffstats
path: root/common/filetype.c
diff options
context:
space:
mode:
authorPeter Mamonov <pmamonov@gmail.com>2015-11-09 13:32:51 +0300
committerSascha Hauer <s.hauer@pengutronix.de>2015-11-23 08:24:56 +0100
commitbc87f4399c6a290d820f2dd00ef772f0f3ef8767 (patch)
tree8da2d5cba26026e1edcf1fad2eb926659641a9a8 /common/filetype.c
parent99c9da2817ba1bcc3d33782e68ec6ceeeb2c4545 (diff)
downloadbarebox-bc87f4399c6a290d820f2dd00ef772f0f3ef8767.tar.gz
barebox-bc87f4399c6a290d820f2dd00ef772f0f3ef8767.tar.xz
common: filetype: do not redetect MBR-type devices as a FAT-type
Deleted pieces of code detect MBR-containig device as a FAT-type device, if it's first partition contains a FAT filesystem. This behaviour enabled one to mount the FAT FS which is either directly on the device (disk0) or on the first partition (disk0.0) using the same command: mount /dev/disk0 /fat However, the desired behaviour can be reached with a: mount /dev/disk0 /fat || mount /dev/disk0.0 /fat || echo "Mounting failed" Signed-off-by: Peter Mamonov <pmamonov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common/filetype.c')
-rw-r--r--common/filetype.c31
1 files changed, 0 insertions, 31 deletions
diff --git a/common/filetype.c b/common/filetype.c
index 9ec8ebf7c2..8cfae88aeb 100644
--- a/common/filetype.c
+++ b/common/filetype.c
@@ -326,7 +326,6 @@ enum filetype file_name_detect_type(const char *filename)
int fd, ret;
void *buf;
enum filetype type = filetype_unknown;
- unsigned long bootsec;
fd = open(filename, O_RDONLY);
if (fd < 0)
@@ -340,21 +339,6 @@ enum filetype file_name_detect_type(const char *filename)
type = file_detect_type(buf, ret);
- if (type == filetype_mbr) {
- /*
- * Get the first partition start sector
- * and check for FAT in it
- */
- is_fat_or_mbr(buf, &bootsec);
- ret = lseek(fd, (bootsec) * 512, SEEK_SET);
- if (ret < 0)
- goto err_out;
- ret = read(fd, buf, 512);
- if (ret < 0)
- goto err_out;
- type = is_fat_or_mbr((u8 *)buf, NULL);
- }
-
err_out:
close(fd);
free(buf);
@@ -380,21 +364,6 @@ enum filetype cdev_detect_type(const char *name)
type = file_detect_type(buf, ret);
- if (type == filetype_mbr) {
- unsigned long bootsec;
- /*
- * Get the first partition start sector
- * and check for FAT in it
- */
- is_fat_or_mbr(buf, &bootsec);
-
- ret = cdev_read(cdev, buf, 512, bootsec * 512, 0);
- if (ret < 0)
- goto err_out;
-
- type = is_fat_or_mbr((u8 *)buf, NULL);
- }
-
err_out:
free(buf);
cdev_close(cdev);