cdev: store dos partition type in struct cdev
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
parent
51dce5facb
commit
1369bfd44f
|
@ -63,6 +63,8 @@ static int register_one_partition(struct block_device *blk,
|
|||
goto out;
|
||||
}
|
||||
|
||||
cdev->dos_partition_type = part->dos_partition_type;
|
||||
|
||||
free(partition_name);
|
||||
|
||||
if (!part->name[0])
|
||||
|
@ -84,7 +86,7 @@ static int register_one_partition(struct block_device *blk,
|
|||
ret = 0;
|
||||
out:
|
||||
free(partition_name);
|
||||
return 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static struct partition_parser *partition_parser_get_by_filetype(uint8_t *buf)
|
||||
|
|
|
@ -138,10 +138,13 @@ static void dos_partition(void *buf, struct block_device *blk,
|
|||
for (i = 0; i < 4; i++) {
|
||||
pentry.first_sec = get_unaligned_le32(&table[i].partition_start);
|
||||
pentry.size = get_unaligned_le32(&table[i].partition_size);
|
||||
pentry.dos_partition_type = table[i].type;
|
||||
|
||||
if (pentry.first_sec != 0) {
|
||||
pd->parts[pd->used_entries].first_sec = pentry.first_sec;
|
||||
pd->parts[pd->used_entries].size = pentry.size;
|
||||
int n = pd->used_entries;
|
||||
pd->parts[n].first_sec = pentry.first_sec;
|
||||
pd->parts[n].size = pentry.size;
|
||||
pd->parts[n].dos_partition_type = pentry.dos_partition_type;
|
||||
pd->used_entries++;
|
||||
} else {
|
||||
dev_dbg(blk->dev, "Skipping empty partition %d\n", i);
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
struct partition {
|
||||
char name[MAX_PARTITION_NAME];
|
||||
u8 dos_partition_type;
|
||||
uint64_t first_sec;
|
||||
uint64_t size;
|
||||
};
|
||||
|
|
|
@ -456,6 +456,7 @@ struct cdev {
|
|||
unsigned int flags;
|
||||
int open;
|
||||
struct mtd_info *mtd;
|
||||
u8 dos_partition_type;
|
||||
};
|
||||
|
||||
int devfs_create(struct cdev *);
|
||||
|
|
Loading…
Reference in New Issue