9
0
Fork 0

cdev: Add partuuid string to struct cdev

This adds the partuuid string to struct cdev in order to have this
available for constructing a suitable Linux root=PARTUUID= option
for booting Linux.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Sascha Hauer 2015-06-17 12:40:04 +02:00
parent acc930f1e9
commit bc31d85c6e
4 changed files with 9 additions and 0 deletions

View File

@ -64,6 +64,7 @@ static int register_one_partition(struct block_device *blk,
}
cdev->dos_partition_type = part->dos_partition_type;
strcpy(cdev->partuuid, part->partuuid);
free(partition_name);

View File

@ -185,6 +185,7 @@ static void dos_partition(void *buf, struct block_device *blk,
uint8_t *buffer = buf;
int i;
struct disk_signature_priv *dsp;
uint32_t signature = get_unaligned_le32(buf + 0x1b8);
table = (struct partition_entry *)&buffer[446];
@ -202,6 +203,9 @@ static void dos_partition(void *buf, struct block_device *blk,
pd->parts[n].first_sec = pentry.first_sec;
pd->parts[n].size = pentry.size;
pd->parts[n].dos_partition_type = pentry.dos_partition_type;
if (signature)
sprintf(pd->parts[n].partuuid, "%08x-%02d",
signature, i + 1);
pd->used_entries++;
/*
* Partitions of type 0x05 and 0x0f (and some more)

View File

@ -17,6 +17,7 @@
struct partition {
char name[MAX_PARTITION_NAME];
u8 dos_partition_type;
char partuuid[MAX_PARTUUID_STR];
uint64_t first_sec;
uint64_t size;
};

View File

@ -435,6 +435,8 @@ struct file_operations {
int (*memmap)(struct cdev*, void **map, int flags);
};
#define MAX_PARTUUID_STR sizeof("00112233-4455-6677-8899-AABBCCDDEEFF")
struct cdev {
struct file_operations *ops;
void *priv;
@ -445,6 +447,7 @@ struct cdev {
char *partname; /* the partition name, usually the above without the
* device part, i.e. name = "nand0.barebox" -> partname = "barebox"
*/
char partuuid[MAX_PARTUUID_STR];
loff_t offset;
loff_t size;
unsigned int flags;